detecting

This commit is contained in:
kangwei 2020-08-13 15:48:31 +08:00
parent 006aa31b18
commit 6c0a656558
2 changed files with 10 additions and 8 deletions

View File

@ -364,7 +364,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
); );
} }
private disableHovering?: () => void; private disableDetecting?: () => void;
/** /**
* *
*/ */
@ -376,7 +376,6 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
return; return;
} }
const nodeInst = this.getNodeInstanceFromElement(e.target as Element); const nodeInst = this.getNodeInstanceFromElement(e.target as Element);
console.info(nodeInst);
detecting.capture(nodeInst?.node || null); detecting.capture(nodeInst?.node || null);
e.stopPropagation(); e.stopPropagation();
}; };
@ -394,11 +393,11 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
true, true,
); );
this.disableHovering = () => { this.disableDetecting = () => {
detecting.leave(this.project.currentDocument); detecting.leave(this.project.currentDocument);
doc.removeEventListener('mouseover', hover, true); doc.removeEventListener('mouseover', hover, true);
doc.removeEventListener('mouseleave', leave, false); doc.removeEventListener('mouseleave', leave, false);
this.disableHovering = undefined; this.disableDetecting = undefined;
}; };
} }
@ -445,15 +444,19 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
*/ */
setSuspense(suspended: boolean) { setSuspense(suspended: boolean) {
if (suspended) { if (suspended) {
if (this.disableHovering) { /*
this.disableHovering(); if (this.disableDetecting) {
this.disableDetecting();
} }
*/
// sleep some autorun reaction // sleep some autorun reaction
} else { } else {
// weekup some autorun reaction // weekup some autorun reaction
if (!this.disableHovering) { /*
if (!this.disableDetecting) {
this.setupDetecting(); this.setupDetecting();
} }
*/
} }
} }

View File

@ -186,7 +186,6 @@ class Renderer extends Component<{ documentInstance: DocumentInstance }> {
selectMode: false, selectMode: false,
triggerType: 'click', triggerType: 'click',
}); });
console.info('menuprops', viewProps);
} }
return createElement(getDeviceView(Component, device, designMode), viewProps, _children); return createElement(getDeviceView(Component, device, designMode), viewProps, _children);