@inditextech/weave-sdk 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/sdk.cjs +43 -31
  2. package/dist/sdk.js +43 -31
  3. package/package.json +2 -2
package/dist/sdk.cjs CHANGED
@@ -15754,6 +15754,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
15754
15754
  rotationSnapTolerance: 3,
15755
15755
  ignoreStroke: true,
15756
15756
  flipEnabled: false,
15757
+ keepRatio: false,
15757
15758
  useSingleNodeRotation: true,
15758
15759
  shouldOverdrawWholeArea: true,
15759
15760
  anchorStyleFunc: (anchor) => {
@@ -17806,7 +17807,7 @@ var WeaveRegisterManager = class {
17806
17807
 
17807
17808
  //#endregion
17808
17809
  //#region package.json
17809
- var version = "0.6.0";
17810
+ var version = "0.7.1";
17810
17811
 
17811
17812
  //#endregion
17812
17813
  //#region src/managers/setup.ts
@@ -18958,6 +18959,7 @@ var WeaveImageToolAction = class extends WeaveAction {
18958
18959
  imageURL: this.imageURL,
18959
18960
  stroke: "#000000ff",
18960
18961
  strokeWidth: 0,
18962
+ strokeScaleEnabled: false,
18961
18963
  imageInfo: {
18962
18964
  width: this.preloadImgs[this.imageId].width,
18963
18965
  height: this.preloadImgs[this.imageId].height
@@ -19571,6 +19573,7 @@ var WeaveFrameNode = class extends WeaveNode {
19571
19573
  width: props.frameWidth,
19572
19574
  stroke: props.borderColor,
19573
19575
  strokeWidth: props.borderWidth,
19576
+ strokeScaleEnabled: false,
19574
19577
  height: props.frameHeight,
19575
19578
  fill: "#ffffffff",
19576
19579
  draggable: false
@@ -19588,6 +19591,7 @@ var WeaveFrameNode = class extends WeaveNode {
19588
19591
  text: props.title,
19589
19592
  stroke: "#000000ff",
19590
19593
  strokeWidth: 1,
19594
+ strokeScaleEnabled: false,
19591
19595
  listening: false,
19592
19596
  draggable: false
19593
19597
  });
@@ -19601,6 +19605,7 @@ var WeaveFrameNode = class extends WeaveNode {
19601
19605
  height: props.frameHeight,
19602
19606
  draggable: false,
19603
19607
  stroke: "transparent",
19608
+ strokeScaleEnabled: false,
19604
19609
  borderWidth: props.borderWidth,
19605
19610
  clipX: 0,
19606
19611
  clipY: 0,
@@ -20179,6 +20184,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
20179
20184
  const nodeHandler = this.instance.getNodeHandler("rectangle");
20180
20185
  const node = nodeHandler.create(this.rectId, {
20181
20186
  ...this.props,
20187
+ strokeScaleEnabled: false,
20182
20188
  x: this.clickPoint?.x ?? 0,
20183
20189
  y: this.clickPoint?.y ?? 0,
20184
20190
  width: 0,
@@ -20343,6 +20349,7 @@ var WeavePenToolAction = class extends WeaveAction {
20343
20349
  const nodeHandler = this.instance.getNodeHandler("line");
20344
20350
  const node = nodeHandler.create(this.lineId, {
20345
20351
  ...this.props,
20352
+ strokeScaleEnabled: false,
20346
20353
  x: this.clickPoint?.x ?? 0,
20347
20354
  y: this.clickPoint?.y ?? 0,
20348
20355
  points: [0, 0]
@@ -20352,6 +20359,7 @@ var WeavePenToolAction = class extends WeaveAction {
20352
20359
  x: this.clickPoint?.x ?? 0,
20353
20360
  y: this.clickPoint?.y ?? 0,
20354
20361
  radius: 5 / stage.scaleX(),
20362
+ strokeScaleEnabled: false,
20355
20363
  stroke: "#cccccc",
20356
20364
  strokeWidth: 0,
20357
20365
  fill: "#cccccc"
@@ -20368,6 +20376,7 @@ var WeavePenToolAction = class extends WeaveAction {
20368
20376
  x: this.clickPoint?.x ?? 0,
20369
20377
  y: this.clickPoint?.y ?? 0,
20370
20378
  radius: 5 / stage.scaleX(),
20379
+ strokeScaleEnabled: false,
20371
20380
  stroke: "#cccccc",
20372
20381
  strokeWidth: 0,
20373
20382
  fill: "#cccccc"
@@ -20560,6 +20569,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
20560
20569
  const nodeHandler = this.instance.getNodeHandler("line");
20561
20570
  const node = nodeHandler.create(this.strokeId, {
20562
20571
  ...this.props,
20572
+ strokeScaleEnabled: false,
20563
20573
  x: this.clickPoint?.x ?? 0,
20564
20574
  y: this.clickPoint?.y ?? 0,
20565
20575
  points: [0, 0]
@@ -20705,6 +20715,7 @@ var WeaveTextToolAction = class extends WeaveAction {
20705
20715
  strokeEnabled: false,
20706
20716
  stroke: "#000000ff",
20707
20717
  strokeWidth: 1,
20718
+ strokeScaleEnabled: false,
20708
20719
  align: "left",
20709
20720
  verticalAlign: "top",
20710
20721
  opacity: 1,
@@ -21671,9 +21682,9 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21671
21682
  this.enabled = enabled;
21672
21683
  }
21673
21684
  evaluateGuidelines(e) {
21674
- const mainLayer = this.instance.getMainLayer();
21685
+ const utilityLayer = this.instance.getUtilityLayer();
21675
21686
  if (!this.enabled) return;
21676
- if (!mainLayer) return;
21687
+ if (!utilityLayer) return;
21677
21688
  let node = void 0;
21678
21689
  if (e.type === "dragmove" && e.target instanceof konva.default.Transformer) {
21679
21690
  const actualTarget = e.target;
@@ -21681,11 +21692,11 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21681
21692
  }
21682
21693
  if (e.type === "transform") node = e.target;
21683
21694
  if (typeof node === "undefined") return;
21684
- mainLayer.find(`.${GUIDE_LINE_NAME}`).forEach((l) => l.destroy());
21685
21695
  const lineGuideStops = this.getLineGuideStops(node);
21686
21696
  const itemBounds = this.getObjectSnappingEdges(node);
21687
21697
  const guides = this.getGuides(lineGuideStops, itemBounds, e.type);
21688
21698
  if (!guides.length) return;
21699
+ utilityLayer.find(`.${GUIDE_LINE_NAME}`).forEach((l) => l.destroy());
21689
21700
  this.drawGuides(guides);
21690
21701
  if (e.type === "dragmove") {
21691
21702
  const absPos = node.absolutePosition();
@@ -21709,41 +21720,41 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21709
21720
  const transformer = nodesSelectionPlugin.getTransformer();
21710
21721
  transformer.anchorDragBoundFunc((_, newAbsPos) => {
21711
21722
  const finalPos = { ...newAbsPos };
21712
- guides.forEach((lg) => {
21713
- switch (lg.orientation) {
21714
- case GUIDE_ORIENTATION.VERTICAL: {
21715
- const distX = Math.sqrt(Math.pow(newAbsPos.x - lg.lineGuide, 2));
21716
- if (distX < this.transformSnappingThreshold) finalPos.x = lg.lineGuide;
21717
- break;
21718
- }
21719
- case GUIDE_ORIENTATION.HORIZONTAL: {
21720
- const distY = Math.sqrt(Math.pow(newAbsPos.y - lg.lineGuide, 2));
21721
- if (distY < this.transformSnappingThreshold) finalPos.y = lg.lineGuide;
21722
- break;
21723
- }
21723
+ for (const lg of guides) switch (lg.orientation) {
21724
+ case GUIDE_ORIENTATION.VERTICAL: {
21725
+ const distX = Math.sqrt(Math.pow(newAbsPos.x - lg.lineGuide, 2));
21726
+ if (distX < this.transformSnappingThreshold) finalPos.x = lg.lineGuide;
21727
+ break;
21724
21728
  }
21725
- });
21729
+ case GUIDE_ORIENTATION.HORIZONTAL: {
21730
+ const distY = Math.sqrt(Math.pow(newAbsPos.y - lg.lineGuide, 2));
21731
+ if (distY < this.transformSnappingThreshold) finalPos.y = lg.lineGuide;
21732
+ break;
21733
+ }
21734
+ }
21726
21735
  return finalPos;
21727
21736
  });
21728
21737
  }
21729
21738
  }
21730
21739
  }
21731
21740
  cleanupEvaluateGuidelines() {
21732
- const mainLayer = this.instance.getMainLayer();
21741
+ const utilityLayer = this.instance.getUtilityLayer();
21733
21742
  if (!this.enabled) return;
21734
- if (!mainLayer) return;
21735
- mainLayer.find(`.${GUIDE_LINE_NAME}`).forEach((l) => l.destroy());
21743
+ if (!utilityLayer) return;
21744
+ utilityLayer.find(`.${GUIDE_LINE_NAME}`).forEach((l) => l.destroy());
21736
21745
  }
21737
21746
  initEvents() {
21738
21747
  const stage = this.instance.getStage();
21739
- const mainLayer = this.instance.getMainLayer();
21740
- if (mainLayer) {
21748
+ const utilityLayer = this.instance.getUtilityLayer();
21749
+ if (utilityLayer) {
21741
21750
  stage.on("dragmove", this.evaluateGuidelines.bind(this));
21742
21751
  stage.on("dragend", this.cleanupEvaluateGuidelines.bind(this));
21743
21752
  }
21744
21753
  }
21745
21754
  getLineGuideStops(skipShape) {
21746
21755
  const stage = this.instance.getStage();
21756
+ const nodesSelection = this.instance.getPlugin("nodesSelection");
21757
+ if (nodesSelection) nodesSelection.getTransformer().hide();
21747
21758
  const vertical = [
21748
21759
  0,
21749
21760
  stage.width() / 2,
@@ -21756,7 +21767,7 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21756
21767
  ];
21757
21768
  stage.find(".node").forEach((guideItem) => {
21758
21769
  if (guideItem === skipShape) return;
21759
- const box = guideItem.getClientRect();
21770
+ const box = guideItem.getClientRect({ skipStroke: true });
21760
21771
  vertical.push([
21761
21772
  box.x,
21762
21773
  box.x + box.width,
@@ -21768,28 +21779,29 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21768
21779
  box.y + box.height / 2
21769
21780
  ]);
21770
21781
  });
21782
+ if (nodesSelection) nodesSelection.getTransformer().show();
21771
21783
  return {
21772
21784
  vertical: vertical.flat(),
21773
21785
  horizontal: horizontal.flat()
21774
21786
  };
21775
21787
  }
21776
21788
  getObjectSnappingEdges(node) {
21777
- const box = node.getClientRect();
21789
+ const box = node.getClientRect({ skipStroke: true });
21778
21790
  const absPos = node.absolutePosition();
21779
21791
  const snappingEdges = {
21780
21792
  vertical: [
21781
21793
  {
21782
- guide: Math.round(box.x),
21794
+ guide: box.x,
21783
21795
  offset: Math.round(absPos.x - box.x),
21784
21796
  snap: NODE_SNAP.START
21785
21797
  },
21786
21798
  {
21787
- guide: Math.round(box.x + box.width / 2),
21799
+ guide: box.x + box.width / 2,
21788
21800
  offset: Math.round(absPos.x - box.x - box.width / 2),
21789
21801
  snap: NODE_SNAP.CENTER
21790
21802
  },
21791
21803
  {
21792
- guide: Math.round(box.x + box.width),
21804
+ guide: box.x + box.width,
21793
21805
  offset: Math.round(absPos.x - box.x - box.width),
21794
21806
  snap: NODE_SNAP.END
21795
21807
  }
@@ -21878,8 +21890,8 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21878
21890
  }
21879
21891
  drawGuides(guides) {
21880
21892
  const stage = this.instance.getStage();
21881
- const mainLayer = this.instance.getMainLayer();
21882
- if (mainLayer) guides.forEach((lg) => {
21893
+ const utilityLayer = this.instance.getUtilityLayer();
21894
+ if (utilityLayer) guides.forEach((lg) => {
21883
21895
  if (lg.orientation === GUIDE_ORIENTATION.HORIZONTAL) {
21884
21896
  const line = new konva.default.Line({
21885
21897
  ...this.guideLineConfig,
@@ -21893,7 +21905,7 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21893
21905
  ],
21894
21906
  name: GUIDE_LINE_NAME
21895
21907
  });
21896
- mainLayer.add(line);
21908
+ utilityLayer.add(line);
21897
21909
  line.absolutePosition({
21898
21910
  x: 0,
21899
21911
  y: lg.lineGuide
@@ -21912,7 +21924,7 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21912
21924
  ],
21913
21925
  name: GUIDE_LINE_NAME
21914
21926
  });
21915
- mainLayer.add(line);
21927
+ utilityLayer.add(line);
21916
21928
  line.absolutePosition({
21917
21929
  x: lg.lineGuide,
21918
21930
  y: 0
package/dist/sdk.js CHANGED
@@ -15754,6 +15754,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
15754
15754
  rotationSnapTolerance: 3,
15755
15755
  ignoreStroke: true,
15756
15756
  flipEnabled: false,
15757
+ keepRatio: false,
15757
15758
  useSingleNodeRotation: true,
15758
15759
  shouldOverdrawWholeArea: true,
15759
15760
  anchorStyleFunc: (anchor) => {
@@ -17806,7 +17807,7 @@ var WeaveRegisterManager = class {
17806
17807
 
17807
17808
  //#endregion
17808
17809
  //#region package.json
17809
- var version = "0.6.0";
17810
+ var version = "0.7.1";
17810
17811
 
17811
17812
  //#endregion
17812
17813
  //#region src/managers/setup.ts
@@ -18958,6 +18959,7 @@ var WeaveImageToolAction = class extends WeaveAction {
18958
18959
  imageURL: this.imageURL,
18959
18960
  stroke: "#000000ff",
18960
18961
  strokeWidth: 0,
18962
+ strokeScaleEnabled: false,
18961
18963
  imageInfo: {
18962
18964
  width: this.preloadImgs[this.imageId].width,
18963
18965
  height: this.preloadImgs[this.imageId].height
@@ -19571,6 +19573,7 @@ var WeaveFrameNode = class extends WeaveNode {
19571
19573
  width: props.frameWidth,
19572
19574
  stroke: props.borderColor,
19573
19575
  strokeWidth: props.borderWidth,
19576
+ strokeScaleEnabled: false,
19574
19577
  height: props.frameHeight,
19575
19578
  fill: "#ffffffff",
19576
19579
  draggable: false
@@ -19588,6 +19591,7 @@ var WeaveFrameNode = class extends WeaveNode {
19588
19591
  text: props.title,
19589
19592
  stroke: "#000000ff",
19590
19593
  strokeWidth: 1,
19594
+ strokeScaleEnabled: false,
19591
19595
  listening: false,
19592
19596
  draggable: false
19593
19597
  });
@@ -19601,6 +19605,7 @@ var WeaveFrameNode = class extends WeaveNode {
19601
19605
  height: props.frameHeight,
19602
19606
  draggable: false,
19603
19607
  stroke: "transparent",
19608
+ strokeScaleEnabled: false,
19604
19609
  borderWidth: props.borderWidth,
19605
19610
  clipX: 0,
19606
19611
  clipY: 0,
@@ -20179,6 +20184,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
20179
20184
  const nodeHandler = this.instance.getNodeHandler("rectangle");
20180
20185
  const node = nodeHandler.create(this.rectId, {
20181
20186
  ...this.props,
20187
+ strokeScaleEnabled: false,
20182
20188
  x: this.clickPoint?.x ?? 0,
20183
20189
  y: this.clickPoint?.y ?? 0,
20184
20190
  width: 0,
@@ -20343,6 +20349,7 @@ var WeavePenToolAction = class extends WeaveAction {
20343
20349
  const nodeHandler = this.instance.getNodeHandler("line");
20344
20350
  const node = nodeHandler.create(this.lineId, {
20345
20351
  ...this.props,
20352
+ strokeScaleEnabled: false,
20346
20353
  x: this.clickPoint?.x ?? 0,
20347
20354
  y: this.clickPoint?.y ?? 0,
20348
20355
  points: [0, 0]
@@ -20352,6 +20359,7 @@ var WeavePenToolAction = class extends WeaveAction {
20352
20359
  x: this.clickPoint?.x ?? 0,
20353
20360
  y: this.clickPoint?.y ?? 0,
20354
20361
  radius: 5 / stage.scaleX(),
20362
+ strokeScaleEnabled: false,
20355
20363
  stroke: "#cccccc",
20356
20364
  strokeWidth: 0,
20357
20365
  fill: "#cccccc"
@@ -20368,6 +20376,7 @@ var WeavePenToolAction = class extends WeaveAction {
20368
20376
  x: this.clickPoint?.x ?? 0,
20369
20377
  y: this.clickPoint?.y ?? 0,
20370
20378
  radius: 5 / stage.scaleX(),
20379
+ strokeScaleEnabled: false,
20371
20380
  stroke: "#cccccc",
20372
20381
  strokeWidth: 0,
20373
20382
  fill: "#cccccc"
@@ -20560,6 +20569,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
20560
20569
  const nodeHandler = this.instance.getNodeHandler("line");
20561
20570
  const node = nodeHandler.create(this.strokeId, {
20562
20571
  ...this.props,
20572
+ strokeScaleEnabled: false,
20563
20573
  x: this.clickPoint?.x ?? 0,
20564
20574
  y: this.clickPoint?.y ?? 0,
20565
20575
  points: [0, 0]
@@ -20705,6 +20715,7 @@ var WeaveTextToolAction = class extends WeaveAction {
20705
20715
  strokeEnabled: false,
20706
20716
  stroke: "#000000ff",
20707
20717
  strokeWidth: 1,
20718
+ strokeScaleEnabled: false,
20708
20719
  align: "left",
20709
20720
  verticalAlign: "top",
20710
20721
  opacity: 1,
@@ -21671,9 +21682,9 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21671
21682
  this.enabled = enabled;
21672
21683
  }
21673
21684
  evaluateGuidelines(e) {
21674
- const mainLayer = this.instance.getMainLayer();
21685
+ const utilityLayer = this.instance.getUtilityLayer();
21675
21686
  if (!this.enabled) return;
21676
- if (!mainLayer) return;
21687
+ if (!utilityLayer) return;
21677
21688
  let node = void 0;
21678
21689
  if (e.type === "dragmove" && e.target instanceof Konva.Transformer) {
21679
21690
  const actualTarget = e.target;
@@ -21681,11 +21692,11 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21681
21692
  }
21682
21693
  if (e.type === "transform") node = e.target;
21683
21694
  if (typeof node === "undefined") return;
21684
- mainLayer.find(`.${GUIDE_LINE_NAME}`).forEach((l) => l.destroy());
21685
21695
  const lineGuideStops = this.getLineGuideStops(node);
21686
21696
  const itemBounds = this.getObjectSnappingEdges(node);
21687
21697
  const guides = this.getGuides(lineGuideStops, itemBounds, e.type);
21688
21698
  if (!guides.length) return;
21699
+ utilityLayer.find(`.${GUIDE_LINE_NAME}`).forEach((l) => l.destroy());
21689
21700
  this.drawGuides(guides);
21690
21701
  if (e.type === "dragmove") {
21691
21702
  const absPos = node.absolutePosition();
@@ -21709,41 +21720,41 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21709
21720
  const transformer = nodesSelectionPlugin.getTransformer();
21710
21721
  transformer.anchorDragBoundFunc((_, newAbsPos) => {
21711
21722
  const finalPos = { ...newAbsPos };
21712
- guides.forEach((lg) => {
21713
- switch (lg.orientation) {
21714
- case GUIDE_ORIENTATION.VERTICAL: {
21715
- const distX = Math.sqrt(Math.pow(newAbsPos.x - lg.lineGuide, 2));
21716
- if (distX < this.transformSnappingThreshold) finalPos.x = lg.lineGuide;
21717
- break;
21718
- }
21719
- case GUIDE_ORIENTATION.HORIZONTAL: {
21720
- const distY = Math.sqrt(Math.pow(newAbsPos.y - lg.lineGuide, 2));
21721
- if (distY < this.transformSnappingThreshold) finalPos.y = lg.lineGuide;
21722
- break;
21723
- }
21723
+ for (const lg of guides) switch (lg.orientation) {
21724
+ case GUIDE_ORIENTATION.VERTICAL: {
21725
+ const distX = Math.sqrt(Math.pow(newAbsPos.x - lg.lineGuide, 2));
21726
+ if (distX < this.transformSnappingThreshold) finalPos.x = lg.lineGuide;
21727
+ break;
21724
21728
  }
21725
- });
21729
+ case GUIDE_ORIENTATION.HORIZONTAL: {
21730
+ const distY = Math.sqrt(Math.pow(newAbsPos.y - lg.lineGuide, 2));
21731
+ if (distY < this.transformSnappingThreshold) finalPos.y = lg.lineGuide;
21732
+ break;
21733
+ }
21734
+ }
21726
21735
  return finalPos;
21727
21736
  });
21728
21737
  }
21729
21738
  }
21730
21739
  }
21731
21740
  cleanupEvaluateGuidelines() {
21732
- const mainLayer = this.instance.getMainLayer();
21741
+ const utilityLayer = this.instance.getUtilityLayer();
21733
21742
  if (!this.enabled) return;
21734
- if (!mainLayer) return;
21735
- mainLayer.find(`.${GUIDE_LINE_NAME}`).forEach((l) => l.destroy());
21743
+ if (!utilityLayer) return;
21744
+ utilityLayer.find(`.${GUIDE_LINE_NAME}`).forEach((l) => l.destroy());
21736
21745
  }
21737
21746
  initEvents() {
21738
21747
  const stage = this.instance.getStage();
21739
- const mainLayer = this.instance.getMainLayer();
21740
- if (mainLayer) {
21748
+ const utilityLayer = this.instance.getUtilityLayer();
21749
+ if (utilityLayer) {
21741
21750
  stage.on("dragmove", this.evaluateGuidelines.bind(this));
21742
21751
  stage.on("dragend", this.cleanupEvaluateGuidelines.bind(this));
21743
21752
  }
21744
21753
  }
21745
21754
  getLineGuideStops(skipShape) {
21746
21755
  const stage = this.instance.getStage();
21756
+ const nodesSelection = this.instance.getPlugin("nodesSelection");
21757
+ if (nodesSelection) nodesSelection.getTransformer().hide();
21747
21758
  const vertical = [
21748
21759
  0,
21749
21760
  stage.width() / 2,
@@ -21756,7 +21767,7 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21756
21767
  ];
21757
21768
  stage.find(".node").forEach((guideItem) => {
21758
21769
  if (guideItem === skipShape) return;
21759
- const box = guideItem.getClientRect();
21770
+ const box = guideItem.getClientRect({ skipStroke: true });
21760
21771
  vertical.push([
21761
21772
  box.x,
21762
21773
  box.x + box.width,
@@ -21768,28 +21779,29 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21768
21779
  box.y + box.height / 2
21769
21780
  ]);
21770
21781
  });
21782
+ if (nodesSelection) nodesSelection.getTransformer().show();
21771
21783
  return {
21772
21784
  vertical: vertical.flat(),
21773
21785
  horizontal: horizontal.flat()
21774
21786
  };
21775
21787
  }
21776
21788
  getObjectSnappingEdges(node) {
21777
- const box = node.getClientRect();
21789
+ const box = node.getClientRect({ skipStroke: true });
21778
21790
  const absPos = node.absolutePosition();
21779
21791
  const snappingEdges = {
21780
21792
  vertical: [
21781
21793
  {
21782
- guide: Math.round(box.x),
21794
+ guide: box.x,
21783
21795
  offset: Math.round(absPos.x - box.x),
21784
21796
  snap: NODE_SNAP.START
21785
21797
  },
21786
21798
  {
21787
- guide: Math.round(box.x + box.width / 2),
21799
+ guide: box.x + box.width / 2,
21788
21800
  offset: Math.round(absPos.x - box.x - box.width / 2),
21789
21801
  snap: NODE_SNAP.CENTER
21790
21802
  },
21791
21803
  {
21792
- guide: Math.round(box.x + box.width),
21804
+ guide: box.x + box.width,
21793
21805
  offset: Math.round(absPos.x - box.x - box.width),
21794
21806
  snap: NODE_SNAP.END
21795
21807
  }
@@ -21878,8 +21890,8 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21878
21890
  }
21879
21891
  drawGuides(guides) {
21880
21892
  const stage = this.instance.getStage();
21881
- const mainLayer = this.instance.getMainLayer();
21882
- if (mainLayer) guides.forEach((lg) => {
21893
+ const utilityLayer = this.instance.getUtilityLayer();
21894
+ if (utilityLayer) guides.forEach((lg) => {
21883
21895
  if (lg.orientation === GUIDE_ORIENTATION.HORIZONTAL) {
21884
21896
  const line = new Konva.Line({
21885
21897
  ...this.guideLineConfig,
@@ -21893,7 +21905,7 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21893
21905
  ],
21894
21906
  name: GUIDE_LINE_NAME
21895
21907
  });
21896
- mainLayer.add(line);
21908
+ utilityLayer.add(line);
21897
21909
  line.absolutePosition({
21898
21910
  x: 0,
21899
21911
  y: lg.lineGuide
@@ -21912,7 +21924,7 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
21912
21924
  ],
21913
21925
  name: GUIDE_LINE_NAME
21914
21926
  });
21915
- mainLayer.add(line);
21927
+ utilityLayer.add(line);
21916
21928
  line.absolutePosition({
21917
21929
  x: lg.lineGuide,
21918
21930
  y: 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inditextech/weave-sdk",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>",
@@ -43,7 +43,7 @@
43
43
  "version:release": "npm version $RELEASE_VERSION -m \"[npm-scripts] prepare release $RELEASE_VERSION\" --tag-version-prefix \"\""
44
44
  },
45
45
  "dependencies": {
46
- "@inditextech/weave-types": "0.6.0",
46
+ "@inditextech/weave-types": "0.7.1",
47
47
  "@syncedstore/core": "0.6.0",
48
48
  "canvas": "3.1.0",
49
49
  "konva": "9.3.20",