mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-03 01:12:42 +08:00
fix button sprite bidirectional sync and mask options error (#4544)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user