@inditextech/weave-sdk 3.2.4 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk.js CHANGED
@@ -21971,7 +21971,7 @@ var WeaveRegisterManager = class {
21971
21971
 
21972
21972
  //#endregion
21973
21973
  //#region package.json
21974
- var version = "3.2.4";
21974
+ var version = "3.3.0";
21975
21975
 
21976
21976
  //#endregion
21977
21977
  //#region src/managers/setup.ts
@@ -24139,11 +24139,15 @@ var GreedySnapper = class {
24139
24139
  reset() {
24140
24140
  this.snappedAngle = null;
24141
24141
  }
24142
+ angleDiff(a, b) {
24143
+ const diff = Math.abs(a - b) % 360;
24144
+ return diff > 180 ? 360 - diff : diff;
24145
+ }
24142
24146
  apply(angleDeg) {
24143
24147
  const { snapAngles, activateThreshold, releaseThreshold } = this.config;
24144
24148
  const normalized = (angleDeg % 360 + 360) % 360;
24145
24149
  if (this.snappedAngle !== null) {
24146
- const diff = Math.abs(normalized - this.snappedAngle);
24150
+ const diff = this.angleDiff(normalized, this.snappedAngle);
24147
24151
  if (diff > releaseThreshold) {
24148
24152
  this.snappedAngle = null;
24149
24153
  return normalized;
@@ -25751,12 +25755,14 @@ const doPreloadCursors = async (cursorsToPreload, setCursor, getFallbackCursor,
25751
25755
  const cursorUrls = [];
25752
25756
  for (const cursorKey of cursors) {
25753
25757
  const cursorValue = cursorsToPreload[cursorKey];
25754
- const { preload, cursor } = extractCursorUrl(cursorValue);
25755
- if (preload) cursorUrls.push({
25756
- state: cursorKey,
25757
- value: cursorValue,
25758
- src: cursor
25759
- });
25758
+ if (hasValidUrl(cursorValue)) {
25759
+ const { preload, cursor } = extractCursorUrl(cursorValue);
25760
+ if (preload) cursorUrls.push({
25761
+ state: cursorKey,
25762
+ value: cursorValue,
25763
+ src: cursor
25764
+ });
25765
+ } else setCursor(cursorKey, cursorValue);
25760
25766
  }
25761
25767
  if (cursorUrls.length > 0) {
25762
25768
  const cursorsPreloading = [];
@@ -25805,6 +25811,9 @@ const extractCursorUrl = (cursor) => {
25805
25811
  cursor: url
25806
25812
  };
25807
25813
  };
25814
+ const hasValidUrl = (value) => {
25815
+ return /url\(["']?.+?["']?\)/i.test(value);
25816
+ };
25808
25817
  const isAllowedUrl = (value) => {
25809
25818
  if (/^https?:\/\//i.test(value)) return true;
25810
25819
  if (/^(javascript|data|blob|ftp):/i.test(value)) return false;
@@ -27461,8 +27470,8 @@ const WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG = { snapAngles: {
27461
27470
  270,
27462
27471
  315
27463
27472
  ],
27464
- activateThreshold: 5,
27465
- releaseThreshold: 10
27473
+ activateThreshold: 3,
27474
+ releaseThreshold: 4
27466
27475
  } };
27467
27476
  const WEAVE_STROKE_SINGLE_NODE_TIP_TYPE = {
27468
27477
  NONE: "none",
@@ -27584,7 +27593,7 @@ var WeaveArrowLineTipManager = class extends WeaveBaseLineTipManager {
27584
27593
  const height = instance.getAttrs()[`tip${this.capitalizeFirst(point)}Height`] ?? Math.sqrt(3) / 2 * 3;
27585
27594
  const triangle = new Konva.Line({
27586
27595
  id: `${instance.getAttrs().id}-tip-${point}`,
27587
- name: "lineTip",
27596
+ name: "lineTip stroke-internal",
27588
27597
  nodeId: instance.getAttrs().id,
27589
27598
  closed: true,
27590
27599
  stroke,
@@ -27650,7 +27659,7 @@ var WeaveCircleLineTipManager = class extends WeaveBaseLineTipManager {
27650
27659
  const radius = instance.getAttrs()[`tip${this.capitalizeFirst(point)}Radius`] ?? 1.5;
27651
27660
  const circle = new Konva.Circle({
27652
27661
  id: `${instance.getAttrs().id}-tip-${point}`,
27653
- name: "lineTip",
27662
+ name: "lineTip stroke-internal",
27654
27663
  nodeId: instance.getAttrs().id,
27655
27664
  radius,
27656
27665
  stroke: "black",
@@ -27764,7 +27773,7 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
27764
27773
  const width = instance.getAttrs()[`tip${this.capitalizeFirst(point)}Width`] ?? 3;
27765
27774
  const square = new Konva.Rect({
27766
27775
  id: `${instance.getAttrs().id}-tip-${point}`,
27767
- name: "lineTip",
27776
+ name: "lineTip stroke-internal",
27768
27777
  nodeId: instance.getAttrs().id,
27769
27778
  width,
27770
27779
  height: width,
@@ -27813,13 +27822,26 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27813
27822
  this.config = mergeExceptArrays(WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, params?.config ?? {});
27814
27823
  this.handleNodeChanges = null;
27815
27824
  this.handleZoomChanges = null;
27825
+ this.shiftPressed = false;
27816
27826
  this.snapper = new GreedySnapper({
27817
27827
  snapAngles: this.config.snapAngles.angles,
27818
27828
  activateThreshold: this.config.snapAngles.activateThreshold,
27819
27829
  releaseThreshold: this.config.snapAngles.releaseThreshold
27820
27830
  });
27831
+ this.eventsInitialized = false;
27832
+ }
27833
+ initEvents() {
27834
+ if (this.eventsInitialized) return;
27835
+ window.addEventListener("keydown", (e) => {
27836
+ if (e.key === "Shift") this.shiftPressed = true;
27837
+ });
27838
+ window.addEventListener("keyup", (e) => {
27839
+ if (e.key === "Shift") this.shiftPressed = false;
27840
+ });
27841
+ this.eventsInitialized = true;
27821
27842
  }
27822
27843
  onRender(props) {
27844
+ this.initEvents();
27823
27845
  const stroke = new Konva.Group({
27824
27846
  ...props,
27825
27847
  name: `node ${WEAVE_STROKE_SINGLE_NODE_TYPE}`,
@@ -27831,7 +27853,7 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27831
27853
  ...props,
27832
27854
  id: `${stroke.getAttrs().id}-line`,
27833
27855
  nodeId: stroke.getAttrs().id,
27834
- name: void 0,
27856
+ name: "stroke-internal",
27835
27857
  x: 0,
27836
27858
  y: 0,
27837
27859
  strokeScaleEnabled: true,
@@ -27853,6 +27875,7 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27853
27875
  shouldOverdrawWholeArea: points.length !== 4
27854
27876
  };
27855
27877
  };
27878
+ this.setupDefaultNodeEvents(stroke);
27856
27879
  let originalStartHandleVisibility = null;
27857
27880
  let originalEndHandleVisibility = null;
27858
27881
  stroke.on("dragstart", () => {
@@ -27867,7 +27890,6 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27867
27890
  originalStartHandleVisibility = null;
27868
27891
  originalEndHandleVisibility = null;
27869
27892
  });
27870
- this.setupDefaultNodeEvents(stroke);
27871
27893
  if (!this.handleZoomChanges) {
27872
27894
  this.handleZoomChanges = () => {
27873
27895
  if (this.startHandle) this.startHandle.scale({
@@ -27884,12 +27906,10 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27884
27906
  if (!this.handleNodeChanges) {
27885
27907
  this.handleNodeChanges = (nodes) => {
27886
27908
  this.teardownSelection();
27887
- if (nodes.length === 1 && nodes[0].instance.getAttrs().nodeType === WEAVE_STROKE_SINGLE_NODE_TYPE) {
27888
- const strokeSelected = this.instance.getStage().findOne(`#${nodes[0].instance.getAttrs().id}`);
27889
- if (!strokeSelected) return;
27909
+ if (nodes.length === 1 && nodes[0].node?.type === WEAVE_STROKE_SINGLE_NODE_TYPE) {
27890
27910
  this.setupHandles();
27891
- this.showHandles(strokeSelected);
27892
- this.setupSelection(strokeSelected, true);
27911
+ this.showHandles(nodes[0].instance);
27912
+ this.setupSelection(nodes[0].instance, true);
27893
27913
  } else {
27894
27914
  this.startHandle?.setAttr("strokeId", void 0);
27895
27915
  this.startHandle?.visible(false);
@@ -27932,175 +27952,92 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27932
27952
  return stroke;
27933
27953
  }
27934
27954
  setupHandles() {
27935
- if (!this.startHandle) {
27936
- const startHandle = new Konva.Circle({
27937
- id: "line-start-handle",
27938
- radius: 5,
27939
- fill: "#ffffff",
27940
- stroke: "#000000",
27941
- strokeWidth: 1,
27942
- edgeDistanceDisableOnDrag: true,
27943
- scaleX: 1 / this.instance.getStage().scaleX(),
27944
- scaleY: 1 / this.instance.getStage().scaleY(),
27945
- draggable: true
27946
- });
27947
- startHandle.on("pointerover", () => {
27948
- this.instance.getStage().container().style.cursor = "move";
27949
- });
27950
- startHandle.on("pointerout", () => {
27951
- this.instance.getStage().container().style.cursor = "default";
27952
- });
27953
- startHandle.on("dragstart", (e) => {
27954
- const tr = this.instance.getPlugin("nodesSelection")?.getTransformer();
27955
- if (tr) tr.hide();
27956
- const strokeId = e.target.getAttr("strokeId");
27957
- const stroke = this.instance.getStage().findOne(`#${strokeId}`);
27958
- if (!stroke) return;
27959
- const points = stroke.getAttrs().linePoints;
27960
- if (points.length === 4) stroke.setAttr("eventTarget", true);
27961
- this.instance.emitEvent("onDrag", e.target);
27962
- });
27963
- startHandle.on("dragmove", (e) => {
27964
- const draggedTarget = e.target;
27965
- const strokeId = draggedTarget.getAttr("strokeId");
27966
- const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
27967
- if (!draggedStroke) return;
27968
- const internalLine = draggedStroke.findOne(`#${draggedStroke.getAttrs().id}-line`);
27969
- if (!internalLine) return;
27970
- const points = draggedStroke.getAttrs().linePoints;
27971
- if (points.length !== 4) return;
27972
- this.teardownSelection();
27973
- const newLinePoint = this.getLinePointFromHandle(draggedStroke, e);
27974
- draggedStroke.setAttrs({ linePoints: [
27975
- newLinePoint.x,
27976
- newLinePoint.y,
27977
- points[2],
27978
- points[3]
27979
- ] });
27980
- this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
27981
- const tipStartStyle = draggedStroke.getAttrs().tipStartStyle ?? "none";
27982
- this.tipManagers[tipStartStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
27983
- const tipEndStyle = draggedStroke.getAttrs().tipEndStyle ?? "none";
27984
- this.tipManagers[tipEndStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
27985
- this.setupSelection(draggedStroke);
27986
- });
27987
- startHandle.on("dragend", (e) => {
27988
- const tr = this.instance.getPlugin("nodesSelection")?.getTransformer();
27989
- if (tr) tr.show();
27990
- const draggedTarget = e.target;
27991
- const strokeId = draggedTarget.getAttr("strokeId");
27992
- const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
27993
- if (!draggedStroke) return;
27994
- const internalLine = draggedStroke.findOne(`#${draggedStroke.getAttrs().id}-line`);
27995
- if (!internalLine) return;
27996
- const points = draggedStroke.getAttrs().linePoints;
27997
- if (points.length !== 4) return;
27998
- this.teardownSelection();
27999
- const newLinePoint = this.getLinePointFromHandle(draggedStroke, e);
28000
- draggedStroke.setAttrs({ linePoints: [
28001
- newLinePoint.x,
28002
- newLinePoint.y,
28003
- points[2],
28004
- points[3]
28005
- ] });
28006
- this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
28007
- const tipStartStyle = draggedStroke.getAttrs().tipStartStyle ?? "none";
28008
- this.tipManagers[tipStartStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
28009
- const tipEndStyle = draggedStroke.getAttrs().tipEndStyle ?? "none";
28010
- this.tipManagers[tipEndStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28011
- this.setupSelection(draggedStroke);
28012
- this.instance.updateNode(this.serialize(draggedStroke));
28013
- this.instance.emitEvent("onDrag", null);
28014
- });
28015
- this.startHandle = startHandle;
27955
+ if (!this.startHandle) this.setupHandle("start");
27956
+ if (!this.endHandle) this.setupHandle("end");
27957
+ }
27958
+ setupHandle(side) {
27959
+ const handleDragStart = (e) => {
27960
+ const tr = this.instance.getPlugin("nodesSelection")?.getTransformer();
27961
+ if (tr) tr.hide();
27962
+ const strokeId = e.target.getAttr("strokeId");
27963
+ const stroke = this.instance.getStage().findOne(`#${strokeId}`);
27964
+ if (!stroke) return;
27965
+ const points = stroke.getAttrs().linePoints;
27966
+ if (points.length === 4) stroke.setAttr("eventTarget", true);
27967
+ this.instance.emitEvent("onDrag", e.target);
27968
+ };
27969
+ const handleDragPosition = (side$1) => (e) => {
27970
+ const draggedTarget = e.target;
27971
+ const strokeId = draggedTarget.getAttr("strokeId");
27972
+ const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
27973
+ if (!draggedStroke) return;
27974
+ const internalLine = draggedStroke.findOne(`#${draggedStroke.getAttrs().id}-line`);
27975
+ if (!internalLine) return;
27976
+ const points = draggedStroke.getAttrs().linePoints;
27977
+ if (points.length !== 4) return;
27978
+ this.teardownSelection();
27979
+ const newLinePoint = this.getLinePointFromHandle(draggedStroke, e);
27980
+ const pos = this.getDragPoint(draggedStroke, newLinePoint, side$1);
27981
+ if (side$1 === "start") draggedStroke.setAttrs({ linePoints: [
27982
+ pos.x,
27983
+ pos.y,
27984
+ points[2],
27985
+ points[3]
27986
+ ] });
27987
+ else draggedStroke.setAttrs({ linePoints: [
27988
+ points[0],
27989
+ points[1],
27990
+ pos.x,
27991
+ pos.y
27992
+ ] });
27993
+ this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
27994
+ this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
27995
+ const tipStartStyle = draggedStroke.getAttrs().tipStartStyle ?? "none";
27996
+ this.tipManagers[tipStartStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
27997
+ const tipEndStyle = draggedStroke.getAttrs().tipEndStyle ?? "none";
27998
+ this.tipManagers[tipEndStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
27999
+ this.setupSelection(draggedStroke);
28000
+ };
28001
+ const handleDragMove = (side$1) => (e) => {
28002
+ handleDragPosition(side$1)(e);
28003
+ };
28004
+ const handleDragEnd = (side$1) => (e) => {
28005
+ handleDragPosition(side$1)(e);
28006
+ const draggedTarget = e.target;
28007
+ const strokeId = draggedTarget.getAttr("strokeId");
28008
+ const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
28009
+ if (!draggedStroke) return;
28010
+ this.instance.updateNode(this.serialize(draggedStroke));
28011
+ this.instance.emitEvent("onDrag", null);
28012
+ };
28013
+ const handle = new Konva.Circle({
28014
+ id: `line-${side}-handle`,
28015
+ radius: 5,
28016
+ fill: "#ffffff",
28017
+ stroke: "#000000",
28018
+ strokeWidth: 1,
28019
+ edgeDistanceDisableOnDrag: true,
28020
+ scaleX: 1 / this.instance.getStage().scaleX(),
28021
+ scaleY: 1 / this.instance.getStage().scaleY(),
28022
+ draggable: true
28023
+ });
28024
+ handle.on("pointerover", () => {
28025
+ this.instance.getStage().container().style.cursor = "move";
28026
+ });
28027
+ handle.on("pointerout", () => {
28028
+ this.instance.getStage().container().style.cursor = "default";
28029
+ });
28030
+ handle.on("dragstart", handleDragStart);
28031
+ handle.on("dragmove", handleDragMove(side));
28032
+ handle.on("dragend", handleDragEnd(side));
28033
+ if (side === "start") {
28034
+ this.startHandle = handle;
28016
28035
  this.startHandle.visible(false);
28017
- this.instance.getSelectionLayer()?.add(this.startHandle);
28018
- }
28019
- if (!this.endHandle) {
28020
- const endHandle = new Konva.Circle({
28021
- id: "line-end-handle",
28022
- radius: 5,
28023
- fill: "#ffffff",
28024
- stroke: "#000000",
28025
- strokeWidth: 1,
28026
- edgeDistanceDisableOnDrag: true,
28027
- scaleX: 1 / this.instance.getStage().scaleX(),
28028
- scaleY: 1 / this.instance.getStage().scaleY(),
28029
- draggable: true
28030
- });
28031
- endHandle.on("pointerover", () => {
28032
- this.instance.getStage().container().style.cursor = "move";
28033
- });
28034
- endHandle.on("pointerout", () => {
28035
- this.instance.getStage().container().style.cursor = "default";
28036
- });
28037
- endHandle.on("dragstart", (e) => {
28038
- const tr = this.instance.getPlugin("nodesSelection")?.getTransformer();
28039
- if (tr) tr.hide();
28040
- const strokeId = e.target.getAttr("strokeId");
28041
- const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
28042
- if (!draggedStroke) return;
28043
- const points = draggedStroke.getAttrs().linePoints;
28044
- if (points.length !== 4) return;
28045
- if (points.length === 4) draggedStroke.setAttr("eventTarget", true);
28046
- this.instance.emitEvent("onDrag", e.target);
28047
- });
28048
- endHandle.on("dragmove", (e) => {
28049
- const draggedTarget = e.target;
28050
- const strokeId = draggedTarget.getAttr("strokeId");
28051
- const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
28052
- if (!draggedStroke) return;
28053
- const internalLine = draggedStroke.findOne(`#${draggedStroke.getAttrs().id}-line`);
28054
- if (!internalLine) return;
28055
- const points = draggedStroke.getAttrs().linePoints;
28056
- if (points.length !== 4) return;
28057
- this.teardownSelection();
28058
- const newLinePoint = this.getLinePointFromHandle(draggedStroke, e);
28059
- draggedStroke.setAttrs({ linePoints: [
28060
- points[0],
28061
- points[1],
28062
- newLinePoint.x,
28063
- newLinePoint.y
28064
- ] });
28065
- this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28066
- const tipStartStyle = draggedStroke.getAttrs().tipStartStyle ?? "none";
28067
- this.tipManagers[tipStartStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
28068
- const tipEndStyle = draggedStroke.getAttrs().tipEndStyle ?? "none";
28069
- this.tipManagers[tipEndStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28070
- this.setupSelection(draggedStroke);
28071
- });
28072
- endHandle.on("dragend", (e) => {
28073
- const tr = this.instance.getPlugin("nodesSelection")?.getTransformer();
28074
- if (tr) tr.show();
28075
- const draggedTarget = e.target;
28076
- const strokeId = draggedTarget.getAttr("strokeId");
28077
- const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
28078
- if (!draggedStroke) return;
28079
- const internalLine = draggedStroke.findOne(`#${draggedStroke.getAttrs().id}-line`);
28080
- if (!internalLine) return;
28081
- const points = draggedStroke.getAttrs().linePoints;
28082
- if (points.length !== 4) return;
28083
- this.teardownSelection();
28084
- const newLinePoint = this.getLinePointFromHandle(draggedStroke, e);
28085
- draggedStroke.setAttrs({ linePoints: [
28086
- points[0],
28087
- points[1],
28088
- newLinePoint.x,
28089
- newLinePoint.y
28090
- ] });
28091
- this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28092
- const tipStartStyle = draggedStroke.getAttrs().tipStartStyle ?? "none";
28093
- this.tipManagers[tipStartStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
28094
- const tipEndStyle = draggedStroke.getAttrs().tipEndStyle ?? "none";
28095
- this.tipManagers[tipEndStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28096
- this.setupSelection(draggedStroke);
28097
- this.instance.updateNode(this.serialize(draggedStroke));
28098
- this.instance.emitEvent("onDrag", null);
28099
- });
28100
- this.endHandle = endHandle;
28036
+ } else {
28037
+ this.endHandle = handle;
28101
28038
  this.endHandle.visible(false);
28102
- this.instance.getSelectionLayer()?.add(this.endHandle);
28103
28039
  }
28040
+ this.instance.getSelectionLayer()?.add(handle);
28104
28041
  }
28105
28042
  showHandles(stroke) {
28106
28043
  if (this.startHandle === null || this.endHandle === null) return;
@@ -28124,7 +28061,7 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
28124
28061
  this.tipManagers[tipEndStyle]?.render(stroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28125
28062
  const internalLine = stroke.findOne(`#${stroke.getAttrs().id}-line`);
28126
28063
  if (internalLine) internalLine.setAttrs({
28127
- name: void 0,
28064
+ name: "stroke-internal",
28128
28065
  dash: nextProps.dash,
28129
28066
  fill: nextProps.fill,
28130
28067
  stroke: nextProps.stroke,
@@ -28184,20 +28121,19 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
28184
28121
  if (markSelected) instance.setAttrs({ isSelected: true });
28185
28122
  const hoverClone = instance.findOne(".hoverClone");
28186
28123
  if (hoverClone) return;
28187
- const internalLine = instance.findOne(`#${instance.getAttrs().id}-line`);
28188
- if (!internalLine) return;
28189
- const internalLineHover = internalLine.clone();
28190
- internalLineHover.setAttrs({
28191
- name: "hoverClone",
28192
- stroke: "#1a1aff",
28193
- listening: false,
28194
- draggable: false,
28195
- strokeWidth: 1,
28196
- points: instance.getAttrs().linePoints,
28197
- strokeScaleEnabled: false
28198
- });
28199
- instance.add(internalLineHover);
28200
- internalLineHover.moveToTop();
28124
+ const internalNodes = instance.find(".stroke-internal");
28125
+ for (const node of internalNodes) {
28126
+ const internalNode = node.clone();
28127
+ internalNode.setAttrs({
28128
+ name: "hoverClone",
28129
+ fill: "#1a1aff",
28130
+ stroke: "#1a1aff",
28131
+ listening: false,
28132
+ draggable: false
28133
+ });
28134
+ instance.add(internalNode);
28135
+ internalNode.moveToTop();
28136
+ }
28201
28137
  }
28202
28138
  teardownSelection() {
28203
28139
  const stage = this.instance.getStage();
@@ -28215,6 +28151,37 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
28215
28151
  const tipEndStyle = instance.getAttrs().tipEndStyle ?? "none";
28216
28152
  this.tipManagers[tipEndStyle]?.update(instance, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28217
28153
  }
28154
+ getDragPoint(draggedStroke, newLinePoint, dragFrom) {
28155
+ const pos = {
28156
+ x: 0,
28157
+ y: 0
28158
+ };
28159
+ const linePoints = draggedStroke.getAttrs().linePoints;
28160
+ const fixed = dragFrom === "start" ? {
28161
+ x: linePoints[2],
28162
+ y: linePoints[3]
28163
+ } : {
28164
+ x: linePoints[0],
28165
+ y: linePoints[1]
28166
+ };
28167
+ if (this.shiftPressed) {
28168
+ let dx = newLinePoint.x - fixed.x;
28169
+ let dy = newLinePoint.y - fixed.y;
28170
+ const angle = Math.atan2(dy, dx);
28171
+ const angleDeg = angle * 180 / Math.PI;
28172
+ const snapped = this.snapper.apply(angleDeg);
28173
+ const dist = Math.hypot(dx, dy);
28174
+ const rad = snapped * Math.PI / 180;
28175
+ dx = Math.cos(rad) * dist;
28176
+ dy = Math.sin(rad) * dist;
28177
+ pos.x = fixed.x + dx;
28178
+ pos.y = fixed.y + dy;
28179
+ } else {
28180
+ pos.x = newLinePoint.x;
28181
+ pos.y = newLinePoint.y;
28182
+ }
28183
+ return pos;
28184
+ }
28218
28185
  };
28219
28186
 
28220
28187
  //#endregion