fix editbox eventtype and remove unless code (#6044)

This commit is contained in:
JoneLau
2020-01-08 12:56:31 +08:00
committed by pandamicro
parent 6e092ad307
commit c7cf4f0c2d
2 changed files with 13 additions and 17 deletions
@@ -55,6 +55,13 @@ function capitalize (str: string) {
function capitalizeFirstLetter (str: string) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
enum EventType {
EDITING_DID_BEGAN = 'editing-did-began',
EDITING_DID_ENDED = 'editing-did-ended',
TEXT_CHANGED = 'text-changed',
EDITING_RETURN = 'editing-return',
}
/**
* @en
* cc.EditBoxComponent is a component for inputing text, you can use it to gather small amounts of text from users.
@@ -429,6 +436,7 @@ export class EditBoxComponent extends Component {
public static KeyboardReturnType = KeyboardReturnType;
public static InputFlag = InputFlag;
public static InputMode = InputMode;
public static EventType = EventType;
/**
* @en
* The event handler to be called when EditBox began to edit text.
@@ -585,24 +593,24 @@ export class EditBoxComponent extends Component {
public _editBoxEditingDidBegan () {
ComponentEventHandler.emitEvents(this.editingDidBegan, this);
this.node.emit('editing-did-began', this);
this.node.emit(EventType.EDITING_DID_BEGAN, this);
}
public _editBoxEditingDidEnded () {
ComponentEventHandler.emitEvents(this.editingDidEnded, this);
this.node.emit('editing-did-ended', this);
this.node.emit(EventType.EDITING_DID_ENDED, this);
}
public _editBoxTextChanged (text: string) {
text = this._updateLabelStringStyle(text, true);
this.string = text;
ComponentEventHandler.emitEvents(this.textChanged, text, this);
this.node.emit('text-changed', this);
this.node.emit(EventType.TEXT_CHANGED, this);
}
public _editBoxEditingReturn () {
ComponentEventHandler.emitEvents(this.editingReturn, this);
this.node.emit('editing-return', this);
this.node.emit(EventType.EDITING_RETURN, this);
}
public _showLabels () {
+1 -13
View File
@@ -732,19 +732,7 @@ export class LabelComponent extends UIRenderComponent {
}
protected _flushMaterial () {
const material = this._material;
// Setup blend function for premultiplied ttf label texture
// if (this._texture === this._ttfSpriteFrame) {
// this._srcBlendFactor = macro.BlendFactor.ONE;
// } else {
// this._srcBlendFactor = macro.BlendFactor.SRC_ALPHA;
// }
if (material) {
material.setProperty('mainTexture', this._texture);
}
this._updateMaterial(material);
this._updateMaterial(this._material);
}
protected _applyFontTexture (force: boolean) {