mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-15 10:48:17 +00:00
feat: 🎸 polyfill exchange
vision exchange api
This commit is contained in:
parent
e49a02e37c
commit
286e7d8f45
@ -157,7 +157,7 @@ export class Selection {
|
|||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelectionChange(fn: (ids: string[]) => void): () => void {
|
onSelectionChange(fn: () => void): () => void {
|
||||||
this.emitter.on('selectionchange', fn);
|
this.emitter.on('selectionchange', fn);
|
||||||
return () => {
|
return () => {
|
||||||
this.emitter.removeListener('selectionchange', fn);
|
this.emitter.removeListener('selectionchange', fn);
|
||||||
|
|||||||
@ -1,23 +1,20 @@
|
|||||||
import { Selection, DocumentModel, Node } from '@ali/lowcode-designer';
|
import { Selection, Node } from '@ali/lowcode-designer';
|
||||||
import editor from './editor';
|
import { editor } from './editor';
|
||||||
|
|
||||||
let currentSelection: Selection;
|
let currentSelection: Selection;
|
||||||
// let currentDocument: DocumentModel;
|
|
||||||
|
|
||||||
// get selection async
|
// get selection async
|
||||||
editor.once('designer.ready', () => {
|
editor.once('designer.ready', () => {
|
||||||
const getSelection = () => {
|
const getSelection = () => {
|
||||||
if (editor.designer.currentSelection) {
|
if (editor.designer.currentSelection) {
|
||||||
currentSelection = editor.designer.currentSelection;
|
currentSelection = editor.designer.currentSelection;
|
||||||
// currentDocument = editor.designer.currentDocument;
|
|
||||||
|
|
||||||
currentSelection.onSelectionChange((ids: string[]) => {
|
currentSelection.onSelectionChange(() => {
|
||||||
// console.log(ids);
|
// const nodes = currentSelection.getNodes();
|
||||||
// const nodes = ids.map((id: string) => currentDocument.getNode(id));
|
|
||||||
// console.log(nodes);
|
// console.log(nodes);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('waiting ...');
|
// console.log('waiting ...');
|
||||||
requestAnimationFrame(getSelection);
|
requestAnimationFrame(getSelection);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user