mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
fix editbox fringe (#4571)
This commit is contained in:
@@ -28,8 +28,9 @@ import { SpriteFrame } from '../../../../assets/sprite-frame';
|
||||
import { Component } from '../../../../components/component';
|
||||
import { EventHandler as ComponentEventHandler } from '../../../../components/component-event-handler';
|
||||
import { ccclass, executeInEditMode, executionOrder, menu, property } from '../../../../core/data/class-decorator';
|
||||
import { EventTouch } from '../../../../core/platform';
|
||||
import { SystemEventType } from '../../../../core/platform/event-manager/event-enum';
|
||||
import Color from '../../../../core/value-types/color';
|
||||
import { Color, Size } from '../../../../core/value-types';
|
||||
import { Node } from '../../../../scene-graph';
|
||||
import { LabelComponent, VerticalTextAlignment } from '../label-component';
|
||||
import { SpriteComponent } from '../sprite-component';
|
||||
@@ -561,7 +562,7 @@ export class EditBoxComponent extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
public _updateLabelPosition (size) {
|
||||
public _updateLabelPosition (size: Size) {
|
||||
const node = this.node;
|
||||
const offx = -node.anchorX * node.width;
|
||||
const offy = -node.anchorY * node.height;
|
||||
@@ -698,7 +699,7 @@ export class EditBoxComponent extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
public _updateString (text) {
|
||||
public _updateString (text: string) {
|
||||
const textLabel = this._textLabel;
|
||||
// Not inited yet
|
||||
if (!textLabel) {
|
||||
@@ -765,21 +766,21 @@ export class EditBoxComponent extends Component {
|
||||
this.node.emit('editing-return', this);
|
||||
}
|
||||
|
||||
public _onTouchBegan (event) {
|
||||
public _onTouchBegan (event: EventTouch) {
|
||||
if (this._impl) {
|
||||
this._impl._onTouchBegan(event.touch);
|
||||
}
|
||||
event.propagationStopped = true;
|
||||
}
|
||||
|
||||
public _onTouchCancel (event) {
|
||||
// if (this._impl) {
|
||||
// this._impl._onTouchCancel();
|
||||
// }
|
||||
event.propagationStopped = true;
|
||||
}
|
||||
// public _onTouchCancel (event) {
|
||||
// // if (this._impl) {
|
||||
// // this._impl._onTouchCancel();
|
||||
// // }
|
||||
// event.propagationStopped = true;
|
||||
// }
|
||||
|
||||
public _onTouchEnded (event) {
|
||||
public _onTouchEnded (event: EventTouch) {
|
||||
if (this._impl) {
|
||||
this._impl._onTouchEnded();
|
||||
}
|
||||
|
||||
@@ -123,6 +123,10 @@ export class EditBoxImpl {
|
||||
return this._alwaysOnTop;
|
||||
}
|
||||
|
||||
get editing (){
|
||||
return this._editing;
|
||||
}
|
||||
|
||||
set editing (value: boolean) {
|
||||
this._editing = value;
|
||||
}
|
||||
@@ -153,7 +157,7 @@ export class EditBoxImpl {
|
||||
this._edTxt.style.display = 'none';
|
||||
}
|
||||
|
||||
public setTabIndex (index) {
|
||||
public setTabIndex (index: number) {
|
||||
if (this._edTxt) {
|
||||
this._edTxt.tabIndex = index;
|
||||
}
|
||||
@@ -183,7 +187,7 @@ export class EditBoxImpl {
|
||||
}
|
||||
}
|
||||
|
||||
public setMaxLength (maxLength) {
|
||||
public setMaxLength (maxLength: number) {
|
||||
if (!isNaN(maxLength)) {
|
||||
if (maxLength < 0) {
|
||||
// we can't set Number.MAX_VALUE to input's maxLength property
|
||||
@@ -197,7 +201,7 @@ export class EditBoxImpl {
|
||||
}
|
||||
}
|
||||
|
||||
public setString (text) {
|
||||
public setString (text: string) {
|
||||
this._text = text;
|
||||
if (this._edTxt) {
|
||||
this._edTxt.value = text;
|
||||
|
||||
Reference in New Issue
Block a user