@inditextech/weave-sdk 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk.d.ts +70 -10
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +10398 -10199
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.node.d.ts +68 -8
- package/dist/sdk.node.d.ts.map +1 -1
- package/dist/sdk.node.js +222 -28
- package/dist/sdk.node.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.node.js
CHANGED
|
@@ -15129,10 +15129,12 @@ var WeaveStore = class {
|
|
|
15129
15129
|
undoStateStep() {
|
|
15130
15130
|
if (!this.supportsUndoManager) throw new Error("Undo manager not supported");
|
|
15131
15131
|
this.undoManager.undo();
|
|
15132
|
+
this.instance.emitEvent("onUndoChange");
|
|
15132
15133
|
}
|
|
15133
15134
|
redoStateStep() {
|
|
15134
15135
|
if (!this.supportsUndoManager) throw new Error("Undo manager not supported");
|
|
15135
15136
|
this.undoManager.redo();
|
|
15137
|
+
this.instance.emitEvent("onRedoChange");
|
|
15136
15138
|
}
|
|
15137
15139
|
handleConnectionStatusChange(status) {
|
|
15138
15140
|
this.instance.emitEvent("onStoreConnectionStatusChange", status);
|
|
@@ -18495,6 +18497,16 @@ const WEAVE_STAGE_PANNING_DEFAULT_CONFIG = {
|
|
|
18495
18497
|
edgePanSpeed: 10
|
|
18496
18498
|
};
|
|
18497
18499
|
|
|
18500
|
+
//#endregion
|
|
18501
|
+
//#region src/plugins/nodes-multi-selection-feedback/constants.ts
|
|
18502
|
+
const WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_KEY = "nodesMultiSelectionFeedback";
|
|
18503
|
+
const WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_LAYER_ID = "selectionLayer";
|
|
18504
|
+
const WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG = { style: {
|
|
18505
|
+
stroke: "#ff2c2cff",
|
|
18506
|
+
strokeWidth: 2,
|
|
18507
|
+
fill: "transparent"
|
|
18508
|
+
} };
|
|
18509
|
+
|
|
18498
18510
|
//#endregion
|
|
18499
18511
|
//#region src/plugins/nodes-selection/nodes-selection.ts
|
|
18500
18512
|
var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
@@ -18508,6 +18520,8 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18508
18520
|
y: 0
|
|
18509
18521
|
};
|
|
18510
18522
|
panLoopId = null;
|
|
18523
|
+
prevSelectedNodes = [];
|
|
18524
|
+
handledClickOrTap = false;
|
|
18511
18525
|
constructor(params) {
|
|
18512
18526
|
super();
|
|
18513
18527
|
this.config = mergeExceptArrays(WEAVE_NODES_SELECTION_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -18636,7 +18650,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18636
18650
|
nodeHovered = targetNode;
|
|
18637
18651
|
}
|
|
18638
18652
|
targetNode?.handleMouseover();
|
|
18639
|
-
}
|
|
18653
|
+
} else nodeHovered?.handleMouseout();
|
|
18640
18654
|
});
|
|
18641
18655
|
tr.on("mouseover", () => {
|
|
18642
18656
|
stage.container().style.cursor = "grab";
|
|
@@ -18769,6 +18783,20 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18769
18783
|
for (const node of selectedNodes) node.setAttrs({ isCloned: void 0 });
|
|
18770
18784
|
tr.forceUpdate();
|
|
18771
18785
|
});
|
|
18786
|
+
this.instance.addEventListener("onNodesChange", () => {
|
|
18787
|
+
const currentSelectedNodes = tr.nodes();
|
|
18788
|
+
const unselectedNodes = this.prevSelectedNodes.filter((node) => !currentSelectedNodes.map((node1) => node1.getAttrs().id).includes(node.getAttrs().id));
|
|
18789
|
+
if (currentSelectedNodes.length > 1) for (const node of currentSelectedNodes) node.handleSelectNode();
|
|
18790
|
+
if (currentSelectedNodes.length === 1) currentSelectedNodes[0].handleDeselectNode();
|
|
18791
|
+
for (const node of unselectedNodes) node.handleDeselectNode();
|
|
18792
|
+
this.prevSelectedNodes = tr.nodes();
|
|
18793
|
+
});
|
|
18794
|
+
this.instance.addEventListener("onUndoChange", () => {
|
|
18795
|
+
this.handleUndoRedoSelectionChange();
|
|
18796
|
+
});
|
|
18797
|
+
this.instance.addEventListener("onRedoChange", () => {
|
|
18798
|
+
this.handleUndoRedoSelectionChange();
|
|
18799
|
+
});
|
|
18772
18800
|
this.tr = tr;
|
|
18773
18801
|
this.trHover = trHover;
|
|
18774
18802
|
this.selectionRectangle = selectionRectangle;
|
|
@@ -18795,6 +18823,18 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18795
18823
|
stage.container().style.cursor = "default";
|
|
18796
18824
|
});
|
|
18797
18825
|
}
|
|
18826
|
+
handleUndoRedoSelectionChange() {
|
|
18827
|
+
const selectionLayer = this.instance.getSelectionLayer();
|
|
18828
|
+
const selectionFeedbackPlugin = this.getNodesSelectionFeedbackPlugin();
|
|
18829
|
+
if (selectionLayer && selectionFeedbackPlugin) {
|
|
18830
|
+
selectionLayer.find(`.selection-halo`).forEach((node) => node.destroy());
|
|
18831
|
+
selectionFeedbackPlugin.cleanupSelectedHalos();
|
|
18832
|
+
const currentSelectedNodes = this.tr.nodes();
|
|
18833
|
+
if (currentSelectedNodes.length > 1) for (const node of currentSelectedNodes) node.handleSelectNode();
|
|
18834
|
+
if (currentSelectedNodes.length === 1) currentSelectedNodes[0].handleDeselectNode();
|
|
18835
|
+
this.prevSelectedNodes = currentSelectedNodes;
|
|
18836
|
+
}
|
|
18837
|
+
}
|
|
18798
18838
|
getLayer() {
|
|
18799
18839
|
const stage = this.instance.getStage();
|
|
18800
18840
|
return stage.findOne(`#${this.getLayerName()}`);
|
|
@@ -18972,6 +19012,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18972
19012
|
});
|
|
18973
19013
|
stage.on("pointerdown", (e) => {
|
|
18974
19014
|
this.setTapStart(e);
|
|
19015
|
+
this.handledClickOrTap = false;
|
|
18975
19016
|
this.pointers[e.evt.pointerId] = e.evt;
|
|
18976
19017
|
if (e.evt.pointerType === "touch" && Object.keys(this.pointers).length > 1) return;
|
|
18977
19018
|
if (e.evt.pointerType === "mouse" && e.evt.button !== 0) return;
|
|
@@ -19087,7 +19128,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19087
19128
|
}
|
|
19088
19129
|
if (contextMenuPlugin?.isContextMenuVisible()) this.stopPanLoop();
|
|
19089
19130
|
const selectedGroup = getTargetedNode(this.instance);
|
|
19090
|
-
if (!moved && selectedGroup?.getParent() instanceof Konva.Transformer) {
|
|
19131
|
+
if (!moved && selectedGroup?.getParent() instanceof Konva.Transformer && !this.handledClickOrTap) {
|
|
19091
19132
|
this.selecting = false;
|
|
19092
19133
|
this.stopPanLoop();
|
|
19093
19134
|
this.hideSelectorArea();
|
|
@@ -19180,6 +19221,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19180
19221
|
}
|
|
19181
19222
|
handleClickOrTap(e) {
|
|
19182
19223
|
const stage = this.instance.getStage();
|
|
19224
|
+
this.handledClickOrTap = true;
|
|
19183
19225
|
e.cancelBubble = true;
|
|
19184
19226
|
if (!this.enabled) return;
|
|
19185
19227
|
if (this.instance.getActiveAction() !== SELECTION_TOOL_ACTION_NAME) return;
|
|
@@ -19311,6 +19353,10 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19311
19353
|
this.getLayer()?.hide();
|
|
19312
19354
|
this.enabled = false;
|
|
19313
19355
|
}
|
|
19356
|
+
getNodesSelectionFeedbackPlugin() {
|
|
19357
|
+
const selectionFeedbackPlugin = this.instance.getPlugin(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_KEY);
|
|
19358
|
+
return selectionFeedbackPlugin;
|
|
19359
|
+
}
|
|
19314
19360
|
getContextMenuPlugin() {
|
|
19315
19361
|
const contextMenuPlugin = this.instance.getPlugin(WEAVE_CONTEXT_MENU_PLUGIN_KEY);
|
|
19316
19362
|
return contextMenuPlugin;
|
|
@@ -19831,6 +19877,8 @@ var WeaveNode = class {
|
|
|
19831
19877
|
node.resetCrop = function() {};
|
|
19832
19878
|
node.handleMouseover = function() {};
|
|
19833
19879
|
node.handleMouseout = function() {};
|
|
19880
|
+
node.handleSelectNode = function() {};
|
|
19881
|
+
node.handleDeselectNode = function() {};
|
|
19834
19882
|
}
|
|
19835
19883
|
isNodeSelected(ele) {
|
|
19836
19884
|
const selectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
@@ -19854,6 +19902,7 @@ var WeaveNode = class {
|
|
|
19854
19902
|
return;
|
|
19855
19903
|
}
|
|
19856
19904
|
selectionPlugin.getHoverTransformer().nodes([node]);
|
|
19905
|
+
selectionPlugin.getHoverTransformer().moveToTop();
|
|
19857
19906
|
}
|
|
19858
19907
|
hideHoverState() {
|
|
19859
19908
|
const selectionPlugin = this.getSelectionPlugin();
|
|
@@ -19882,6 +19931,7 @@ var WeaveNode = class {
|
|
|
19882
19931
|
let transforming = false;
|
|
19883
19932
|
node.on("transformstart", (e) => {
|
|
19884
19933
|
transforming = true;
|
|
19934
|
+
this.getNodesSelectionFeedbackPlugin()?.hideSelectionHalo(node);
|
|
19885
19935
|
this.instance.emitEvent("onTransform", e.target);
|
|
19886
19936
|
});
|
|
19887
19937
|
const handleTransform = (e) => {
|
|
@@ -19901,8 +19951,10 @@ var WeaveNode = class {
|
|
|
19901
19951
|
if (nodesSnappingPlugin) nodesSnappingPlugin.cleanupGuidelines();
|
|
19902
19952
|
if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
19903
19953
|
this.scaleReset(node$1);
|
|
19954
|
+
this.getNodesSelectionFeedbackPlugin()?.hideSelectionHalo(node$1);
|
|
19904
19955
|
const nodeHandler = this.instance.getNodeHandler(node$1.getAttrs().nodeType);
|
|
19905
19956
|
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node$1));
|
|
19957
|
+
this.getNodesSelectionPlugin()?.getHoverTransformer().forceUpdate();
|
|
19906
19958
|
});
|
|
19907
19959
|
const stage = this.instance.getStage();
|
|
19908
19960
|
let originalPosition = null;
|
|
@@ -19917,6 +19969,7 @@ var WeaveNode = class {
|
|
|
19917
19969
|
});
|
|
19918
19970
|
node.on("dragstart", (e) => {
|
|
19919
19971
|
const nodeTarget = e.target;
|
|
19972
|
+
this.getNodesSelectionFeedbackPlugin()?.hideSelectionHalo(nodeTarget);
|
|
19920
19973
|
this.didMove = false;
|
|
19921
19974
|
if (e.evt?.buttons === 0) {
|
|
19922
19975
|
nodeTarget.stopDrag();
|
|
@@ -19983,6 +20036,7 @@ var WeaveNode = class {
|
|
|
19983
20036
|
node.on("dragmove", (0, import_lodash.throttle)(handleDragMove, 100));
|
|
19984
20037
|
node.on("dragend", (e) => {
|
|
19985
20038
|
const nodeTarget = e.target;
|
|
20039
|
+
this.getNodesSelectionFeedbackPlugin()?.hideSelectionHalo(nodeTarget);
|
|
19986
20040
|
e.cancelBubble = true;
|
|
19987
20041
|
if (nodeTarget.getAttrs().isCloneOrigin && originalPosition) {
|
|
19988
20042
|
nodeTarget.setAbsolutePosition(originalPosition);
|
|
@@ -20026,6 +20080,12 @@ var WeaveNode = class {
|
|
|
20026
20080
|
node.handleMouseout = () => {
|
|
20027
20081
|
this.handleMouseout(node);
|
|
20028
20082
|
};
|
|
20083
|
+
node.handleSelectNode = () => {
|
|
20084
|
+
this.getNodesSelectionFeedbackPlugin()?.createSelectionHalo(node);
|
|
20085
|
+
};
|
|
20086
|
+
node.handleDeselectNode = () => {
|
|
20087
|
+
this.getNodesSelectionFeedbackPlugin()?.destroySelectionHalo(node);
|
|
20088
|
+
};
|
|
20029
20089
|
node.on("pointerover", (e) => {
|
|
20030
20090
|
const doCancelBubble = this.handleMouseOver(e.target);
|
|
20031
20091
|
if (doCancelBubble) e.cancelBubble = true;
|
|
@@ -20204,6 +20264,10 @@ var WeaveNode = class {
|
|
|
20204
20264
|
}
|
|
20205
20265
|
return realNodeTarget;
|
|
20206
20266
|
}
|
|
20267
|
+
getNodesSelectionFeedbackPlugin() {
|
|
20268
|
+
const selectionFeedbackPlugin = this.instance.getPlugin(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_KEY);
|
|
20269
|
+
return selectionFeedbackPlugin;
|
|
20270
|
+
}
|
|
20207
20271
|
};
|
|
20208
20272
|
|
|
20209
20273
|
//#endregion
|
|
@@ -20719,6 +20783,7 @@ var WeaveGroupsManager = class {
|
|
|
20719
20783
|
const groupNode = stage.findOne(`#${groupId}`);
|
|
20720
20784
|
if (groupHandler && groupNode) this.instance.updateNode(groupHandler.serialize(groupNode));
|
|
20721
20785
|
setTimeout(() => {
|
|
20786
|
+
this.getNodesMultiSelectionFeedbackPlugin()?.cleanupSelectedHalos();
|
|
20722
20787
|
const groupNode$1 = stage.findOne(`#${groupId}`);
|
|
20723
20788
|
const selectionPlugin$1 = this.instance.getPlugin("nodesSelection");
|
|
20724
20789
|
if (groupNode$1 && selectionPlugin$1) {
|
|
@@ -20797,6 +20862,7 @@ var WeaveGroupsManager = class {
|
|
|
20797
20862
|
this.instance.removeNode(groupNode);
|
|
20798
20863
|
}
|
|
20799
20864
|
setTimeout(() => {
|
|
20865
|
+
this.getNodesMultiSelectionFeedbackPlugin()?.cleanupSelectedHalos();
|
|
20800
20866
|
const firstElement = newLayer.findOne(`#${newChildId}`);
|
|
20801
20867
|
const selectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
20802
20868
|
if (firstElement && selectionPlugin) selectionPlugin.setSelectedNodes([firstElement]);
|
|
@@ -20815,6 +20881,9 @@ var WeaveGroupsManager = class {
|
|
|
20815
20881
|
rotation
|
|
20816
20882
|
};
|
|
20817
20883
|
}
|
|
20884
|
+
getNodesMultiSelectionFeedbackPlugin() {
|
|
20885
|
+
return this.instance.getPlugin(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_KEY);
|
|
20886
|
+
}
|
|
20818
20887
|
};
|
|
20819
20888
|
|
|
20820
20889
|
//#endregion
|
|
@@ -21636,7 +21705,7 @@ var WeaveRegisterManager = class {
|
|
|
21636
21705
|
|
|
21637
21706
|
//#endregion
|
|
21638
21707
|
//#region package.json
|
|
21639
|
-
var version = "1.
|
|
21708
|
+
var version = "1.3.0";
|
|
21640
21709
|
|
|
21641
21710
|
//#endregion
|
|
21642
21711
|
//#region src/managers/setup.ts
|
|
@@ -24043,20 +24112,14 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
24043
24112
|
if (this.imageSource[id]) {
|
|
24044
24113
|
imagePlaceholder.destroy();
|
|
24045
24114
|
internalImage.setAttrs({
|
|
24046
|
-
width: this.imageSource[id].width,
|
|
24047
|
-
height: this.imageSource[id].height,
|
|
24048
24115
|
image: this.imageSource[id],
|
|
24049
24116
|
visible: true
|
|
24050
24117
|
});
|
|
24051
|
-
image.setAttr("
|
|
24052
|
-
image.setAttr("width", this.imageSource[id].width);
|
|
24053
|
-
image.setAttr("height", this.imageSource[id].height);
|
|
24054
|
-
image.setAttr("cropInfo", props.cropInfo ?? void 0);
|
|
24055
|
-
image.setAttr("uncroppedImage", props.uncroppedImage ?? {
|
|
24118
|
+
image.setAttr("imageInfo", {
|
|
24056
24119
|
width: this.imageSource[id].width,
|
|
24057
24120
|
height: this.imageSource[id].height
|
|
24058
24121
|
});
|
|
24059
|
-
|
|
24122
|
+
internalImage.setAttr("imageInfo", {
|
|
24060
24123
|
width: this.imageSource[id].width,
|
|
24061
24124
|
height: this.imageSource[id].height
|
|
24062
24125
|
});
|
|
@@ -24165,7 +24228,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
24165
24228
|
draggable: false,
|
|
24166
24229
|
zIndex: 0
|
|
24167
24230
|
});
|
|
24168
|
-
this.updateImageCrop(nodeInstance
|
|
24231
|
+
this.updateImageCrop(nodeInstance);
|
|
24169
24232
|
}
|
|
24170
24233
|
}
|
|
24171
24234
|
preloadImage(imageId, imageURL, { onLoad, onError }) {
|
|
@@ -24228,27 +24291,18 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
24228
24291
|
width: this.imageSource[id].width,
|
|
24229
24292
|
height: this.imageSource[id].height
|
|
24230
24293
|
});
|
|
24231
|
-
this.scaleReset(image);
|
|
24232
|
-
if (!imageProps.uncroppedImage) imageProps.uncroppedImage = {
|
|
24233
|
-
width: this.imageSource[id].width,
|
|
24234
|
-
height: this.imageSource[id].height
|
|
24235
|
-
};
|
|
24236
24294
|
const imageRect = image.getClientRect({ relativeTo: this.instance.getStage() });
|
|
24237
|
-
if (imageProps.cropInfo && imageProps.uncroppedImage) image.setAttr("uncroppedImage", {
|
|
24238
|
-
width: imageProps.uncroppedImage.width,
|
|
24239
|
-
height: imageProps.uncroppedImage.height
|
|
24240
|
-
});
|
|
24241
|
-
if (!imageProps.cropInfo) image.setAttr("uncroppedImage", {
|
|
24295
|
+
if (!imageProps.cropInfo && !imageProps.uncroppedImage) image.setAttr("uncroppedImage", {
|
|
24242
24296
|
width: imageRect.width,
|
|
24243
24297
|
height: imageRect.height
|
|
24244
24298
|
});
|
|
24245
|
-
this.updateImageCrop(image, imageProps);
|
|
24246
24299
|
this.imageState[id] = {
|
|
24247
24300
|
loaded: true,
|
|
24248
24301
|
error: false
|
|
24249
24302
|
};
|
|
24250
24303
|
const nodeHandler = this.instance.getNodeHandler(image.getAttrs().nodeType);
|
|
24251
24304
|
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(image));
|
|
24305
|
+
this.updateImageCrop(image);
|
|
24252
24306
|
this.resolveAsyncElement(id);
|
|
24253
24307
|
}
|
|
24254
24308
|
},
|
|
@@ -24291,8 +24345,8 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
24291
24345
|
imagePlaceholder.height(imageAttrs.uncroppedImage.height);
|
|
24292
24346
|
}
|
|
24293
24347
|
}
|
|
24294
|
-
updateImageCrop(image
|
|
24295
|
-
const imageAttrs =
|
|
24348
|
+
updateImageCrop(image) {
|
|
24349
|
+
const imageAttrs = image.getAttrs();
|
|
24296
24350
|
const internalImage = image?.findOne(`#${imageAttrs.id}-image`);
|
|
24297
24351
|
if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
|
|
24298
24352
|
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo) {
|
|
@@ -30825,6 +30879,144 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
30825
30879
|
}
|
|
30826
30880
|
};
|
|
30827
30881
|
|
|
30882
|
+
//#endregion
|
|
30883
|
+
//#region src/plugins/nodes-multi-selection-feedback/nodes-multi-selection-feedback.ts
|
|
30884
|
+
var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
30885
|
+
selectedHalos = {};
|
|
30886
|
+
constructor(params) {
|
|
30887
|
+
super();
|
|
30888
|
+
this.config = mergeExceptArrays(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, params?.config ?? {});
|
|
30889
|
+
this.selectedHalos = {};
|
|
30890
|
+
}
|
|
30891
|
+
getName() {
|
|
30892
|
+
return WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_KEY;
|
|
30893
|
+
}
|
|
30894
|
+
getLayerName() {
|
|
30895
|
+
return WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_LAYER_ID;
|
|
30896
|
+
}
|
|
30897
|
+
initLayer() {
|
|
30898
|
+
const stage = this.instance.getStage();
|
|
30899
|
+
const findLayer = stage.findOne(`#${this.getLayerName()}`);
|
|
30900
|
+
if (!findLayer) {
|
|
30901
|
+
const layer = new Konva.Layer({ id: this.getLayerName() });
|
|
30902
|
+
stage.add(layer);
|
|
30903
|
+
}
|
|
30904
|
+
}
|
|
30905
|
+
getSelectedHalos() {
|
|
30906
|
+
return this.selectedHalos;
|
|
30907
|
+
}
|
|
30908
|
+
cleanupSelectedHalos() {
|
|
30909
|
+
const keys = Object.keys(this.selectedHalos);
|
|
30910
|
+
keys.forEach((key) => {
|
|
30911
|
+
this.selectedHalos[key].destroy();
|
|
30912
|
+
delete this.selectedHalos[key];
|
|
30913
|
+
});
|
|
30914
|
+
}
|
|
30915
|
+
getNodeRectInfo(node) {
|
|
30916
|
+
const stage = node.getStage();
|
|
30917
|
+
if (!stage) return null;
|
|
30918
|
+
const clone = node.clone();
|
|
30919
|
+
const box = clone.getClientRect({
|
|
30920
|
+
skipTransform: true,
|
|
30921
|
+
skipStroke: true,
|
|
30922
|
+
relativeTo: node.getParent() ?? this.instance.getMainLayer()
|
|
30923
|
+
});
|
|
30924
|
+
const localBox = clone.getClientRect({
|
|
30925
|
+
skipTransform: true,
|
|
30926
|
+
skipStroke: true
|
|
30927
|
+
});
|
|
30928
|
+
const transform = clone.getAbsoluteTransform();
|
|
30929
|
+
const corners = [
|
|
30930
|
+
{
|
|
30931
|
+
x: localBox.x,
|
|
30932
|
+
y: localBox.y
|
|
30933
|
+
},
|
|
30934
|
+
{
|
|
30935
|
+
x: localBox.x + localBox.width,
|
|
30936
|
+
y: localBox.y
|
|
30937
|
+
},
|
|
30938
|
+
{
|
|
30939
|
+
x: localBox.x + localBox.width,
|
|
30940
|
+
y: localBox.y + localBox.height
|
|
30941
|
+
},
|
|
30942
|
+
{
|
|
30943
|
+
x: localBox.x,
|
|
30944
|
+
y: localBox.y + localBox.height
|
|
30945
|
+
}
|
|
30946
|
+
].map((p) => transform.point(p));
|
|
30947
|
+
return {
|
|
30948
|
+
x: corners[0].x,
|
|
30949
|
+
y: corners[0].y,
|
|
30950
|
+
width: box.width * clone.scaleX(),
|
|
30951
|
+
height: box.height * clone.scaleY(),
|
|
30952
|
+
rotation: clone.rotation()
|
|
30953
|
+
};
|
|
30954
|
+
}
|
|
30955
|
+
createSelectionHalo(node) {
|
|
30956
|
+
const nodeId = node.getAttrs().id ?? "";
|
|
30957
|
+
if (this.selectedHalos[nodeId]) return;
|
|
30958
|
+
const info = this.getNodeRectInfo(node);
|
|
30959
|
+
if (info) {
|
|
30960
|
+
const parent = node.getParent();
|
|
30961
|
+
if (node.getAttrs().nodeId) {
|
|
30962
|
+
const realParent = this.instance.getStage().findOne(`#${node.getAttrs().nodeId}`);
|
|
30963
|
+
if (realParent) {
|
|
30964
|
+
info.x += realParent.x();
|
|
30965
|
+
info.y += realParent.y();
|
|
30966
|
+
}
|
|
30967
|
+
}
|
|
30968
|
+
if (parent && parent.getAttrs().nodeId) {
|
|
30969
|
+
const realParent = this.instance.getStage().findOne(`#${parent.getAttrs().nodeId}`);
|
|
30970
|
+
if (realParent) {
|
|
30971
|
+
info.x += realParent.x();
|
|
30972
|
+
info.y += realParent.y();
|
|
30973
|
+
}
|
|
30974
|
+
}
|
|
30975
|
+
this.selectedHalos[nodeId] = new Konva.Rect({
|
|
30976
|
+
id: `${nodeId}-selection-halo`,
|
|
30977
|
+
name: "selection-halo",
|
|
30978
|
+
x: info.x,
|
|
30979
|
+
y: info.y,
|
|
30980
|
+
width: info.width,
|
|
30981
|
+
height: info.height,
|
|
30982
|
+
rotation: info.rotation,
|
|
30983
|
+
stroke: this.config.style.stroke,
|
|
30984
|
+
strokeWidth: this.config.style.strokeWidth,
|
|
30985
|
+
fill: this.config.style.fill,
|
|
30986
|
+
draggable: false,
|
|
30987
|
+
listening: false
|
|
30988
|
+
});
|
|
30989
|
+
this.instance.getSelectionLayer()?.add(this.selectedHalos[nodeId]);
|
|
30990
|
+
}
|
|
30991
|
+
}
|
|
30992
|
+
destroySelectionHalo(node) {
|
|
30993
|
+
const nodeId = node.getAttrs().id ?? "";
|
|
30994
|
+
if (this.selectedHalos[nodeId]) {
|
|
30995
|
+
this.selectedHalos[nodeId].destroy();
|
|
30996
|
+
delete this.selectedHalos[nodeId];
|
|
30997
|
+
}
|
|
30998
|
+
}
|
|
30999
|
+
hideSelectionHalo(node) {
|
|
31000
|
+
const selectionLayer = this.instance.getSelectionLayer();
|
|
31001
|
+
if (selectionLayer) {
|
|
31002
|
+
const groupHalo = selectionLayer.findOne(`#${node.getAttrs().id}-selection-halo`);
|
|
31003
|
+
if (groupHalo) groupHalo.hide();
|
|
31004
|
+
}
|
|
31005
|
+
}
|
|
31006
|
+
getLayer() {
|
|
31007
|
+
const stage = this.instance.getStage();
|
|
31008
|
+
return stage.findOne(`#${this.getLayerName()}`);
|
|
31009
|
+
}
|
|
31010
|
+
enable() {
|
|
31011
|
+
this.getLayer()?.show();
|
|
31012
|
+
this.enabled = true;
|
|
31013
|
+
}
|
|
31014
|
+
disable() {
|
|
31015
|
+
this.getLayer()?.hide();
|
|
31016
|
+
this.enabled = false;
|
|
31017
|
+
}
|
|
31018
|
+
};
|
|
31019
|
+
|
|
30828
31020
|
//#endregion
|
|
30829
31021
|
//#region src/plugins/connected-users/constants.ts
|
|
30830
31022
|
const WEAVE_CONNECTED_USERS_KEY = "connectedUsers";
|
|
@@ -32338,9 +32530,11 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
32338
32530
|
|
|
32339
32531
|
//#endregion
|
|
32340
32532
|
//#region src/index.node.ts
|
|
32341
|
-
|
|
32342
|
-
global.
|
|
32533
|
+
if (typeof window === "undefined") {
|
|
32534
|
+
global._weave_isServerSide = true;
|
|
32535
|
+
global._weave_serverSideBackend = void 0;
|
|
32536
|
+
}
|
|
32343
32537
|
|
|
32344
32538
|
//#endregion
|
|
32345
|
-
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE, ARROW_TOOL_ACTION_NAME, ARROW_TOOL_STATE, BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_DEFAULT_CONFIG, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_STATE, ELLIPSE_TOOL_ACTION_NAME, ELLIPSE_TOOL_STATE, ERASER_TOOL_ACTION_NAME, ERASER_TOOL_STATE, FRAME_TOOL_ACTION_NAME, FRAME_TOOL_STATE, GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, GUIDE_ENTER_SNAPPING_TOLERANCE, GUIDE_EXIT_SNAPPING_TOLERANCE, GUIDE_HORIZONTAL_LINE_NAME, GUIDE_LINE_DEFAULT_CONFIG, GUIDE_LINE_DRAG_SNAPPING_THRESHOLD, GUIDE_LINE_NAME, GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD, GUIDE_ORIENTATION, GUIDE_VERTICAL_LINE_NAME, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, NODE_SNAP_HORIZONTAL, NODE_SNAP_VERTICAL, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, REGULAR_POLYGON_TOOL_ACTION_NAME, REGULAR_POLYGON_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, STAGE_MINIMAP_DEFAULT_CONFIG, STAR_TOOL_ACTION_NAME, STAR_TOOL_STATE, TEXT_LAYOUT, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, VIDEO_TOOL_ACTION_NAME, VIDEO_TOOL_STATE, WEAVE_ARROW_NODE_TYPE, WEAVE_COMMENTS_RENDERER_KEY, WEAVE_COMMENTS_TOOL_LAYER_ID, WEAVE_COMMENT_CREATE_ACTION, WEAVE_COMMENT_NODE_ACTION, WEAVE_COMMENT_NODE_DEFAULTS, WEAVE_COMMENT_NODE_TYPE, WEAVE_COMMENT_STATUS, WEAVE_COMMENT_TOOL_ACTION_NAME, WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, WEAVE_COMMENT_TOOL_STATE, WEAVE_COMMENT_VIEW_ACTION, WEAVE_COPY_PASTE_CONFIG_DEFAULT, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_COPY_PASTE_PASTE_CATCHER_ID, WEAVE_COPY_PASTE_PASTE_MODES, WEAVE_DEFAULT_USER_INFO_FUNCTION, WEAVE_ELLIPSE_NODE_TYPE, WEAVE_FRAME_DEFAULT_BACKGROUND_COLOR, WEAVE_FRAME_NODE_DEFAULT_CONFIG, WEAVE_FRAME_NODE_DEFAULT_PROPS, WEAVE_FRAME_NODE_TYPE, WEAVE_GRID_DEFAULT_COLOR, WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS, WEAVE_GRID_DEFAULT_MAJOR_DOT_RATIO, WEAVE_GRID_DEFAULT_MAJOR_EVERY, WEAVE_GRID_DEFAULT_MAJOR_LINE_RATIO, WEAVE_GRID_DEFAULT_ORIGIN_COLOR, WEAVE_GRID_DEFAULT_RADIUS, WEAVE_GRID_DEFAULT_SIZE, WEAVE_GRID_DEFAULT_STROKE, WEAVE_GRID_DEFAULT_TYPE, WEAVE_GRID_LAYER_ID, WEAVE_GRID_TYPES, WEAVE_GROUP_NODE_TYPE, WEAVE_IMAGE_CROP_END_TYPE, WEAVE_IMAGE_DEFAULT_CONFIG, WEAVE_IMAGE_NODE_TYPE, WEAVE_LAYER_NODE_TYPE, WEAVE_LINE_NODE_TYPE, WEAVE_NODES_DISTANCE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_EDGE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_SELECTION_DEFAULT_CONFIG, WEAVE_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_RECTANGLE_NODE_TYPE, WEAVE_REGULAR_POLYGON_NODE_TYPE, WEAVE_STAGE_DEFAULT_MODE, WEAVE_STAGE_GRID_PLUGIN_KEY, WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, WEAVE_STAGE_KEYBOARD_MOVE_KEY, WEAVE_STAGE_MINIMAP_KEY, WEAVE_STAGE_NODE_TYPE, WEAVE_STAGE_PANNING_DEFAULT_CONFIG, WEAVE_STAGE_PANNING_KEY, WEAVE_STAR_NODE_TYPE, WEAVE_STROKE_NODE_DEFAULT_CONFIG, WEAVE_STROKE_NODE_TYPE, WEAVE_TEXT_NODE_TYPE, WEAVE_USERS_POINTERS_CONFIG_DEFAULT_PROPS, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTER_KEY, WEAVE_USER_SELECTION_KEY, WEAVE_VIDEO_DEFAULT_CONFIG, WEAVE_VIDEO_NODE_TYPE, Weave, WeaveAction, WeaveAlignNodesToolAction, WeaveArrowNode, WeaveArrowToolAction, WeaveBrushToolAction, WeaveCommentNode, WeaveCommentToolAction, WeaveCommentsRendererPlugin, WeaveConnectedUsersPlugin, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveEllipseNode, WeaveEllipseToolAction, WeaveEraserToolAction, WeaveExportNodesToolAction, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToSelectionToolAction, WeaveFrameNode, WeaveFrameToolAction, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveLayerNode, WeaveLineNode, WeaveMoveToolAction, WeaveNode, WeaveNodesDistanceSnappingPlugin, WeaveNodesEdgeSnappingPlugin, WeaveNodesSelectionPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageKeyboardMovePlugin, WeaveStageMinimapPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStore, WeaveStrokeNode, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersSelectionPlugin, WeaveVideoNode, WeaveVideoToolAction, WeaveZoomInToolAction, WeaveZoomOutToolAction, canComposite, clearContainerTargets, containerOverCursor, containsNodeDeep, getBoundingBox, getExportBoundingBox, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isIOS, isInShadowDOM, isNodeInSelection, isServer, memoize, mergeExceptArrays, moveNodeToContainer, resetScale, setupCanvasBackend, setupSkiaBackend };
|
|
32539
|
+
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE, ARROW_TOOL_ACTION_NAME, ARROW_TOOL_STATE, BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_DEFAULT_CONFIG, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_STATE, ELLIPSE_TOOL_ACTION_NAME, ELLIPSE_TOOL_STATE, ERASER_TOOL_ACTION_NAME, ERASER_TOOL_STATE, FRAME_TOOL_ACTION_NAME, FRAME_TOOL_STATE, GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, GUIDE_ENTER_SNAPPING_TOLERANCE, GUIDE_EXIT_SNAPPING_TOLERANCE, GUIDE_HORIZONTAL_LINE_NAME, GUIDE_LINE_DEFAULT_CONFIG, GUIDE_LINE_DRAG_SNAPPING_THRESHOLD, GUIDE_LINE_NAME, GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD, GUIDE_ORIENTATION, GUIDE_VERTICAL_LINE_NAME, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, NODE_SNAP_HORIZONTAL, NODE_SNAP_VERTICAL, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, REGULAR_POLYGON_TOOL_ACTION_NAME, REGULAR_POLYGON_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, STAGE_MINIMAP_DEFAULT_CONFIG, STAR_TOOL_ACTION_NAME, STAR_TOOL_STATE, TEXT_LAYOUT, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, VIDEO_TOOL_ACTION_NAME, VIDEO_TOOL_STATE, WEAVE_ARROW_NODE_TYPE, WEAVE_COMMENTS_RENDERER_KEY, WEAVE_COMMENTS_TOOL_LAYER_ID, WEAVE_COMMENT_CREATE_ACTION, WEAVE_COMMENT_NODE_ACTION, WEAVE_COMMENT_NODE_DEFAULTS, WEAVE_COMMENT_NODE_TYPE, WEAVE_COMMENT_STATUS, WEAVE_COMMENT_TOOL_ACTION_NAME, WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, WEAVE_COMMENT_TOOL_STATE, WEAVE_COMMENT_VIEW_ACTION, WEAVE_COPY_PASTE_CONFIG_DEFAULT, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_COPY_PASTE_PASTE_CATCHER_ID, WEAVE_COPY_PASTE_PASTE_MODES, WEAVE_DEFAULT_USER_INFO_FUNCTION, WEAVE_ELLIPSE_NODE_TYPE, WEAVE_FRAME_DEFAULT_BACKGROUND_COLOR, WEAVE_FRAME_NODE_DEFAULT_CONFIG, WEAVE_FRAME_NODE_DEFAULT_PROPS, WEAVE_FRAME_NODE_TYPE, WEAVE_GRID_DEFAULT_COLOR, WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS, WEAVE_GRID_DEFAULT_MAJOR_DOT_RATIO, WEAVE_GRID_DEFAULT_MAJOR_EVERY, WEAVE_GRID_DEFAULT_MAJOR_LINE_RATIO, WEAVE_GRID_DEFAULT_ORIGIN_COLOR, WEAVE_GRID_DEFAULT_RADIUS, WEAVE_GRID_DEFAULT_SIZE, WEAVE_GRID_DEFAULT_STROKE, WEAVE_GRID_DEFAULT_TYPE, WEAVE_GRID_LAYER_ID, WEAVE_GRID_TYPES, WEAVE_GROUP_NODE_TYPE, WEAVE_IMAGE_CROP_END_TYPE, WEAVE_IMAGE_DEFAULT_CONFIG, WEAVE_IMAGE_NODE_TYPE, WEAVE_LAYER_NODE_TYPE, WEAVE_LINE_NODE_TYPE, WEAVE_NODES_DISTANCE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_EDGE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_KEY, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_LAYER_ID, WEAVE_NODES_SELECTION_DEFAULT_CONFIG, WEAVE_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_RECTANGLE_NODE_TYPE, WEAVE_REGULAR_POLYGON_NODE_TYPE, WEAVE_STAGE_DEFAULT_MODE, WEAVE_STAGE_GRID_PLUGIN_KEY, WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, WEAVE_STAGE_KEYBOARD_MOVE_KEY, WEAVE_STAGE_MINIMAP_KEY, WEAVE_STAGE_NODE_TYPE, WEAVE_STAGE_PANNING_DEFAULT_CONFIG, WEAVE_STAGE_PANNING_KEY, WEAVE_STAR_NODE_TYPE, WEAVE_STROKE_NODE_DEFAULT_CONFIG, WEAVE_STROKE_NODE_TYPE, WEAVE_TEXT_NODE_TYPE, WEAVE_USERS_POINTERS_CONFIG_DEFAULT_PROPS, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTER_KEY, WEAVE_USER_SELECTION_KEY, WEAVE_VIDEO_DEFAULT_CONFIG, WEAVE_VIDEO_NODE_TYPE, Weave, WeaveAction, WeaveAlignNodesToolAction, WeaveArrowNode, WeaveArrowToolAction, WeaveBrushToolAction, WeaveCommentNode, WeaveCommentToolAction, WeaveCommentsRendererPlugin, WeaveConnectedUsersPlugin, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveEllipseNode, WeaveEllipseToolAction, WeaveEraserToolAction, WeaveExportNodesToolAction, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToSelectionToolAction, WeaveFrameNode, WeaveFrameToolAction, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveLayerNode, WeaveLineNode, WeaveMoveToolAction, WeaveNode, WeaveNodesDistanceSnappingPlugin, WeaveNodesEdgeSnappingPlugin, WeaveNodesMultiSelectionFeedbackPlugin, WeaveNodesSelectionPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageKeyboardMovePlugin, WeaveStageMinimapPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStore, WeaveStrokeNode, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersSelectionPlugin, WeaveVideoNode, WeaveVideoToolAction, WeaveZoomInToolAction, WeaveZoomOutToolAction, canComposite, clearContainerTargets, containerOverCursor, containsNodeDeep, getBoundingBox, getExportBoundingBox, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isIOS, isInShadowDOM, isNodeInSelection, isServer, memoize, mergeExceptArrays, moveNodeToContainer, resetScale, setupCanvasBackend, setupSkiaBackend };
|
|
32346
32540
|
//# sourceMappingURL=sdk.node.js.map
|