mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 19:52:51 +00:00
feat: support onMouseDownHook, onChildMoveHook hooks
This commit is contained in:
parent
b664663890
commit
abe7f40325
@ -542,6 +542,11 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
if (!node) {
|
if (!node) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 触发 onMouseDownHook 钩子
|
||||||
|
const onMouseDownHook = node.componentMeta?.getMetadata()?.configure.advanced?.callbacks?.onMouseDownHook;
|
||||||
|
if (onMouseDownHook) {
|
||||||
|
onMouseDownHook(downEvent, node.internalToShellNode());
|
||||||
|
}
|
||||||
const rglNode = node?.getParent();
|
const rglNode = node?.getParent();
|
||||||
const isRGLNode = rglNode?.isRGLContainer;
|
const isRGLNode = rglNode?.isRGLContainer;
|
||||||
if (isRGLNode) {
|
if (isRGLNode) {
|
||||||
@ -1200,7 +1205,23 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
const onMoveHook = node.componentMeta?.getMetadata()?.configure.advanced?.callbacks?.onMoveHook;
|
const onMoveHook = node.componentMeta?.getMetadata()?.configure.advanced?.callbacks?.onMoveHook;
|
||||||
const canMove = onMoveHook && typeof onMoveHook === 'function' ? onMoveHook(node.internalToShellNode()) : true;
|
const canMove = onMoveHook && typeof onMoveHook === 'function' ? onMoveHook(node.internalToShellNode()) : true;
|
||||||
|
|
||||||
return canMove;
|
let parentContainerNode: Node | null = null;
|
||||||
|
let parentNode = node.parent;
|
||||||
|
|
||||||
|
while (parentNode) {
|
||||||
|
if (parentNode.isContainer()) {
|
||||||
|
parentContainerNode = parentNode;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
parentNode = parentNode.parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
const onChildMoveHook = parentContainerNode?.componentMeta?.getMetadata()?.configure.advanced?.callbacks?.onChildMoveHook;
|
||||||
|
|
||||||
|
const childrenCanMove = onChildMoveHook && parentContainerNode && typeof onChildMoveHook === 'function' ? onChildMoveHook(node.internalToShellNode(), parentContainerNode.internalToShellNode()) : true;
|
||||||
|
|
||||||
|
return canMove && childrenCanMove;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (nodes && (!operationalNodes || operationalNodes.length === 0)) {
|
if (nodes && (!operationalNodes || operationalNodes.length === 0)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user