lift widget duplicate into api and delegate annotations to mode client

This commit is contained in:
Stewart Allen 2021-11-29 20:11:27 -05:00
commit d648c2948a
4 changed files with 49 additions and 19 deletions

View file

@ -322,6 +322,18 @@
return;
}
});
api.event.on("widget.duplicate", (widget, oldwidget) => {
if (!isFdmMode) {
return;
}
let ann = API.widgets.annotate(widget.id);
if (ann.support) {
for (let supp of Object.values(ann.support)) {
supp.id = Math.abs(Math.random() * 0xffffffffffff);
}
restoreSupports([widget]);
}
});
api.event.on("widget.mirror", widget => {
if (!isFdmMode) {
return;
@ -670,5 +682,6 @@
FDM.delbox = delbox;
FDM.addbox = addbox;
FDM.restoreSupports = restoreSupports;
})();