mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
fix eventManager (#5103)
This commit is contained in:
@@ -1171,7 +1171,7 @@ export class BaseNode extends CCObject implements IBaseNode {
|
||||
}
|
||||
}
|
||||
|
||||
protected _onPostActivated () {
|
||||
protected _onPostActivated (active:boolean) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -348,6 +348,18 @@ export class NodeEventProcessor {
|
||||
this._node = node;
|
||||
}
|
||||
|
||||
public reattach (): void {
|
||||
if (this.touchListener) {
|
||||
var mask = this.touchListener.mask = _searchMaskInParent(this._node);
|
||||
if (this.mouseListener) {
|
||||
this.mouseListener.mask = mask;
|
||||
}
|
||||
}
|
||||
else if (this.mouseListener) {
|
||||
this.mouseListener.mask = _searchMaskInParent(this._node);
|
||||
}
|
||||
}
|
||||
|
||||
public destroy (): void{
|
||||
if (_currentHovered === this._node) {
|
||||
_currentHovered = null;
|
||||
|
||||
@@ -974,6 +974,17 @@ export class Node extends BaseNode implements INode {
|
||||
eventManager.resumeTarget(this, recursive);
|
||||
}
|
||||
|
||||
public _onPostActivated (active) {
|
||||
if (active) {
|
||||
eventManager.resumeTarget(this);
|
||||
this.eventProcessor.reattach();
|
||||
}
|
||||
else {
|
||||
// deactivate
|
||||
eventManager.pauseTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
public _onPreDestroy () {
|
||||
this._eventProcessor.destroy();
|
||||
super._onPreDestroy();
|
||||
|
||||
Reference in New Issue
Block a user