feat: 支持设置是否允许画布鼠标事件的冒泡

This commit is contained in:
力皓 2021-06-10 16:05:24 +08:00
parent 341f938f7f
commit 4e5c7f57c1

View File

@ -641,14 +641,16 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
*/
setupDetecting() {
const doc = this.contentDocument!;
const { detecting } = this.designer;
const { detecting, dragon } = this.designer;
const hover = (e: MouseEvent) => {
if (!detecting.enable || this.designMode !== 'design') {
return;
}
const nodeInst = this.getNodeInstanceFromElement(e.target as Element);
detecting.capture(nodeInst?.node || null);
e.stopPropagation();
if (!engineConfig.get('enableMouseEventPropagationInCanvas', false) || dragon.dragging) {
e.stopPropagation();
}
};
const leave = () => detecting.leave(this.project.currentDocument);
@ -659,7 +661,9 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
doc.addEventListener(
'mousemove',
(e: Event) => {
e.stopPropagation();
if (!engineConfig.get('enableMouseEventPropagationInCanvas', false) || dragon.dragging) {
e.stopPropagation();
}
},
true,
);