diff --git a/packages/designer/src/designer/designer-view.tsx b/packages/designer/src/designer/designer-view.tsx index 6aef22c50..c39269df2 100644 --- a/packages/designer/src/designer/designer-view.tsx +++ b/packages/designer/src/designer/designer-view.tsx @@ -15,7 +15,12 @@ export class DesignerView extends Component { - const getSelection = () => { - if (editor.designer.currentSelection) { - currentSelection = editor.designer.currentSelection; - - currentSelection.onSelectionChange(() => { - // const nodes = currentSelection.getNodes(); - // console.log(nodes); - }); - } else { - // console.log('waiting ...'); - requestAnimationFrame(getSelection); - } - }; - getSelection(); -}); +import { Node } from '@ali/lowcode-designer'; +import { designer } from './editor'; export default { select: (node: Node) => { if (!node) { return designer.currentSelection?.clear(); } - currentSelection.select(node.id); + designer.currentSelection?.select(node.id); }, getSelected: () => { - const nodes = currentSelection.getNodes(); + const nodes = designer.currentSelection?.getNodes(); return nodes; }, - // 以下废弃 - // hover: (node: Node) => { - // hovering.hover(node); - // }, - // getDropping: () => { - // return null; - // }, - // onIntoView: (func: (node: any, insertion: Insertion) => any) => { - // currentSelection.onSelectionChange((ids) => { - // console.log(ids); - // }); - // return null; - // }, }