mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-06-01 05:09:18 +08:00
fix(stage): 修复鼠标移出画布后,highlight没有清除
This commit is contained in:
parent
f7ba716fe9
commit
9cb821c491
@ -56,6 +56,7 @@ export default class StageHighlight extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
public clearHighlight(): void {
|
public clearHighlight(): void {
|
||||||
if (!this.moveable) return;
|
if (!this.moveable) return;
|
||||||
|
this.target = undefined;
|
||||||
this.moveable.target = null;
|
this.moveable.target = null;
|
||||||
this.moveable.updateTarget();
|
this.moveable.updateTarget();
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,7 @@ export default class StageMask extends Rule {
|
|||||||
this.wrapper.appendChild(this.content);
|
this.wrapper.appendChild(this.content);
|
||||||
this.content.addEventListener('wheel', this.mouseWheelHandler);
|
this.content.addEventListener('wheel', this.mouseWheelHandler);
|
||||||
this.content.addEventListener('mousemove', this.highlightHandler);
|
this.content.addEventListener('mousemove', this.highlightHandler);
|
||||||
|
this.content.addEventListener('mouseleave', this.mouseLeaveHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setMode(mode: Mode) {
|
public setMode(mode: Mode) {
|
||||||
@ -141,6 +142,7 @@ export default class StageMask extends Rule {
|
|||||||
|
|
||||||
this.fixScrollValue();
|
this.fixScrollValue();
|
||||||
this.scroll();
|
this.scroll();
|
||||||
|
this.core.dr.updateMoveable();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.pageResizeObserver.observe(page);
|
this.pageResizeObserver.observe(page);
|
||||||
@ -180,6 +182,8 @@ export default class StageMask extends Rule {
|
|||||||
this.pageScrollParent = null;
|
this.pageScrollParent = null;
|
||||||
this.pageResizeObserver?.disconnect();
|
this.pageResizeObserver?.disconnect();
|
||||||
this.wrapperResizeObserver?.disconnect();
|
this.wrapperResizeObserver?.disconnect();
|
||||||
|
|
||||||
|
this.content.removeEventListener('mouseleave', this.mouseLeaveHandler);
|
||||||
super.destroy();
|
super.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,4 +305,8 @@ export default class StageMask extends Rule {
|
|||||||
|
|
||||||
this.emit('scroll', event);
|
this.emit('scroll', event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private mouseLeaveHandler = () => {
|
||||||
|
setTimeout(() => this.emit('clearHighlight'), throttleTime);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user