@inditextech/weave-sdk 0.44.0 → 0.46.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.cjs +518 -237
- package/dist/sdk.d.cts +35 -11
- package/dist/sdk.d.cts.map +1 -1
- package/dist/sdk.d.ts +35 -11
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +515 -238
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.cjs
CHANGED
|
@@ -15665,25 +15665,28 @@ function clearContainerTargets(instance) {
|
|
|
15665
15665
|
const containers = instance.getContainerNodes();
|
|
15666
15666
|
for (const container of containers) container.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, { bubbles: true });
|
|
15667
15667
|
}
|
|
15668
|
-
function
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
|
|
15674
|
-
|
|
15675
|
-
if (
|
|
15676
|
-
|
|
15677
|
-
|
|
15678
|
-
|
|
15679
|
-
|
|
15668
|
+
function containerOverCursor(instance) {
|
|
15669
|
+
konva.default.hitOnDragEnabled = true;
|
|
15670
|
+
const stage = instance.getStage();
|
|
15671
|
+
const cursorPosition = stage.getRelativePointerPosition();
|
|
15672
|
+
if (!cursorPosition) return void 0;
|
|
15673
|
+
const nodesUnderPointer = new Set();
|
|
15674
|
+
stage.find("Shape").reverse().forEach((node) => {
|
|
15675
|
+
if (!node.isVisible() || !(node instanceof konva.default.Shape)) return;
|
|
15676
|
+
const shapeRect = node.getClientRect({ relativeTo: stage });
|
|
15677
|
+
if (cursorPosition.x >= shapeRect.x && cursorPosition.x <= shapeRect.x + shapeRect.width && cursorPosition.y >= shapeRect.y && cursorPosition.y <= shapeRect.y + shapeRect.height && node.getAttrs().nodeId) {
|
|
15678
|
+
const realNode = stage.findOne(`#${node.getAttrs().nodeId}`);
|
|
15679
|
+
if (realNode?.getAttrs().isContainerPrincipal) nodesUnderPointer.add(realNode);
|
|
15680
|
+
}
|
|
15681
|
+
});
|
|
15682
|
+
const nodes = Array.from(nodesUnderPointer);
|
|
15683
|
+
if (nodes.length === 0) return void 0;
|
|
15680
15684
|
let layerToMove = void 0;
|
|
15681
|
-
if (
|
|
15685
|
+
if (nodes[0]?.getAttrs().containerId && nodes[0]?.getAttrs().isContainerPrincipal) layerToMove = nodes[0];
|
|
15682
15686
|
return layerToMove;
|
|
15683
15687
|
}
|
|
15684
|
-
function moveNodeToContainer(instance, node) {
|
|
15688
|
+
function moveNodeToContainer(instance, node, containerToMove, invalidOriginsTypes = ["frame"]) {
|
|
15685
15689
|
const stage = instance.getStage();
|
|
15686
|
-
const nodeIntersected = instance.nodeIntersectsContainerElement(node);
|
|
15687
15690
|
const isLocked = instance.allNodesLocked([node]);
|
|
15688
15691
|
if (isLocked) return;
|
|
15689
15692
|
let nodeActualContainer = node.getParent();
|
|
@@ -15694,8 +15697,7 @@ function moveNodeToContainer(instance, node) {
|
|
|
15694
15697
|
if (!nodeActualContainer) return void 0;
|
|
15695
15698
|
const actualContainerAttrs = nodeActualContainer.getAttrs();
|
|
15696
15699
|
let layerToMove = void 0;
|
|
15697
|
-
if (
|
|
15698
|
-
if (!nodeIntersected && actualContainerAttrs.id !== __inditextech_weave_types.WEAVE_NODE_LAYER_ID) layerToMove = instance.getMainLayer();
|
|
15700
|
+
if (actualContainerAttrs.id !== containerToMove.getAttrs().id && !invalidOriginsTypes.includes(node.getAttrs().nodeType)) layerToMove = containerToMove;
|
|
15699
15701
|
if (layerToMove && actualContainerAttrs.id !== layerToMove.getAttrs().id && actualContainerAttrs.id !== layerToMove.getAttrs().containerId) {
|
|
15700
15702
|
const layerToMoveAttrs = layerToMove.getAttrs();
|
|
15701
15703
|
const nodePos = node.getAbsolutePosition();
|
|
@@ -15766,7 +15768,7 @@ function getTargetedNode(instance) {
|
|
|
15766
15768
|
let selectedGroup = void 0;
|
|
15767
15769
|
const mousePos = stage.getPointerPosition();
|
|
15768
15770
|
if (mousePos) {
|
|
15769
|
-
const allInter = stage.getAllIntersections(mousePos);
|
|
15771
|
+
const allInter = stage.getAllIntersections(mousePos).reverse();
|
|
15770
15772
|
if (allInter.length === 1) selectedGroup = instance.getInstanceRecursive(allInter[0]);
|
|
15771
15773
|
else {
|
|
15772
15774
|
const allInterContainersFiltered = allInter.filter((ele) => typeof ele.getAttrs().containerElement === "undefined");
|
|
@@ -15775,6 +15777,27 @@ function getTargetedNode(instance) {
|
|
|
15775
15777
|
}
|
|
15776
15778
|
return selectedGroup;
|
|
15777
15779
|
}
|
|
15780
|
+
function hasImages(node) {
|
|
15781
|
+
if (node.getAttrs().nodeType === "image") return true;
|
|
15782
|
+
if (node.getAttrs().nodeType !== "group") return false;
|
|
15783
|
+
const nodes = node.find((node$1) => {
|
|
15784
|
+
return node$1.getAttrs().nodeType === "image";
|
|
15785
|
+
});
|
|
15786
|
+
if (nodes.length === 0) return false;
|
|
15787
|
+
else return true;
|
|
15788
|
+
}
|
|
15789
|
+
function hasFrames(node) {
|
|
15790
|
+
if (node.getAttrs().nodeType === "frame") return true;
|
|
15791
|
+
if (node.getAttrs().nodeType !== "group") return false;
|
|
15792
|
+
const nodes = node.find((node$1) => {
|
|
15793
|
+
return node$1.getAttrs().nodeType === "frame";
|
|
15794
|
+
});
|
|
15795
|
+
if (nodes.length === 0) return false;
|
|
15796
|
+
else return true;
|
|
15797
|
+
}
|
|
15798
|
+
function intersectArrays(arrays) {
|
|
15799
|
+
return arrays.reduce((acc, arr) => acc.filter((val) => arr.includes(val)), arrays[0]);
|
|
15800
|
+
}
|
|
15778
15801
|
|
|
15779
15802
|
//#endregion
|
|
15780
15803
|
//#region src/plugins/context-menu/context-menu.ts
|
|
@@ -15973,9 +15996,19 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
15973
15996
|
rotationSnapTolerance: 3,
|
|
15974
15997
|
ignoreStroke: true,
|
|
15975
15998
|
flipEnabled: false,
|
|
15976
|
-
keepRatio:
|
|
15999
|
+
keepRatio: true,
|
|
15977
16000
|
useSingleNodeRotation: true,
|
|
15978
16001
|
shouldOverdrawWholeArea: true,
|
|
16002
|
+
enabledAnchors: [
|
|
16003
|
+
"top-left",
|
|
16004
|
+
"top-center",
|
|
16005
|
+
"top-right",
|
|
16006
|
+
"middle-right",
|
|
16007
|
+
"middle-left",
|
|
16008
|
+
"bottom-left",
|
|
16009
|
+
"bottom-center",
|
|
16010
|
+
"bottom-right"
|
|
16011
|
+
],
|
|
15979
16012
|
anchorStyleFunc: (anchor) => {
|
|
15980
16013
|
anchor.stroke("#27272aff");
|
|
15981
16014
|
anchor.cornerRadius(12);
|
|
@@ -15992,17 +16025,17 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
15992
16025
|
anchor.offsetX(4);
|
|
15993
16026
|
}
|
|
15994
16027
|
},
|
|
15995
|
-
borderStroke: "#
|
|
15996
|
-
borderStrokeWidth:
|
|
16028
|
+
borderStroke: "#1a1aff",
|
|
16029
|
+
borderStrokeWidth: 2,
|
|
15997
16030
|
...config?.selection
|
|
15998
16031
|
},
|
|
15999
16032
|
hover: {
|
|
16000
|
-
borderStrokeWidth:
|
|
16033
|
+
borderStrokeWidth: 2,
|
|
16001
16034
|
...config?.hover
|
|
16002
16035
|
},
|
|
16003
16036
|
selectionArea: {
|
|
16004
|
-
fill: "#
|
|
16005
|
-
stroke: "#
|
|
16037
|
+
fill: "#1a1aff11",
|
|
16038
|
+
stroke: "#1a1aff",
|
|
16006
16039
|
strokeWidth: 1,
|
|
16007
16040
|
dash: [12, 4],
|
|
16008
16041
|
...config?.selectionArea
|
|
@@ -16037,6 +16070,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16037
16070
|
this.initialized = false;
|
|
16038
16071
|
this.enabled = false;
|
|
16039
16072
|
this.pointers = {};
|
|
16073
|
+
this.selectionOriginalConfig = { ...this.config.selection };
|
|
16040
16074
|
}
|
|
16041
16075
|
getName() {
|
|
16042
16076
|
return WEAVE_NODES_SELECTION_KEY;
|
|
@@ -16080,7 +16114,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16080
16114
|
selectionLayer?.add(selectionRectangle);
|
|
16081
16115
|
const tr = new konva.default.Transformer({
|
|
16082
16116
|
id: "selectionTransformer",
|
|
16083
|
-
...this.
|
|
16117
|
+
...this.selectionOriginalConfig
|
|
16084
16118
|
});
|
|
16085
16119
|
selectionLayer?.add(tr);
|
|
16086
16120
|
const trHover = new konva.default.Transformer({
|
|
@@ -16143,16 +16177,16 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16143
16177
|
this.didMove = true;
|
|
16144
16178
|
e.cancelBubble = true;
|
|
16145
16179
|
const selectedNodes = tr.nodes();
|
|
16146
|
-
let
|
|
16180
|
+
let selectionContainsFrames = false;
|
|
16147
16181
|
for (let i = 0; i < selectedNodes.length; i++) {
|
|
16148
16182
|
const node = selectedNodes[i];
|
|
16149
|
-
|
|
16183
|
+
selectionContainsFrames = selectionContainsFrames || hasFrames(node);
|
|
16150
16184
|
node.updatePosition(node.getAbsolutePosition());
|
|
16151
16185
|
}
|
|
16152
16186
|
if (this.isSelecting() && selectedNodes.length > 1) {
|
|
16153
16187
|
clearContainerTargets(this.instance);
|
|
16154
|
-
const layerToMove =
|
|
16155
|
-
if (layerToMove && !
|
|
16188
|
+
const layerToMove = containerOverCursor(this.instance);
|
|
16189
|
+
if (layerToMove && !selectionContainsFrames) layerToMove.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
|
|
16156
16190
|
}
|
|
16157
16191
|
tr.forceUpdate();
|
|
16158
16192
|
};
|
|
@@ -16161,10 +16195,10 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16161
16195
|
if (!this.didMove) return;
|
|
16162
16196
|
e.cancelBubble = true;
|
|
16163
16197
|
const selectedNodes = tr.nodes();
|
|
16164
|
-
let
|
|
16198
|
+
let selectionContainsFrames = false;
|
|
16165
16199
|
for (let i = 0; i < selectedNodes.length; i++) {
|
|
16166
16200
|
const node = selectedNodes[i];
|
|
16167
|
-
|
|
16201
|
+
selectionContainsFrames = selectionContainsFrames || hasFrames(node);
|
|
16168
16202
|
node.updatePosition(node.getAbsolutePosition());
|
|
16169
16203
|
}
|
|
16170
16204
|
if (this.isSelecting() && tr.nodes().length > 1) {
|
|
@@ -16173,12 +16207,19 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16173
16207
|
clearContainerTargets(this.instance);
|
|
16174
16208
|
const toSelect = [];
|
|
16175
16209
|
const toUpdate = [];
|
|
16210
|
+
const layerToMove = containerOverCursor(this.instance);
|
|
16176
16211
|
const nodeUpdatePromise = (node) => {
|
|
16177
16212
|
return new Promise((resolve) => {
|
|
16178
16213
|
setTimeout(() => {
|
|
16179
16214
|
clearContainerTargets(this.instance);
|
|
16180
|
-
if (!hasFrames) moveNodeToContainer(this.instance, node);
|
|
16181
16215
|
const nodeHandler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
16216
|
+
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node));
|
|
16217
|
+
let containerToMove = this.instance.getMainLayer();
|
|
16218
|
+
if (layerToMove) {
|
|
16219
|
+
containerToMove = layerToMove;
|
|
16220
|
+
containerToMove.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, { bubbles: true });
|
|
16221
|
+
}
|
|
16222
|
+
if (containerToMove && !selectionContainsFrames) moveNodeToContainer(this.instance, node, containerToMove);
|
|
16182
16223
|
if (!nodeHandler) return resolve();
|
|
16183
16224
|
toSelect.push(node.getAttrs().id ?? "");
|
|
16184
16225
|
toUpdate.push(nodeHandler.serialize(node));
|
|
@@ -16187,7 +16228,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16187
16228
|
});
|
|
16188
16229
|
};
|
|
16189
16230
|
const promises = [];
|
|
16190
|
-
for (let i = 0; i < selectedNodes.length; i++)
|
|
16231
|
+
for (let i = 0; i < selectedNodes.length; i++) {
|
|
16232
|
+
const nodeHandler = this.instance.getNodeHandler(selectedNodes[i].getAttrs().nodeType);
|
|
16233
|
+
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(selectedNodes[i]));
|
|
16234
|
+
promises.push(nodeUpdatePromise(selectedNodes[i]));
|
|
16235
|
+
}
|
|
16191
16236
|
Promise.allSettled(promises).then((results) => {
|
|
16192
16237
|
if (results.length > 0) this.instance.updateNodes(toUpdate);
|
|
16193
16238
|
stage.container().style.cursor = actualCursor;
|
|
@@ -16476,25 +16521,30 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16476
16521
|
const frameNode = node;
|
|
16477
16522
|
if (!frameNode.getAttrs().locked) selectedNodes.add(node);
|
|
16478
16523
|
});
|
|
16479
|
-
const nodesArray = [...selectedNodes];
|
|
16480
|
-
if (nodesArray.length > 1 && !this.config.behaviors.multipleSelection.enabled || nodesArray.length === 1 && !this.config.behaviors.singleSelection.enabled) this.tr.enabledAnchors([]);
|
|
16481
|
-
if (nodesArray.length > 1 && this.config.behaviors.multipleSelection.enabled || nodesArray.length === 1 && this.config.behaviors.singleSelection.enabled) this.tr.enabledAnchors(this.defaultEnabledAnchors);
|
|
16482
|
-
if (nodesArray.length === 1) {
|
|
16483
|
-
this.tr.setAttrs({
|
|
16484
|
-
...this.config.selection,
|
|
16485
|
-
...nodesArray[0].getTransformerProperties()
|
|
16486
|
-
});
|
|
16487
|
-
this.tr.forceUpdate();
|
|
16488
|
-
} else {
|
|
16489
|
-
this.tr.setAttrs({ ...this.config.selection });
|
|
16490
|
-
this.tr.forceUpdate();
|
|
16491
|
-
}
|
|
16492
16524
|
this.selecting = false;
|
|
16493
|
-
this.tr.nodes(
|
|
16525
|
+
this.tr.nodes([...selectedNodes]);
|
|
16526
|
+
this.handleBehaviors();
|
|
16494
16527
|
this.triggerSelectedNodesEvent();
|
|
16495
16528
|
stage.container().tabIndex = 1;
|
|
16496
16529
|
stage.container().focus();
|
|
16497
16530
|
});
|
|
16531
|
+
this.instance.addEventListener("onStateChange", () => {
|
|
16532
|
+
this.syncSelection();
|
|
16533
|
+
});
|
|
16534
|
+
this.instance.addEventListener("onUndoManagerStatusChange", () => {
|
|
16535
|
+
this.syncSelection();
|
|
16536
|
+
});
|
|
16537
|
+
}
|
|
16538
|
+
syncSelection() {
|
|
16539
|
+
const newSelectedNodes = [];
|
|
16540
|
+
const actualSelectedNodes = this.tr.nodes();
|
|
16541
|
+
for (const node of actualSelectedNodes) {
|
|
16542
|
+
const existNode = this.instance.getStage().findOne(`#${node.getAttrs().id}`);
|
|
16543
|
+
if (existNode) newSelectedNodes.push(existNode);
|
|
16544
|
+
}
|
|
16545
|
+
this.tr.nodes([...newSelectedNodes]);
|
|
16546
|
+
this.tr.forceUpdate();
|
|
16547
|
+
this.triggerSelectedNodesEvent();
|
|
16498
16548
|
}
|
|
16499
16549
|
getSelectionPlugin() {
|
|
16500
16550
|
const selectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
@@ -16511,7 +16561,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16511
16561
|
if (!this.enabled) return;
|
|
16512
16562
|
if (this.instance.getActiveAction() !== "selectionTool") return;
|
|
16513
16563
|
const contextMenuPlugin = this.getContextMenuPlugin();
|
|
16514
|
-
if (contextMenuPlugin
|
|
16564
|
+
if (contextMenuPlugin?.isContextMenuVisible()) {
|
|
16515
16565
|
this.selecting = false;
|
|
16516
16566
|
return;
|
|
16517
16567
|
}
|
|
@@ -16577,17 +16627,22 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16577
16627
|
}
|
|
16578
16628
|
handleBehaviors() {
|
|
16579
16629
|
const nodes = this.getSelectedNodes();
|
|
16580
|
-
const nodesSelected =
|
|
16630
|
+
const nodesSelected = nodes.length;
|
|
16581
16631
|
if (nodesSelected > 1 && !this.config.behaviors.multipleSelection.enabled || nodesSelected === 1 && !this.config.behaviors.singleSelection.enabled) this.tr.enabledAnchors([]);
|
|
16582
16632
|
if (nodesSelected > 1 && this.config.behaviors.multipleSelection.enabled || nodesSelected === 1 && this.config.behaviors.singleSelection.enabled) this.tr.enabledAnchors(this.defaultEnabledAnchors);
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
}
|
|
16590
|
-
|
|
16633
|
+
const anchorsArrays = [];
|
|
16634
|
+
for (const node of nodes) anchorsArrays.push(node.allowedAnchors());
|
|
16635
|
+
let transformerAttrs = {};
|
|
16636
|
+
if (nodesSelected === 1) transformerAttrs = {
|
|
16637
|
+
...this.selectionOriginalConfig,
|
|
16638
|
+
enabledAnchors: nodes[0].allowedAnchors()
|
|
16639
|
+
};
|
|
16640
|
+
else if (nodesSelected > 1) transformerAttrs = {
|
|
16641
|
+
...this.selectionOriginalConfig,
|
|
16642
|
+
enabledAnchors: intersectArrays(anchorsArrays)
|
|
16643
|
+
};
|
|
16644
|
+
if (this.tr) {
|
|
16645
|
+
this.tr.setAttrs(transformerAttrs);
|
|
16591
16646
|
this.tr.forceUpdate();
|
|
16592
16647
|
}
|
|
16593
16648
|
}
|
|
@@ -16636,11 +16691,21 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16636
16691
|
const snappingPlugin = this.instance.getPlugin("nodesSnapping");
|
|
16637
16692
|
return snappingPlugin;
|
|
16638
16693
|
}
|
|
16694
|
+
getSelectorConfig() {
|
|
16695
|
+
return this.selectionOriginalConfig;
|
|
16696
|
+
}
|
|
16639
16697
|
};
|
|
16640
16698
|
|
|
16641
16699
|
//#endregion
|
|
16642
16700
|
//#region src/plugins/copy-paste-nodes/constants.ts
|
|
16643
16701
|
const WEAVE_COPY_PASTE_NODES_KEY = "copyPasteNodes";
|
|
16702
|
+
const WEAVE_COPY_PASTE_PASTE_MODES = {
|
|
16703
|
+
["INTERNAL"]: "internal",
|
|
16704
|
+
["EXTERNAL"]: "external",
|
|
16705
|
+
["NOT_ALLOWED"]: "not-allowed",
|
|
16706
|
+
["CLIPBOARD_API_ERROR"]: "clipboard-api-error",
|
|
16707
|
+
["CLIPBOARD_API_NOT_SUPPORTED"]: "clipboard-api-not-supported"
|
|
16708
|
+
};
|
|
16644
16709
|
const COPY_PASTE_NODES_PLUGIN_STATE = {
|
|
16645
16710
|
["IDLE"]: "idle",
|
|
16646
16711
|
["PASTING"]: "pasting"
|
|
@@ -16841,6 +16906,22 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
16841
16906
|
if (!nodesSelectionPlugin) throw new Error("WeaveNodesSelectionPlugin plugin not found");
|
|
16842
16907
|
return nodesSelectionPlugin;
|
|
16843
16908
|
}
|
|
16909
|
+
isClipboardApiEnabled() {
|
|
16910
|
+
return typeof navigator !== "undefined" && !!navigator.clipboard && typeof navigator.clipboard.readText === "function" && window.isSecureContext;
|
|
16911
|
+
}
|
|
16912
|
+
async getAvailablePasteMode(canHandleExternal) {
|
|
16913
|
+
if (!this.isClipboardApiEnabled()) return WEAVE_COPY_PASTE_PASTE_MODES.CLIPBOARD_API_NOT_SUPPORTED;
|
|
16914
|
+
try {
|
|
16915
|
+
const allowPaste = await this.readClipboardData();
|
|
16916
|
+
if (allowPaste) return WEAVE_COPY_PASTE_PASTE_MODES.INTERNAL;
|
|
16917
|
+
const items = await navigator.clipboard.read();
|
|
16918
|
+
if (await canHandleExternal(items)) return WEAVE_COPY_PASTE_PASTE_MODES.EXTERNAL;
|
|
16919
|
+
} catch (e) {
|
|
16920
|
+
this.getLogger().error("Error reading clipboard data", e);
|
|
16921
|
+
return WEAVE_COPY_PASTE_PASTE_MODES.CLIPBOARD_API_ERROR;
|
|
16922
|
+
}
|
|
16923
|
+
return WEAVE_COPY_PASTE_PASTE_MODES.NOT_ALLOWED;
|
|
16924
|
+
}
|
|
16844
16925
|
enable() {
|
|
16845
16926
|
this.enabled = true;
|
|
16846
16927
|
}
|
|
@@ -16859,10 +16940,7 @@ const augmentKonvaStageClass = () => {
|
|
|
16859
16940
|
const augmentKonvaNodeClass = (config) => {
|
|
16860
16941
|
const { transform } = config ?? {};
|
|
16861
16942
|
konva.default.Node.prototype.getTransformerProperties = function() {
|
|
16862
|
-
return {
|
|
16863
|
-
WEAVE_DEFAULT_TRANSFORM_PROPERTIES: __inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
16864
|
-
...transform
|
|
16865
|
-
};
|
|
16943
|
+
return { ...transform };
|
|
16866
16944
|
};
|
|
16867
16945
|
konva.default.Node.prototype.getRealClientRect = function(config$1) {
|
|
16868
16946
|
return this.getClientRect(config$1);
|
|
@@ -16901,7 +16979,19 @@ var WeaveNode = class {
|
|
|
16901
16979
|
}
|
|
16902
16980
|
setupDefaultNodeAugmentation(node) {
|
|
16903
16981
|
node.getTransformerProperties = () => {
|
|
16904
|
-
return
|
|
16982
|
+
return this.defaultGetTransformerProperties({});
|
|
16983
|
+
};
|
|
16984
|
+
node.allowedAnchors = () => {
|
|
16985
|
+
return [
|
|
16986
|
+
"top-left",
|
|
16987
|
+
"top-center",
|
|
16988
|
+
"top-right",
|
|
16989
|
+
"middle-right",
|
|
16990
|
+
"middle-left",
|
|
16991
|
+
"bottom-left",
|
|
16992
|
+
"bottom-center",
|
|
16993
|
+
"bottom-right"
|
|
16994
|
+
];
|
|
16905
16995
|
};
|
|
16906
16996
|
node.movedToContainer = () => {};
|
|
16907
16997
|
node.updatePosition = () => {};
|
|
@@ -16913,10 +17003,13 @@ var WeaveNode = class {
|
|
|
16913
17003
|
return false;
|
|
16914
17004
|
}
|
|
16915
17005
|
scaleReset(node) {
|
|
16916
|
-
|
|
16917
|
-
node.
|
|
16918
|
-
node.
|
|
16919
|
-
node.
|
|
17006
|
+
const scale = node.scale();
|
|
17007
|
+
node.width(Math.max(5, node.width() * scale.x));
|
|
17008
|
+
node.height(Math.max(5, node.height() * scale.y));
|
|
17009
|
+
node.scale({
|
|
17010
|
+
x: 1,
|
|
17011
|
+
y: 1
|
|
17012
|
+
});
|
|
16920
17013
|
}
|
|
16921
17014
|
setHoverState(node) {
|
|
16922
17015
|
const selectionPlugin = this.getSelectionPlugin();
|
|
@@ -16962,7 +17055,6 @@ var WeaveNode = class {
|
|
|
16962
17055
|
const nodesSnappingPlugin = this.instance.getPlugin("nodesSnapping");
|
|
16963
17056
|
if (nodesSelectionPlugin && this.isSelecting() && this.isNodeSelected(node$1)) nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
16964
17057
|
if (nodesSnappingPlugin && transforming && this.isSelecting() && this.isNodeSelected(node$1)) nodesSnappingPlugin.evaluateGuidelines(e);
|
|
16965
|
-
if (this.isSelecting() && this.isNodeSelected(node$1)) this.scaleReset(node$1);
|
|
16966
17058
|
};
|
|
16967
17059
|
node.on("transform", (0, import_lodash.throttle)(handleTransform, 100));
|
|
16968
17060
|
node.on("transformend", (e) => {
|
|
@@ -16973,6 +17065,7 @@ var WeaveNode = class {
|
|
|
16973
17065
|
const nodesSnappingPlugin = this.instance.getPlugin("nodesSnapping");
|
|
16974
17066
|
if (nodesSnappingPlugin) nodesSnappingPlugin.cleanupEvaluateGuidelines();
|
|
16975
17067
|
if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
17068
|
+
this.scaleReset(node$1);
|
|
16976
17069
|
const nodeHandler = this.instance.getNodeHandler(node$1.getAttrs().nodeType);
|
|
16977
17070
|
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node$1));
|
|
16978
17071
|
});
|
|
@@ -17013,8 +17106,8 @@ var WeaveNode = class {
|
|
|
17013
17106
|
}
|
|
17014
17107
|
if (this.isSelecting() && this.isNodeSelected(node) && this.getSelectionPlugin()?.getSelectedNodes().length === 1) {
|
|
17015
17108
|
clearContainerTargets(this.instance);
|
|
17016
|
-
const layerToMove =
|
|
17017
|
-
if (layerToMove) layerToMove.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
|
|
17109
|
+
const layerToMove = containerOverCursor(this.instance);
|
|
17110
|
+
if (layerToMove && !hasFrames(node)) layerToMove.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
|
|
17018
17111
|
}
|
|
17019
17112
|
};
|
|
17020
17113
|
node.on("dragmove", (0, import_lodash.throttle)(handleDragMove, 100));
|
|
@@ -17030,8 +17123,13 @@ var WeaveNode = class {
|
|
|
17030
17123
|
clearContainerTargets(this.instance);
|
|
17031
17124
|
const nodesSnappingPlugin = this.instance.getPlugin("nodesSnapping");
|
|
17032
17125
|
if (nodesSnappingPlugin) nodesSnappingPlugin.cleanupEvaluateGuidelines();
|
|
17033
|
-
const
|
|
17034
|
-
|
|
17126
|
+
const layerToMove = containerOverCursor(this.instance);
|
|
17127
|
+
let containerToMove = this.instance.getMainLayer();
|
|
17128
|
+
if (layerToMove) {
|
|
17129
|
+
containerToMove = layerToMove;
|
|
17130
|
+
containerToMove.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, { bubbles: true });
|
|
17131
|
+
}
|
|
17132
|
+
if (containerToMove) moveNodeToContainer(this.instance, e.target, containerToMove);
|
|
17035
17133
|
this.instance.updateNode(this.serialize(node));
|
|
17036
17134
|
}
|
|
17037
17135
|
});
|
|
@@ -17149,6 +17247,18 @@ var WeaveNode = class {
|
|
|
17149
17247
|
if (instance.getAttrs().nodeId === false) realInstance = this.instance.getInstanceRecursive(instance);
|
|
17150
17248
|
return realInstance.getAttrs().locked ?? false;
|
|
17151
17249
|
}
|
|
17250
|
+
defaultGetTransformerProperties(nodeTransformConfig) {
|
|
17251
|
+
const selectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
17252
|
+
let transformProperties = {};
|
|
17253
|
+
if (selectionPlugin) transformProperties = {
|
|
17254
|
+
...transformProperties,
|
|
17255
|
+
...selectionPlugin.getSelectorConfig()
|
|
17256
|
+
};
|
|
17257
|
+
return {
|
|
17258
|
+
...transformProperties,
|
|
17259
|
+
...nodeTransformConfig
|
|
17260
|
+
};
|
|
17261
|
+
}
|
|
17152
17262
|
};
|
|
17153
17263
|
|
|
17154
17264
|
//#endregion
|
|
@@ -17531,25 +17641,36 @@ var WeaveGroupsManager = class {
|
|
|
17531
17641
|
allNodesInSameParent(nodes) {
|
|
17532
17642
|
const stage = this.instance.getStage();
|
|
17533
17643
|
if (nodes.length === 0) return {
|
|
17534
|
-
|
|
17535
|
-
nodeId: void 0,
|
|
17644
|
+
realNodes: [],
|
|
17536
17645
|
parentId: void 0
|
|
17537
17646
|
};
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
|
|
17647
|
+
const framesIds = [];
|
|
17648
|
+
nodes.forEach((node) => {
|
|
17649
|
+
const nodeInstance$1 = stage.findOne(`#${node.key}`);
|
|
17650
|
+
if (nodeInstance$1 && nodeInstance$1.getAttrs().nodeType === "frame") framesIds.push(node.key);
|
|
17651
|
+
});
|
|
17652
|
+
let realNodes = [];
|
|
17653
|
+
if (framesIds.length > 0) for (const node of nodes) {
|
|
17654
|
+
const nodeInstance$1 = stage.findOne(`#${node.key}`);
|
|
17655
|
+
if (framesIds.includes(node.key)) realNodes.push(node);
|
|
17656
|
+
if (!framesIds.includes(node.key) && nodeInstance$1 && !framesIds.includes(nodeInstance$1.getParent()?.getAttrs().nodeId)) realNodes.push(node);
|
|
17657
|
+
}
|
|
17658
|
+
if (realNodes.length === 0) realNodes = nodes;
|
|
17659
|
+
const parentIds = [];
|
|
17660
|
+
for (const node of realNodes) {
|
|
17661
|
+
const nodeInstance$1 = stage.findOne(`#${node.key}`);
|
|
17662
|
+
if (nodeInstance$1) {
|
|
17663
|
+
const parentId$1 = nodeInstance$1.getParent()?.getAttrs().id;
|
|
17664
|
+
if (parentId$1 && !parentIds.includes(parentId$1)) parentIds.push(parentId$1);
|
|
17665
|
+
}
|
|
17666
|
+
}
|
|
17667
|
+
const nodeInstance = stage.findOne(`#${realNodes[0].props.id}`);
|
|
17541
17668
|
const nodeId = nodeInstance?.getParent()?.getAttrs().nodeId;
|
|
17542
|
-
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
if (nodeParentId !== parentId) {
|
|
17546
|
-
allInSame = false;
|
|
17547
|
-
break;
|
|
17548
|
-
}
|
|
17549
|
-
}
|
|
17669
|
+
let parentId = nodeInstance?.getParent()?.getAttrs().id;
|
|
17670
|
+
if (parentIds.length === 1 && nodeId) parentId = nodeId;
|
|
17671
|
+
if (parentIds.length > 1) parentId = void 0;
|
|
17550
17672
|
return {
|
|
17551
|
-
|
|
17552
|
-
nodeId,
|
|
17673
|
+
realNodes,
|
|
17553
17674
|
parentId
|
|
17554
17675
|
};
|
|
17555
17676
|
}
|
|
@@ -17562,11 +17683,7 @@ var WeaveGroupsManager = class {
|
|
|
17562
17683
|
this.logger.warn({ nodes }, "State is empty, cannot group nodes");
|
|
17563
17684
|
return;
|
|
17564
17685
|
}
|
|
17565
|
-
const {
|
|
17566
|
-
if (!allInSame) {
|
|
17567
|
-
this.logger.warn({ nodes }, "Not all nodes are in the same container, cannot group them");
|
|
17568
|
-
return;
|
|
17569
|
-
}
|
|
17686
|
+
const { realNodes, parentId } = this.allNodesInSameParent(nodes);
|
|
17570
17687
|
const selectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
17571
17688
|
if (selectionPlugin) {
|
|
17572
17689
|
const tr = selectionPlugin.getTransformer();
|
|
@@ -17585,10 +17702,10 @@ var WeaveGroupsManager = class {
|
|
|
17585
17702
|
parentLayer?.add(groupInstance);
|
|
17586
17703
|
const groupHandler = this.instance.getNodeHandler("group");
|
|
17587
17704
|
if (groupHandler) {
|
|
17588
|
-
const groupNode = groupHandler.create(groupId, { draggable: true });
|
|
17589
|
-
this.instance.addNode(groupNode,
|
|
17705
|
+
const groupNode$1 = groupHandler.create(groupId, { draggable: true });
|
|
17706
|
+
this.instance.addNode(groupNode$1, parentNodeId);
|
|
17590
17707
|
}
|
|
17591
|
-
const nodesWithZIndex =
|
|
17708
|
+
const nodesWithZIndex = realNodes.map((node) => {
|
|
17592
17709
|
const instance = mainLayer?.findOne(`#${node.key}`);
|
|
17593
17710
|
return {
|
|
17594
17711
|
node,
|
|
@@ -17636,12 +17753,14 @@ var WeaveGroupsManager = class {
|
|
|
17636
17753
|
}
|
|
17637
17754
|
this.instance.removeNodes(sortedNodesByZIndex);
|
|
17638
17755
|
groupInstance.destroy();
|
|
17756
|
+
const groupNode = stage.findOne(`#${groupId}`);
|
|
17757
|
+
if (groupHandler && groupNode) this.instance.updateNode(groupHandler.serialize(groupNode));
|
|
17639
17758
|
setTimeout(() => {
|
|
17640
|
-
const groupNode = stage.findOne(`#${groupId}`);
|
|
17759
|
+
const groupNode$1 = stage.findOne(`#${groupId}`);
|
|
17641
17760
|
const selectionPlugin$1 = this.instance.getPlugin("nodesSelection");
|
|
17642
|
-
if (groupNode && selectionPlugin$1) {
|
|
17761
|
+
if (groupNode$1 && selectionPlugin$1) {
|
|
17643
17762
|
const tr = selectionPlugin$1.getTransformer();
|
|
17644
|
-
selectionPlugin$1.setSelectedNodes([groupNode]);
|
|
17763
|
+
selectionPlugin$1.setSelectedNodes([groupNode$1]);
|
|
17645
17764
|
tr.show();
|
|
17646
17765
|
tr.forceUpdate();
|
|
17647
17766
|
}
|
|
@@ -17671,18 +17790,40 @@ var WeaveGroupsManager = class {
|
|
|
17671
17790
|
let newChildId = void 0;
|
|
17672
17791
|
const children = [...konvaGroup.getChildren()];
|
|
17673
17792
|
for (const child of children) {
|
|
17674
|
-
const
|
|
17675
|
-
const
|
|
17793
|
+
const absPos = child.getAbsolutePosition();
|
|
17794
|
+
const absScale = child.getAbsoluteScale();
|
|
17795
|
+
const absRotation = child.getAbsoluteRotation();
|
|
17676
17796
|
child.moveTo(newLayer);
|
|
17677
|
-
child.
|
|
17678
|
-
|
|
17797
|
+
child.position({
|
|
17798
|
+
x: 0,
|
|
17799
|
+
y: 0
|
|
17800
|
+
});
|
|
17801
|
+
child.scale({
|
|
17802
|
+
x: 1,
|
|
17803
|
+
y: 1
|
|
17804
|
+
});
|
|
17805
|
+
child.rotation(0);
|
|
17806
|
+
child.offset({
|
|
17807
|
+
x: 0,
|
|
17808
|
+
y: 0
|
|
17809
|
+
});
|
|
17810
|
+
child.setAbsolutePosition(absPos);
|
|
17811
|
+
child.scale({
|
|
17812
|
+
x: absScale.x / stage.scaleX(),
|
|
17813
|
+
y: absScale.y / stage.scaleY()
|
|
17814
|
+
});
|
|
17815
|
+
child.rotation(absRotation);
|
|
17679
17816
|
child.zIndex(newLayerChildrenAmount - 1 + child.zIndex());
|
|
17680
|
-
child.setAttr("id", v4_default());
|
|
17681
17817
|
child.setAttr("draggable", true);
|
|
17682
17818
|
newChildId = child.getAttrs().id;
|
|
17683
17819
|
const handler = this.instance.getNodeHandler(child.getAttrs().nodeType);
|
|
17684
17820
|
if (handler) {
|
|
17685
17821
|
const node = handler.serialize(child);
|
|
17822
|
+
const newNodeId = v4_default();
|
|
17823
|
+
const oldId = node.key;
|
|
17824
|
+
node.key = newNodeId;
|
|
17825
|
+
node.props.id = newNodeId;
|
|
17826
|
+
for (const prop of Object.keys(node.props)) if (typeof node.props[prop] === "string") node.props[prop] = node.props[prop].replace(oldId, newNodeId);
|
|
17686
17827
|
this.instance.addNode(node, nodeId ?? newLayer.getAttrs().id);
|
|
17687
17828
|
}
|
|
17688
17829
|
child.destroy();
|
|
@@ -17698,6 +17839,19 @@ var WeaveGroupsManager = class {
|
|
|
17698
17839
|
if (firstElement && selectionPlugin) selectionPlugin.setSelectedNodes([firstElement]);
|
|
17699
17840
|
}, 0);
|
|
17700
17841
|
}
|
|
17842
|
+
extractTransformFromMatrix(m) {
|
|
17843
|
+
const a = m[0], b = m[1], c = m[2], d = m[3], e = m[4], f = m[5];
|
|
17844
|
+
const scaleX = Math.sqrt(a * a + b * b);
|
|
17845
|
+
const scaleY = Math.sqrt(c * c + d * d);
|
|
17846
|
+
const rotation = Math.atan2(b, a) * (180 / Math.PI);
|
|
17847
|
+
return {
|
|
17848
|
+
x: e,
|
|
17849
|
+
y: f,
|
|
17850
|
+
scaleX,
|
|
17851
|
+
scaleY,
|
|
17852
|
+
rotation
|
|
17853
|
+
};
|
|
17854
|
+
}
|
|
17701
17855
|
};
|
|
17702
17856
|
|
|
17703
17857
|
//#endregion
|
|
@@ -18489,13 +18643,7 @@ var WeaveStateManager = class {
|
|
|
18489
18643
|
target[key] = [...sourceArr];
|
|
18490
18644
|
return;
|
|
18491
18645
|
}
|
|
18492
|
-
|
|
18493
|
-
for (let i = 0; i < sourceArr.length; i++) {
|
|
18494
|
-
const srcItem = sourceArr[i];
|
|
18495
|
-
const tgtItem = tgtArr[i];
|
|
18496
|
-
if (this.isObject(srcItem) && this.isObject(tgtItem)) this.deepSyncSyncedStore(tgtItem, srcItem);
|
|
18497
|
-
else if (tgtItem !== srcItem) tgtArr[i] = srcItem;
|
|
18498
|
-
}
|
|
18646
|
+
target[key] = [...sourceArr];
|
|
18499
18647
|
}
|
|
18500
18648
|
isObject(val) {
|
|
18501
18649
|
return typeof val === "object" && val !== null;
|
|
@@ -18678,7 +18826,7 @@ var WeaveRegisterManager = class {
|
|
|
18678
18826
|
|
|
18679
18827
|
//#endregion
|
|
18680
18828
|
//#region package.json
|
|
18681
|
-
var version = "0.
|
|
18829
|
+
var version = "0.46.0";
|
|
18682
18830
|
|
|
18683
18831
|
//#endregion
|
|
18684
18832
|
//#region src/managers/setup.ts
|
|
@@ -19517,10 +19665,21 @@ var WeaveGroupNode = class extends WeaveNode {
|
|
|
19517
19665
|
constructor(params) {
|
|
19518
19666
|
super();
|
|
19519
19667
|
const { config } = params ?? {};
|
|
19520
|
-
this.config = { transform: {
|
|
19521
|
-
|
|
19522
|
-
|
|
19523
|
-
|
|
19668
|
+
this.config = { transform: { ...config?.transform } };
|
|
19669
|
+
}
|
|
19670
|
+
groupHasFrames(group) {
|
|
19671
|
+
const frameNodes = group.find((node) => {
|
|
19672
|
+
return node.getAttrs().nodeType === "frame";
|
|
19673
|
+
});
|
|
19674
|
+
if (frameNodes.length === 0) return false;
|
|
19675
|
+
else return true;
|
|
19676
|
+
}
|
|
19677
|
+
groupHasImages(group) {
|
|
19678
|
+
const imageNodes = group.find((node) => {
|
|
19679
|
+
return node.getAttrs().nodeType === "image";
|
|
19680
|
+
});
|
|
19681
|
+
if (imageNodes.length === 0) return false;
|
|
19682
|
+
else return true;
|
|
19524
19683
|
}
|
|
19525
19684
|
onRender(props) {
|
|
19526
19685
|
const group = new konva.default.Group({
|
|
@@ -19530,7 +19689,19 @@ var WeaveGroupNode = class extends WeaveNode {
|
|
|
19530
19689
|
});
|
|
19531
19690
|
this.setupDefaultNodeAugmentation(group);
|
|
19532
19691
|
group.getTransformerProperties = () => {
|
|
19533
|
-
|
|
19692
|
+
const baseConfig = this.defaultGetTransformerProperties(this.config.transform);
|
|
19693
|
+
return {
|
|
19694
|
+
...baseConfig,
|
|
19695
|
+
enabledAnchors: group.allowedAnchors()
|
|
19696
|
+
};
|
|
19697
|
+
};
|
|
19698
|
+
group.allowedAnchors = () => {
|
|
19699
|
+
const stage = this.instance.getStage();
|
|
19700
|
+
const actualGroup = stage.findOne(`#${group.id()}`);
|
|
19701
|
+
const children = actualGroup.getChildren();
|
|
19702
|
+
const anchorsArrays = [];
|
|
19703
|
+
for (const child of children) anchorsArrays.push(child.allowedAnchors());
|
|
19704
|
+
return intersectArrays(anchorsArrays);
|
|
19534
19705
|
};
|
|
19535
19706
|
this.setupDefaultNodeEvents(group);
|
|
19536
19707
|
return group;
|
|
@@ -19556,10 +19727,15 @@ var WeaveGroupNode = class extends WeaveNode {
|
|
|
19556
19727
|
...attrs,
|
|
19557
19728
|
id: attrs.id ?? "",
|
|
19558
19729
|
nodeType: attrs.nodeType,
|
|
19559
|
-
children: childrenMapped
|
|
19730
|
+
children: childrenMapped,
|
|
19731
|
+
x: instance.x() ?? 0,
|
|
19732
|
+
y: instance.y() ?? 0,
|
|
19733
|
+
scaleX: instance.scaleX() ?? 1,
|
|
19734
|
+
scaleY: instance.scaleY() ?? 1
|
|
19560
19735
|
}
|
|
19561
19736
|
};
|
|
19562
19737
|
}
|
|
19738
|
+
scaleReset() {}
|
|
19563
19739
|
};
|
|
19564
19740
|
|
|
19565
19741
|
//#endregion
|
|
@@ -19573,19 +19749,17 @@ var WeaveRectangleNode = class extends WeaveNode {
|
|
|
19573
19749
|
constructor(params) {
|
|
19574
19750
|
super();
|
|
19575
19751
|
const { config } = params ?? {};
|
|
19576
|
-
this.config = { transform: {
|
|
19577
|
-
...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
19578
|
-
...config?.transform
|
|
19579
|
-
} };
|
|
19752
|
+
this.config = { transform: { ...config?.transform } };
|
|
19580
19753
|
}
|
|
19581
19754
|
onRender(props) {
|
|
19582
19755
|
const rectangle = new konva.default.Rect({
|
|
19583
19756
|
...props,
|
|
19584
|
-
name: "node"
|
|
19757
|
+
name: "node",
|
|
19758
|
+
strokeScaleEnabled: false
|
|
19585
19759
|
});
|
|
19586
19760
|
this.setupDefaultNodeAugmentation(rectangle);
|
|
19587
19761
|
rectangle.getTransformerProperties = () => {
|
|
19588
|
-
return this.config.transform;
|
|
19762
|
+
return this.defaultGetTransformerProperties(this.config.transform);
|
|
19589
19763
|
};
|
|
19590
19764
|
this.setupDefaultNodeEvents(rectangle);
|
|
19591
19765
|
return rectangle;
|
|
@@ -19595,6 +19769,15 @@ var WeaveRectangleNode = class extends WeaveNode {
|
|
|
19595
19769
|
const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
19596
19770
|
if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
19597
19771
|
}
|
|
19772
|
+
scaleReset(node) {
|
|
19773
|
+
const scale = node.scale();
|
|
19774
|
+
node.width(Math.max(5, node.width() * scale.x));
|
|
19775
|
+
node.height(Math.max(5, node.height() * scale.y));
|
|
19776
|
+
node.scale({
|
|
19777
|
+
x: 1,
|
|
19778
|
+
y: 1
|
|
19779
|
+
});
|
|
19780
|
+
}
|
|
19598
19781
|
};
|
|
19599
19782
|
|
|
19600
19783
|
//#endregion
|
|
@@ -19608,10 +19791,7 @@ var WeaveEllipseNode = class extends WeaveNode {
|
|
|
19608
19791
|
constructor(params) {
|
|
19609
19792
|
super();
|
|
19610
19793
|
const { config } = params ?? {};
|
|
19611
|
-
this.config = { transform: {
|
|
19612
|
-
...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
19613
|
-
...config?.transform
|
|
19614
|
-
} };
|
|
19794
|
+
this.config = { transform: { ...config?.transform } };
|
|
19615
19795
|
}
|
|
19616
19796
|
onRender(props) {
|
|
19617
19797
|
const ellipse = new konva.default.Ellipse({
|
|
@@ -19624,8 +19804,9 @@ var WeaveEllipseNode = class extends WeaveNode {
|
|
|
19624
19804
|
ellipse.getTransformerProperties = () => {
|
|
19625
19805
|
const stage = this.instance.getStage();
|
|
19626
19806
|
const node = stage.findOne(`#${props.id}`);
|
|
19807
|
+
const baseConfig = this.defaultGetTransformerProperties(this.config.transform);
|
|
19627
19808
|
if (node && node.getAttrs().keepAspectRatio) return {
|
|
19628
|
-
...
|
|
19809
|
+
...baseConfig,
|
|
19629
19810
|
enabledAnchors: [
|
|
19630
19811
|
"top-left",
|
|
19631
19812
|
"top-right",
|
|
@@ -19634,7 +19815,27 @@ var WeaveEllipseNode = class extends WeaveNode {
|
|
|
19634
19815
|
],
|
|
19635
19816
|
keepRatio: true
|
|
19636
19817
|
};
|
|
19637
|
-
return
|
|
19818
|
+
return baseConfig;
|
|
19819
|
+
};
|
|
19820
|
+
ellipse.allowedAnchors = () => {
|
|
19821
|
+
const stage = this.instance.getStage();
|
|
19822
|
+
const actualEllipse = stage.findOne(`#${ellipse.id()}`);
|
|
19823
|
+
if (actualEllipse.getAttrs().keepAspectRatio) return [
|
|
19824
|
+
"top-left",
|
|
19825
|
+
"top-right",
|
|
19826
|
+
"bottom-left",
|
|
19827
|
+
"bottom-right"
|
|
19828
|
+
];
|
|
19829
|
+
return [
|
|
19830
|
+
"top-left",
|
|
19831
|
+
"top-center",
|
|
19832
|
+
"top-right",
|
|
19833
|
+
"middle-right",
|
|
19834
|
+
"middle-left",
|
|
19835
|
+
"bottom-left",
|
|
19836
|
+
"bottom-center",
|
|
19837
|
+
"bottom-right"
|
|
19838
|
+
];
|
|
19638
19839
|
};
|
|
19639
19840
|
this.setupDefaultNodeEvents(ellipse);
|
|
19640
19841
|
return ellipse;
|
|
@@ -19649,11 +19850,12 @@ var WeaveEllipseNode = class extends WeaveNode {
|
|
|
19649
19850
|
}
|
|
19650
19851
|
}
|
|
19651
19852
|
scaleReset(node) {
|
|
19652
|
-
|
|
19653
|
-
|
|
19654
|
-
|
|
19655
|
-
|
|
19656
|
-
|
|
19853
|
+
node.radiusX(Math.max(5, node.radiusX() * node.scaleX()));
|
|
19854
|
+
node.radiusY(Math.max(5, node.radiusY() * node.scaleY()));
|
|
19855
|
+
node.scale({
|
|
19856
|
+
x: 1,
|
|
19857
|
+
y: 1
|
|
19858
|
+
});
|
|
19657
19859
|
}
|
|
19658
19860
|
};
|
|
19659
19861
|
|
|
@@ -19668,10 +19870,7 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
19668
19870
|
constructor(params) {
|
|
19669
19871
|
super();
|
|
19670
19872
|
const { config } = params ?? {};
|
|
19671
|
-
this.config = { transform: {
|
|
19672
|
-
...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
19673
|
-
...config?.transform
|
|
19674
|
-
} };
|
|
19873
|
+
this.config = { transform: { ...config?.transform } };
|
|
19675
19874
|
}
|
|
19676
19875
|
onRender(props) {
|
|
19677
19876
|
const line = new konva.default.Line({
|
|
@@ -19680,7 +19879,7 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
19680
19879
|
});
|
|
19681
19880
|
this.setupDefaultNodeAugmentation(line);
|
|
19682
19881
|
line.getTransformerProperties = () => {
|
|
19683
|
-
return this.config.transform;
|
|
19882
|
+
return this.defaultGetTransformerProperties(this.config.transform);
|
|
19684
19883
|
};
|
|
19685
19884
|
this.setupDefaultNodeEvents(line);
|
|
19686
19885
|
return line;
|
|
@@ -19691,23 +19890,19 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
19691
19890
|
if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
19692
19891
|
}
|
|
19693
19892
|
scaleReset(node) {
|
|
19694
|
-
|
|
19695
|
-
|
|
19696
|
-
|
|
19697
|
-
|
|
19698
|
-
|
|
19699
|
-
|
|
19700
|
-
|
|
19701
|
-
y: oldPoints[i * 2 + 1] * lineNode.scaleY()
|
|
19702
|
-
};
|
|
19703
|
-
newPoints.push(point.x, point.y);
|
|
19704
|
-
}
|
|
19705
|
-
lineNode.points(newPoints);
|
|
19893
|
+
const scale = node.scale();
|
|
19894
|
+
const oldPoints = node.points();
|
|
19895
|
+
const newPoints = [];
|
|
19896
|
+
for (let i = 0; i < oldPoints.length; i += 2) {
|
|
19897
|
+
const x = oldPoints[i] * scale.x;
|
|
19898
|
+
const y = oldPoints[i + 1] * scale.y;
|
|
19899
|
+
newPoints.push(x, y);
|
|
19706
19900
|
}
|
|
19707
|
-
node.
|
|
19708
|
-
node.
|
|
19709
|
-
|
|
19710
|
-
|
|
19901
|
+
node.points(newPoints);
|
|
19902
|
+
node.scale({
|
|
19903
|
+
x: 1,
|
|
19904
|
+
y: 1
|
|
19905
|
+
});
|
|
19711
19906
|
}
|
|
19712
19907
|
};
|
|
19713
19908
|
|
|
@@ -19748,10 +19943,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
19748
19943
|
constructor(params) {
|
|
19749
19944
|
super();
|
|
19750
19945
|
const { config } = params ?? {};
|
|
19751
|
-
this.config = { transform: {
|
|
19752
|
-
...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
19753
|
-
...config?.transform
|
|
19754
|
-
} };
|
|
19946
|
+
this.config = { transform: { ...config?.transform } };
|
|
19755
19947
|
this.editing = false;
|
|
19756
19948
|
this.textArea = null;
|
|
19757
19949
|
}
|
|
@@ -19770,18 +19962,40 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
19770
19962
|
text.getTransformerProperties = () => {
|
|
19771
19963
|
const stage = this.instance.getStage();
|
|
19772
19964
|
const actualText = stage.findOne(`#${text.id()}`);
|
|
19965
|
+
const baseConfig = this.defaultGetTransformerProperties(this.config.transform);
|
|
19773
19966
|
if (actualText) {
|
|
19774
19967
|
const attrs = actualText.getAttrs();
|
|
19775
19968
|
if (attrs.layout === TEXT_LAYOUT.AUTO_ALL) return {
|
|
19969
|
+
...baseConfig,
|
|
19776
19970
|
resizeEnabled: false,
|
|
19777
19971
|
enabledAnchors: []
|
|
19778
19972
|
};
|
|
19779
19973
|
if (attrs.layout === TEXT_LAYOUT.AUTO_HEIGHT) return {
|
|
19974
|
+
...baseConfig,
|
|
19780
19975
|
resizeEnabled: true,
|
|
19781
19976
|
enabledAnchors: ["middle-right", "middle-left"]
|
|
19782
19977
|
};
|
|
19783
19978
|
}
|
|
19784
|
-
return
|
|
19979
|
+
return baseConfig;
|
|
19980
|
+
};
|
|
19981
|
+
text.allowedAnchors = () => {
|
|
19982
|
+
const stage = this.instance.getStage();
|
|
19983
|
+
const actualText = stage.findOne(`#${text.id()}`);
|
|
19984
|
+
if (actualText) {
|
|
19985
|
+
const attrs = actualText.getAttrs();
|
|
19986
|
+
if (attrs.layout === TEXT_LAYOUT.AUTO_ALL) return [];
|
|
19987
|
+
if (attrs.layout === TEXT_LAYOUT.AUTO_HEIGHT) return ["middle-right", "middle-left"];
|
|
19988
|
+
}
|
|
19989
|
+
return [
|
|
19990
|
+
"top-left",
|
|
19991
|
+
"top-center",
|
|
19992
|
+
"top-right",
|
|
19993
|
+
"middle-right",
|
|
19994
|
+
"middle-left",
|
|
19995
|
+
"bottom-left",
|
|
19996
|
+
"bottom-center",
|
|
19997
|
+
"bottom-right"
|
|
19998
|
+
];
|
|
19785
19999
|
};
|
|
19786
20000
|
text.setAttrs({ measureMultilineText: this.measureMultilineText(text) });
|
|
19787
20001
|
this.setupDefaultNodeEvents(text);
|
|
@@ -20336,7 +20550,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
20336
20550
|
image: this.preloadImgs[this.imageId],
|
|
20337
20551
|
stroke: "#000000ff",
|
|
20338
20552
|
strokeWidth: 0,
|
|
20339
|
-
strokeScaleEnabled:
|
|
20553
|
+
strokeScaleEnabled: false,
|
|
20340
20554
|
listening: false
|
|
20341
20555
|
});
|
|
20342
20556
|
this.instance.getMainLayer()?.add(this.tempImageNode);
|
|
@@ -20366,7 +20580,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
20366
20580
|
imageURL: this.imageURL,
|
|
20367
20581
|
stroke: "#000000ff",
|
|
20368
20582
|
strokeWidth: 0,
|
|
20369
|
-
strokeScaleEnabled:
|
|
20583
|
+
strokeScaleEnabled: false,
|
|
20370
20584
|
imageWidth: this.preloadImgs[this.imageId].width,
|
|
20371
20585
|
imageHeight: this.preloadImgs[this.imageId].height,
|
|
20372
20586
|
imageInfo: {
|
|
@@ -20780,10 +20994,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
20780
20994
|
this.lastTapTime = 0;
|
|
20781
20995
|
this.config = {
|
|
20782
20996
|
crossOrigin: config?.crossOrigin ?? "anonymous",
|
|
20783
|
-
transform: {
|
|
20784
|
-
...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
20785
|
-
...config?.transform
|
|
20786
|
-
}
|
|
20997
|
+
transform: { ...config?.transform }
|
|
20787
20998
|
};
|
|
20788
20999
|
this.imageCrop = null;
|
|
20789
21000
|
this.cachedCropInfo = {};
|
|
@@ -20865,7 +21076,15 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
20865
21076
|
this.cachedCropInfo[image$1.getAttrs().id ?? ""] = void 0;
|
|
20866
21077
|
};
|
|
20867
21078
|
image.getTransformerProperties = () => {
|
|
20868
|
-
return this.config.transform;
|
|
21079
|
+
return this.defaultGetTransformerProperties(this.config.transform);
|
|
21080
|
+
};
|
|
21081
|
+
image.allowedAnchors = () => {
|
|
21082
|
+
return [
|
|
21083
|
+
"top-left",
|
|
21084
|
+
"top-right",
|
|
21085
|
+
"bottom-left",
|
|
21086
|
+
"bottom-right"
|
|
21087
|
+
];
|
|
20869
21088
|
};
|
|
20870
21089
|
const imagePlaceholder = new konva.default.Rect({
|
|
20871
21090
|
...groupImageProps,
|
|
@@ -20896,7 +21115,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
20896
21115
|
rotation: 0,
|
|
20897
21116
|
width: 0,
|
|
20898
21117
|
height: 0,
|
|
20899
|
-
strokeScaleEnabled:
|
|
21118
|
+
strokeScaleEnabled: false,
|
|
20900
21119
|
draggable: false,
|
|
20901
21120
|
visible: false,
|
|
20902
21121
|
name: void 0
|
|
@@ -21115,18 +21334,49 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
21115
21334
|
return imageToolAction;
|
|
21116
21335
|
}
|
|
21117
21336
|
scaleReset(node) {
|
|
21337
|
+
const scale = node.scale();
|
|
21118
21338
|
const widthNotNormalized = node.width();
|
|
21119
21339
|
const heightNotNormalized = node.height();
|
|
21120
|
-
node.width(Math.max(5, node.width() * node.scaleX()));
|
|
21121
|
-
node.height(Math.max(5, node.height() * node.scaleY()));
|
|
21122
21340
|
const uncroppedWidth = node.getAttrs().uncroppedImage ? node.getAttrs().uncroppedImage.width : widthNotNormalized;
|
|
21123
21341
|
const uncroppedHeight = node.getAttrs().uncroppedImage ? node.getAttrs().uncroppedImage.height : heightNotNormalized;
|
|
21124
21342
|
node.setAttrs({ uncroppedImage: {
|
|
21125
21343
|
width: uncroppedWidth * node.scaleX(),
|
|
21126
21344
|
height: uncroppedHeight * node.scaleY()
|
|
21127
21345
|
} });
|
|
21128
|
-
node.
|
|
21129
|
-
node.
|
|
21346
|
+
const placeholder = node.findOne(`#${node.getAttrs().id}-placeholder`);
|
|
21347
|
+
const internalImage = node.findOne(`#${node.getAttrs().id}-image`);
|
|
21348
|
+
const cropGroup = node.findOne(`#${node.getAttrs().id}-cropGroup`);
|
|
21349
|
+
if (placeholder) {
|
|
21350
|
+
placeholder.width(Math.max(5, placeholder.width() * placeholder.scaleX()));
|
|
21351
|
+
placeholder.height(Math.max(5, placeholder.height() * placeholder.scaleY()));
|
|
21352
|
+
placeholder.scale({
|
|
21353
|
+
x: 1,
|
|
21354
|
+
y: 1
|
|
21355
|
+
});
|
|
21356
|
+
}
|
|
21357
|
+
if (internalImage) {
|
|
21358
|
+
internalImage.width(Math.max(5, internalImage.width() * internalImage.scaleX()));
|
|
21359
|
+
internalImage.height(Math.max(5, internalImage.height() * internalImage.scaleY()));
|
|
21360
|
+
internalImage.scale({
|
|
21361
|
+
x: 1,
|
|
21362
|
+
y: 1
|
|
21363
|
+
});
|
|
21364
|
+
}
|
|
21365
|
+
if (cropGroup) {
|
|
21366
|
+
cropGroup.width(Math.max(5, cropGroup.width() * cropGroup.scaleX()));
|
|
21367
|
+
cropGroup.height(Math.max(5, cropGroup.height() * cropGroup.scaleY()));
|
|
21368
|
+
cropGroup.scale({
|
|
21369
|
+
x: 1,
|
|
21370
|
+
y: 1
|
|
21371
|
+
});
|
|
21372
|
+
}
|
|
21373
|
+
node.width(Math.max(5, node.width() * scale.x));
|
|
21374
|
+
node.height(Math.max(5, node.height() * scale.y));
|
|
21375
|
+
node.scale({
|
|
21376
|
+
x: 1,
|
|
21377
|
+
y: 1
|
|
21378
|
+
});
|
|
21379
|
+
this.instance.getMainLayer()?.batchDraw();
|
|
21130
21380
|
}
|
|
21131
21381
|
};
|
|
21132
21382
|
|
|
@@ -21141,10 +21391,7 @@ var WeaveStarNode = class extends WeaveNode {
|
|
|
21141
21391
|
constructor(params) {
|
|
21142
21392
|
super();
|
|
21143
21393
|
const { config } = params ?? {};
|
|
21144
|
-
this.config = { transform: {
|
|
21145
|
-
...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
21146
|
-
...config?.transform
|
|
21147
|
-
} };
|
|
21394
|
+
this.config = { transform: { ...config?.transform } };
|
|
21148
21395
|
}
|
|
21149
21396
|
onRender(props) {
|
|
21150
21397
|
const star = new konva.default.Star({
|
|
@@ -21157,9 +21404,10 @@ var WeaveStarNode = class extends WeaveNode {
|
|
|
21157
21404
|
this.setupDefaultNodeAugmentation(star);
|
|
21158
21405
|
star.getTransformerProperties = () => {
|
|
21159
21406
|
const stage = this.instance.getStage();
|
|
21407
|
+
const baseConfig = this.defaultGetTransformerProperties(this.config.transform);
|
|
21160
21408
|
const node = stage.findOne(`#${props.id}`);
|
|
21161
21409
|
if (node && node.getAttrs().keepAspectRatio) return {
|
|
21162
|
-
...
|
|
21410
|
+
...baseConfig,
|
|
21163
21411
|
enabledAnchors: [
|
|
21164
21412
|
"top-left",
|
|
21165
21413
|
"top-right",
|
|
@@ -21168,7 +21416,27 @@ var WeaveStarNode = class extends WeaveNode {
|
|
|
21168
21416
|
],
|
|
21169
21417
|
keepRatio: true
|
|
21170
21418
|
};
|
|
21171
|
-
return
|
|
21419
|
+
return baseConfig;
|
|
21420
|
+
};
|
|
21421
|
+
star.allowedAnchors = () => {
|
|
21422
|
+
const stage = this.instance.getStage();
|
|
21423
|
+
const actualStar = stage.findOne(`#${star.id()}`);
|
|
21424
|
+
if (actualStar.getAttrs().keepAspectRatio) return [
|
|
21425
|
+
"top-left",
|
|
21426
|
+
"top-right",
|
|
21427
|
+
"bottom-left",
|
|
21428
|
+
"bottom-right"
|
|
21429
|
+
];
|
|
21430
|
+
return [
|
|
21431
|
+
"top-left",
|
|
21432
|
+
"top-center",
|
|
21433
|
+
"top-right",
|
|
21434
|
+
"middle-right",
|
|
21435
|
+
"middle-left",
|
|
21436
|
+
"bottom-left",
|
|
21437
|
+
"bottom-center",
|
|
21438
|
+
"bottom-right"
|
|
21439
|
+
];
|
|
21172
21440
|
};
|
|
21173
21441
|
this.setupDefaultNodeEvents(star);
|
|
21174
21442
|
return star;
|
|
@@ -21183,11 +21451,12 @@ var WeaveStarNode = class extends WeaveNode {
|
|
|
21183
21451
|
}
|
|
21184
21452
|
}
|
|
21185
21453
|
scaleReset(node) {
|
|
21186
|
-
|
|
21187
|
-
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
|
|
21454
|
+
node.innerRadius(Math.max(5, node.innerRadius() * node.scaleX()));
|
|
21455
|
+
node.outerRadius(Math.max(5, node.outerRadius() * node.scaleY()));
|
|
21456
|
+
node.scale({
|
|
21457
|
+
x: 1,
|
|
21458
|
+
y: 1
|
|
21459
|
+
});
|
|
21191
21460
|
}
|
|
21192
21461
|
};
|
|
21193
21462
|
|
|
@@ -21202,10 +21471,7 @@ var WeaveArrowNode = class extends WeaveNode {
|
|
|
21202
21471
|
constructor(params) {
|
|
21203
21472
|
super();
|
|
21204
21473
|
const { config } = params ?? {};
|
|
21205
|
-
this.config = { transform: {
|
|
21206
|
-
...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
21207
|
-
...config?.transform
|
|
21208
|
-
} };
|
|
21474
|
+
this.config = { transform: { ...config?.transform } };
|
|
21209
21475
|
}
|
|
21210
21476
|
onRender(props) {
|
|
21211
21477
|
const line = new konva.default.Arrow({
|
|
@@ -21215,7 +21481,7 @@ var WeaveArrowNode = class extends WeaveNode {
|
|
|
21215
21481
|
});
|
|
21216
21482
|
this.setupDefaultNodeAugmentation(line);
|
|
21217
21483
|
line.getTransformerProperties = () => {
|
|
21218
|
-
return this.config.transform;
|
|
21484
|
+
return this.defaultGetTransformerProperties(this.config.transform);
|
|
21219
21485
|
};
|
|
21220
21486
|
this.setupDefaultNodeEvents(line);
|
|
21221
21487
|
return line;
|
|
@@ -21226,23 +21492,22 @@ var WeaveArrowNode = class extends WeaveNode {
|
|
|
21226
21492
|
if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
21227
21493
|
}
|
|
21228
21494
|
scaleReset(node) {
|
|
21229
|
-
|
|
21230
|
-
|
|
21231
|
-
|
|
21232
|
-
const
|
|
21233
|
-
|
|
21234
|
-
|
|
21235
|
-
|
|
21236
|
-
|
|
21237
|
-
};
|
|
21238
|
-
newPoints.push(point.x, point.y);
|
|
21239
|
-
}
|
|
21240
|
-
arrowNode.points(newPoints);
|
|
21495
|
+
const oldPoints = node.points();
|
|
21496
|
+
const newPoints = [];
|
|
21497
|
+
for (let i = 0; i < oldPoints.length / 2; i++) {
|
|
21498
|
+
const point = {
|
|
21499
|
+
x: oldPoints[i * 2] * node.scaleX(),
|
|
21500
|
+
y: oldPoints[i * 2 + 1] * node.scaleY()
|
|
21501
|
+
};
|
|
21502
|
+
newPoints.push(point.x, point.y);
|
|
21241
21503
|
}
|
|
21504
|
+
node.points(newPoints);
|
|
21242
21505
|
node.width(Math.max(5, node.width() * node.scaleX()));
|
|
21243
21506
|
node.height(Math.max(5, node.height() * node.scaleY()));
|
|
21244
|
-
node.
|
|
21245
|
-
|
|
21507
|
+
node.scale({
|
|
21508
|
+
x: 1,
|
|
21509
|
+
y: 1
|
|
21510
|
+
});
|
|
21246
21511
|
}
|
|
21247
21512
|
};
|
|
21248
21513
|
|
|
@@ -21257,10 +21522,7 @@ var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
|
21257
21522
|
constructor(params) {
|
|
21258
21523
|
super();
|
|
21259
21524
|
const { config } = params ?? {};
|
|
21260
|
-
this.config = { transform: {
|
|
21261
|
-
...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
21262
|
-
...config?.transform
|
|
21263
|
-
} };
|
|
21525
|
+
this.config = { transform: { ...config?.transform } };
|
|
21264
21526
|
}
|
|
21265
21527
|
onRender(props) {
|
|
21266
21528
|
const regularPolygon = new konva.default.RegularPolygon({
|
|
@@ -21271,8 +21533,9 @@ var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
|
21271
21533
|
});
|
|
21272
21534
|
this.setupDefaultNodeAugmentation(regularPolygon);
|
|
21273
21535
|
regularPolygon.getTransformerProperties = () => {
|
|
21536
|
+
const baseConfig = this.defaultGetTransformerProperties(this.config.transform);
|
|
21274
21537
|
return {
|
|
21275
|
-
...
|
|
21538
|
+
...baseConfig,
|
|
21276
21539
|
enabledAnchors: [
|
|
21277
21540
|
"top-left",
|
|
21278
21541
|
"top-right",
|
|
@@ -21282,6 +21545,14 @@ var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
|
21282
21545
|
keepRatio: true
|
|
21283
21546
|
};
|
|
21284
21547
|
};
|
|
21548
|
+
regularPolygon.allowedAnchors = () => {
|
|
21549
|
+
return [
|
|
21550
|
+
"top-left",
|
|
21551
|
+
"top-right",
|
|
21552
|
+
"bottom-left",
|
|
21553
|
+
"bottom-right"
|
|
21554
|
+
];
|
|
21555
|
+
};
|
|
21285
21556
|
this.setupDefaultNodeEvents(regularPolygon);
|
|
21286
21557
|
return regularPolygon;
|
|
21287
21558
|
}
|
|
@@ -21298,10 +21569,11 @@ var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
|
21298
21569
|
}
|
|
21299
21570
|
}
|
|
21300
21571
|
scaleReset(node) {
|
|
21301
|
-
|
|
21302
|
-
|
|
21303
|
-
|
|
21304
|
-
|
|
21572
|
+
node.radius(Math.max(5, node.radius() * node.scaleX()));
|
|
21573
|
+
node.scale({
|
|
21574
|
+
x: 1,
|
|
21575
|
+
y: 1
|
|
21576
|
+
});
|
|
21305
21577
|
}
|
|
21306
21578
|
};
|
|
21307
21579
|
|
|
@@ -21328,7 +21600,7 @@ const WEAVE_FRAME_NODE_DEFAULT_CONFIG = {
|
|
|
21328
21600
|
rotateEnabled: false,
|
|
21329
21601
|
resizeEnabled: false,
|
|
21330
21602
|
enabledAnchors: [],
|
|
21331
|
-
borderStrokeWidth:
|
|
21603
|
+
borderStrokeWidth: 2,
|
|
21332
21604
|
padding: 0
|
|
21333
21605
|
}
|
|
21334
21606
|
};
|
|
@@ -21384,6 +21656,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21384
21656
|
fill: "transparent",
|
|
21385
21657
|
draggable: true,
|
|
21386
21658
|
clip: void 0,
|
|
21659
|
+
allowScaling: false,
|
|
21387
21660
|
name: "node containerCapable"
|
|
21388
21661
|
});
|
|
21389
21662
|
this.setupDefaultNodeAugmentation(frame);
|
|
@@ -21393,7 +21666,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21393
21666
|
y: 0,
|
|
21394
21667
|
width: props.frameWidth,
|
|
21395
21668
|
height: props.frameHeight,
|
|
21396
|
-
strokeScaleEnabled:
|
|
21669
|
+
strokeScaleEnabled: false,
|
|
21397
21670
|
draggable: false
|
|
21398
21671
|
});
|
|
21399
21672
|
frame.add(frameInternalGroup);
|
|
@@ -21405,7 +21678,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21405
21678
|
width: props.frameWidth,
|
|
21406
21679
|
stroke: borderColor,
|
|
21407
21680
|
strokeWidth: borderWidth,
|
|
21408
|
-
strokeScaleEnabled:
|
|
21681
|
+
strokeScaleEnabled: false,
|
|
21409
21682
|
shadowForStrokeEnabled: false,
|
|
21410
21683
|
height: props.frameHeight,
|
|
21411
21684
|
fill: "#ffffffff",
|
|
@@ -21426,7 +21699,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21426
21699
|
text: props.title,
|
|
21427
21700
|
fill: fontColor,
|
|
21428
21701
|
strokeWidth: 0,
|
|
21429
|
-
strokeScaleEnabled:
|
|
21702
|
+
strokeScaleEnabled: false,
|
|
21430
21703
|
listening: false,
|
|
21431
21704
|
draggable: false
|
|
21432
21705
|
});
|
|
@@ -21436,7 +21709,10 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21436
21709
|
text.height(textHeight);
|
|
21437
21710
|
frameInternalGroup.add(text);
|
|
21438
21711
|
frame.getTransformerProperties = () => {
|
|
21439
|
-
return this.config.transform;
|
|
21712
|
+
return this.defaultGetTransformerProperties(this.config.transform);
|
|
21713
|
+
};
|
|
21714
|
+
frame.allowedAnchors = () => {
|
|
21715
|
+
return [];
|
|
21440
21716
|
};
|
|
21441
21717
|
const frameInternal = new konva.default.Group({
|
|
21442
21718
|
id: `${id}-group-internal`,
|
|
@@ -21445,7 +21721,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21445
21721
|
y: borderWidth,
|
|
21446
21722
|
width: props.frameWidth - borderWidth * 2,
|
|
21447
21723
|
height: props.frameHeight - borderWidth * 2,
|
|
21448
|
-
strokeScaleEnabled:
|
|
21724
|
+
strokeScaleEnabled: false,
|
|
21449
21725
|
clipFunc: (ctx) => {
|
|
21450
21726
|
const width = (frameInternal.width() + borderWidth) * frameInternal.scaleX();
|
|
21451
21727
|
const height = (frameInternal.height() + borderWidth) * frameInternal.scaleY();
|
|
@@ -21485,6 +21761,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21485
21761
|
ctx.fillStrokeShape(shape);
|
|
21486
21762
|
},
|
|
21487
21763
|
fill: "transparent",
|
|
21764
|
+
nodeId: id,
|
|
21488
21765
|
id: `${id}-container-area`,
|
|
21489
21766
|
listening: false,
|
|
21490
21767
|
draggable: false
|
|
@@ -21591,6 +21868,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21591
21868
|
}
|
|
21592
21869
|
};
|
|
21593
21870
|
}
|
|
21871
|
+
scaleReset() {}
|
|
21594
21872
|
};
|
|
21595
21873
|
|
|
21596
21874
|
//#endregion
|
|
@@ -21604,10 +21882,7 @@ var WeaveStrokeNode = class extends WeaveNode {
|
|
|
21604
21882
|
constructor(params) {
|
|
21605
21883
|
super();
|
|
21606
21884
|
const { config } = params ?? {};
|
|
21607
|
-
this.config = { transform: {
|
|
21608
|
-
...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
21609
|
-
...config?.transform
|
|
21610
|
-
} };
|
|
21885
|
+
this.config = { transform: { ...config?.transform } };
|
|
21611
21886
|
}
|
|
21612
21887
|
drawStroke(strokeElements, context, shape) {
|
|
21613
21888
|
context.strokeStyle = shape.getAttrs().stroke ?? "black";
|
|
@@ -21652,7 +21927,7 @@ var WeaveStrokeNode = class extends WeaveNode {
|
|
|
21652
21927
|
});
|
|
21653
21928
|
this.setupDefaultNodeAugmentation(stroke);
|
|
21654
21929
|
stroke.getTransformerProperties = () => {
|
|
21655
|
-
return this.config.transform;
|
|
21930
|
+
return this.defaultGetTransformerProperties(this.config.transform);
|
|
21656
21931
|
};
|
|
21657
21932
|
this.setupDefaultNodeEvents(stroke);
|
|
21658
21933
|
return stroke;
|
|
@@ -21677,8 +21952,10 @@ var WeaveStrokeNode = class extends WeaveNode {
|
|
|
21677
21952
|
strokeNode.setAttrs({ strokeElements: newPoints });
|
|
21678
21953
|
node.width(Math.max(5, node.width() * node.scaleX()));
|
|
21679
21954
|
node.height(Math.max(5, node.height() * node.scaleY()));
|
|
21680
|
-
node.
|
|
21681
|
-
|
|
21955
|
+
node.scale({
|
|
21956
|
+
x: 1,
|
|
21957
|
+
y: 1
|
|
21958
|
+
});
|
|
21682
21959
|
}
|
|
21683
21960
|
serialize(instance) {
|
|
21684
21961
|
const attrs = instance.getAttrs();
|
|
@@ -24236,7 +24513,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
24236
24513
|
this.tempRectNode = new konva.default.Rect({
|
|
24237
24514
|
...this.props,
|
|
24238
24515
|
id: this.rectId,
|
|
24239
|
-
strokeScaleEnabled:
|
|
24516
|
+
strokeScaleEnabled: false,
|
|
24240
24517
|
x: this.clickPoint?.x ?? 0,
|
|
24241
24518
|
y: this.clickPoint?.y ?? 0,
|
|
24242
24519
|
width: 0,
|
|
@@ -24438,7 +24715,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
24438
24715
|
if (nodeHandler) {
|
|
24439
24716
|
const node = nodeHandler.create(this.ellipseId, {
|
|
24440
24717
|
...this.props,
|
|
24441
|
-
strokeScaleEnabled:
|
|
24718
|
+
strokeScaleEnabled: false,
|
|
24442
24719
|
x: this.clickPoint?.x ?? 0 + this.props.radiusX,
|
|
24443
24720
|
y: this.clickPoint?.y ?? 0 + this.props.radiusY,
|
|
24444
24721
|
radiusX: 0,
|
|
@@ -24638,7 +24915,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
24638
24915
|
this.tempMainLineNode = new konva.default.Line({
|
|
24639
24916
|
...this.props,
|
|
24640
24917
|
id: this.lineId,
|
|
24641
|
-
strokeScaleEnabled:
|
|
24918
|
+
strokeScaleEnabled: false,
|
|
24642
24919
|
x: this.clickPoint?.x ?? 0,
|
|
24643
24920
|
y: this.clickPoint?.y ?? 0,
|
|
24644
24921
|
points: [0, 0]
|
|
@@ -24648,7 +24925,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
24648
24925
|
x: this.clickPoint?.x ?? 0,
|
|
24649
24926
|
y: this.clickPoint?.y ?? 0,
|
|
24650
24927
|
radius: 5 / stage.scaleX(),
|
|
24651
|
-
strokeScaleEnabled:
|
|
24928
|
+
strokeScaleEnabled: false,
|
|
24652
24929
|
stroke: "#cccccc",
|
|
24653
24930
|
strokeWidth: 0,
|
|
24654
24931
|
fill: "#cccccc"
|
|
@@ -24659,7 +24936,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
24659
24936
|
id: this.tempLineId,
|
|
24660
24937
|
x: this.clickPoint?.x ?? 0,
|
|
24661
24938
|
y: this.clickPoint?.y ?? 0,
|
|
24662
|
-
strokeScaleEnabled:
|
|
24939
|
+
strokeScaleEnabled: false,
|
|
24663
24940
|
points: [0, 0]
|
|
24664
24941
|
});
|
|
24665
24942
|
this.measureContainer?.add(this.tempLineNode);
|
|
@@ -24667,7 +24944,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
24667
24944
|
x: this.clickPoint?.x ?? 0,
|
|
24668
24945
|
y: this.clickPoint?.y ?? 0,
|
|
24669
24946
|
radius: 5 / stage.scaleX(),
|
|
24670
|
-
strokeScaleEnabled:
|
|
24947
|
+
strokeScaleEnabled: false,
|
|
24671
24948
|
stroke: "#cccccc",
|
|
24672
24949
|
strokeWidth: 0,
|
|
24673
24950
|
fill: "#cccccc"
|
|
@@ -24891,7 +25168,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
24891
25168
|
if (nodeHandler) {
|
|
24892
25169
|
const node = nodeHandler.create(this.strokeId, {
|
|
24893
25170
|
...this.props,
|
|
24894
|
-
strokeScaleEnabled:
|
|
25171
|
+
strokeScaleEnabled: false,
|
|
24895
25172
|
x: 0,
|
|
24896
25173
|
y: 0,
|
|
24897
25174
|
width: 0,
|
|
@@ -25213,7 +25490,7 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
25213
25490
|
if (nodeHandler) {
|
|
25214
25491
|
const node = nodeHandler.create(this.starId, {
|
|
25215
25492
|
...this.props,
|
|
25216
|
-
strokeScaleEnabled:
|
|
25493
|
+
strokeScaleEnabled: false,
|
|
25217
25494
|
x: this.clickPoint?.x ?? 0 + this.props.outerRadius,
|
|
25218
25495
|
y: this.clickPoint?.y ?? 0 + this.props.outerRadius,
|
|
25219
25496
|
numPoints: 5,
|
|
@@ -25419,7 +25696,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
25419
25696
|
this.tempMainArrowNode = new konva.default.Line({
|
|
25420
25697
|
...this.props,
|
|
25421
25698
|
id: this.arrowId,
|
|
25422
|
-
strokeScaleEnabled:
|
|
25699
|
+
strokeScaleEnabled: false,
|
|
25423
25700
|
x: this.clickPoint?.x ?? 0,
|
|
25424
25701
|
y: this.clickPoint?.y ?? 0,
|
|
25425
25702
|
points: [0, 0]
|
|
@@ -25429,7 +25706,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
25429
25706
|
x: this.clickPoint?.x ?? 0,
|
|
25430
25707
|
y: this.clickPoint?.y ?? 0,
|
|
25431
25708
|
radius: 5 / stage.scaleX(),
|
|
25432
|
-
strokeScaleEnabled:
|
|
25709
|
+
strokeScaleEnabled: false,
|
|
25433
25710
|
stroke: "#cccccc",
|
|
25434
25711
|
strokeWidth: 0,
|
|
25435
25712
|
fill: "#cccccc"
|
|
@@ -25438,7 +25715,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
25438
25715
|
this.tempArrowNode = new konva.default.Arrow({
|
|
25439
25716
|
...this.props,
|
|
25440
25717
|
id: this.tempArrowId,
|
|
25441
|
-
strokeScaleEnabled:
|
|
25718
|
+
strokeScaleEnabled: false,
|
|
25442
25719
|
x: this.clickPoint?.x ?? 0,
|
|
25443
25720
|
y: this.clickPoint?.y ?? 0,
|
|
25444
25721
|
points: [0, 0]
|
|
@@ -25448,7 +25725,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
25448
25725
|
x: this.clickPoint?.x ?? 0,
|
|
25449
25726
|
y: this.clickPoint?.y ?? 0,
|
|
25450
25727
|
radius: 5 / stage.scaleX(),
|
|
25451
|
-
strokeScaleEnabled:
|
|
25728
|
+
strokeScaleEnabled: false,
|
|
25452
25729
|
stroke: "#cccccc",
|
|
25453
25730
|
strokeWidth: 0,
|
|
25454
25731
|
fill: "#cccccc"
|
|
@@ -25666,7 +25943,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
25666
25943
|
if (nodeHandler) {
|
|
25667
25944
|
const node = nodeHandler.create(this.regularPolygonId, {
|
|
25668
25945
|
...this.props,
|
|
25669
|
-
strokeScaleEnabled:
|
|
25946
|
+
strokeScaleEnabled: false,
|
|
25670
25947
|
x: (this.clickPoint?.x ?? 0) + this.props.radius,
|
|
25671
25948
|
y: (this.clickPoint?.y ?? 0) + this.props.radius,
|
|
25672
25949
|
radius: 0
|
|
@@ -27667,6 +27944,7 @@ exports.TEXT_TOOL_ACTION_NAME = TEXT_TOOL_ACTION_NAME
|
|
|
27667
27944
|
exports.TEXT_TOOL_STATE = TEXT_TOOL_STATE
|
|
27668
27945
|
exports.WEAVE_ARROW_NODE_TYPE = WEAVE_ARROW_NODE_TYPE
|
|
27669
27946
|
exports.WEAVE_COPY_PASTE_NODES_KEY = WEAVE_COPY_PASTE_NODES_KEY
|
|
27947
|
+
exports.WEAVE_COPY_PASTE_PASTE_MODES = WEAVE_COPY_PASTE_PASTE_MODES
|
|
27670
27948
|
exports.WEAVE_DEFAULT_USER_INFO_FUNCTION = WEAVE_DEFAULT_USER_INFO_FUNCTION
|
|
27671
27949
|
exports.WEAVE_ELLIPSE_NODE_TYPE = WEAVE_ELLIPSE_NODE_TYPE
|
|
27672
27950
|
exports.WEAVE_FRAME_NODE_DEFAULT_CONFIG = WEAVE_FRAME_NODE_DEFAULT_CONFIG
|
|
@@ -27754,11 +28032,14 @@ exports.WeaveUsersPointersPlugin = WeaveUsersPointersPlugin
|
|
|
27754
28032
|
exports.WeaveUsersSelectionPlugin = WeaveUsersSelectionPlugin
|
|
27755
28033
|
exports.WeaveZoomInToolAction = WeaveZoomInToolAction
|
|
27756
28034
|
exports.WeaveZoomOutToolAction = WeaveZoomOutToolAction
|
|
27757
|
-
exports.checkIfOverContainer = checkIfOverContainer
|
|
27758
28035
|
exports.clearContainerTargets = clearContainerTargets
|
|
28036
|
+
exports.containerOverCursor = containerOverCursor
|
|
27759
28037
|
exports.getBoundingBox = getBoundingBox
|
|
27760
28038
|
exports.getContrastTextColor = getContrastTextColor
|
|
27761
28039
|
exports.getTargetedNode = getTargetedNode
|
|
28040
|
+
exports.hasFrames = hasFrames
|
|
28041
|
+
exports.hasImages = hasImages
|
|
28042
|
+
exports.intersectArrays = intersectArrays
|
|
27762
28043
|
exports.moveNodeToContainer = moveNodeToContainer
|
|
27763
28044
|
exports.resetScale = resetScale
|
|
27764
28045
|
exports.stringToColor = stringToColor
|