diff --git a/cocos/3d/ui/assembler/mask/stencil-manager.ts b/cocos/3d/ui/assembler/mask/stencil-manager.ts index b1d4fc4e76..d4466c264e 100644 --- a/cocos/3d/ui/assembler/mask/stencil-manager.ts +++ b/cocos/3d/ui/assembler/mask/stencil-manager.ts @@ -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) { diff --git a/cocos/3d/ui/components/button-component.ts b/cocos/3d/ui/components/button-component.ts index c72543078e..ea49fd2af8 100644 --- a/cocos/3d/ui/components/button-component.ts +++ b/cocos/3d/ui/components/button-component.ts @@ -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) { diff --git a/cocos/scene-graph/node.ts b/cocos/scene-graph/node.ts index 78dc44cdd1..2111ab5acc 100644 --- a/cocos/scene-graph/node.ts +++ b/cocos/scene-graph/node.ts @@ -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);