@inditextech/weave-sdk 2.2.0 → 2.3.1
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 +18 -4
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +161 -35
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.node.d.ts +23 -9
- package/dist/sdk.node.d.ts.map +1 -1
- package/dist/sdk.node.js +174 -49
- package/dist/sdk.node.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.js
CHANGED
|
@@ -15290,7 +15290,8 @@ const WEAVE_NODES_SELECTION_DEFAULT_CONFIG = {
|
|
|
15290
15290
|
]
|
|
15291
15291
|
};
|
|
15292
15292
|
}
|
|
15293
|
-
}
|
|
15293
|
+
},
|
|
15294
|
+
style: { dragOpacity: .75 }
|
|
15294
15295
|
};
|
|
15295
15296
|
|
|
15296
15297
|
//#endregion
|
|
@@ -17616,7 +17617,7 @@ function resetScale(node) {
|
|
|
17616
17617
|
}
|
|
17617
17618
|
function clearContainerTargets(instance) {
|
|
17618
17619
|
const containers = instance.getContainerNodes();
|
|
17619
|
-
for (const container of containers) container.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, {
|
|
17620
|
+
for (const container of containers) container.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, { node: void 0 });
|
|
17620
17621
|
}
|
|
17621
17622
|
function containerOverCursor(instance, ignoreNodes, definedCursorPosition) {
|
|
17622
17623
|
Konva.hitOnDragEnabled = true;
|
|
@@ -17642,6 +17643,8 @@ function moveNodeToContainer(instance, node, containerToMove, invalidOriginsType
|
|
|
17642
17643
|
const stage = instance.getStage();
|
|
17643
17644
|
const isLocked = instance.allNodesLocked([node]);
|
|
17644
17645
|
if (isLocked) return false;
|
|
17646
|
+
const canMoveToLayer = containerToMove.canMoveToContainer(node);
|
|
17647
|
+
if (!canMoveToLayer) return false;
|
|
17645
17648
|
let nodeActualContainer = node.getParent();
|
|
17646
17649
|
if (nodeActualContainer.getAttrs().nodeId) {
|
|
17647
17650
|
const realParent = stage.findOne(`#${nodeActualContainer.getAttrs().nodeId}`);
|
|
@@ -17661,6 +17664,10 @@ function moveNodeToContainer(instance, node, containerToMove, invalidOriginsType
|
|
|
17661
17664
|
node.x(node.x() - (layerToMoveAttrs.containerOffsetX ?? 0));
|
|
17662
17665
|
node.y(node.y() - (layerToMoveAttrs.containerOffsetY ?? 0));
|
|
17663
17666
|
node.movedToContainer(layerToMove);
|
|
17667
|
+
instance.emitEvent("onNodeMovedToContainer", {
|
|
17668
|
+
node: node.clone(),
|
|
17669
|
+
container: layerToMove
|
|
17670
|
+
});
|
|
17664
17671
|
const nodeHandler = instance.getNodeHandler(node.getAttrs().nodeType);
|
|
17665
17672
|
if (nodeHandler) {
|
|
17666
17673
|
const actualNode = nodeHandler.serialize(node);
|
|
@@ -17902,6 +17909,16 @@ function mergeExceptArrays(object, source) {
|
|
|
17902
17909
|
return void 0;
|
|
17903
17910
|
});
|
|
17904
17911
|
}
|
|
17912
|
+
function getStageClickPoint(instance, pointerPos) {
|
|
17913
|
+
const stage = instance.getStage();
|
|
17914
|
+
const scale = stage.scale();
|
|
17915
|
+
const position = stage.position();
|
|
17916
|
+
const stageClickPoint = {
|
|
17917
|
+
x: (pointerPos.x - position.x) / scale.x,
|
|
17918
|
+
y: (pointerPos.y - position.y) / scale.y
|
|
17919
|
+
};
|
|
17920
|
+
return stageClickPoint;
|
|
17921
|
+
}
|
|
17905
17922
|
|
|
17906
17923
|
//#endregion
|
|
17907
17924
|
//#region src/actions/selection-tool/constants.ts
|
|
@@ -18716,6 +18733,13 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18716
18733
|
};
|
|
18717
18734
|
tr.on("transform", (0, import_throttle.default)(handleTransform, 50));
|
|
18718
18735
|
tr.on("transformend", () => {
|
|
18736
|
+
if (tr.nodes().length > 1) {
|
|
18737
|
+
const nodes = tr.nodes();
|
|
18738
|
+
for (const node of nodes) {
|
|
18739
|
+
this.getNodesSelectionFeedbackPlugin()?.showSelectionHalo(node);
|
|
18740
|
+
this.getNodesSelectionFeedbackPlugin()?.updateSelectionHalo(node);
|
|
18741
|
+
}
|
|
18742
|
+
}
|
|
18719
18743
|
this.triggerSelectedNodesEvent();
|
|
18720
18744
|
});
|
|
18721
18745
|
let initialPos = null;
|
|
@@ -18731,6 +18755,12 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18731
18755
|
e.target.stopDrag();
|
|
18732
18756
|
return;
|
|
18733
18757
|
}
|
|
18758
|
+
const nodes = tr.nodes();
|
|
18759
|
+
if (nodes.length > 1) for (const node of nodes) {
|
|
18760
|
+
const originalNodeOpacity = node.getAttrs().opacity ?? 1;
|
|
18761
|
+
node.setAttr("dragStartOpacity", originalNodeOpacity);
|
|
18762
|
+
node.opacity(this.getDragOpacity());
|
|
18763
|
+
}
|
|
18734
18764
|
e.cancelBubble = true;
|
|
18735
18765
|
tr.forceUpdate();
|
|
18736
18766
|
});
|
|
@@ -18761,7 +18791,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18761
18791
|
if (this.isSelecting() && selectedNodes.length > 1) {
|
|
18762
18792
|
clearContainerTargets(this.instance);
|
|
18763
18793
|
const layerToMove = containerOverCursor(this.instance, selectedNodes);
|
|
18764
|
-
if (layerToMove && !selectionContainsFrames) layerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, {
|
|
18794
|
+
if (layerToMove && !selectionContainsFrames) layerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { node: void 0 });
|
|
18765
18795
|
}
|
|
18766
18796
|
tr.forceUpdate();
|
|
18767
18797
|
};
|
|
@@ -18769,6 +18799,13 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18769
18799
|
tr.on("dragend", (e) => {
|
|
18770
18800
|
if (!this.didMove) return;
|
|
18771
18801
|
e.cancelBubble = true;
|
|
18802
|
+
if (tr.nodes().length > 1) {
|
|
18803
|
+
const nodes$1 = tr.nodes();
|
|
18804
|
+
for (const node of nodes$1) {
|
|
18805
|
+
this.getNodesSelectionFeedbackPlugin()?.showSelectionHalo(node);
|
|
18806
|
+
this.getNodesSelectionFeedbackPlugin()?.updateSelectionHalo(node);
|
|
18807
|
+
}
|
|
18808
|
+
}
|
|
18772
18809
|
this.instance.getCloningManager().cleanupClones();
|
|
18773
18810
|
this.getStagePanningPlugin()?.cleanupEdgeMoveIntervals();
|
|
18774
18811
|
const selectedNodes = tr.nodes();
|
|
@@ -18778,6 +18815,12 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18778
18815
|
selectionContainsFrames = selectionContainsFrames || hasFrames(node);
|
|
18779
18816
|
node.updatePosition(node.getAbsolutePosition());
|
|
18780
18817
|
}
|
|
18818
|
+
const nodes = tr.nodes();
|
|
18819
|
+
if (nodes.length > 1) for (const node of nodes) {
|
|
18820
|
+
const dragStartOpacity = node.getAttr("dragStartOpacity") ?? 1;
|
|
18821
|
+
node.opacity(dragStartOpacity);
|
|
18822
|
+
node.setAttr("dragStartOpacity", void 0);
|
|
18823
|
+
}
|
|
18781
18824
|
if (this.isSelecting() && tr.nodes().length > 1) {
|
|
18782
18825
|
const actualCursor = stage.container().style.cursor;
|
|
18783
18826
|
stage.container().style.cursor = "wait";
|
|
@@ -18788,17 +18831,29 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18788
18831
|
const nodeUpdatePromise = (node) => {
|
|
18789
18832
|
return new Promise((resolve) => {
|
|
18790
18833
|
setTimeout(() => {
|
|
18791
|
-
|
|
18792
|
-
|
|
18793
|
-
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
|
|
18797
|
-
|
|
18798
|
-
|
|
18799
|
-
|
|
18800
|
-
|
|
18801
|
-
|
|
18834
|
+
const isLockedToContainer = node.getAttrs().lockToContainer;
|
|
18835
|
+
if (!isLockedToContainer) {
|
|
18836
|
+
clearContainerTargets(this.instance);
|
|
18837
|
+
const nodeHandler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
18838
|
+
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node));
|
|
18839
|
+
let containerToMove = this.instance.getMainLayer();
|
|
18840
|
+
if (layerToMove) containerToMove = layerToMove;
|
|
18841
|
+
let moved = false;
|
|
18842
|
+
if (containerToMove && !selectionContainsFrames) moved = moveNodeToContainer(this.instance, node, containerToMove);
|
|
18843
|
+
if (containerToMove) containerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, { node: void 0 });
|
|
18844
|
+
if (!nodeHandler) return resolve();
|
|
18845
|
+
toSelect.push(node.getAttrs().id ?? "");
|
|
18846
|
+
if (!moved) toUpdate.push(nodeHandler.serialize(node));
|
|
18847
|
+
}
|
|
18848
|
+
if (isLockedToContainer) {
|
|
18849
|
+
clearContainerTargets(this.instance);
|
|
18850
|
+
toSelect.push(node.getAttrs().id ?? "");
|
|
18851
|
+
const nodeHandler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
18852
|
+
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node));
|
|
18853
|
+
if (!nodeHandler) return resolve();
|
|
18854
|
+
toSelect.push(node.getAttrs().id ?? "");
|
|
18855
|
+
toUpdate.push(nodeHandler.serialize(node));
|
|
18856
|
+
}
|
|
18802
18857
|
resolve();
|
|
18803
18858
|
}, 0);
|
|
18804
18859
|
});
|
|
@@ -18812,16 +18867,16 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18812
18867
|
Promise.allSettled(promises).then((results) => {
|
|
18813
18868
|
if (results.length > 0) this.instance.updateNodes(toUpdate);
|
|
18814
18869
|
stage.container().style.cursor = actualCursor;
|
|
18870
|
+
setTimeout(() => {
|
|
18871
|
+
const finalSelectedNodes = [];
|
|
18872
|
+
toSelect.forEach((nodeId) => {
|
|
18873
|
+
const actNode = this.instance.getStage().findOne(`#${nodeId}`);
|
|
18874
|
+
if (actNode) finalSelectedNodes.push(actNode);
|
|
18875
|
+
});
|
|
18876
|
+
tr.nodes(finalSelectedNodes);
|
|
18877
|
+
tr.forceUpdate();
|
|
18878
|
+
}, 0);
|
|
18815
18879
|
});
|
|
18816
|
-
setTimeout(() => {
|
|
18817
|
-
const finalSelectedNodes = [];
|
|
18818
|
-
toSelect.forEach((nodeId) => {
|
|
18819
|
-
const actNode = this.instance.getStage().findOne(`#${nodeId}`);
|
|
18820
|
-
if (actNode) finalSelectedNodes.push(actNode);
|
|
18821
|
-
});
|
|
18822
|
-
tr.nodes(finalSelectedNodes);
|
|
18823
|
-
tr.forceUpdate();
|
|
18824
|
-
}, 0);
|
|
18825
18880
|
}
|
|
18826
18881
|
for (const node of selectedNodes) node.setAttrs({ isCloned: void 0 });
|
|
18827
18882
|
tr.forceUpdate();
|
|
@@ -19424,6 +19479,9 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19424
19479
|
getSelectorConfig() {
|
|
19425
19480
|
return this.config.selection;
|
|
19426
19481
|
}
|
|
19482
|
+
getDragOpacity() {
|
|
19483
|
+
return this.config.style.dragOpacity;
|
|
19484
|
+
}
|
|
19427
19485
|
};
|
|
19428
19486
|
|
|
19429
19487
|
//#endregion
|
|
@@ -19923,6 +19981,9 @@ var WeaveNode = class {
|
|
|
19923
19981
|
node.handleMouseout = function() {};
|
|
19924
19982
|
node.handleSelectNode = function() {};
|
|
19925
19983
|
node.handleDeselectNode = function() {};
|
|
19984
|
+
node.canMoveToContainer = function() {
|
|
19985
|
+
return true;
|
|
19986
|
+
};
|
|
19926
19987
|
}
|
|
19927
19988
|
isNodeSelected(ele) {
|
|
19928
19989
|
const selectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
@@ -19941,7 +20002,7 @@ var WeaveNode = class {
|
|
|
19941
20002
|
setHoverState(node) {
|
|
19942
20003
|
const selectionPlugin = this.getSelectionPlugin();
|
|
19943
20004
|
if (!selectionPlugin) return;
|
|
19944
|
-
if (selectionPlugin.isAreaSelecting()) {
|
|
20005
|
+
if (selectionPlugin.getSelectedNodes().length === 1 && node === selectionPlugin.getSelectedNodes()[0] || selectionPlugin.isAreaSelecting()) {
|
|
19945
20006
|
this.hideHoverState();
|
|
19946
20007
|
return;
|
|
19947
20008
|
}
|
|
@@ -19995,7 +20056,10 @@ var WeaveNode = class {
|
|
|
19995
20056
|
if (nodesSnappingPlugin) nodesSnappingPlugin.cleanupGuidelines();
|
|
19996
20057
|
if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
19997
20058
|
this.scaleReset(node$1);
|
|
19998
|
-
this.
|
|
20059
|
+
if (this.getSelectionPlugin()?.getSelectedNodes().length === 1) {
|
|
20060
|
+
this.getNodesSelectionFeedbackPlugin()?.showSelectionHalo(node$1);
|
|
20061
|
+
this.getNodesSelectionFeedbackPlugin()?.updateSelectionHalo(node$1);
|
|
20062
|
+
}
|
|
19999
20063
|
const nodeHandler = this.instance.getNodeHandler(node$1.getAttrs().nodeType);
|
|
20000
20064
|
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node$1));
|
|
20001
20065
|
this.getNodesSelectionPlugin()?.getHoverTransformer().forceUpdate();
|
|
@@ -20031,6 +20095,10 @@ var WeaveNode = class {
|
|
|
20031
20095
|
}
|
|
20032
20096
|
const realNodeTarget = this.getRealSelectedNode(nodeTarget);
|
|
20033
20097
|
if (realNodeTarget.getAttrs().isCloned) return;
|
|
20098
|
+
if (this.getNodesSelectionPlugin()?.getSelectedNodes().length === 1) {
|
|
20099
|
+
realNodeTarget.setAttr("dragStartOpacity", realNodeTarget.opacity());
|
|
20100
|
+
realNodeTarget.opacity(this.getNodesSelectionPlugin()?.getDragOpacity());
|
|
20101
|
+
}
|
|
20034
20102
|
if (e.evt?.altKey) {
|
|
20035
20103
|
nodeTarget.setAttrs({ isCloneOrigin: true });
|
|
20036
20104
|
nodeTarget.setAttrs({ isCloned: false });
|
|
@@ -20074,13 +20142,16 @@ var WeaveNode = class {
|
|
|
20074
20142
|
if (this.isSelecting() && this.getSelectionPlugin()?.getSelectedNodes().length === 1) {
|
|
20075
20143
|
clearContainerTargets(this.instance);
|
|
20076
20144
|
const layerToMove = containerOverCursor(this.instance, [realNodeTarget]);
|
|
20077
|
-
if (layerToMove && !hasFrames(realNodeTarget) && realNodeTarget.isDragging()) layerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, {
|
|
20145
|
+
if (layerToMove && !hasFrames(realNodeTarget) && realNodeTarget.isDragging() && !realNodeTarget.getAttrs().lockToContainer) layerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { node: realNodeTarget });
|
|
20078
20146
|
}
|
|
20079
20147
|
};
|
|
20080
20148
|
node.on("dragmove", (0, import_lodash.throttle)(handleDragMove, 100));
|
|
20081
20149
|
node.on("dragend", (e) => {
|
|
20082
20150
|
const nodeTarget = e.target;
|
|
20083
|
-
this.
|
|
20151
|
+
if (this.getSelectionPlugin()?.getSelectedNodes().length === 1) {
|
|
20152
|
+
this.getNodesSelectionFeedbackPlugin()?.showSelectionHalo(nodeTarget);
|
|
20153
|
+
this.getNodesSelectionFeedbackPlugin()?.updateSelectionHalo(nodeTarget);
|
|
20154
|
+
}
|
|
20084
20155
|
e.cancelBubble = true;
|
|
20085
20156
|
if (nodeTarget.getAttrs().isCloneOrigin && originalPosition) {
|
|
20086
20157
|
nodeTarget.setAbsolutePosition(originalPosition);
|
|
@@ -20097,7 +20168,12 @@ var WeaveNode = class {
|
|
|
20097
20168
|
}
|
|
20098
20169
|
this.instance.emitEvent("onDrag", null);
|
|
20099
20170
|
const realNodeTarget = this.getRealSelectedNode(nodeTarget);
|
|
20100
|
-
if (this.
|
|
20171
|
+
if (this.getNodesSelectionPlugin()?.getSelectedNodes().length === 1) {
|
|
20172
|
+
const originalNodeOpacity = realNodeTarget.getAttr("dragStartOpacity") ?? 1;
|
|
20173
|
+
realNodeTarget.setAttrs({ opacity: originalNodeOpacity });
|
|
20174
|
+
realNodeTarget.setAttr("dragStartOpacity", void 0);
|
|
20175
|
+
}
|
|
20176
|
+
if (this.isSelecting() && this.getSelectionPlugin()?.getSelectedNodes().length === 1 && (realNodeTarget.getAttrs().lockToContainer === void 0 || !realNodeTarget.getAttrs().lockToContainer)) {
|
|
20101
20177
|
clearContainerTargets(this.instance);
|
|
20102
20178
|
const nodesEdgeSnappingPlugin = this.getNodesEdgeSnappingPlugin();
|
|
20103
20179
|
const nodesDistanceSnappingPlugin = this.getNodesDistanceSnappingPlugin();
|
|
@@ -20109,9 +20185,17 @@ var WeaveNode = class {
|
|
|
20109
20185
|
let moved = false;
|
|
20110
20186
|
if (containerToMove && !hasFrames(node)) moved = moveNodeToContainer(this.instance, realNodeTarget, containerToMove);
|
|
20111
20187
|
if (realNodeTarget.getAttrs().isCloned) this.instance.getCloningManager().removeClone(realNodeTarget);
|
|
20112
|
-
if (containerToMove) containerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, {
|
|
20188
|
+
if (containerToMove) containerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, { node: realNodeTarget });
|
|
20113
20189
|
if (!moved) this.instance.updateNode(this.serialize(realNodeTarget));
|
|
20114
20190
|
}
|
|
20191
|
+
if (this.isSelecting() && this.getSelectionPlugin()?.getSelectedNodes().length === 1 && realNodeTarget.getAttrs().lockToContainer) {
|
|
20192
|
+
clearContainerTargets(this.instance);
|
|
20193
|
+
const nodesEdgeSnappingPlugin = this.getNodesEdgeSnappingPlugin();
|
|
20194
|
+
const nodesDistanceSnappingPlugin = this.getNodesDistanceSnappingPlugin();
|
|
20195
|
+
if (nodesEdgeSnappingPlugin) nodesEdgeSnappingPlugin.cleanupGuidelines();
|
|
20196
|
+
if (nodesDistanceSnappingPlugin) nodesDistanceSnappingPlugin.cleanupGuidelines();
|
|
20197
|
+
this.instance.updateNode(this.serialize(realNodeTarget));
|
|
20198
|
+
}
|
|
20115
20199
|
nodeTarget.setAttrs({ isCloned: void 0 });
|
|
20116
20200
|
nodeTarget.setAttrs({ isCloneOrigin: void 0 });
|
|
20117
20201
|
realNodeTarget.setAttrs({ isCloned: void 0 });
|
|
@@ -20807,6 +20891,9 @@ var WeaveLayerNode = class extends WeaveNode {
|
|
|
20807
20891
|
nodeType = WEAVE_LAYER_NODE_TYPE;
|
|
20808
20892
|
onRender(props) {
|
|
20809
20893
|
const layer = new Konva.Layer({ ...props });
|
|
20894
|
+
layer.canMoveToContainer = function() {
|
|
20895
|
+
return true;
|
|
20896
|
+
};
|
|
20810
20897
|
return layer;
|
|
20811
20898
|
}
|
|
20812
20899
|
onUpdate(nodeInstance, nextProps) {
|
|
@@ -22890,6 +22977,9 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
22890
22977
|
fill: onTargetEnterFill
|
|
22891
22978
|
});
|
|
22892
22979
|
});
|
|
22980
|
+
frame.canMoveToContainer = function() {
|
|
22981
|
+
return true;
|
|
22982
|
+
};
|
|
22893
22983
|
return frame;
|
|
22894
22984
|
}
|
|
22895
22985
|
onUpdate(nodeInstance, nextProps) {
|
|
@@ -27264,6 +27354,7 @@ const FRAME_TOOL_STATE = {
|
|
|
27264
27354
|
//#region src/actions/frame-tool/frame-tool.ts
|
|
27265
27355
|
var WeaveFrameToolAction = class extends WeaveAction {
|
|
27266
27356
|
initialized = false;
|
|
27357
|
+
templateId = null;
|
|
27267
27358
|
onPropsChange = void 0;
|
|
27268
27359
|
onInit = void 0;
|
|
27269
27360
|
constructor() {
|
|
@@ -27285,6 +27376,9 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
27285
27376
|
opacity: 1
|
|
27286
27377
|
};
|
|
27287
27378
|
}
|
|
27379
|
+
setTemplateToUse(templateId) {
|
|
27380
|
+
this.templateId = templateId;
|
|
27381
|
+
}
|
|
27288
27382
|
setupEvents() {
|
|
27289
27383
|
const stage = this.instance.getStage();
|
|
27290
27384
|
window.addEventListener("keydown", (e) => {
|
|
@@ -27299,7 +27393,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
27299
27393
|
});
|
|
27300
27394
|
stage.on("pointerclick", () => {
|
|
27301
27395
|
if (this.state === FRAME_TOOL_STATE.IDLE) return;
|
|
27302
|
-
if (this.state === FRAME_TOOL_STATE.ADDING) {
|
|
27396
|
+
if (this.state === FRAME_TOOL_STATE.ADDING && this.templateId === null) {
|
|
27303
27397
|
this.handleAdding();
|
|
27304
27398
|
return;
|
|
27305
27399
|
}
|
|
@@ -27313,6 +27407,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
27313
27407
|
this.setCursor();
|
|
27314
27408
|
this.setFocusStage();
|
|
27315
27409
|
this.instance.emitEvent("onAddingFrame");
|
|
27410
|
+
this.templateId = null;
|
|
27316
27411
|
this.frameId = null;
|
|
27317
27412
|
this.clickPoint = null;
|
|
27318
27413
|
this.setState(FRAME_TOOL_STATE.ADDING);
|
|
@@ -27362,6 +27457,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
27362
27457
|
this.frameId = null;
|
|
27363
27458
|
this.container = void 0;
|
|
27364
27459
|
this.clickPoint = null;
|
|
27460
|
+
this.templateId = null;
|
|
27365
27461
|
this.setState(FRAME_TOOL_STATE.IDLE);
|
|
27366
27462
|
}
|
|
27367
27463
|
setCursor() {
|
|
@@ -28977,9 +29073,7 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
|
28977
29073
|
rotation: clone.rotation()
|
|
28978
29074
|
};
|
|
28979
29075
|
}
|
|
28980
|
-
|
|
28981
|
-
const nodeId = node.getAttrs().id ?? "";
|
|
28982
|
-
if (this.selectedHalos[nodeId]) return;
|
|
29076
|
+
getNodeInfo(node) {
|
|
28983
29077
|
const info = this.getNodeRectInfo(node);
|
|
28984
29078
|
if (info) {
|
|
28985
29079
|
const parent = node.getParent();
|
|
@@ -28997,6 +29091,14 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
|
28997
29091
|
info.y += realParent.y();
|
|
28998
29092
|
}
|
|
28999
29093
|
}
|
|
29094
|
+
}
|
|
29095
|
+
return info;
|
|
29096
|
+
}
|
|
29097
|
+
createSelectionHalo(node) {
|
|
29098
|
+
const nodeId = node.getAttrs().id ?? "";
|
|
29099
|
+
if (this.selectedHalos[nodeId]) return;
|
|
29100
|
+
const info = this.getNodeInfo(node);
|
|
29101
|
+
if (info) {
|
|
29000
29102
|
this.selectedHalos[nodeId] = new Konva.Rect({
|
|
29001
29103
|
id: `${nodeId}-selection-halo`,
|
|
29002
29104
|
name: "selection-halo",
|
|
@@ -29021,6 +29123,30 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
|
29021
29123
|
delete this.selectedHalos[nodeId];
|
|
29022
29124
|
}
|
|
29023
29125
|
}
|
|
29126
|
+
updateSelectionHalo(node) {
|
|
29127
|
+
const nodeId = node.getAttrs().id ?? "";
|
|
29128
|
+
if (!this.selectedHalos[nodeId]) return;
|
|
29129
|
+
const info = this.getNodeInfo(node);
|
|
29130
|
+
if (info) {
|
|
29131
|
+
const selectionLayer = this.instance.getSelectionLayer();
|
|
29132
|
+
if (!selectionLayer) return;
|
|
29133
|
+
const groupHalo = selectionLayer.findOne(`#${node.getAttrs().id}-selection-halo`);
|
|
29134
|
+
groupHalo?.setAttrs({
|
|
29135
|
+
x: info.x,
|
|
29136
|
+
y: info.y,
|
|
29137
|
+
width: info.width,
|
|
29138
|
+
height: info.height,
|
|
29139
|
+
rotation: info.rotation
|
|
29140
|
+
});
|
|
29141
|
+
}
|
|
29142
|
+
}
|
|
29143
|
+
showSelectionHalo(node) {
|
|
29144
|
+
const selectionLayer = this.instance.getSelectionLayer();
|
|
29145
|
+
if (selectionLayer) {
|
|
29146
|
+
const groupHalo = selectionLayer.findOne(`#${node.getAttrs().id}-selection-halo`);
|
|
29147
|
+
if (groupHalo) groupHalo.show();
|
|
29148
|
+
}
|
|
29149
|
+
}
|
|
29024
29150
|
hideSelectionHalo(node) {
|
|
29025
29151
|
const selectionLayer = this.instance.getSelectionLayer();
|
|
29026
29152
|
if (selectionLayer) {
|
|
@@ -31607,7 +31733,7 @@ var WeaveRegisterManager = class {
|
|
|
31607
31733
|
|
|
31608
31734
|
//#endregion
|
|
31609
31735
|
//#region package.json
|
|
31610
|
-
var version = "2.
|
|
31736
|
+
var version = "2.3.1";
|
|
31611
31737
|
|
|
31612
31738
|
//#endregion
|
|
31613
31739
|
//#region src/managers/setup.ts
|
|
@@ -32658,5 +32784,5 @@ window._weave_isServerSide = false;
|
|
|
32658
32784
|
window._weave_serverSideBackend = void 0;
|
|
32659
32785
|
|
|
32660
32786
|
//#endregion
|
|
32661
|
-
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, defaultInitialState, getBoundingBox, getExportBoundingBox, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isIOS, isInShadowDOM, isNodeInSelection, isServer, memoize, mergeExceptArrays, moveNodeToContainer, resetScale };
|
|
32787
|
+
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, defaultInitialState, getBoundingBox, getExportBoundingBox, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getStageClickPoint, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isIOS, isInShadowDOM, isNodeInSelection, isServer, memoize, mergeExceptArrays, moveNodeToContainer, resetScale };
|
|
32662
32788
|
//# sourceMappingURL=sdk.js.map
|