@inditextech/weave-sdk 0.43.0 → 0.45.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 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 checkIfOverContainer(instance, node) {
15669
- if (node instanceof konva.default.Transformer) {
15670
- const transformerNodes = node.nodes();
15671
- const containersInSelection = [];
15672
- for (const actualNode of transformerNodes) if (typeof actualNode.getAttrs().isContainerPrincipal !== "undefined" && actualNode.getAttrs().isContainerPrincipal) containersInSelection.push(actualNode);
15673
- const containersInSelectionSet = new Set(containersInSelection);
15674
- const uniqueContainersInSelection = Array.from(containersInSelectionSet);
15675
- if (uniqueContainersInSelection.length > 0) return void 0;
15676
- }
15677
- const intersectedNode = instance.nodeIntersectsContainerElement(node);
15678
- let nodeActualContainer = node.getParent();
15679
- if (nodeActualContainer?.getAttrs().nodeId) nodeActualContainer = instance.getStage().findOne(`#${nodeActualContainer.getAttrs().nodeId}`);
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 (!node.getAttrs().containerId && intersectedNode && nodeActualContainer?.getAttrs().id !== intersectedNode.getAttrs().id) layerToMove = intersectedNode;
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 (nodeIntersected && actualContainerAttrs.id !== nodeIntersected.getAttrs().id && !node.getAttrs().isContainerPrincipal) layerToMove = nodeIntersected;
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
@@ -15958,7 +15981,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
15958
15981
  super();
15959
15982
  const { config } = params ?? {};
15960
15983
  this.config = {
15961
- transformer: {
15984
+ selection: {
15962
15985
  rotationSnaps: [
15963
15986
  0,
15964
15987
  45,
@@ -15973,9 +15996,19 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
15973
15996
  rotationSnapTolerance: 3,
15974
15997
  ignoreStroke: true,
15975
15998
  flipEnabled: false,
15976
- keepRatio: false,
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,28 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
15992
16025
  anchor.offsetX(4);
15993
16026
  }
15994
16027
  },
15995
- borderStroke: "#0074ffcc",
15996
- borderStrokeWidth: 3,
15997
- ...config?.transformer
16028
+ borderStroke: "#1a1aff",
16029
+ borderStrokeWidth: 2,
16030
+ ...config?.selection
16031
+ },
16032
+ hover: {
16033
+ borderStrokeWidth: 2,
16034
+ ...config?.hover
16035
+ },
16036
+ selectionArea: {
16037
+ fill: "#1a1aff11",
16038
+ stroke: "#1a1aff",
16039
+ strokeWidth: 1,
16040
+ dash: [12, 4],
16041
+ ...config?.selectionArea
15998
16042
  },
15999
- transformations: {
16043
+ behaviors: {
16000
16044
  singleSelection: { enabled: true },
16001
16045
  multipleSelection: { enabled: false },
16002
- ...config?.transformations
16046
+ ...config?.behaviors
16003
16047
  }
16004
16048
  };
16005
- this.defaultEnabledAnchors = this.config.transformer?.enabledAnchors ?? [
16049
+ this.defaultEnabledAnchors = this.config.selection?.enabledAnchors ?? [
16006
16050
  "top-left",
16007
16051
  "top-center",
16008
16052
  "top-right",
@@ -16026,6 +16070,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16026
16070
  this.initialized = false;
16027
16071
  this.enabled = false;
16028
16072
  this.pointers = {};
16073
+ this.selectionOriginalConfig = { ...this.config.selection };
16029
16074
  }
16030
16075
  getName() {
16031
16076
  return WEAVE_NODES_SELECTION_KEY;
@@ -16060,23 +16105,21 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16060
16105
  stage.container().tabIndex = 1;
16061
16106
  stage.container().focus();
16062
16107
  const selectionRectangle = new konva.default.Rect({
16063
- fill: "rgba(147, 197, 253, 0.25)",
16064
- stroke: "#1e40afff",
16065
- strokeWidth: 1 * stage.scaleX(),
16066
- dash: [12 * stage.scaleX(), 4 * stage.scaleX()],
16108
+ ...this.config.selectionArea,
16109
+ ...this.config.selectionArea.strokeWidth && { strokeWidth: this.config.selectionArea.strokeWidth / stage.scaleX() },
16110
+ ...this.config.selectionArea.dash && { dash: this.config.selectionArea.dash.map((d) => d / stage.scaleX()) },
16067
16111
  visible: false,
16068
16112
  listening: false
16069
16113
  });
16070
16114
  selectionLayer?.add(selectionRectangle);
16071
16115
  const tr = new konva.default.Transformer({
16072
16116
  id: "selectionTransformer",
16073
- ...this.config.transformer
16117
+ ...this.selectionOriginalConfig
16074
16118
  });
16075
16119
  selectionLayer?.add(tr);
16076
16120
  const trHover = new konva.default.Transformer({
16077
16121
  id: "hoverTransformer",
16078
- ...this.config.transformer,
16079
- borderStrokeWidth: 3,
16122
+ ...this.config.hover,
16080
16123
  rotateEnabled: false,
16081
16124
  resizeEnabled: false,
16082
16125
  enabledAnchors: [],
@@ -16134,16 +16177,16 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16134
16177
  this.didMove = true;
16135
16178
  e.cancelBubble = true;
16136
16179
  const selectedNodes = tr.nodes();
16137
- let hasFrames = false;
16180
+ let selectionContainsFrames = false;
16138
16181
  for (let i = 0; i < selectedNodes.length; i++) {
16139
16182
  const node = selectedNodes[i];
16140
- if (node.getAttrs().nodeType === "frame") hasFrames = hasFrames || true;
16183
+ selectionContainsFrames = selectionContainsFrames || hasFrames(node);
16141
16184
  node.updatePosition(node.getAbsolutePosition());
16142
16185
  }
16143
16186
  if (this.isSelecting() && selectedNodes.length > 1) {
16144
16187
  clearContainerTargets(this.instance);
16145
- const layerToMove = checkIfOverContainer(this.instance, e.target);
16146
- if (layerToMove && !hasFrames) layerToMove.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
16188
+ const layerToMove = containerOverCursor(this.instance);
16189
+ if (layerToMove && !selectionContainsFrames) layerToMove.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
16147
16190
  }
16148
16191
  tr.forceUpdate();
16149
16192
  };
@@ -16152,10 +16195,10 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16152
16195
  if (!this.didMove) return;
16153
16196
  e.cancelBubble = true;
16154
16197
  const selectedNodes = tr.nodes();
16155
- let hasFrames = false;
16198
+ let selectionContainsFrames = false;
16156
16199
  for (let i = 0; i < selectedNodes.length; i++) {
16157
16200
  const node = selectedNodes[i];
16158
- if (node.getAttrs().nodeType === "frame") hasFrames = hasFrames || true;
16201
+ selectionContainsFrames = selectionContainsFrames || hasFrames(node);
16159
16202
  node.updatePosition(node.getAbsolutePosition());
16160
16203
  }
16161
16204
  if (this.isSelecting() && tr.nodes().length > 1) {
@@ -16164,12 +16207,19 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16164
16207
  clearContainerTargets(this.instance);
16165
16208
  const toSelect = [];
16166
16209
  const toUpdate = [];
16210
+ const layerToMove = containerOverCursor(this.instance);
16167
16211
  const nodeUpdatePromise = (node) => {
16168
16212
  return new Promise((resolve) => {
16169
16213
  setTimeout(() => {
16170
16214
  clearContainerTargets(this.instance);
16171
- if (!hasFrames) moveNodeToContainer(this.instance, node);
16172
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);
16173
16223
  if (!nodeHandler) return resolve();
16174
16224
  toSelect.push(node.getAttrs().id ?? "");
16175
16225
  toUpdate.push(nodeHandler.serialize(node));
@@ -16178,7 +16228,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16178
16228
  });
16179
16229
  };
16180
16230
  const promises = [];
16181
- for (let i = 0; i < selectedNodes.length; i++) promises.push(nodeUpdatePromise(selectedNodes[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
+ }
16182
16236
  Promise.allSettled(promises).then((results) => {
16183
16237
  if (results.length > 0) this.instance.updateNodes(toUpdate);
16184
16238
  stage.container().style.cursor = actualCursor;
@@ -16347,8 +16401,8 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16347
16401
  y1 = intStage.getRelativePointerPosition()?.y ?? 0;
16348
16402
  x2 = intStage.getRelativePointerPosition()?.x ?? 0;
16349
16403
  y2 = intStage.getRelativePointerPosition()?.y ?? 0;
16350
- this.selectionRectangle.strokeWidth(1 / stage.scaleX());
16351
- this.selectionRectangle.dash([12 / stage.scaleX(), 4 / stage.scaleX()]);
16404
+ this.selectionRectangle.strokeWidth(this.config.selectionArea.strokeWidth / stage.scaleX());
16405
+ this.selectionRectangle.dash(this.config.selectionArea.dash?.map((d) => d / stage.scaleX()) ?? []);
16352
16406
  this.selectionRectangle.width(0);
16353
16407
  this.selectionRectangle.height(0);
16354
16408
  this.selecting = true;
@@ -16467,25 +16521,30 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16467
16521
  const frameNode = node;
16468
16522
  if (!frameNode.getAttrs().locked) selectedNodes.add(node);
16469
16523
  });
16470
- const nodesArray = [...selectedNodes];
16471
- if (nodesArray.length > 1 && !this.config.transformations.multipleSelection.enabled || nodesArray.length === 1 && !this.config.transformations.singleSelection.enabled) this.tr.enabledAnchors([]);
16472
- if (nodesArray.length > 1 && this.config.transformations.multipleSelection.enabled || nodesArray.length === 1 && this.config.transformations.singleSelection.enabled) this.tr.enabledAnchors(this.defaultEnabledAnchors);
16473
- if (nodesArray.length === 1) {
16474
- this.tr.setAttrs({
16475
- ...this.config.transformer,
16476
- ...nodesArray[0].getTransformerProperties()
16477
- });
16478
- this.tr.forceUpdate();
16479
- } else {
16480
- this.tr.setAttrs({ ...this.config.transformer });
16481
- this.tr.forceUpdate();
16482
- }
16483
16524
  this.selecting = false;
16484
- this.tr.nodes(nodesArray);
16525
+ this.tr.nodes([...selectedNodes]);
16526
+ this.handleBehaviors();
16485
16527
  this.triggerSelectedNodesEvent();
16486
16528
  stage.container().tabIndex = 1;
16487
16529
  stage.container().focus();
16488
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();
16489
16548
  }
16490
16549
  getSelectionPlugin() {
16491
16550
  const selectionPlugin = this.instance.getPlugin("nodesSelection");
@@ -16521,7 +16580,6 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16521
16580
  if (targetNode && targetNode.getAttrs().nodeType) nodeTargeted = targetNode;
16522
16581
  }
16523
16582
  if (!nodeTargeted.getAttrs().nodeType) return;
16524
- let nodesSelected = 0;
16525
16583
  const metaPressed = e.evt.shiftKey || e.evt.ctrlKey || e.evt.metaKey;
16526
16584
  const nodeSelectedIndex = this.tr.nodes().findIndex((node) => {
16527
16585
  return node.getAttrs().id === nodeTargeted.getAttrs().id;
@@ -16539,7 +16597,6 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16539
16597
  }
16540
16598
  if (!metaPressed) {
16541
16599
  this.tr.nodes([nodeTargeted]);
16542
- nodesSelected = this.tr.nodes().length;
16543
16600
  this.tr.show();
16544
16601
  areNodesSelected = true;
16545
16602
  }
@@ -16547,24 +16604,14 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16547
16604
  const nodes = this.tr.nodes().slice();
16548
16605
  nodes.splice(nodes.indexOf(nodeTargeted), 1);
16549
16606
  this.tr.nodes(nodes);
16550
- nodesSelected = this.tr.nodes().length;
16551
16607
  areNodesSelected = true;
16552
16608
  }
16553
16609
  if (metaPressed && !isSelected) {
16554
16610
  const nodes = this.tr.nodes().concat([nodeTargeted]);
16555
16611
  this.tr.nodes(nodes);
16556
- nodesSelected = this.tr.nodes().length;
16557
16612
  areNodesSelected = true;
16558
16613
  }
16559
- if (nodesSelected > 1 && !this.config.transformations.multipleSelection.enabled || nodesSelected === 1 && !this.config.transformations.singleSelection.enabled) this.tr.enabledAnchors([]);
16560
- if (nodesSelected > 1 && this.config.transformations.multipleSelection.enabled || nodesSelected === 1 && this.config.transformations.singleSelection.enabled) this.tr.enabledAnchors(this.defaultEnabledAnchors);
16561
- if (nodesSelected === 1) {
16562
- this.tr.setAttrs({
16563
- ...this.config.transformer,
16564
- ...nodeTargeted.getTransformerProperties()
16565
- });
16566
- this.tr.forceUpdate();
16567
- }
16614
+ this.handleBehaviors();
16568
16615
  if (areNodesSelected) {
16569
16616
  stage.container().tabIndex = 1;
16570
16617
  stage.container().focus();
@@ -16578,21 +16625,28 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16578
16625
  getHoverTransformer() {
16579
16626
  return this.trHover;
16580
16627
  }
16628
+ handleBehaviors() {
16629
+ const nodes = this.getSelectedNodes();
16630
+ const nodesSelected = nodes.length;
16631
+ if (nodesSelected > 1 && !this.config.behaviors.multipleSelection.enabled || nodesSelected === 1 && !this.config.behaviors.singleSelection.enabled) this.tr.enabledAnchors([]);
16632
+ if (nodesSelected > 1 && this.config.behaviors.multipleSelection.enabled || nodesSelected === 1 && this.config.behaviors.singleSelection.enabled) this.tr.enabledAnchors(this.defaultEnabledAnchors);
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
+ this.tr.setAttrs(transformerAttrs);
16645
+ this.tr.forceUpdate();
16646
+ }
16581
16647
  setSelectedNodes(nodes) {
16582
16648
  this.tr.setNodes(nodes);
16583
- const nodesSelected = nodes.length;
16584
- if (nodesSelected > 1 && !this.config.transformations.multipleSelection.enabled || nodesSelected === 1 && !this.config.transformations.singleSelection.enabled) this.tr.enabledAnchors([]);
16585
- if (nodesSelected > 1 && this.config.transformations.multipleSelection.enabled || nodesSelected === 1 && this.config.transformations.singleSelection.enabled) this.tr.enabledAnchors(this.defaultEnabledAnchors);
16586
- if (nodesSelected === 1) {
16587
- this.tr.setAttrs({
16588
- ...this.config.transformer,
16589
- ...nodes[0].getTransformerProperties()
16590
- });
16591
- this.tr.forceUpdate();
16592
- } else if (nodesSelected > 1) {
16593
- this.tr.setAttrs({ ...this.config.transformer });
16594
- this.tr.forceUpdate();
16595
- }
16649
+ this.handleBehaviors();
16596
16650
  this.triggerSelectedNodesEvent();
16597
16651
  }
16598
16652
  getSelectedNodes() {
@@ -16635,6 +16689,9 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16635
16689
  const snappingPlugin = this.instance.getPlugin("nodesSnapping");
16636
16690
  return snappingPlugin;
16637
16691
  }
16692
+ getSelectorConfig() {
16693
+ return this.selectionOriginalConfig;
16694
+ }
16638
16695
  };
16639
16696
 
16640
16697
  //#endregion
@@ -16858,10 +16915,7 @@ const augmentKonvaStageClass = () => {
16858
16915
  const augmentKonvaNodeClass = (config) => {
16859
16916
  const { transform } = config ?? {};
16860
16917
  konva.default.Node.prototype.getTransformerProperties = function() {
16861
- return {
16862
- WEAVE_DEFAULT_TRANSFORM_PROPERTIES: __inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
16863
- ...transform
16864
- };
16918
+ return { ...transform };
16865
16919
  };
16866
16920
  konva.default.Node.prototype.getRealClientRect = function(config$1) {
16867
16921
  return this.getClientRect(config$1);
@@ -16900,7 +16954,19 @@ var WeaveNode = class {
16900
16954
  }
16901
16955
  setupDefaultNodeAugmentation(node) {
16902
16956
  node.getTransformerProperties = () => {
16903
- return __inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES;
16957
+ return this.defaultGetTransformerProperties({});
16958
+ };
16959
+ node.allowedAnchors = () => {
16960
+ return [
16961
+ "top-left",
16962
+ "top-center",
16963
+ "top-right",
16964
+ "middle-right",
16965
+ "middle-left",
16966
+ "bottom-left",
16967
+ "bottom-center",
16968
+ "bottom-right"
16969
+ ];
16904
16970
  };
16905
16971
  node.movedToContainer = () => {};
16906
16972
  node.updatePosition = () => {};
@@ -16912,10 +16978,13 @@ var WeaveNode = class {
16912
16978
  return false;
16913
16979
  }
16914
16980
  scaleReset(node) {
16915
- node.width(Math.max(5, node.width() * node.scaleX()));
16916
- node.height(Math.max(5, node.height() * node.scaleY()));
16917
- node.scaleX(1);
16918
- node.scaleY(1);
16981
+ const scale = node.scale();
16982
+ node.width(Math.max(5, node.width() * scale.x));
16983
+ node.height(Math.max(5, node.height() * scale.y));
16984
+ node.scale({
16985
+ x: 1,
16986
+ y: 1
16987
+ });
16919
16988
  }
16920
16989
  setHoverState(node) {
16921
16990
  const selectionPlugin = this.getSelectionPlugin();
@@ -16961,7 +17030,6 @@ var WeaveNode = class {
16961
17030
  const nodesSnappingPlugin = this.instance.getPlugin("nodesSnapping");
16962
17031
  if (nodesSelectionPlugin && this.isSelecting() && this.isNodeSelected(node$1)) nodesSelectionPlugin.getTransformer().forceUpdate();
16963
17032
  if (nodesSnappingPlugin && transforming && this.isSelecting() && this.isNodeSelected(node$1)) nodesSnappingPlugin.evaluateGuidelines(e);
16964
- if (this.isSelecting() && this.isNodeSelected(node$1)) this.scaleReset(node$1);
16965
17033
  };
16966
17034
  node.on("transform", (0, import_lodash.throttle)(handleTransform, 100));
16967
17035
  node.on("transformend", (e) => {
@@ -16972,6 +17040,7 @@ var WeaveNode = class {
16972
17040
  const nodesSnappingPlugin = this.instance.getPlugin("nodesSnapping");
16973
17041
  if (nodesSnappingPlugin) nodesSnappingPlugin.cleanupEvaluateGuidelines();
16974
17042
  if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
17043
+ this.scaleReset(node$1);
16975
17044
  const nodeHandler = this.instance.getNodeHandler(node$1.getAttrs().nodeType);
16976
17045
  if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node$1));
16977
17046
  });
@@ -17012,8 +17081,8 @@ var WeaveNode = class {
17012
17081
  }
17013
17082
  if (this.isSelecting() && this.isNodeSelected(node) && this.getSelectionPlugin()?.getSelectedNodes().length === 1) {
17014
17083
  clearContainerTargets(this.instance);
17015
- const layerToMove = checkIfOverContainer(this.instance, e.target);
17016
- if (layerToMove) layerToMove.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
17084
+ const layerToMove = containerOverCursor(this.instance);
17085
+ if (layerToMove && !hasFrames(node)) layerToMove.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
17017
17086
  }
17018
17087
  };
17019
17088
  node.on("dragmove", (0, import_lodash.throttle)(handleDragMove, 100));
@@ -17029,8 +17098,13 @@ var WeaveNode = class {
17029
17098
  clearContainerTargets(this.instance);
17030
17099
  const nodesSnappingPlugin = this.instance.getPlugin("nodesSnapping");
17031
17100
  if (nodesSnappingPlugin) nodesSnappingPlugin.cleanupEvaluateGuidelines();
17032
- const containerToMove = moveNodeToContainer(this.instance, e.target);
17033
- if (containerToMove) return;
17101
+ const layerToMove = containerOverCursor(this.instance);
17102
+ let containerToMove = this.instance.getMainLayer();
17103
+ if (layerToMove) {
17104
+ containerToMove = layerToMove;
17105
+ containerToMove.fire(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, { bubbles: true });
17106
+ }
17107
+ if (containerToMove) moveNodeToContainer(this.instance, e.target, containerToMove);
17034
17108
  this.instance.updateNode(this.serialize(node));
17035
17109
  }
17036
17110
  });
@@ -17148,6 +17222,18 @@ var WeaveNode = class {
17148
17222
  if (instance.getAttrs().nodeId === false) realInstance = this.instance.getInstanceRecursive(instance);
17149
17223
  return realInstance.getAttrs().locked ?? false;
17150
17224
  }
17225
+ defaultGetTransformerProperties(nodeTransformConfig) {
17226
+ const selectionPlugin = this.instance.getPlugin("nodesSelection");
17227
+ let transformProperties = {};
17228
+ if (selectionPlugin) transformProperties = {
17229
+ ...transformProperties,
17230
+ ...selectionPlugin.getSelectorConfig()
17231
+ };
17232
+ return {
17233
+ ...transformProperties,
17234
+ ...nodeTransformConfig
17235
+ };
17236
+ }
17151
17237
  };
17152
17238
 
17153
17239
  //#endregion
@@ -17530,25 +17616,36 @@ var WeaveGroupsManager = class {
17530
17616
  allNodesInSameParent(nodes) {
17531
17617
  const stage = this.instance.getStage();
17532
17618
  if (nodes.length === 0) return {
17533
- allInSame: false,
17534
- nodeId: void 0,
17619
+ realNodes: [],
17535
17620
  parentId: void 0
17536
17621
  };
17537
- let allInSame = true;
17538
- const nodeInstance = stage.findOne(`#${nodes[0].props.id}`);
17539
- const parentId = nodeInstance?.getParent()?.getAttrs().id;
17622
+ const framesIds = [];
17623
+ nodes.forEach((node) => {
17624
+ const nodeInstance$1 = stage.findOne(`#${node.key}`);
17625
+ if (nodeInstance$1 && nodeInstance$1.getAttrs().nodeType === "frame") framesIds.push(node.key);
17626
+ });
17627
+ let realNodes = [];
17628
+ if (framesIds.length > 0) for (const node of nodes) {
17629
+ const nodeInstance$1 = stage.findOne(`#${node.key}`);
17630
+ if (framesIds.includes(node.key)) realNodes.push(node);
17631
+ if (!framesIds.includes(node.key) && nodeInstance$1 && !framesIds.includes(nodeInstance$1.getParent()?.getAttrs().nodeId)) realNodes.push(node);
17632
+ }
17633
+ if (realNodes.length === 0) realNodes = nodes;
17634
+ const parentIds = [];
17635
+ for (const node of realNodes) {
17636
+ const nodeInstance$1 = stage.findOne(`#${node.key}`);
17637
+ if (nodeInstance$1) {
17638
+ const parentId$1 = nodeInstance$1.getParent()?.getAttrs().id;
17639
+ if (parentId$1 && !parentIds.includes(parentId$1)) parentIds.push(parentId$1);
17640
+ }
17641
+ }
17642
+ const nodeInstance = stage.findOne(`#${realNodes[0].props.id}`);
17540
17643
  const nodeId = nodeInstance?.getParent()?.getAttrs().nodeId;
17541
- for (const node of nodes) {
17542
- const nodeInstance$1 = stage.findOne(`#${node.props.id}`);
17543
- const nodeParentId = nodeInstance$1?.getParent()?.getAttrs().id;
17544
- if (nodeParentId !== parentId) {
17545
- allInSame = false;
17546
- break;
17547
- }
17548
- }
17644
+ let parentId = nodeInstance?.getParent()?.getAttrs().id;
17645
+ if (parentIds.length === 1 && nodeId) parentId = nodeId;
17646
+ if (parentIds.length > 1) parentId = void 0;
17549
17647
  return {
17550
- allInSame,
17551
- nodeId,
17648
+ realNodes,
17552
17649
  parentId
17553
17650
  };
17554
17651
  }
@@ -17561,11 +17658,7 @@ var WeaveGroupsManager = class {
17561
17658
  this.logger.warn({ nodes }, "State is empty, cannot group nodes");
17562
17659
  return;
17563
17660
  }
17564
- const { allInSame, nodeId, parentId } = this.allNodesInSameParent(nodes);
17565
- if (!allInSame) {
17566
- this.logger.warn({ nodes }, "Not all nodes are in the same container, cannot group them");
17567
- return;
17568
- }
17661
+ const { realNodes, parentId } = this.allNodesInSameParent(nodes);
17569
17662
  const selectionPlugin = this.instance.getPlugin("nodesSelection");
17570
17663
  if (selectionPlugin) {
17571
17664
  const tr = selectionPlugin.getTransformer();
@@ -17584,10 +17677,10 @@ var WeaveGroupsManager = class {
17584
17677
  parentLayer?.add(groupInstance);
17585
17678
  const groupHandler = this.instance.getNodeHandler("group");
17586
17679
  if (groupHandler) {
17587
- const groupNode = groupHandler.create(groupId, { draggable: true });
17588
- this.instance.addNode(groupNode, nodeId ?? parentNodeId);
17680
+ const groupNode$1 = groupHandler.create(groupId, { draggable: true });
17681
+ this.instance.addNode(groupNode$1, parentNodeId);
17589
17682
  }
17590
- const nodesWithZIndex = nodes.map((node) => {
17683
+ const nodesWithZIndex = realNodes.map((node) => {
17591
17684
  const instance = mainLayer?.findOne(`#${node.key}`);
17592
17685
  return {
17593
17686
  node,
@@ -17635,12 +17728,14 @@ var WeaveGroupsManager = class {
17635
17728
  }
17636
17729
  this.instance.removeNodes(sortedNodesByZIndex);
17637
17730
  groupInstance.destroy();
17731
+ const groupNode = stage.findOne(`#${groupId}`);
17732
+ if (groupHandler && groupNode) this.instance.updateNode(groupHandler.serialize(groupNode));
17638
17733
  setTimeout(() => {
17639
- const groupNode = stage.findOne(`#${groupId}`);
17734
+ const groupNode$1 = stage.findOne(`#${groupId}`);
17640
17735
  const selectionPlugin$1 = this.instance.getPlugin("nodesSelection");
17641
- if (groupNode && selectionPlugin$1) {
17736
+ if (groupNode$1 && selectionPlugin$1) {
17642
17737
  const tr = selectionPlugin$1.getTransformer();
17643
- selectionPlugin$1.setSelectedNodes([groupNode]);
17738
+ selectionPlugin$1.setSelectedNodes([groupNode$1]);
17644
17739
  tr.show();
17645
17740
  tr.forceUpdate();
17646
17741
  }
@@ -17670,18 +17765,40 @@ var WeaveGroupsManager = class {
17670
17765
  let newChildId = void 0;
17671
17766
  const children = [...konvaGroup.getChildren()];
17672
17767
  for (const child of children) {
17673
- const nodePos = child.getAbsolutePosition();
17674
- const nodeRotation = child.getAbsoluteRotation();
17768
+ const absPos = child.getAbsolutePosition();
17769
+ const absScale = child.getAbsoluteScale();
17770
+ const absRotation = child.getAbsoluteRotation();
17675
17771
  child.moveTo(newLayer);
17676
- child.setAbsolutePosition(nodePos);
17677
- child.rotation(nodeRotation);
17772
+ child.position({
17773
+ x: 0,
17774
+ y: 0
17775
+ });
17776
+ child.scale({
17777
+ x: 1,
17778
+ y: 1
17779
+ });
17780
+ child.rotation(0);
17781
+ child.offset({
17782
+ x: 0,
17783
+ y: 0
17784
+ });
17785
+ child.setAbsolutePosition(absPos);
17786
+ child.scale({
17787
+ x: absScale.x / stage.scaleX(),
17788
+ y: absScale.y / stage.scaleY()
17789
+ });
17790
+ child.rotation(absRotation);
17678
17791
  child.zIndex(newLayerChildrenAmount - 1 + child.zIndex());
17679
- child.setAttr("id", v4_default());
17680
17792
  child.setAttr("draggable", true);
17681
17793
  newChildId = child.getAttrs().id;
17682
17794
  const handler = this.instance.getNodeHandler(child.getAttrs().nodeType);
17683
17795
  if (handler) {
17684
17796
  const node = handler.serialize(child);
17797
+ const newNodeId = v4_default();
17798
+ const oldId = node.key;
17799
+ node.key = newNodeId;
17800
+ node.props.id = newNodeId;
17801
+ for (const prop of Object.keys(node.props)) if (typeof node.props[prop] === "string") node.props[prop] = node.props[prop].replace(oldId, newNodeId);
17685
17802
  this.instance.addNode(node, nodeId ?? newLayer.getAttrs().id);
17686
17803
  }
17687
17804
  child.destroy();
@@ -17697,6 +17814,19 @@ var WeaveGroupsManager = class {
17697
17814
  if (firstElement && selectionPlugin) selectionPlugin.setSelectedNodes([firstElement]);
17698
17815
  }, 0);
17699
17816
  }
17817
+ extractTransformFromMatrix(m) {
17818
+ const a = m[0], b = m[1], c = m[2], d = m[3], e = m[4], f = m[5];
17819
+ const scaleX = Math.sqrt(a * a + b * b);
17820
+ const scaleY = Math.sqrt(c * c + d * d);
17821
+ const rotation = Math.atan2(b, a) * (180 / Math.PI);
17822
+ return {
17823
+ x: e,
17824
+ y: f,
17825
+ scaleX,
17826
+ scaleY,
17827
+ rotation
17828
+ };
17829
+ }
17700
17830
  };
17701
17831
 
17702
17832
  //#endregion
@@ -18488,13 +18618,7 @@ var WeaveStateManager = class {
18488
18618
  target[key] = [...sourceArr];
18489
18619
  return;
18490
18620
  }
18491
- while (tgtArr.length > sourceArr.length) tgtArr.pop();
18492
- for (let i = 0; i < sourceArr.length; i++) {
18493
- const srcItem = sourceArr[i];
18494
- const tgtItem = tgtArr[i];
18495
- if (this.isObject(srcItem) && this.isObject(tgtItem)) this.deepSyncSyncedStore(tgtItem, srcItem);
18496
- else if (tgtItem !== srcItem) tgtArr[i] = srcItem;
18497
- }
18621
+ target[key] = [...sourceArr];
18498
18622
  }
18499
18623
  isObject(val) {
18500
18624
  return typeof val === "object" && val !== null;
@@ -18677,7 +18801,7 @@ var WeaveRegisterManager = class {
18677
18801
 
18678
18802
  //#endregion
18679
18803
  //#region package.json
18680
- var version = "0.43.0";
18804
+ var version = "0.45.0";
18681
18805
 
18682
18806
  //#endregion
18683
18807
  //#region src/managers/setup.ts
@@ -19516,10 +19640,21 @@ var WeaveGroupNode = class extends WeaveNode {
19516
19640
  constructor(params) {
19517
19641
  super();
19518
19642
  const { config } = params ?? {};
19519
- this.config = { transform: {
19520
- ...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
19521
- ...config?.transform
19522
- } };
19643
+ this.config = { transform: { ...config?.transform } };
19644
+ }
19645
+ groupHasFrames(group) {
19646
+ const frameNodes = group.find((node) => {
19647
+ return node.getAttrs().nodeType === "frame";
19648
+ });
19649
+ if (frameNodes.length === 0) return false;
19650
+ else return true;
19651
+ }
19652
+ groupHasImages(group) {
19653
+ const imageNodes = group.find((node) => {
19654
+ return node.getAttrs().nodeType === "image";
19655
+ });
19656
+ if (imageNodes.length === 0) return false;
19657
+ else return true;
19523
19658
  }
19524
19659
  onRender(props) {
19525
19660
  const group = new konva.default.Group({
@@ -19529,7 +19664,19 @@ var WeaveGroupNode = class extends WeaveNode {
19529
19664
  });
19530
19665
  this.setupDefaultNodeAugmentation(group);
19531
19666
  group.getTransformerProperties = () => {
19532
- return this.config.transform;
19667
+ const baseConfig = this.defaultGetTransformerProperties(this.config.transform);
19668
+ return {
19669
+ ...baseConfig,
19670
+ enabledAnchors: group.allowedAnchors()
19671
+ };
19672
+ };
19673
+ group.allowedAnchors = () => {
19674
+ const stage = this.instance.getStage();
19675
+ const actualGroup = stage.findOne(`#${group.id()}`);
19676
+ const children = actualGroup.getChildren();
19677
+ const anchorsArrays = [];
19678
+ for (const child of children) anchorsArrays.push(child.allowedAnchors());
19679
+ return intersectArrays(anchorsArrays);
19533
19680
  };
19534
19681
  this.setupDefaultNodeEvents(group);
19535
19682
  return group;
@@ -19555,10 +19702,15 @@ var WeaveGroupNode = class extends WeaveNode {
19555
19702
  ...attrs,
19556
19703
  id: attrs.id ?? "",
19557
19704
  nodeType: attrs.nodeType,
19558
- children: childrenMapped
19705
+ children: childrenMapped,
19706
+ x: instance.x() ?? 0,
19707
+ y: instance.y() ?? 0,
19708
+ scaleX: instance.scaleX() ?? 1,
19709
+ scaleY: instance.scaleY() ?? 1
19559
19710
  }
19560
19711
  };
19561
19712
  }
19713
+ scaleReset() {}
19562
19714
  };
19563
19715
 
19564
19716
  //#endregion
@@ -19572,19 +19724,17 @@ var WeaveRectangleNode = class extends WeaveNode {
19572
19724
  constructor(params) {
19573
19725
  super();
19574
19726
  const { config } = params ?? {};
19575
- this.config = { transform: {
19576
- ...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
19577
- ...config?.transform
19578
- } };
19727
+ this.config = { transform: { ...config?.transform } };
19579
19728
  }
19580
19729
  onRender(props) {
19581
19730
  const rectangle = new konva.default.Rect({
19582
19731
  ...props,
19583
- name: "node"
19732
+ name: "node",
19733
+ strokeScaleEnabled: false
19584
19734
  });
19585
19735
  this.setupDefaultNodeAugmentation(rectangle);
19586
19736
  rectangle.getTransformerProperties = () => {
19587
- return this.config.transform;
19737
+ return this.defaultGetTransformerProperties(this.config.transform);
19588
19738
  };
19589
19739
  this.setupDefaultNodeEvents(rectangle);
19590
19740
  return rectangle;
@@ -19594,6 +19744,15 @@ var WeaveRectangleNode = class extends WeaveNode {
19594
19744
  const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
19595
19745
  if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
19596
19746
  }
19747
+ scaleReset(node) {
19748
+ const scale = node.scale();
19749
+ node.width(Math.max(5, node.width() * scale.x));
19750
+ node.height(Math.max(5, node.height() * scale.y));
19751
+ node.scale({
19752
+ x: 1,
19753
+ y: 1
19754
+ });
19755
+ }
19597
19756
  };
19598
19757
 
19599
19758
  //#endregion
@@ -19607,10 +19766,7 @@ var WeaveEllipseNode = class extends WeaveNode {
19607
19766
  constructor(params) {
19608
19767
  super();
19609
19768
  const { config } = params ?? {};
19610
- this.config = { transform: {
19611
- ...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
19612
- ...config?.transform
19613
- } };
19769
+ this.config = { transform: { ...config?.transform } };
19614
19770
  }
19615
19771
  onRender(props) {
19616
19772
  const ellipse = new konva.default.Ellipse({
@@ -19623,8 +19779,9 @@ var WeaveEllipseNode = class extends WeaveNode {
19623
19779
  ellipse.getTransformerProperties = () => {
19624
19780
  const stage = this.instance.getStage();
19625
19781
  const node = stage.findOne(`#${props.id}`);
19782
+ const baseConfig = this.defaultGetTransformerProperties(this.config.transform);
19626
19783
  if (node && node.getAttrs().keepAspectRatio) return {
19627
- ...this.config.transform,
19784
+ ...baseConfig,
19628
19785
  enabledAnchors: [
19629
19786
  "top-left",
19630
19787
  "top-right",
@@ -19633,7 +19790,27 @@ var WeaveEllipseNode = class extends WeaveNode {
19633
19790
  ],
19634
19791
  keepRatio: true
19635
19792
  };
19636
- return this.config.transform;
19793
+ return baseConfig;
19794
+ };
19795
+ ellipse.allowedAnchors = () => {
19796
+ const stage = this.instance.getStage();
19797
+ const actualEllipse = stage.findOne(`#${ellipse.id()}`);
19798
+ if (actualEllipse.getAttrs().keepAspectRatio) return [
19799
+ "top-left",
19800
+ "top-right",
19801
+ "bottom-left",
19802
+ "bottom-right"
19803
+ ];
19804
+ return [
19805
+ "top-left",
19806
+ "top-center",
19807
+ "top-right",
19808
+ "middle-right",
19809
+ "middle-left",
19810
+ "bottom-left",
19811
+ "bottom-center",
19812
+ "bottom-right"
19813
+ ];
19637
19814
  };
19638
19815
  this.setupDefaultNodeEvents(ellipse);
19639
19816
  return ellipse;
@@ -19648,11 +19825,12 @@ var WeaveEllipseNode = class extends WeaveNode {
19648
19825
  }
19649
19826
  }
19650
19827
  scaleReset(node) {
19651
- const ellipseNode = node;
19652
- ellipseNode.radiusX(Math.max(5, ellipseNode.radiusX() * ellipseNode.scaleX()));
19653
- ellipseNode.radiusY(Math.max(5, ellipseNode.radiusY() * ellipseNode.scaleY()));
19654
- node.scaleX(1);
19655
- node.scaleY(1);
19828
+ node.radiusX(Math.max(5, node.radiusX() * node.scaleX()));
19829
+ node.radiusY(Math.max(5, node.radiusY() * node.scaleY()));
19830
+ node.scale({
19831
+ x: 1,
19832
+ y: 1
19833
+ });
19656
19834
  }
19657
19835
  };
19658
19836
 
@@ -19667,10 +19845,7 @@ var WeaveLineNode = class extends WeaveNode {
19667
19845
  constructor(params) {
19668
19846
  super();
19669
19847
  const { config } = params ?? {};
19670
- this.config = { transform: {
19671
- ...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
19672
- ...config?.transform
19673
- } };
19848
+ this.config = { transform: { ...config?.transform } };
19674
19849
  }
19675
19850
  onRender(props) {
19676
19851
  const line = new konva.default.Line({
@@ -19679,7 +19854,7 @@ var WeaveLineNode = class extends WeaveNode {
19679
19854
  });
19680
19855
  this.setupDefaultNodeAugmentation(line);
19681
19856
  line.getTransformerProperties = () => {
19682
- return this.config.transform;
19857
+ return this.defaultGetTransformerProperties(this.config.transform);
19683
19858
  };
19684
19859
  this.setupDefaultNodeEvents(line);
19685
19860
  return line;
@@ -19690,23 +19865,19 @@ var WeaveLineNode = class extends WeaveNode {
19690
19865
  if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
19691
19866
  }
19692
19867
  scaleReset(node) {
19693
- if (node.getAttrs().nodeType === "line") {
19694
- const lineNode = node;
19695
- const oldPoints = lineNode.points();
19696
- const newPoints = [];
19697
- for (let i = 0; i < oldPoints.length / 2; i++) {
19698
- const point = {
19699
- x: oldPoints[i * 2] * lineNode.scaleX(),
19700
- y: oldPoints[i * 2 + 1] * lineNode.scaleY()
19701
- };
19702
- newPoints.push(point.x, point.y);
19703
- }
19704
- lineNode.points(newPoints);
19868
+ const scale = node.scale();
19869
+ const oldPoints = node.points();
19870
+ const newPoints = [];
19871
+ for (let i = 0; i < oldPoints.length; i += 2) {
19872
+ const x = oldPoints[i] * scale.x;
19873
+ const y = oldPoints[i + 1] * scale.y;
19874
+ newPoints.push(x, y);
19705
19875
  }
19706
- node.width(Math.max(5, node.width() * node.scaleX()));
19707
- node.height(Math.max(5, node.height() * node.scaleY()));
19708
- node.scaleX(1);
19709
- node.scaleY(1);
19876
+ node.points(newPoints);
19877
+ node.scale({
19878
+ x: 1,
19879
+ y: 1
19880
+ });
19710
19881
  }
19711
19882
  };
19712
19883
 
@@ -19747,10 +19918,7 @@ var WeaveTextNode = class extends WeaveNode {
19747
19918
  constructor(params) {
19748
19919
  super();
19749
19920
  const { config } = params ?? {};
19750
- this.config = { transform: {
19751
- ...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
19752
- ...config?.transform
19753
- } };
19921
+ this.config = { transform: { ...config?.transform } };
19754
19922
  this.editing = false;
19755
19923
  this.textArea = null;
19756
19924
  }
@@ -19769,18 +19937,40 @@ var WeaveTextNode = class extends WeaveNode {
19769
19937
  text.getTransformerProperties = () => {
19770
19938
  const stage = this.instance.getStage();
19771
19939
  const actualText = stage.findOne(`#${text.id()}`);
19940
+ const baseConfig = this.defaultGetTransformerProperties(this.config.transform);
19772
19941
  if (actualText) {
19773
19942
  const attrs = actualText.getAttrs();
19774
19943
  if (attrs.layout === TEXT_LAYOUT.AUTO_ALL) return {
19944
+ ...baseConfig,
19775
19945
  resizeEnabled: false,
19776
19946
  enabledAnchors: []
19777
19947
  };
19778
19948
  if (attrs.layout === TEXT_LAYOUT.AUTO_HEIGHT) return {
19949
+ ...baseConfig,
19779
19950
  resizeEnabled: true,
19780
19951
  enabledAnchors: ["middle-right", "middle-left"]
19781
19952
  };
19782
19953
  }
19783
- return this.config.transform;
19954
+ return baseConfig;
19955
+ };
19956
+ text.allowedAnchors = () => {
19957
+ const stage = this.instance.getStage();
19958
+ const actualText = stage.findOne(`#${text.id()}`);
19959
+ if (actualText) {
19960
+ const attrs = actualText.getAttrs();
19961
+ if (attrs.layout === TEXT_LAYOUT.AUTO_ALL) return [];
19962
+ if (attrs.layout === TEXT_LAYOUT.AUTO_HEIGHT) return ["middle-right", "middle-left"];
19963
+ }
19964
+ return [
19965
+ "top-left",
19966
+ "top-center",
19967
+ "top-right",
19968
+ "middle-right",
19969
+ "middle-left",
19970
+ "bottom-left",
19971
+ "bottom-center",
19972
+ "bottom-right"
19973
+ ];
19784
19974
  };
19785
19975
  text.setAttrs({ measureMultilineText: this.measureMultilineText(text) });
19786
19976
  this.setupDefaultNodeEvents(text);
@@ -20335,7 +20525,7 @@ var WeaveImageToolAction = class extends WeaveAction {
20335
20525
  image: this.preloadImgs[this.imageId],
20336
20526
  stroke: "#000000ff",
20337
20527
  strokeWidth: 0,
20338
- strokeScaleEnabled: true,
20528
+ strokeScaleEnabled: false,
20339
20529
  listening: false
20340
20530
  });
20341
20531
  this.instance.getMainLayer()?.add(this.tempImageNode);
@@ -20365,7 +20555,7 @@ var WeaveImageToolAction = class extends WeaveAction {
20365
20555
  imageURL: this.imageURL,
20366
20556
  stroke: "#000000ff",
20367
20557
  strokeWidth: 0,
20368
- strokeScaleEnabled: true,
20558
+ strokeScaleEnabled: false,
20369
20559
  imageWidth: this.preloadImgs[this.imageId].width,
20370
20560
  imageHeight: this.preloadImgs[this.imageId].height,
20371
20561
  imageInfo: {
@@ -20779,10 +20969,7 @@ var WeaveImageNode = class extends WeaveNode {
20779
20969
  this.lastTapTime = 0;
20780
20970
  this.config = {
20781
20971
  crossOrigin: config?.crossOrigin ?? "anonymous",
20782
- transform: {
20783
- ...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
20784
- ...config?.transform
20785
- }
20972
+ transform: { ...config?.transform }
20786
20973
  };
20787
20974
  this.imageCrop = null;
20788
20975
  this.cachedCropInfo = {};
@@ -20864,7 +21051,15 @@ var WeaveImageNode = class extends WeaveNode {
20864
21051
  this.cachedCropInfo[image$1.getAttrs().id ?? ""] = void 0;
20865
21052
  };
20866
21053
  image.getTransformerProperties = () => {
20867
- return this.config.transform;
21054
+ return this.defaultGetTransformerProperties(this.config.transform);
21055
+ };
21056
+ image.allowedAnchors = () => {
21057
+ return [
21058
+ "top-left",
21059
+ "top-right",
21060
+ "bottom-left",
21061
+ "bottom-right"
21062
+ ];
20868
21063
  };
20869
21064
  const imagePlaceholder = new konva.default.Rect({
20870
21065
  ...groupImageProps,
@@ -20895,7 +21090,7 @@ var WeaveImageNode = class extends WeaveNode {
20895
21090
  rotation: 0,
20896
21091
  width: 0,
20897
21092
  height: 0,
20898
- strokeScaleEnabled: true,
21093
+ strokeScaleEnabled: false,
20899
21094
  draggable: false,
20900
21095
  visible: false,
20901
21096
  name: void 0
@@ -21114,18 +21309,49 @@ var WeaveImageNode = class extends WeaveNode {
21114
21309
  return imageToolAction;
21115
21310
  }
21116
21311
  scaleReset(node) {
21312
+ const scale = node.scale();
21117
21313
  const widthNotNormalized = node.width();
21118
21314
  const heightNotNormalized = node.height();
21119
- node.width(Math.max(5, node.width() * node.scaleX()));
21120
- node.height(Math.max(5, node.height() * node.scaleY()));
21121
21315
  const uncroppedWidth = node.getAttrs().uncroppedImage ? node.getAttrs().uncroppedImage.width : widthNotNormalized;
21122
21316
  const uncroppedHeight = node.getAttrs().uncroppedImage ? node.getAttrs().uncroppedImage.height : heightNotNormalized;
21123
21317
  node.setAttrs({ uncroppedImage: {
21124
21318
  width: uncroppedWidth * node.scaleX(),
21125
21319
  height: uncroppedHeight * node.scaleY()
21126
21320
  } });
21127
- node.scaleX(1);
21128
- node.scaleY(1);
21321
+ const placeholder = node.findOne(`#${node.getAttrs().id}-placeholder`);
21322
+ const internalImage = node.findOne(`#${node.getAttrs().id}-image`);
21323
+ const cropGroup = node.findOne(`#${node.getAttrs().id}-cropGroup`);
21324
+ if (placeholder) {
21325
+ placeholder.width(Math.max(5, placeholder.width() * placeholder.scaleX()));
21326
+ placeholder.height(Math.max(5, placeholder.height() * placeholder.scaleY()));
21327
+ placeholder.scale({
21328
+ x: 1,
21329
+ y: 1
21330
+ });
21331
+ }
21332
+ if (internalImage) {
21333
+ internalImage.width(Math.max(5, internalImage.width() * internalImage.scaleX()));
21334
+ internalImage.height(Math.max(5, internalImage.height() * internalImage.scaleY()));
21335
+ internalImage.scale({
21336
+ x: 1,
21337
+ y: 1
21338
+ });
21339
+ }
21340
+ if (cropGroup) {
21341
+ cropGroup.width(Math.max(5, cropGroup.width() * cropGroup.scaleX()));
21342
+ cropGroup.height(Math.max(5, cropGroup.height() * cropGroup.scaleY()));
21343
+ cropGroup.scale({
21344
+ x: 1,
21345
+ y: 1
21346
+ });
21347
+ }
21348
+ node.width(Math.max(5, node.width() * scale.x));
21349
+ node.height(Math.max(5, node.height() * scale.y));
21350
+ node.scale({
21351
+ x: 1,
21352
+ y: 1
21353
+ });
21354
+ this.instance.getMainLayer()?.batchDraw();
21129
21355
  }
21130
21356
  };
21131
21357
 
@@ -21140,10 +21366,7 @@ var WeaveStarNode = class extends WeaveNode {
21140
21366
  constructor(params) {
21141
21367
  super();
21142
21368
  const { config } = params ?? {};
21143
- this.config = { transform: {
21144
- ...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
21145
- ...config?.transform
21146
- } };
21369
+ this.config = { transform: { ...config?.transform } };
21147
21370
  }
21148
21371
  onRender(props) {
21149
21372
  const star = new konva.default.Star({
@@ -21156,9 +21379,10 @@ var WeaveStarNode = class extends WeaveNode {
21156
21379
  this.setupDefaultNodeAugmentation(star);
21157
21380
  star.getTransformerProperties = () => {
21158
21381
  const stage = this.instance.getStage();
21382
+ const baseConfig = this.defaultGetTransformerProperties(this.config.transform);
21159
21383
  const node = stage.findOne(`#${props.id}`);
21160
21384
  if (node && node.getAttrs().keepAspectRatio) return {
21161
- ...this.config.transform,
21385
+ ...baseConfig,
21162
21386
  enabledAnchors: [
21163
21387
  "top-left",
21164
21388
  "top-right",
@@ -21167,7 +21391,27 @@ var WeaveStarNode = class extends WeaveNode {
21167
21391
  ],
21168
21392
  keepRatio: true
21169
21393
  };
21170
- return this.config.transform;
21394
+ return baseConfig;
21395
+ };
21396
+ star.allowedAnchors = () => {
21397
+ const stage = this.instance.getStage();
21398
+ const actualStar = stage.findOne(`#${star.id()}`);
21399
+ if (actualStar.getAttrs().keepAspectRatio) return [
21400
+ "top-left",
21401
+ "top-right",
21402
+ "bottom-left",
21403
+ "bottom-right"
21404
+ ];
21405
+ return [
21406
+ "top-left",
21407
+ "top-center",
21408
+ "top-right",
21409
+ "middle-right",
21410
+ "middle-left",
21411
+ "bottom-left",
21412
+ "bottom-center",
21413
+ "bottom-right"
21414
+ ];
21171
21415
  };
21172
21416
  this.setupDefaultNodeEvents(star);
21173
21417
  return star;
@@ -21182,11 +21426,12 @@ var WeaveStarNode = class extends WeaveNode {
21182
21426
  }
21183
21427
  }
21184
21428
  scaleReset(node) {
21185
- const starNode = node;
21186
- starNode.innerRadius(Math.max(5, starNode.innerRadius() * starNode.scaleX()));
21187
- starNode.outerRadius(Math.max(5, starNode.outerRadius() * starNode.scaleY()));
21188
- node.scaleX(1);
21189
- node.scaleY(1);
21429
+ node.innerRadius(Math.max(5, node.innerRadius() * node.scaleX()));
21430
+ node.outerRadius(Math.max(5, node.outerRadius() * node.scaleY()));
21431
+ node.scale({
21432
+ x: 1,
21433
+ y: 1
21434
+ });
21190
21435
  }
21191
21436
  };
21192
21437
 
@@ -21201,10 +21446,7 @@ var WeaveArrowNode = class extends WeaveNode {
21201
21446
  constructor(params) {
21202
21447
  super();
21203
21448
  const { config } = params ?? {};
21204
- this.config = { transform: {
21205
- ...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
21206
- ...config?.transform
21207
- } };
21449
+ this.config = { transform: { ...config?.transform } };
21208
21450
  }
21209
21451
  onRender(props) {
21210
21452
  const line = new konva.default.Arrow({
@@ -21214,7 +21456,7 @@ var WeaveArrowNode = class extends WeaveNode {
21214
21456
  });
21215
21457
  this.setupDefaultNodeAugmentation(line);
21216
21458
  line.getTransformerProperties = () => {
21217
- return this.config.transform;
21459
+ return this.defaultGetTransformerProperties(this.config.transform);
21218
21460
  };
21219
21461
  this.setupDefaultNodeEvents(line);
21220
21462
  return line;
@@ -21225,23 +21467,22 @@ var WeaveArrowNode = class extends WeaveNode {
21225
21467
  if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
21226
21468
  }
21227
21469
  scaleReset(node) {
21228
- if (node.getAttrs().nodeType === "arrow") {
21229
- const arrowNode = node;
21230
- const oldPoints = arrowNode.points();
21231
- const newPoints = [];
21232
- for (let i = 0; i < oldPoints.length / 2; i++) {
21233
- const point = {
21234
- x: oldPoints[i * 2] * arrowNode.scaleX(),
21235
- y: oldPoints[i * 2 + 1] * arrowNode.scaleY()
21236
- };
21237
- newPoints.push(point.x, point.y);
21238
- }
21239
- arrowNode.points(newPoints);
21470
+ const oldPoints = node.points();
21471
+ const newPoints = [];
21472
+ for (let i = 0; i < oldPoints.length / 2; i++) {
21473
+ const point = {
21474
+ x: oldPoints[i * 2] * node.scaleX(),
21475
+ y: oldPoints[i * 2 + 1] * node.scaleY()
21476
+ };
21477
+ newPoints.push(point.x, point.y);
21240
21478
  }
21479
+ node.points(newPoints);
21241
21480
  node.width(Math.max(5, node.width() * node.scaleX()));
21242
21481
  node.height(Math.max(5, node.height() * node.scaleY()));
21243
- node.scaleX(1);
21244
- node.scaleY(1);
21482
+ node.scale({
21483
+ x: 1,
21484
+ y: 1
21485
+ });
21245
21486
  }
21246
21487
  };
21247
21488
 
@@ -21256,10 +21497,7 @@ var WeaveRegularPolygonNode = class extends WeaveNode {
21256
21497
  constructor(params) {
21257
21498
  super();
21258
21499
  const { config } = params ?? {};
21259
- this.config = { transform: {
21260
- ...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
21261
- ...config?.transform
21262
- } };
21500
+ this.config = { transform: { ...config?.transform } };
21263
21501
  }
21264
21502
  onRender(props) {
21265
21503
  const regularPolygon = new konva.default.RegularPolygon({
@@ -21270,8 +21508,9 @@ var WeaveRegularPolygonNode = class extends WeaveNode {
21270
21508
  });
21271
21509
  this.setupDefaultNodeAugmentation(regularPolygon);
21272
21510
  regularPolygon.getTransformerProperties = () => {
21511
+ const baseConfig = this.defaultGetTransformerProperties(this.config.transform);
21273
21512
  return {
21274
- ...this.config.transform,
21513
+ ...baseConfig,
21275
21514
  enabledAnchors: [
21276
21515
  "top-left",
21277
21516
  "top-right",
@@ -21281,6 +21520,14 @@ var WeaveRegularPolygonNode = class extends WeaveNode {
21281
21520
  keepRatio: true
21282
21521
  };
21283
21522
  };
21523
+ regularPolygon.allowedAnchors = () => {
21524
+ return [
21525
+ "top-left",
21526
+ "top-right",
21527
+ "bottom-left",
21528
+ "bottom-right"
21529
+ ];
21530
+ };
21284
21531
  this.setupDefaultNodeEvents(regularPolygon);
21285
21532
  return regularPolygon;
21286
21533
  }
@@ -21297,10 +21544,11 @@ var WeaveRegularPolygonNode = class extends WeaveNode {
21297
21544
  }
21298
21545
  }
21299
21546
  scaleReset(node) {
21300
- const regularPolygonNode = node;
21301
- regularPolygonNode.radius(Math.max(5, regularPolygonNode.radius() * regularPolygonNode.scaleX()));
21302
- node.scaleX(1);
21303
- node.scaleY(1);
21547
+ node.radius(Math.max(5, node.radius() * node.scaleX()));
21548
+ node.scale({
21549
+ x: 1,
21550
+ y: 1
21551
+ });
21304
21552
  }
21305
21553
  };
21306
21554
 
@@ -21327,7 +21575,7 @@ const WEAVE_FRAME_NODE_DEFAULT_CONFIG = {
21327
21575
  rotateEnabled: false,
21328
21576
  resizeEnabled: false,
21329
21577
  enabledAnchors: [],
21330
- borderStrokeWidth: 3,
21578
+ borderStrokeWidth: 2,
21331
21579
  padding: 0
21332
21580
  }
21333
21581
  };
@@ -21383,6 +21631,7 @@ var WeaveFrameNode = class extends WeaveNode {
21383
21631
  fill: "transparent",
21384
21632
  draggable: true,
21385
21633
  clip: void 0,
21634
+ allowScaling: false,
21386
21635
  name: "node containerCapable"
21387
21636
  });
21388
21637
  this.setupDefaultNodeAugmentation(frame);
@@ -21392,7 +21641,7 @@ var WeaveFrameNode = class extends WeaveNode {
21392
21641
  y: 0,
21393
21642
  width: props.frameWidth,
21394
21643
  height: props.frameHeight,
21395
- strokeScaleEnabled: true,
21644
+ strokeScaleEnabled: false,
21396
21645
  draggable: false
21397
21646
  });
21398
21647
  frame.add(frameInternalGroup);
@@ -21404,7 +21653,7 @@ var WeaveFrameNode = class extends WeaveNode {
21404
21653
  width: props.frameWidth,
21405
21654
  stroke: borderColor,
21406
21655
  strokeWidth: borderWidth,
21407
- strokeScaleEnabled: true,
21656
+ strokeScaleEnabled: false,
21408
21657
  shadowForStrokeEnabled: false,
21409
21658
  height: props.frameHeight,
21410
21659
  fill: "#ffffffff",
@@ -21412,30 +21661,33 @@ var WeaveFrameNode = class extends WeaveNode {
21412
21661
  draggable: false
21413
21662
  });
21414
21663
  frameInternalGroup.add(background);
21664
+ const stage = this.instance.getStage();
21415
21665
  const text = new konva.default.Text({
21416
21666
  id: `${id}-title`,
21417
21667
  x: 0,
21418
- width: props.frameWidth,
21419
- fontSize,
21668
+ width: props.frameWidth / stage.scaleX(),
21669
+ fontSize: fontSize / stage.scaleX(),
21420
21670
  fontFamily,
21421
21671
  fontStyle,
21672
+ verticalAlign: "middle",
21422
21673
  align: "left",
21423
21674
  text: props.title,
21424
21675
  fill: fontColor,
21425
21676
  strokeWidth: 0,
21426
- strokeScaleEnabled: true,
21677
+ strokeScaleEnabled: false,
21427
21678
  listening: false,
21428
21679
  draggable: false
21429
21680
  });
21430
21681
  const textMeasures = text.measureSize(text.getAttrs().text ?? "");
21431
- const textWidth = textMeasures.width;
21432
- const textHeight = textMeasures.height;
21433
- text.y(-textHeight - titleMargin);
21434
- text.width(textWidth);
21682
+ const textHeight = textMeasures.height + 2 * titleMargin / stage.scaleX();
21683
+ text.y(-textHeight);
21435
21684
  text.height(textHeight);
21436
21685
  frameInternalGroup.add(text);
21437
21686
  frame.getTransformerProperties = () => {
21438
- return this.config.transform;
21687
+ return this.defaultGetTransformerProperties(this.config.transform);
21688
+ };
21689
+ frame.allowedAnchors = () => {
21690
+ return [];
21439
21691
  };
21440
21692
  const frameInternal = new konva.default.Group({
21441
21693
  id: `${id}-group-internal`,
@@ -21444,7 +21696,7 @@ var WeaveFrameNode = class extends WeaveNode {
21444
21696
  y: borderWidth,
21445
21697
  width: props.frameWidth - borderWidth * 2,
21446
21698
  height: props.frameHeight - borderWidth * 2,
21447
- strokeScaleEnabled: true,
21699
+ strokeScaleEnabled: false,
21448
21700
  clipFunc: (ctx) => {
21449
21701
  const width = (frameInternal.width() + borderWidth) * frameInternal.scaleX();
21450
21702
  const height = (frameInternal.height() + borderWidth) * frameInternal.scaleY();
@@ -21463,7 +21715,7 @@ var WeaveFrameNode = class extends WeaveNode {
21463
21715
  height: props.frameHeight,
21464
21716
  hitFunc: function(ctx, shape) {
21465
21717
  ctx.beginPath();
21466
- ctx.rect(0, -textHeight - titleMargin, textWidth, textHeight);
21718
+ ctx.rect(0, -textHeight, props.frameWidth, textHeight);
21467
21719
  ctx.fillStrokeShape(shape);
21468
21720
  },
21469
21721
  fill: "transparent",
@@ -21484,6 +21736,7 @@ var WeaveFrameNode = class extends WeaveNode {
21484
21736
  ctx.fillStrokeShape(shape);
21485
21737
  },
21486
21738
  fill: "transparent",
21739
+ nodeId: id,
21487
21740
  id: `${id}-container-area`,
21488
21741
  listening: false,
21489
21742
  draggable: false
@@ -21503,6 +21756,20 @@ var WeaveFrameNode = class extends WeaveNode {
21503
21756
  selectionArea.off("dragmove");
21504
21757
  selectionArea.off("dragend");
21505
21758
  this.setupDefaultNodeEvents(frame);
21759
+ this.instance.addEventListener("onZoomChange", () => {
21760
+ const stage$1 = this.instance.getStage();
21761
+ text.fontSize(fontSize / stage$1.scaleX());
21762
+ text.width(props.frameWidth / stage$1.scaleX());
21763
+ const textMeasures$1 = text.measureSize(text.getAttrs().text ?? "");
21764
+ const textHeight$1 = textMeasures$1.height + 2 * titleMargin / stage$1.scaleX();
21765
+ text.y(-textHeight$1);
21766
+ text.height(textHeight$1);
21767
+ selectionArea.hitFunc(function(ctx, shape) {
21768
+ ctx.beginPath();
21769
+ ctx.rect(0, -textHeight$1, props.frameWidth, textHeight$1);
21770
+ ctx.fillStrokeShape(shape);
21771
+ });
21772
+ });
21506
21773
  frame.off("pointerover");
21507
21774
  frame.on(__inditextech_weave_types.WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, () => {
21508
21775
  background.setAttrs({
@@ -21536,14 +21803,12 @@ var WeaveFrameNode = class extends WeaveNode {
21536
21803
  if (title && selectionArea) {
21537
21804
  title.text(newProps.title);
21538
21805
  const textMeasures = title.measureSize(title.getAttrs().text ?? "");
21539
- const textWidth = textMeasures.width;
21540
- const textHeight = textMeasures.height;
21541
- title.y(-textHeight - titleMargin);
21542
- title.width(textWidth);
21806
+ const textHeight = textMeasures.height + 2 * titleMargin / stage.scaleX();
21807
+ title.y(-textHeight);
21543
21808
  title.height(textHeight);
21544
21809
  selectionArea.hitFunc(function(ctx, shape) {
21545
21810
  ctx.beginPath();
21546
- ctx.rect(0, -textHeight - titleMargin, textWidth, textHeight);
21811
+ ctx.rect(0, -textHeight, nextProps.frameWidth, textHeight);
21547
21812
  ctx.fillStrokeShape(shape);
21548
21813
  });
21549
21814
  }
@@ -21578,6 +21843,7 @@ var WeaveFrameNode = class extends WeaveNode {
21578
21843
  }
21579
21844
  };
21580
21845
  }
21846
+ scaleReset() {}
21581
21847
  };
21582
21848
 
21583
21849
  //#endregion
@@ -21591,10 +21857,7 @@ var WeaveStrokeNode = class extends WeaveNode {
21591
21857
  constructor(params) {
21592
21858
  super();
21593
21859
  const { config } = params ?? {};
21594
- this.config = { transform: {
21595
- ...__inditextech_weave_types.WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
21596
- ...config?.transform
21597
- } };
21860
+ this.config = { transform: { ...config?.transform } };
21598
21861
  }
21599
21862
  drawStroke(strokeElements, context, shape) {
21600
21863
  context.strokeStyle = shape.getAttrs().stroke ?? "black";
@@ -21639,7 +21902,7 @@ var WeaveStrokeNode = class extends WeaveNode {
21639
21902
  });
21640
21903
  this.setupDefaultNodeAugmentation(stroke);
21641
21904
  stroke.getTransformerProperties = () => {
21642
- return this.config.transform;
21905
+ return this.defaultGetTransformerProperties(this.config.transform);
21643
21906
  };
21644
21907
  this.setupDefaultNodeEvents(stroke);
21645
21908
  return stroke;
@@ -21664,8 +21927,10 @@ var WeaveStrokeNode = class extends WeaveNode {
21664
21927
  strokeNode.setAttrs({ strokeElements: newPoints });
21665
21928
  node.width(Math.max(5, node.width() * node.scaleX()));
21666
21929
  node.height(Math.max(5, node.height() * node.scaleY()));
21667
- node.scaleX(1);
21668
- node.scaleY(1);
21930
+ node.scale({
21931
+ x: 1,
21932
+ y: 1
21933
+ });
21669
21934
  }
21670
21935
  serialize(instance) {
21671
21936
  const attrs = instance.getAttrs();
@@ -24223,7 +24488,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
24223
24488
  this.tempRectNode = new konva.default.Rect({
24224
24489
  ...this.props,
24225
24490
  id: this.rectId,
24226
- strokeScaleEnabled: true,
24491
+ strokeScaleEnabled: false,
24227
24492
  x: this.clickPoint?.x ?? 0,
24228
24493
  y: this.clickPoint?.y ?? 0,
24229
24494
  width: 0,
@@ -24425,7 +24690,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
24425
24690
  if (nodeHandler) {
24426
24691
  const node = nodeHandler.create(this.ellipseId, {
24427
24692
  ...this.props,
24428
- strokeScaleEnabled: true,
24693
+ strokeScaleEnabled: false,
24429
24694
  x: this.clickPoint?.x ?? 0 + this.props.radiusX,
24430
24695
  y: this.clickPoint?.y ?? 0 + this.props.radiusY,
24431
24696
  radiusX: 0,
@@ -24625,7 +24890,7 @@ var WeavePenToolAction = class extends WeaveAction {
24625
24890
  this.tempMainLineNode = new konva.default.Line({
24626
24891
  ...this.props,
24627
24892
  id: this.lineId,
24628
- strokeScaleEnabled: true,
24893
+ strokeScaleEnabled: false,
24629
24894
  x: this.clickPoint?.x ?? 0,
24630
24895
  y: this.clickPoint?.y ?? 0,
24631
24896
  points: [0, 0]
@@ -24635,7 +24900,7 @@ var WeavePenToolAction = class extends WeaveAction {
24635
24900
  x: this.clickPoint?.x ?? 0,
24636
24901
  y: this.clickPoint?.y ?? 0,
24637
24902
  radius: 5 / stage.scaleX(),
24638
- strokeScaleEnabled: true,
24903
+ strokeScaleEnabled: false,
24639
24904
  stroke: "#cccccc",
24640
24905
  strokeWidth: 0,
24641
24906
  fill: "#cccccc"
@@ -24646,7 +24911,7 @@ var WeavePenToolAction = class extends WeaveAction {
24646
24911
  id: this.tempLineId,
24647
24912
  x: this.clickPoint?.x ?? 0,
24648
24913
  y: this.clickPoint?.y ?? 0,
24649
- strokeScaleEnabled: true,
24914
+ strokeScaleEnabled: false,
24650
24915
  points: [0, 0]
24651
24916
  });
24652
24917
  this.measureContainer?.add(this.tempLineNode);
@@ -24654,7 +24919,7 @@ var WeavePenToolAction = class extends WeaveAction {
24654
24919
  x: this.clickPoint?.x ?? 0,
24655
24920
  y: this.clickPoint?.y ?? 0,
24656
24921
  radius: 5 / stage.scaleX(),
24657
- strokeScaleEnabled: true,
24922
+ strokeScaleEnabled: false,
24658
24923
  stroke: "#cccccc",
24659
24924
  strokeWidth: 0,
24660
24925
  fill: "#cccccc"
@@ -24878,7 +25143,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
24878
25143
  if (nodeHandler) {
24879
25144
  const node = nodeHandler.create(this.strokeId, {
24880
25145
  ...this.props,
24881
- strokeScaleEnabled: true,
25146
+ strokeScaleEnabled: false,
24882
25147
  x: 0,
24883
25148
  y: 0,
24884
25149
  width: 0,
@@ -25200,7 +25465,7 @@ var WeaveStarToolAction = class extends WeaveAction {
25200
25465
  if (nodeHandler) {
25201
25466
  const node = nodeHandler.create(this.starId, {
25202
25467
  ...this.props,
25203
- strokeScaleEnabled: true,
25468
+ strokeScaleEnabled: false,
25204
25469
  x: this.clickPoint?.x ?? 0 + this.props.outerRadius,
25205
25470
  y: this.clickPoint?.y ?? 0 + this.props.outerRadius,
25206
25471
  numPoints: 5,
@@ -25406,7 +25671,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
25406
25671
  this.tempMainArrowNode = new konva.default.Line({
25407
25672
  ...this.props,
25408
25673
  id: this.arrowId,
25409
- strokeScaleEnabled: true,
25674
+ strokeScaleEnabled: false,
25410
25675
  x: this.clickPoint?.x ?? 0,
25411
25676
  y: this.clickPoint?.y ?? 0,
25412
25677
  points: [0, 0]
@@ -25416,7 +25681,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
25416
25681
  x: this.clickPoint?.x ?? 0,
25417
25682
  y: this.clickPoint?.y ?? 0,
25418
25683
  radius: 5 / stage.scaleX(),
25419
- strokeScaleEnabled: true,
25684
+ strokeScaleEnabled: false,
25420
25685
  stroke: "#cccccc",
25421
25686
  strokeWidth: 0,
25422
25687
  fill: "#cccccc"
@@ -25425,7 +25690,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
25425
25690
  this.tempArrowNode = new konva.default.Arrow({
25426
25691
  ...this.props,
25427
25692
  id: this.tempArrowId,
25428
- strokeScaleEnabled: true,
25693
+ strokeScaleEnabled: false,
25429
25694
  x: this.clickPoint?.x ?? 0,
25430
25695
  y: this.clickPoint?.y ?? 0,
25431
25696
  points: [0, 0]
@@ -25435,7 +25700,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
25435
25700
  x: this.clickPoint?.x ?? 0,
25436
25701
  y: this.clickPoint?.y ?? 0,
25437
25702
  radius: 5 / stage.scaleX(),
25438
- strokeScaleEnabled: true,
25703
+ strokeScaleEnabled: false,
25439
25704
  stroke: "#cccccc",
25440
25705
  strokeWidth: 0,
25441
25706
  fill: "#cccccc"
@@ -25653,7 +25918,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
25653
25918
  if (nodeHandler) {
25654
25919
  const node = nodeHandler.create(this.regularPolygonId, {
25655
25920
  ...this.props,
25656
- strokeScaleEnabled: true,
25921
+ strokeScaleEnabled: false,
25657
25922
  x: (this.clickPoint?.x ?? 0) + this.props.radius,
25658
25923
  y: (this.clickPoint?.y ?? 0) + this.props.radius,
25659
25924
  radius: 0
@@ -27741,11 +28006,14 @@ exports.WeaveUsersPointersPlugin = WeaveUsersPointersPlugin
27741
28006
  exports.WeaveUsersSelectionPlugin = WeaveUsersSelectionPlugin
27742
28007
  exports.WeaveZoomInToolAction = WeaveZoomInToolAction
27743
28008
  exports.WeaveZoomOutToolAction = WeaveZoomOutToolAction
27744
- exports.checkIfOverContainer = checkIfOverContainer
27745
28009
  exports.clearContainerTargets = clearContainerTargets
28010
+ exports.containerOverCursor = containerOverCursor
27746
28011
  exports.getBoundingBox = getBoundingBox
27747
28012
  exports.getContrastTextColor = getContrastTextColor
27748
28013
  exports.getTargetedNode = getTargetedNode
28014
+ exports.hasFrames = hasFrames
28015
+ exports.hasImages = hasImages
28016
+ exports.intersectArrays = intersectArrays
27749
28017
  exports.moveNodeToContainer = moveNodeToContainer
27750
28018
  exports.resetScale = resetScale
27751
28019
  exports.stringToColor = stringToColor