fix button sprite bidirectional sync and mask options error (#4544)

This commit is contained in:
JoneLau
2019-06-03 19:25:09 +08:00
committed by Weiliang Wang
parent 13748f235a
commit 63c3bdc31e
3 changed files with 13 additions and 11 deletions
@@ -121,6 +121,10 @@ export class StencilManager {
const pattern = this._stencilPattern;
if (this.stage === Stage.DISABLED) {
pattern.stencilTest = false;
pattern.func = GFXComparisonFunc.ALWAYS;
pattern.failOp = GFXStencilOp.KEEP;
pattern.stencilMask = pattern.writeMask = 0xffffffff;
pattern.ref = 1;
} else {
pattern.stencilTest = true;
if (this.stage === Stage.ENABLED) {
+8 -10
View File
@@ -470,14 +470,13 @@ export class ButtonComponent extends Component {
//
if (!CC_EDITOR) {
this._registerEvent();
} else {
this.node.on('spriteframe-changed', (comp: SpriteComponent) => {
if (this._transition === Transition.SPRITE) {
this._normalSprite = comp.spriteFrame;
}
}, this);
}
// else {
// this.node.on('spriteframe-changed', (comp) => {
// if (this._transition === Transition.SPRITE) {
// this._normalSprite = comp.spriteFrame;
// }
// }, this);
// }
}
public onDisable () {
@@ -491,10 +490,9 @@ export class ButtonComponent extends Component {
this.node.off(SystemEventType.MOUSE_ENTER, this._onMouseMoveIn, this);
this.node.off(SystemEventType.MOUSE_LEAVE, this._onMouseMoveOut, this);
} else {
this.node.off('spriteframe-changed');
}
// else {
// this.node.off('spriteframe-changed');
// }
}
public update (dt: number) {
+1 -1
View File
@@ -857,7 +857,7 @@ class Node extends BaseNode {
this._eventProcessor.on(type, callback, target, useCapture);
}
public off (type: string, callback: Function, target?: Object, useCapture?: any) {
public off (type: string, callback?: Function, target?: Object, useCapture?: any) {
this._eventProcessor.off(type, callback, target, useCapture);
const hasListeners = this._eventProcessor.hasEventListener(type);