@krainovsd/graph 0.13.0-beta3 → 0.14.0-beta-7.2

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 (80) hide show
  1. package/lib/cjs/index.cjs +1044 -528
  2. package/lib/cjs/index.cjs.map +1 -1
  3. package/lib/esm/constants/force-controls.js +4 -2
  4. package/lib/esm/constants/force-controls.js.map +1 -1
  5. package/lib/esm/constants/highlight-controls.js +9 -16
  6. package/lib/esm/constants/highlight-controls.js.map +1 -1
  7. package/lib/esm/constants/link-controls.js +17 -30
  8. package/lib/esm/constants/link-controls.js.map +1 -1
  9. package/lib/esm/constants/node-controls.js +4 -2
  10. package/lib/esm/constants/node-controls.js.map +1 -1
  11. package/lib/esm/index.js +8 -7
  12. package/lib/esm/index.js.map +1 -1
  13. package/lib/esm/module/GraphCanvas/GraphCanvas.js +303 -78
  14. package/lib/esm/module/GraphCanvas/GraphCanvas.js.map +1 -1
  15. package/lib/esm/module/GraphCanvas/constants/force-settings.js +11 -1
  16. package/lib/esm/module/GraphCanvas/constants/force-settings.js.map +1 -1
  17. package/lib/esm/module/GraphCanvas/constants/graph-settings.js +17 -5
  18. package/lib/esm/module/GraphCanvas/constants/graph-settings.js.map +1 -1
  19. package/lib/esm/module/GraphCanvas/constants/highlight-settings.js +5 -3
  20. package/lib/esm/module/GraphCanvas/constants/highlight-settings.js.map +1 -1
  21. package/lib/esm/module/GraphCanvas/constants/index.js +5 -2
  22. package/lib/esm/module/GraphCanvas/constants/index.js.map +1 -1
  23. package/lib/esm/module/GraphCanvas/constants/link-settings.js +19 -10
  24. package/lib/esm/module/GraphCanvas/constants/link-settings.js.map +1 -1
  25. package/lib/esm/module/GraphCanvas/constants/node-settings.js +13 -3
  26. package/lib/esm/module/GraphCanvas/constants/node-settings.js.map +1 -1
  27. package/lib/esm/module/GraphCanvas/lib/settings/force-settings-getter.js +4 -2
  28. package/lib/esm/module/GraphCanvas/lib/settings/force-settings-getter.js.map +1 -1
  29. package/lib/esm/module/GraphCanvas/lib/settings/graph-settings-getter.js +4 -0
  30. package/lib/esm/module/GraphCanvas/lib/settings/graph-settings-getter.js.map +1 -1
  31. package/lib/esm/module/GraphCanvas/lib/settings/highlight-settings-getter.js +4 -2
  32. package/lib/esm/module/GraphCanvas/lib/settings/highlight-settings-getter.js.map +1 -1
  33. package/lib/esm/module/GraphCanvas/lib/settings/link-settings-getter.js +8 -5
  34. package/lib/esm/module/GraphCanvas/lib/settings/link-settings-getter.js.map +1 -1
  35. package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js +14 -2
  36. package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js.map +1 -1
  37. package/lib/esm/module/GraphCanvas/lib/utils/calculate-curve-link-position-by-node.js +5 -2
  38. package/lib/esm/module/GraphCanvas/lib/utils/calculate-curve-link-position-by-node.js.map +1 -1
  39. package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js +5 -2
  40. package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js.map +1 -1
  41. package/lib/esm/module/GraphCanvas/lib/utils/compute-graph-bounds.js +26 -0
  42. package/lib/esm/module/GraphCanvas/lib/utils/compute-graph-bounds.js.map +1 -0
  43. package/lib/esm/module/GraphCanvas/lib/utils/get-particle-position.js +40 -30
  44. package/lib/esm/module/GraphCanvas/lib/utils/get-particle-position.js.map +1 -1
  45. package/lib/esm/module/GraphCanvas/lib/utils/is-empty-object.js +11 -0
  46. package/lib/esm/module/GraphCanvas/lib/utils/is-empty-object.js.map +1 -0
  47. package/lib/esm/module/GraphCanvas/lib/utils/is-node-visible.js +5 -2
  48. package/lib/esm/module/GraphCanvas/lib/utils/is-node-visible.js.map +1 -1
  49. package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js +1 -5
  50. package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js.map +1 -1
  51. package/lib/esm/module/GraphCanvas/lib/utils/node-by-pointer-getter.js +1 -5
  52. package/lib/esm/module/GraphCanvas/lib/utils/node-by-pointer-getter.js.map +1 -1
  53. package/lib/esm/module/GraphCanvas/lib/utils/pointer-getter.js +16 -8
  54. package/lib/esm/module/GraphCanvas/lib/utils/pointer-getter.js.map +1 -1
  55. package/lib/esm/module/GraphCanvas/slices/draw-links.js +47 -62
  56. package/lib/esm/module/GraphCanvas/slices/draw-links.js.map +1 -1
  57. package/lib/esm/module/GraphCanvas/slices/draw-nodes.js +9 -4
  58. package/lib/esm/module/GraphCanvas/slices/draw-nodes.js.map +1 -1
  59. package/lib/esm/module/GraphCanvas/slices/init-area.js +1 -1
  60. package/lib/esm/module/GraphCanvas/slices/init-area.js.map +1 -1
  61. package/lib/esm/module/GraphCanvas/slices/init-dnd.js +20 -13
  62. package/lib/esm/module/GraphCanvas/slices/init-dnd.js.map +1 -1
  63. package/lib/esm/module/GraphCanvas/slices/init-draw.js +14 -52
  64. package/lib/esm/module/GraphCanvas/slices/init-draw.js.map +1 -1
  65. package/lib/esm/module/GraphCanvas/slices/init-pointer.js +45 -72
  66. package/lib/esm/module/GraphCanvas/slices/init-pointer.js.map +1 -1
  67. package/lib/esm/module/GraphCanvas/slices/init-resize.js +14 -2
  68. package/lib/esm/module/GraphCanvas/slices/init-resize.js.map +1 -1
  69. package/lib/esm/module/GraphCanvas/slices/init-selection.js +152 -0
  70. package/lib/esm/module/GraphCanvas/slices/init-selection.js.map +1 -0
  71. package/lib/esm/module/GraphCanvas/slices/init-simulation.js +12 -2
  72. package/lib/esm/module/GraphCanvas/slices/init-simulation.js.map +1 -1
  73. package/lib/esm/module/GraphCanvas/slices/init-zoom.js +88 -16
  74. package/lib/esm/module/GraphCanvas/slices/init-zoom.js.map +1 -1
  75. package/lib/esm/module/GraphCanvas/slices/update-link-cache.js +33 -3
  76. package/lib/esm/module/GraphCanvas/slices/update-link-cache.js.map +1 -1
  77. package/lib/esm/module/GraphCanvas/slices/update-node-cache.js +61 -16
  78. package/lib/esm/module/GraphCanvas/slices/update-node-cache.js.map +1 -1
  79. package/lib/index.d.ts +106 -56
  80. package/package.json +3 -2
@@ -1,11 +1,16 @@
1
1
  import { isNumber } from '@krainovsd/js-helpers';
2
+ import '../constants/force-settings.js';
3
+ import '../constants/graph-settings.js';
4
+ import '../constants/highlight-settings.js';
5
+ import '../constants/link-settings.js';
6
+ import '../constants/node-settings.js';
2
7
  import 'd3-array';
3
8
  import { isNodeVisible } from '../lib/utils/is-node-visible.js';
4
9
  import { nodeFade, nodeHighlight } from '../lib/utils/node-highlight.js';
5
10
  import { drawText } from './draw-text.js';
6
11
 
7
12
  function getDrawNode(nodeRenders, textRenders) {
8
- return function drawNode(node) {
13
+ return function drawNode(node, index) {
9
14
  if (!this.context || !node.x || !node.y)
10
15
  return;
11
16
  if (node.visible != undefined && !node.visible) {
@@ -14,7 +19,7 @@ function getDrawNode(nodeRenders, textRenders) {
14
19
  node._height = 0;
15
20
  return;
16
21
  }
17
- const nodeOptions = this.nodeOptionsCache[node.id];
22
+ const nodeOptions = this.nodeOptionsCache[index];
18
23
  if (!nodeOptions)
19
24
  return;
20
25
  if (nodeOptions.nodeDraw && nodeOptions.textDraw) {
@@ -173,7 +178,7 @@ function getDrawNode(nodeRenders, textRenders) {
173
178
  this.context.lineWidth = borderWidth;
174
179
  this.context.strokeStyle = borderColor;
175
180
  this.context.fillStyle = color;
176
- const labelLines = this.cachedNodeLabel[node.id];
181
+ const labelLines = this.cachedNodeLabel[index];
177
182
  switch (nodeOptions.shape) {
178
183
  case "circle": {
179
184
  if (!node.image) {
@@ -299,7 +304,7 @@ function getDrawNode(nodeRenders, textRenders) {
299
304
  });
300
305
  }
301
306
  /** Text draw */
302
- const textLines = this.cachedNodeText[node.id];
307
+ const textLines = this.cachedNodeText[index];
303
308
  if (nodeOptions.textVisible && nodeOptions.text && textLines) {
304
309
  textRenders.push(() => {
305
310
  if (nodeOptions.textDraw) {
@@ -1 +1 @@
1
- {"version":3,"file":"draw-nodes.js","sources":["../../../../../src/module/GraphCanvas/slices/draw-nodes.ts"],"sourcesContent":["import { isNumber } from \"@krainovsd/js-helpers\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport { isNodeVisible, nodeFade, nodeHighlight } from \"../lib\";\nimport type { NodeInterface } from \"../types\";\nimport { drawText } from \"./draw-text\";\n\nexport function getDrawNode<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(nodeRenders: (() => void)[], textRenders: (() => void)[]) {\n return function drawNode(this: GraphCanvas<NodeData, LinkData>, node: NodeInterface<NodeData>) {\n if (!this.context || !node.x || !node.y) return;\n if (node.visible != undefined && !node.visible) {\n node._radius = 0;\n node._width = 0;\n node._height = 0;\n\n return;\n }\n\n const nodeOptions = this.nodeOptionsCache[node.id];\n if (!nodeOptions) return;\n\n if (nodeOptions.nodeDraw && nodeOptions.textDraw) {\n nodeRenders.push(() => {\n if (nodeOptions.nodeDraw) {\n nodeOptions.nodeDraw.bind(this)(node, nodeOptions);\n }\n });\n\n textRenders.push(() => {\n if (nodeOptions.textDraw) {\n nodeOptions.textDraw.bind(this)(node, nodeOptions);\n }\n });\n\n return;\n }\n\n let radius = nodeOptions.radius;\n let width = nodeOptions.width;\n let height = nodeOptions.height;\n let alpha = nodeOptions.alpha;\n let color = nodeOptions.color;\n let borderColor = nodeOptions.borderColor;\n let borderWidth = nodeOptions.borderWidth;\n let textAlpha = nodeOptions.textAlpha;\n let textSize = nodeOptions.textSize;\n let textShiftX = nodeOptions.textShiftX;\n let textShiftY = nodeOptions.textShiftY;\n let textWeight = nodeOptions.textWeight;\n let labelSize = nodeOptions.labelSize;\n let labelWeight = nodeOptions.labelWeight;\n let labelAlpha = nodeOptions.labelAlpha;\n /** Highlight */\n if (this.highlightedNeighbors && this.highlightedNode) {\n /** By Node Not Highlight */\n if (!this.highlightedNeighbors.has(node.id) && this.highlightedNode.id != node.id) {\n const fadingOptions = nodeFade({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelFadingMin: this.highlightSettings.highlightByNodeForLabelFadingMin,\n highlightForNodeColorFading: this.highlightSettings.highlightByNodeForNodeColorFading,\n highlightForNodeFadingMin: this.highlightSettings.highlightByNodeForNodeFadingMin,\n highlightForTextFadingMin: this.highlightSettings.highlightByNodeForTextFadingMin,\n });\n alpha = fadingOptions.alpha;\n color = fadingOptions.color;\n textAlpha = fadingOptions.textAlpha;\n labelAlpha = fadingOptions.labelAlpha;\n } else if (\n !this.highlightSettings.highlightByNodeOnlyRoot ||\n (this.highlightSettings.highlightByNodeOnlyRoot && this.highlightedNode.id === node.id)\n ) {\n /** By Node Highlight */\n const highlightOptions = nodeHighlight({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelSizingAdditional:\n this.highlightSettings.highlightByNodeForLabelSizingAdditional,\n highlightForLabelWeightAdditional:\n this.highlightSettings.highlightByNodeForLabelWeightAdditional,\n highlightForNodeBorderColor: this.highlightSettings.highlightByNodeForNodeBorderColor,\n highlightForNodeBorderSizingAdditional:\n this.highlightSettings.highlightByNodeForNodeBorderSizingAdditional,\n highlightForNodeColor: this.highlightSettings.highlightByNodeForNodeColor,\n highlightForNodeSizingAdditional:\n this.highlightSettings.highlightByNodeForNodeSizingAdditional,\n highlightForNodeSizingAdditionalCoefficient:\n this.highlightSettings.highlightByNodeForNodeSizingAdditionalCoefficient,\n highlightForTextShiftXAdditional:\n this.highlightSettings.highlightByNodeForTextShiftXAdditional,\n highlightForTextShiftYAdditional:\n this.highlightSettings.highlightByNodeForTextShiftYAdditional,\n highlightForTextSizingAdditional:\n this.highlightSettings.highlightByNodeForTextSizingAdditional,\n highlightForTextWeightAdditional:\n this.highlightSettings.highlightByNodeForTextWeightAdditional,\n });\n color = highlightOptions.color;\n borderColor = highlightOptions.borderColor;\n borderWidth = highlightOptions.borderWidth;\n radius = highlightOptions.radiusInitial;\n width = highlightOptions.widthInitial;\n height = highlightOptions.heightInitial;\n textSize = highlightOptions.textSize;\n textShiftX = highlightOptions.textShiftX;\n textShiftY = highlightOptions.textShiftY;\n textWeight = highlightOptions.textWeight;\n labelSize = highlightOptions.labelSize;\n labelWeight = highlightOptions.labelWeight;\n }\n }\n if (this.highlightedNeighbors && this.highlightedLink) {\n /** By Link Not Highlight */\n if (\n !this.highlightedNeighbors.has(node.id) &&\n this.highlightedLink.source !== node &&\n this.highlightedLink.target !== node\n ) {\n const fadingOptions = nodeFade({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelFadingMin: this.highlightSettings.highlightByLinkForLabelFadingMin,\n highlightForNodeColorFading: this.highlightSettings.highlightByLinkForNodeColorFading,\n highlightForNodeFadingMin: this.highlightSettings.highlightByLinkForNodeFadingMin,\n highlightForTextFadingMin: this.highlightSettings.highlightByLinkForTextFadingMin,\n });\n alpha = fadingOptions.alpha;\n color = fadingOptions.color;\n textAlpha = fadingOptions.textAlpha;\n labelAlpha = fadingOptions.labelAlpha;\n } else {\n /** By Link Highlight */\n\n const highlightOptions = nodeHighlight({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelSizingAdditional:\n this.highlightSettings.highlightByLinkForLabelSizingAdditional,\n highlightForLabelWeightAdditional:\n this.highlightSettings.highlightByLinkForLabelWeightAdditional,\n highlightForNodeBorderColor: this.highlightSettings.highlightByLinkForNodeBorderColor,\n highlightForNodeBorderSizingAdditional:\n this.highlightSettings.highlightByLinkForNodeBorderSizingAdditional,\n highlightForNodeColor: this.highlightSettings.highlightByLinkForNodeColor,\n highlightForNodeSizingAdditional:\n this.highlightSettings.highlightByLinkForNodeSizingAdditional,\n highlightForNodeSizingAdditionalCoefficient:\n this.highlightSettings.highlightByLinkForNodeSizingAdditionalCoefficient,\n highlightForTextShiftXAdditional:\n this.highlightSettings.highlightByLinkForTextShiftXAdditional,\n highlightForTextShiftYAdditional:\n this.highlightSettings.highlightByLinkForTextShiftYAdditional,\n highlightForTextSizingAdditional:\n this.highlightSettings.highlightByLinkForTextSizingAdditional,\n highlightForTextWeightAdditional:\n this.highlightSettings.highlightByLinkForTextWeightAdditional,\n });\n color = highlightOptions.color;\n borderColor = highlightOptions.borderColor;\n borderWidth = highlightOptions.borderWidth;\n radius = highlightOptions.radiusInitial;\n width = highlightOptions.widthInitial;\n height = highlightOptions.heightInitial;\n textSize = highlightOptions.textSize;\n textShiftX = highlightOptions.textShiftX;\n textShiftY = highlightOptions.textShiftY;\n textWeight = highlightOptions.textWeight;\n labelSize = highlightOptions.labelSize;\n labelWeight = highlightOptions.labelWeight;\n }\n }\n\n /** Node parameters */\n node._radius = radius;\n node._borderWidth = borderWidth;\n node._width = width;\n node._height = height;\n node._borderRadius =\n isNumber(nodeOptions.borderRadius) && nodeOptions.borderRadius > 0\n ? Math.min(nodeOptions.borderRadius, nodeOptions.width / 2, nodeOptions.height / 2)\n : 0;\n node._shape = nodeOptions.shape ?? \"circle\";\n\n /** Node Visibility */\n if (\n !isNodeVisible({\n height: this.height,\n width: this.width,\n transform: this.areaTransform,\n node,\n })\n ) {\n node._visible = false;\n\n return;\n }\n node._visible = true;\n\n /** Node draw */\n nodeRenders.push(() => {\n if (!this.context || !node.x || !node.y) return;\n\n this.context.beginPath();\n this.context.globalAlpha = alpha;\n this.context.lineWidth = borderWidth;\n this.context.strokeStyle = borderColor;\n this.context.fillStyle = color;\n const labelLines = this.cachedNodeLabel[node.id];\n\n switch (nodeOptions.shape) {\n case \"circle\": {\n if (!node.image) {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n } else {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n this.context.closePath();\n this.context.save();\n this.context.clip();\n\n this.context.drawImage(\n node.image,\n node.x - radius,\n node.y - radius,\n radius * 2,\n radius * 2,\n );\n\n this.context.restore();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n }\n\n if (node.label && labelLines) {\n this.context.globalAlpha = labelAlpha;\n drawText({\n context: this.context,\n lines: labelLines,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textGap: nodeOptions.labelGap,\n textSize: labelSize,\n textStyle: nodeOptions.labelStyle,\n textWeight: labelWeight,\n x: node.x,\n y: node.y + labelSize / 3,\n });\n }\n\n break;\n }\n case \"square\": {\n if (!node.image) {\n this.context.roundRect(\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n node._borderRadius,\n );\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n } else {\n this.context.roundRect(\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n node._borderRadius,\n );\n this.context.closePath();\n this.context.save();\n this.context.clip();\n this.context.drawImage(\n node.image,\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n );\n this.context.restore();\n\n if (borderWidth > 0) {\n this.context.stroke();\n }\n }\n if (node.label && labelLines) {\n this.context.globalAlpha = labelAlpha;\n drawText({\n context: this.context,\n lines: labelLines,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textGap: nodeOptions.labelGap,\n textSize: labelSize,\n textStyle: nodeOptions.labelStyle,\n textWeight: labelWeight,\n x: node.x,\n y: node.y + labelSize / 3,\n });\n }\n break;\n }\n case \"text\": {\n if (this.nodeSettings.textNodeDebug) {\n this.context.strokeRect(node.x - width / 2, node.y - height / 2, width, height);\n }\n\n if (nodeOptions.label && labelLines)\n drawText({\n lines: labelLines,\n context: this.context,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textSize: labelSize,\n x: node.x,\n y: node.y + textSize / 4 - (labelLines.length - 1) * (textSize / 2),\n textStyle: nodeOptions.labelStyle,\n textWeight,\n textGap: nodeOptions.labelGap,\n });\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n break;\n }\n default: {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n break;\n }\n }\n });\n\n if (nodeOptions.nodeExtraDraw) {\n nodeRenders.push(() => {\n nodeOptions?.nodeExtraDraw?.bind?.(this)?.(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n });\n });\n }\n\n /** Text draw */\n const textLines = this.cachedNodeText[node.id];\n if (nodeOptions.textVisible && nodeOptions.text && textLines) {\n textRenders.push(() => {\n if (nodeOptions.textDraw) {\n nodeOptions.textDraw.bind(this)(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n });\n\n return;\n }\n\n if (!this.context || !node.x || !node.y || !nodeOptions.text) return;\n this.context.beginPath();\n this.context.globalAlpha = textAlpha;\n\n let y = node.y + textShiftY;\n if (nodeOptions.shape === \"circle\") {\n y += radius;\n }\n if (nodeOptions.shape === \"square\" || nodeOptions.shape === \"text\") {\n y += height / 2;\n }\n\n drawText({\n lines: textLines,\n context: this.context,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize,\n x: node.x + textShiftX,\n y,\n textStyle: nodeOptions.textStyle,\n textWeight,\n textGap: nodeOptions.textGap,\n });\n\n if (nodeOptions.textExtraDraw) {\n nodeOptions.textExtraDraw.bind(this)(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n });\n }\n });\n }\n };\n}\n"],"names":[],"mappings":";;;;;;AAMgB,SAAA,WAAW,CAGzB,WAA2B,EAAE,WAA2B,EAAA;IACxD,OAAO,SAAS,QAAQ,CAAwC,IAA6B,EAAA;AAC3F,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAAE;QACzC,IAAI,IAAI,CAAC,OAAO,IAAI,SAAS,IAAI,CAAC,IAAI,CAAC,OA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BAC7B,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;AACzC,wBAAA,GAAG,WAAW;wBACd,MAAM;wBACN,KAAK;wBACL,KAAK;wBACL,SAAS;wBACT,QAAQ;wBACR,UAAU;wBACV,UAAU;wBACV,UAAU;AACX,qBAAA,CAAC;;AAEN,aAAC,CAAC;;AAEN,KAAC;AACH;;;;"}
1
+ {"version":3,"file":"draw-nodes.js","sources":["../../../../../src/module/GraphCanvas/slices/draw-nodes.ts"],"sourcesContent":["import { isNumber } from \"@krainovsd/js-helpers\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport { isNodeVisible, nodeFade, nodeHighlight } from \"../lib\";\nimport type { NodeInterface } from \"../types\";\nimport { drawText } from \"./draw-text\";\n\nexport function getDrawNode<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(nodeRenders: (() => void)[], textRenders: (() => void)[]) {\n return function drawNode(\n this: GraphCanvas<NodeData, LinkData>,\n node: NodeInterface<NodeData>,\n index: number,\n ) {\n if (!this.context || !node.x || !node.y) return;\n if (node.visible != undefined && !node.visible) {\n node._radius = 0;\n node._width = 0;\n node._height = 0;\n\n return;\n }\n\n const nodeOptions = this.nodeOptionsCache[index];\n if (!nodeOptions) return;\n\n if (nodeOptions.nodeDraw && nodeOptions.textDraw) {\n nodeRenders.push(() => {\n if (nodeOptions.nodeDraw) {\n nodeOptions.nodeDraw.bind(this)(node, nodeOptions);\n }\n });\n\n textRenders.push(() => {\n if (nodeOptions.textDraw) {\n nodeOptions.textDraw.bind(this)(node, nodeOptions);\n }\n });\n\n return;\n }\n\n let radius = nodeOptions.radius;\n let width = nodeOptions.width;\n let height = nodeOptions.height;\n let alpha = nodeOptions.alpha;\n let color = nodeOptions.color;\n let borderColor = nodeOptions.borderColor;\n let borderWidth = nodeOptions.borderWidth;\n let textAlpha = nodeOptions.textAlpha;\n let textSize = nodeOptions.textSize;\n let textShiftX = nodeOptions.textShiftX;\n let textShiftY = nodeOptions.textShiftY;\n let textWeight = nodeOptions.textWeight;\n let labelSize = nodeOptions.labelSize;\n let labelWeight = nodeOptions.labelWeight;\n let labelAlpha = nodeOptions.labelAlpha;\n /** Highlight */\n if (this.highlightedNeighbors && this.highlightedNode) {\n /** By Node Not Highlight */\n if (!this.highlightedNeighbors.has(node.id) && this.highlightedNode.id != node.id) {\n const fadingOptions = nodeFade({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelFadingMin: this.highlightSettings.highlightByNodeForLabelFadingMin,\n highlightForNodeColorFading: this.highlightSettings.highlightByNodeForNodeColorFading,\n highlightForNodeFadingMin: this.highlightSettings.highlightByNodeForNodeFadingMin,\n highlightForTextFadingMin: this.highlightSettings.highlightByNodeForTextFadingMin,\n });\n alpha = fadingOptions.alpha;\n color = fadingOptions.color;\n textAlpha = fadingOptions.textAlpha;\n labelAlpha = fadingOptions.labelAlpha;\n } else if (\n !this.highlightSettings.highlightByNodeOnlyRoot ||\n (this.highlightSettings.highlightByNodeOnlyRoot && this.highlightedNode.id === node.id)\n ) {\n /** By Node Highlight */\n const highlightOptions = nodeHighlight({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelSizingAdditional:\n this.highlightSettings.highlightByNodeForLabelSizingAdditional,\n highlightForLabelWeightAdditional:\n this.highlightSettings.highlightByNodeForLabelWeightAdditional,\n highlightForNodeBorderColor: this.highlightSettings.highlightByNodeForNodeBorderColor,\n highlightForNodeBorderSizingAdditional:\n this.highlightSettings.highlightByNodeForNodeBorderSizingAdditional,\n highlightForNodeColor: this.highlightSettings.highlightByNodeForNodeColor,\n highlightForNodeSizingAdditional:\n this.highlightSettings.highlightByNodeForNodeSizingAdditional,\n highlightForNodeSizingAdditionalCoefficient:\n this.highlightSettings.highlightByNodeForNodeSizingAdditionalCoefficient,\n highlightForTextShiftXAdditional:\n this.highlightSettings.highlightByNodeForTextShiftXAdditional,\n highlightForTextShiftYAdditional:\n this.highlightSettings.highlightByNodeForTextShiftYAdditional,\n highlightForTextSizingAdditional:\n this.highlightSettings.highlightByNodeForTextSizingAdditional,\n highlightForTextWeightAdditional:\n this.highlightSettings.highlightByNodeForTextWeightAdditional,\n });\n color = highlightOptions.color;\n borderColor = highlightOptions.borderColor;\n borderWidth = highlightOptions.borderWidth;\n radius = highlightOptions.radiusInitial;\n width = highlightOptions.widthInitial;\n height = highlightOptions.heightInitial;\n textSize = highlightOptions.textSize;\n textShiftX = highlightOptions.textShiftX;\n textShiftY = highlightOptions.textShiftY;\n textWeight = highlightOptions.textWeight;\n labelSize = highlightOptions.labelSize;\n labelWeight = highlightOptions.labelWeight;\n }\n }\n if (this.highlightedNeighbors && this.highlightedLink) {\n /** By Link Not Highlight */\n if (\n !this.highlightedNeighbors.has(node.id) &&\n this.highlightedLink.source !== node &&\n this.highlightedLink.target !== node\n ) {\n const fadingOptions = nodeFade({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelFadingMin: this.highlightSettings.highlightByLinkForLabelFadingMin,\n highlightForNodeColorFading: this.highlightSettings.highlightByLinkForNodeColorFading,\n highlightForNodeFadingMin: this.highlightSettings.highlightByLinkForNodeFadingMin,\n highlightForTextFadingMin: this.highlightSettings.highlightByLinkForTextFadingMin,\n });\n alpha = fadingOptions.alpha;\n color = fadingOptions.color;\n textAlpha = fadingOptions.textAlpha;\n labelAlpha = fadingOptions.labelAlpha;\n } else {\n /** By Link Highlight */\n\n const highlightOptions = nodeHighlight({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelSizingAdditional:\n this.highlightSettings.highlightByLinkForLabelSizingAdditional,\n highlightForLabelWeightAdditional:\n this.highlightSettings.highlightByLinkForLabelWeightAdditional,\n highlightForNodeBorderColor: this.highlightSettings.highlightByLinkForNodeBorderColor,\n highlightForNodeBorderSizingAdditional:\n this.highlightSettings.highlightByLinkForNodeBorderSizingAdditional,\n highlightForNodeColor: this.highlightSettings.highlightByLinkForNodeColor,\n highlightForNodeSizingAdditional:\n this.highlightSettings.highlightByLinkForNodeSizingAdditional,\n highlightForNodeSizingAdditionalCoefficient:\n this.highlightSettings.highlightByLinkForNodeSizingAdditionalCoefficient,\n highlightForTextShiftXAdditional:\n this.highlightSettings.highlightByLinkForTextShiftXAdditional,\n highlightForTextShiftYAdditional:\n this.highlightSettings.highlightByLinkForTextShiftYAdditional,\n highlightForTextSizingAdditional:\n this.highlightSettings.highlightByLinkForTextSizingAdditional,\n highlightForTextWeightAdditional:\n this.highlightSettings.highlightByLinkForTextWeightAdditional,\n });\n color = highlightOptions.color;\n borderColor = highlightOptions.borderColor;\n borderWidth = highlightOptions.borderWidth;\n radius = highlightOptions.radiusInitial;\n width = highlightOptions.widthInitial;\n height = highlightOptions.heightInitial;\n textSize = highlightOptions.textSize;\n textShiftX = highlightOptions.textShiftX;\n textShiftY = highlightOptions.textShiftY;\n textWeight = highlightOptions.textWeight;\n labelSize = highlightOptions.labelSize;\n labelWeight = highlightOptions.labelWeight;\n }\n }\n\n /** Node parameters */\n node._radius = radius;\n node._borderWidth = borderWidth;\n node._width = width;\n node._height = height;\n node._borderRadius =\n isNumber(nodeOptions.borderRadius) && nodeOptions.borderRadius > 0\n ? Math.min(nodeOptions.borderRadius, nodeOptions.width / 2, nodeOptions.height / 2)\n : 0;\n node._shape = nodeOptions.shape ?? \"circle\";\n\n /** Node Visibility */\n if (\n !isNodeVisible({\n height: this.height,\n width: this.width,\n transform: this.areaTransform,\n node,\n })\n ) {\n node._visible = false;\n\n return;\n }\n node._visible = true;\n\n /** Node draw */\n nodeRenders.push(() => {\n if (!this.context || !node.x || !node.y) return;\n\n this.context.beginPath();\n this.context.globalAlpha = alpha;\n this.context.lineWidth = borderWidth;\n this.context.strokeStyle = borderColor;\n this.context.fillStyle = color;\n const labelLines = this.cachedNodeLabel[index];\n\n switch (nodeOptions.shape) {\n case \"circle\": {\n if (!node.image) {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n } else {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n this.context.closePath();\n this.context.save();\n this.context.clip();\n\n this.context.drawImage(\n node.image,\n node.x - radius,\n node.y - radius,\n radius * 2,\n radius * 2,\n );\n\n this.context.restore();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n }\n\n if (node.label && labelLines) {\n this.context.globalAlpha = labelAlpha;\n drawText({\n context: this.context,\n lines: labelLines,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textGap: nodeOptions.labelGap,\n textSize: labelSize,\n textStyle: nodeOptions.labelStyle,\n textWeight: labelWeight,\n x: node.x,\n y: node.y + labelSize / 3,\n });\n }\n\n break;\n }\n case \"square\": {\n if (!node.image) {\n this.context.roundRect(\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n node._borderRadius,\n );\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n } else {\n this.context.roundRect(\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n node._borderRadius,\n );\n this.context.closePath();\n this.context.save();\n this.context.clip();\n this.context.drawImage(\n node.image,\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n );\n this.context.restore();\n\n if (borderWidth > 0) {\n this.context.stroke();\n }\n }\n if (node.label && labelLines) {\n this.context.globalAlpha = labelAlpha;\n drawText({\n context: this.context,\n lines: labelLines,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textGap: nodeOptions.labelGap,\n textSize: labelSize,\n textStyle: nodeOptions.labelStyle,\n textWeight: labelWeight,\n x: node.x,\n y: node.y + labelSize / 3,\n });\n }\n break;\n }\n case \"text\": {\n if (this.nodeSettings.textNodeDebug) {\n this.context.strokeRect(node.x - width / 2, node.y - height / 2, width, height);\n }\n\n if (nodeOptions.label && labelLines)\n drawText({\n lines: labelLines,\n context: this.context,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textSize: labelSize,\n x: node.x,\n y: node.y + textSize / 4 - (labelLines.length - 1) * (textSize / 2),\n textStyle: nodeOptions.labelStyle,\n textWeight,\n textGap: nodeOptions.labelGap,\n });\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n break;\n }\n default: {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n break;\n }\n }\n });\n\n if (nodeOptions.nodeExtraDraw) {\n nodeRenders.push(() => {\n nodeOptions?.nodeExtraDraw?.bind?.(this)?.(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n });\n });\n }\n\n /** Text draw */\n const textLines = this.cachedNodeText[index];\n if (nodeOptions.textVisible && nodeOptions.text && textLines) {\n textRenders.push(() => {\n if (nodeOptions.textDraw) {\n nodeOptions.textDraw.bind(this)(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n });\n\n return;\n }\n\n if (!this.context || !node.x || !node.y || !nodeOptions.text) return;\n this.context.beginPath();\n this.context.globalAlpha = textAlpha;\n\n let y = node.y + textShiftY;\n if (nodeOptions.shape === \"circle\") {\n y += radius;\n }\n if (nodeOptions.shape === \"square\" || nodeOptions.shape === \"text\") {\n y += height / 2;\n }\n\n drawText({\n lines: textLines,\n context: this.context,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize,\n x: node.x + textShiftX,\n y,\n textStyle: nodeOptions.textStyle,\n textWeight,\n textGap: nodeOptions.textGap,\n });\n\n if (nodeOptions.textExtraDraw) {\n nodeOptions.textExtraDraw.bind(this)(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n });\n }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SAAS,EAAE,WAAW,CAAC,SAAS;oBAChC,QAAQ,EAAE,WAAW,CAAC,QAAQ;oBAC9B,QAAQ;AACR,oBAAA,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,UAAU;oBACtB,CAAC;oBACD,SAAS,EAAE,WAAW,CAAC,SAAS;oBAChC,UAAU;oBACV,OAAO,EAAE,WAAW,CAAC,OAAO;AAC7B,iBAAA,CAAC;AAEF,gBAAA,IAAI,WAAW,CAAC,aAAa,EAAE;oBAC7B,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;AACzC,wBAAA,GAAG,WAAW;wBACd,MAAM;wBACN,KAAK;wBACL,KAAK;wBACL,SAAS;wBACT,QAAQ;wBACR,UAAU;wBACV,UAAU;wBACV,UAAU;AACX,qBAAA,CAAC;;AAEN,aAAC,CAAC;;AAEN,KAAC;AACH;;;;"}
@@ -19,11 +19,11 @@ function initArea() {
19
19
  if (!this.area)
20
20
  throw new Error("couldn't create canvas");
21
21
  this.container.appendChild(this.area);
22
- this.areaRect = this.area.getBoundingClientRect();
23
22
  this.context = this.area.getContext("2d");
24
23
  if (!this.context)
25
24
  throw new Error("couldn't create canvas context");
26
25
  this.context.scale(this.dpi, this.dpi);
26
+ this.updateRect();
27
27
  }
28
28
  }
29
29
 
@@ -1 +1 @@
1
- {"version":3,"file":"init-area.js","sources":["../../../../../src/module/GraphCanvas/slices/init-area.ts"],"sourcesContent":["import { create as d3Create } from \"d3-selection\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\n\nexport function initArea<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n if (!this.area || !this.context || !this.container) {\n this.container = d3Create(\"div\")\n .attr(\"style\", \"padding: 0 !important; width: 100%; height: 100%;\")\n .node();\n if (!this.container) throw new Error(\"couldn't create container\");\n this.root.appendChild(this.container);\n\n const { width, height } = this.root.getBoundingClientRect();\n this.width = width;\n this.height = height;\n\n this.area = d3Create(\"canvas\")\n .attr(\"width\", this.dpi * this.width)\n .attr(\"height\", this.dpi * this.height)\n .attr(\"style\", `width: 100%; height: 100%; border: none !important;`)\n .node();\n\n if (!this.area) throw new Error(\"couldn't create canvas\");\n this.container.appendChild(this.area);\n this.areaRect = this.area.getBoundingClientRect();\n\n this.context = this.area.getContext(\"2d\");\n if (!this.context) throw new Error(\"couldn't create canvas context\");\n this.context.scale(this.dpi, this.dpi);\n }\n}\n"],"names":["d3Create"],"mappings":";;SAGgB,QAAQ,GAAA;AAItB,IAAA,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;AAClD,QAAA,IAAI,CAAC,SAAS,GAAGA,MAAQ,CAAC,KAAK;AAC5B,aAAA,IAAI,CAAC,OAAO,EAAE,mDAAmD;AACjE,aAAA,IAAI,EAAE;QACT,IAAI,CAAC,IAAI,CAAC,SAAS;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC;QACjE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC;AAErC,QAAA,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE;AAC3D,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;AAEpB,QAAA,IAAI,CAAC,IAAI,GAAGA,MAAQ,CAAC,QAAQ;aAC1B,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK;aACnC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM;AACrC,aAAA,IAAI,CAAC,OAAO,EAAE,CAAA,mDAAA,CAAqD;AACnE,aAAA,IAAI,EAAE;QAET,IAAI,CAAC,IAAI,CAAC,IAAI;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC;QACzD,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE;QAEjD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QACzC,IAAI,CAAC,IAAI,CAAC,OAAO;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC;AACpE,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;;AAE1C;;;;"}
1
+ {"version":3,"file":"init-area.js","sources":["../../../../../src/module/GraphCanvas/slices/init-area.ts"],"sourcesContent":["import { create as d3Create } from \"d3-selection\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\n\nexport function initArea<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n if (!this.area || !this.context || !this.container) {\n this.container = d3Create(\"div\")\n .attr(\"style\", \"padding: 0 !important; width: 100%; height: 100%;\")\n .node();\n if (!this.container) throw new Error(\"couldn't create container\");\n this.root.appendChild(this.container);\n const { width, height } = this.root.getBoundingClientRect();\n this.width = width;\n this.height = height;\n this.area = d3Create(\"canvas\")\n .attr(\"width\", this.dpi * this.width)\n .attr(\"height\", this.dpi * this.height)\n .attr(\"style\", `width: 100%; height: 100%; border: none !important;`)\n .node();\n if (!this.area) throw new Error(\"couldn't create canvas\");\n this.container.appendChild(this.area);\n this.context = this.area.getContext(\"2d\");\n if (!this.context) throw new Error(\"couldn't create canvas context\");\n this.context.scale(this.dpi, this.dpi);\n this.updateRect();\n }\n}\n"],"names":["d3Create"],"mappings":";;SAGgB,QAAQ,GAAA;AAItB,IAAA,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CA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AU,EAAE;;AAErB;;;;"}
@@ -2,7 +2,6 @@ import { isBoolean } from '@krainovsd/js-helpers';
2
2
  import { greatest } from 'd3-array';
3
3
  import { drag } from 'd3-drag';
4
4
  import { select } from 'd3-selection';
5
- import { pointerGetter } from '../lib/utils/pointer-getter.js';
6
5
 
7
6
  function initDnd() {
8
7
  if (!this.area || !this.nodes)
@@ -12,10 +11,8 @@ function initDnd() {
12
11
  if (this.listeners.onDragSubject) {
13
12
  return this.listeners.onDragSubject.call(this, event);
14
13
  }
15
- if (!this.areaRect)
16
- return;
17
14
  const mouseEvent = event.sourceEvent;
18
- const [pointerX, pointerY] = pointerGetter(mouseEvent, this.areaRect, this.areaTransform);
15
+ const [pointerX, pointerY] = this.getPointerAreaPosition(mouseEvent);
19
16
  return greatest(this.nodes, (node) => {
20
17
  if (!node.x || !node.y || (isBoolean(node.drag) && !node.drag))
21
18
  return undefined;
@@ -31,12 +28,16 @@ function initDnd() {
31
28
  if (this.simulation)
32
29
  this.simulation.alphaTarget(0.3).restart();
33
30
  }
34
- if (!this.areaRect)
35
- return;
36
31
  const mouseEvent = event.sourceEvent;
37
- const [pointerX, pointerY] = pointerGetter(mouseEvent, this.areaRect, this.areaTransform);
38
- event.subject.fx = pointerX;
39
- event.subject.fy = pointerY;
32
+ const [pointerX, pointerY] = this.getPointerAreaPosition(mouseEvent);
33
+ if (this._translateExtent) {
34
+ event.subject.fx = Math.max(this._translateExtent[0][0], Math.min(this._translateExtent[1][0], pointerX));
35
+ event.subject.fy = Math.max(this._translateExtent[0][1], Math.min(this._translateExtent[1][1], pointerY));
36
+ }
37
+ else {
38
+ event.subject.fx = pointerX;
39
+ event.subject.fy = pointerY;
40
+ }
40
41
  this.listeners.onMoveDragFinished?.call?.(this, event);
41
42
  })
42
43
  .on("end", (event) => {
@@ -44,10 +45,16 @@ function initDnd() {
44
45
  if (!event.active && this.simulation)
45
46
  this.simulation.alphaTarget(0);
46
47
  const sourceEvent = event.sourceEvent;
47
- if (sourceEvent.altKey && this.areaRect) {
48
- const [pointerX, pointerY] = pointerGetter(sourceEvent, this.areaRect, this.areaTransform);
49
- event.subject.fx = pointerX;
50
- event.subject.fy = pointerY;
48
+ if (sourceEvent.altKey) {
49
+ const [pointerX, pointerY] = this.getPointerAreaPosition(sourceEvent);
50
+ if (this._translateExtent) {
51
+ event.subject.fx = Math.max(this._translateExtent[0][0], Math.min(this._translateExtent[1][0], pointerX));
52
+ event.subject.fy = Math.max(this._translateExtent[0][1], Math.min(this._translateExtent[1][1], pointerY));
53
+ }
54
+ else {
55
+ event.subject.fx = pointerX;
56
+ event.subject.fy = pointerY;
57
+ }
51
58
  }
52
59
  else {
53
60
  event.subject.fx = null;
@@ -1 +1 @@
1
- {"version":3,"file":"init-dnd.js","sources":["../../../../../src/module/GraphCanvas/slices/init-dnd.ts"],"sourcesContent":["import { isBoolean } from \"@krainovsd/js-helpers\";\nimport { greatest } from \"d3-array\";\nimport { drag as d3Drag } from \"d3-drag\";\nimport { select as d3Select } from \"d3-selection\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport { pointerGetter } from \"../lib\";\nimport type { DragEventInterface } from \"../types\";\n\nexport function initDnd<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n if (!this.area || !this.nodes) throw new Error(\"bad init data\");\n\n const dragHandler = d3Drag<HTMLCanvasElement, unknown>()\n .subject((event: DragEventInterface<NodeData>) => {\n if (this.listeners.onDragSubject) {\n return this.listeners.onDragSubject.call(this, event);\n }\n\n if (!this.areaRect) return;\n\n const mouseEvent = event.sourceEvent as MouseEvent | TouchEvent;\n const [pointerX, pointerY] = pointerGetter(mouseEvent, this.areaRect, this.areaTransform);\n\n return greatest(this.nodes, (node) => {\n if (!node.x || !node.y || (isBoolean(node.drag) && !node.drag)) return undefined;\n\n return this.graphSettings.dragPlaceCoefficient(node, pointerX, pointerY);\n });\n })\n .on(\"start\", (event: DragEventInterface<NodeData>) => {\n this.listeners.onStartDragFinished?.call?.(this, event);\n })\n .on(\"drag\", (event: DragEventInterface<NodeData>) => {\n if (!this.isDragging) {\n this.isDragging = true;\n if (this.simulation) this.simulation.alphaTarget(0.3).restart();\n }\n\n if (!this.areaRect) return;\n const mouseEvent = event.sourceEvent as MouseEvent | TouchEvent;\n const [pointerX, pointerY] = pointerGetter(mouseEvent, this.areaRect, this.areaTransform);\n event.subject.fx = pointerX;\n event.subject.fy = pointerY;\n\n this.listeners.onMoveDragFinished?.call?.(this, event);\n })\n .on(\"end\", (event: DragEventInterface<NodeData>) => {\n this.isDragging = false;\n\n if (!event.active && this.simulation) this.simulation.alphaTarget(0);\n\n const sourceEvent = event.sourceEvent as MouseEvent | TouchEvent;\n if (sourceEvent.altKey && this.areaRect) {\n const [pointerX, pointerY] = pointerGetter(sourceEvent, this.areaRect, this.areaTransform);\n event.subject.fx = pointerX;\n event.subject.fy = pointerY;\n } else {\n event.subject.fx = null;\n event.subject.fy = null;\n }\n\n this.listeners.onEndDragFinished?.call?.(this, event);\n });\n\n d3Select(this.area).call(dragHandler);\n}\n"],"names":["d3Drag","d3Select"],"mappings":";;;;;;SAQgB,OAAO,GAAA;IAIrB,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC;IAE/D,MAAM,WAAW,GAAGA,IAAM;AACvB,SAAA,OAAO,CAAC,CAAC,KAAmC,KAAI;AAC/C,QAAA,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE;AAChC,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;;QAGvD,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE;AAEpB,QAAA,MAAM,UAAU,GAAG,KAAK,CAAC,WAAsC;AAC/D,QAAA,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,aAAa,CAAC,U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I,EAAE,KAAK,CAAC;AACxD,KAAC;AACA,SAAA,EAAE,CAAC,KAAK,EAAE,CAAC,KAAmC,KAAI;AACjD,QAAA,IAAI,CAAC,UAAU,GAAG,KAAK;AAEvB,QAAA,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,UAAU;AAAE,YAAA,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;AAEpE,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,WAAsC;QAChE,IAAI,WAAW,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE;AACvC,YAAA,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC;AAC1F,YAAA,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,QAAQ;AAC3B,YAAA,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,QAAQ;;aACtB;AACL,YAAA,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI;AACvB,YAAA,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI;;AAGzB,QAAA,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,CAAC;AACvD,KAAC,CAAC;IAEJC,MAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;AACvC;;;;"}
1
+ {"version":3,"file":"init-dnd.js","sources":["../../../../../src/module/GraphCanvas/slices/init-dnd.ts"],"sourcesContent":["import { isBoolean } from \"@krainovsd/js-helpers\";\nimport { greatest } from \"d3-array\";\nimport { drag as d3Drag } from \"d3-drag\";\nimport { select as d3Select } from \"d3-selection\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport type { DragEventInterface } from \"../types\";\n\nexport function initDnd<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n if (!this.area || !this.nodes) throw new Error(\"bad init data\");\n\n const dragHandler = d3Drag<HTMLCanvasElement, unknown>()\n .subject((event: DragEventInterface<NodeData>) => {\n if (this.listeners.onDragSubject) {\n return this.listeners.onDragSubject.call(this, event);\n }\n\n const mouseEvent = event.sourceEvent as MouseEvent | TouchEvent;\n const [pointerX, pointerY] = this.getPointerAreaPosition(mouseEvent);\n\n return greatest(this.nodes, (node) => {\n if (!node.x || !node.y || (isBoolean(node.drag) && !node.drag)) return undefined;\n\n return this.graphSettings.dragPlaceCoefficient(node, pointerX, pointerY);\n });\n })\n .on(\"start\", (event: DragEventInterface<NodeData>) => {\n this.listeners.onStartDragFinished?.call?.(this, event);\n })\n .on(\"drag\", (event: DragEventInterface<NodeData>) => {\n if (!this.isDragging) {\n this.isDragging = true;\n if (this.simulation) this.simulation.alphaTarget(0.3).restart();\n }\n\n const mouseEvent = event.sourceEvent as MouseEvent | TouchEvent;\n const [pointerX, pointerY] = this.getPointerAreaPosition(mouseEvent);\n\n if (this._translateExtent) {\n event.subject.fx = Math.max(\n this._translateExtent[0][0],\n Math.min(this._translateExtent[1][0], pointerX),\n );\n event.subject.fy = Math.max(\n this._translateExtent[0][1],\n Math.min(this._translateExtent[1][1], pointerY),\n );\n } else {\n event.subject.fx = pointerX;\n event.subject.fy = pointerY;\n }\n\n this.listeners.onMoveDragFinished?.call?.(this, event);\n })\n .on(\"end\", (event: DragEventInterface<NodeData>) => {\n this.isDragging = false;\n\n if (!event.active && this.simulation) this.simulation.alphaTarget(0);\n\n const sourceEvent = event.sourceEvent as MouseEvent | TouchEvent;\n if (sourceEvent.altKey) {\n const [pointerX, pointerY] = this.getPointerAreaPosition(sourceEvent);\n if (this._translateExtent) {\n event.subject.fx = Math.max(\n this._translateExtent[0][0],\n Math.min(this._translateExtent[1][0], pointerX),\n );\n event.subject.fy = Math.max(\n this._translateExtent[0][1],\n Math.min(this._translateExtent[1][1], pointerY),\n );\n } else {\n event.subject.fx = pointerX;\n event.subject.fy = pointerY;\n }\n } else {\n event.subject.fx = null;\n event.subject.fy = null;\n }\n\n this.listeners.onEndDragFinished?.call?.(this, event);\n });\n\n d3Select(this.area).call(dragHandler);\n}\n"],"names":["d3Drag","d3Select"],"mappings":";;;;;SAOgB,OAAO,GAAA;IAIrB,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC;IAE/D,MAAM,WAAW,GAAGA,IAAM;AACvB,SAAA,OAAO,CAAC,CAAC,KAAmC,KAAI;AAC/C,QAAA,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE;AAChC,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;;AAGvD,QAAA,MAAM,UAAU,GAAG,KAAK,CAAC,WAAsC;AAC/D,QAAA,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC;QAEpE,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,KAAI;YACnC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AAAE,gBAAA,OAAO,SAAS;AAEhF,YAAA,OAAO,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC;AAC1E,SAAC,CAAC;AACJ,KAAC;AACA,SAAA,EAAE,CAAC,OAAO,EAAE,CAAC,KAAmC,KAAI;AACnD,QAAA,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,CAAC;AACzD,KAAC;AACA,SAAA,EAAE,CAAC,MAAM,EAAE,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;AACvC;;;;"}
@@ -4,57 +4,7 @@ import { getDrawLink } from './draw-links.js';
4
4
  import { getDrawNode } from './draw-nodes.js';
5
5
 
6
6
  function initDraw() {
7
- let hasHighlight = false;
8
- function calculateHighlight(recursive) {
9
- if (hasHighlight && !recursive)
10
- return;
11
- /** animation up */
12
- if (!this.highlightWorking && this.highlightProgress > 0) {
13
- const highlightDownStep = 1 / this.highlightSettings.highlightDownFrames;
14
- this.highlightProgress -= highlightDownStep;
15
- if (!this.simulationWorking) {
16
- hasHighlight = true;
17
- return void requestAnimationFrame(() => this.draw(true));
18
- }
19
- if (!this.linkSettings.particles) {
20
- hasHighlight = false;
21
- return;
22
- }
23
- }
24
- /** animation down */
25
- if (this.highlightWorking && this.highlightProgress < 1) {
26
- const highlightUpStep = 1 / this.highlightSettings.highlightUpFrames;
27
- this.highlightProgress += highlightUpStep;
28
- if (!this.simulationWorking) {
29
- hasHighlight = true;
30
- return void requestAnimationFrame(() => this.draw(true));
31
- }
32
- if (!this.linkSettings.particles) {
33
- hasHighlight = false;
34
- return;
35
- }
36
- }
37
- /** animation active */
38
- if (this.linkSettings.particles && this.highlightWorking && !this.simulationWorking) {
39
- hasHighlight = true;
40
- return void requestAnimationFrame(() => this.draw(true));
41
- }
42
- /** animation stop */
43
- if (!this.highlightWorking && this.highlightProgress <= 0) {
44
- if (this.highlightedNeighbors || this.highlightedNode || this.highlightedLink) {
45
- this.highlightedNeighbors = null;
46
- this.highlightedNode = null;
47
- this.highlightedLink = null;
48
- this.particles = {};
49
- if (!this.simulationWorking) {
50
- hasHighlight = true;
51
- return void requestAnimationFrame(() => this.draw(true));
52
- }
53
- }
54
- }
55
- hasHighlight = false;
56
- }
57
- function draw(recursive = false) {
7
+ function draw() {
58
8
  if (!this.context)
59
9
  return;
60
10
  if (this.listeners.onDraw) {
@@ -74,8 +24,20 @@ function initDraw() {
74
24
  nodeRenders.forEach((render) => render());
75
25
  textRenders.forEach((render) => render());
76
26
  this.context.restore();
27
+ /** selection rectangle */
28
+ if (this.isSelecting && this.selectionRect) {
29
+ const rect = this.selectionRect;
30
+ const screenX = Math.min(rect.x1, rect.x2) * this.areaTransform.k + this.areaTransform.x;
31
+ const screenY = Math.min(rect.y1, rect.y2) * this.areaTransform.k + this.areaTransform.y;
32
+ const screenW = Math.abs(rect.x2 - rect.x1) * this.areaTransform.k;
33
+ const screenH = Math.abs(rect.y2 - rect.y1) * this.areaTransform.k;
34
+ this.context.fillStyle = "rgba(66, 133, 244, 0.2)";
35
+ this.context.fillRect(screenX, screenY, screenW, screenH);
36
+ this.context.strokeStyle = "rgba(66, 133, 244, 0.8)";
37
+ this.context.lineWidth = 2;
38
+ this.context.strokeRect(screenX, screenY, screenW, screenH);
39
+ }
77
40
  this.listeners.onDrawFinished?.call?.(this);
78
- calculateHighlight.bind(this)(recursive);
79
41
  }
80
42
  if (this.graphSettings.showDrawTime) {
81
43
  return setDrawTime(draw.bind(this), this.graphSettings.showDrawTimeEveryTick);
@@ -1 +1 @@
1
- {"version":3,"file":"init-draw.js","sources":["../../../../../src/module/GraphCanvas/slices/init-draw.ts"],"sourcesContent":["import { setDrawTime } from \"@/lib\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport { getDrawLink } from \"./draw-links\";\nimport { getDrawNode } from \"./draw-nodes\";\n\nexport function initDraw<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n let hasHighlight = false;\n\n function calculateHighlight(this: GraphCanvas<NodeData, LinkData>, recursive: boolean) {\n if (hasHighlight && !recursive) return;\n\n /** animation up */\n if (!this.highlightWorking && this.highlightProgress > 0) {\n const highlightDownStep = 1 / this.highlightSettings.highlightDownFrames;\n this.highlightProgress -= highlightDownStep;\n\n if (!this.simulationWorking) {\n hasHighlight = true;\n\n return void requestAnimationFrame(() => this.draw(true));\n }\n\n if (!this.linkSettings.particles) {\n hasHighlight = false;\n\n return;\n }\n }\n /** animation down */\n if (this.highlightWorking && this.highlightProgress < 1) {\n const highlightUpStep = 1 / this.highlightSettings.highlightUpFrames;\n this.highlightProgress += highlightUpStep;\n\n if (!this.simulationWorking) {\n hasHighlight = true;\n\n return void requestAnimationFrame(() => this.draw(true));\n }\n\n if (!this.linkSettings.particles) {\n hasHighlight = false;\n\n return;\n }\n }\n /** animation active */\n if (this.linkSettings.particles && this.highlightWorking && !this.simulationWorking) {\n hasHighlight = true;\n\n return void requestAnimationFrame(() => this.draw(true));\n }\n\n /** animation stop */\n if (!this.highlightWorking && this.highlightProgress <= 0) {\n if (this.highlightedNeighbors || this.highlightedNode || this.highlightedLink) {\n this.highlightedNeighbors = null;\n this.highlightedNode = null;\n this.highlightedLink = null;\n this.particles = {};\n\n if (!this.simulationWorking) {\n hasHighlight = true;\n\n return void requestAnimationFrame(() => this.draw(true));\n }\n }\n }\n\n hasHighlight = false;\n }\n\n function draw(this: GraphCanvas<NodeData, LinkData>, recursive: boolean = false) {\n if (!this.context) return;\n\n if (this.listeners.onDraw) {\n this.listeners.onDraw.call(this);\n\n return;\n }\n\n this.context.save();\n this.context.clearRect(0, 0, this.width, this.height);\n this.context.translate(this.areaTransform.x, this.areaTransform.y);\n this.context.scale(this.areaTransform.k, this.areaTransform.k);\n\n const textRenders: (() => void)[] = [];\n const nodeRenders: (() => void)[] = [];\n this.nodes.forEach(getDrawNode<NodeData, LinkData>(nodeRenders, textRenders).bind(this));\n\n /** links */\n this.links.forEach(getDrawLink<NodeData, LinkData>().bind(this));\n\n /** nodes */\n\n nodeRenders.forEach((render) => render());\n textRenders.forEach((render) => render());\n\n this.context.restore();\n\n this.listeners.onDrawFinished?.call?.(this);\n\n calculateHighlight.bind(this)(recursive);\n }\n\n if (this.graphSettings.showDrawTime) {\n return setDrawTime(draw.bind(this), this.graphSettings.showDrawTimeEveryTick);\n }\n\n return draw.bind(this);\n}\n"],"names":[],"mappings":";;;;;SAKgB,QAAQ,GAAA;IAItB,IAAI,YAAY,GAAG,KAAK;IAExB,SAAS,kBAAkB,C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AAmB,EAAE;AACtC,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAqB,WAAW,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;AAGxF,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;QAIhE,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QACzC,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;AAEzC,QAAA,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QAEtB,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,GAAG,IAAI,CAAC;QAE3C,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;;AAG1C,IAAA,IAAI,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE;AACnC,QAAA,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC;;AAG/E,IAAA,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACxB;;;;"}
1
+ {"version":3,"file":"init-draw.js","sources":["../../../../../src/module/GraphCanvas/slices/init-draw.ts"],"sourcesContent":["import { setDrawTime } from \"@/lib\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport { getDrawLink } from \"./draw-links\";\nimport { getDrawNode } from \"./draw-nodes\";\n\nexport function initDraw<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n function draw(this: GraphCanvas<NodeData, LinkData>) {\n if (!this.context) return;\n\n if (this.listeners.onDraw) {\n this.listeners.onDraw.call(this);\n\n return;\n }\n\n this.context.save();\n this.context.clearRect(0, 0, this.width, this.height);\n this.context.translate(this.areaTransform.x, this.areaTransform.y);\n this.context.scale(this.areaTransform.k, this.areaTransform.k);\n\n const textRenders: (() => void)[] = [];\n const nodeRenders: (() => void)[] = [];\n this.nodes.forEach(getDrawNode<NodeData, LinkData>(nodeRenders, textRenders).bind(this));\n\n /** links */\n this.links.forEach(getDrawLink<NodeData, LinkData>().bind(this));\n\n /** nodes */\n\n nodeRenders.forEach((render) => render());\n textRenders.forEach((render) => render());\n\n this.context.restore();\n\n /** selection rectangle */\n if (this.isSelecting && this.selectionRect) {\n const rect = this.selectionRect;\n const screenX = Math.min(rect.x1, rect.x2) * this.areaTransform.k + this.areaTransform.x;\n const screenY = Math.min(rect.y1, rect.y2) * this.areaTransform.k + this.areaTransform.y;\n const screenW = Math.abs(rect.x2 - rect.x1) * this.areaTransform.k;\n const screenH = Math.abs(rect.y2 - rect.y1) * this.areaTransform.k;\n\n this.context.fillStyle = \"rgba(66, 133, 244, 0.2)\";\n this.context.fillRect(screenX, screenY, screenW, screenH);\n this.context.strokeStyle = \"rgba(66, 133, 244, 0.8)\";\n this.context.lineWidth = 2;\n this.context.strokeRect(screenX, screenY, screenW, screenH);\n }\n this.listeners.onDrawFinished?.call?.(this);\n }\n\n if (this.graphSettings.showDrawTime) {\n return setDrawTime(draw.bind(this), this.graphSettings.showDrawTimeEveryTick);\n }\n\n return draw.bind(this);\n}\n"],"names":[],"mappings":";;;;;SAKgB,QAAQ,GAAA;AAItB,IAAA,SAAS,IAAI,GAAA;QACX,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE;AAEnB,QAAA,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YACzB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;YAEhC;;AAGF,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;AACnB,QAAA,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;AACrD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,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;YAClE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;AAElE,YAAA,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,yBAAyB;AAClD,YAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;AACzD,YAAA,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,yBAAyB;AACpD,YAAA,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC;AAC1B,YAAA,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;;QAE7D,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,GAAG,IAAI,CAAC;;AAG7C,IAAA,IAAI,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE;AACnC,QAAA,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC;;AAG/E,IAAA,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACxB;;;;"}
@@ -1,5 +1,8 @@
1
- import { isObject } from 'lodash';
2
- import { checkType } from '../../../lib/check-type.js';
1
+ import '../constants/force-settings.js';
2
+ import '../constants/graph-settings.js';
3
+ import '../constants/highlight-settings.js';
4
+ import '../constants/link-settings.js';
5
+ import '../constants/node-settings.js';
3
6
  import '@krainovsd/js-helpers';
4
7
  import { nodeByPointerGetter } from '../lib/utils/node-by-pointer-getter.js';
5
8
  import { linkByPointerGetter } from '../lib/utils/link-by-pointer-getter.js';
@@ -8,7 +11,7 @@ function initPointer() {
8
11
  if (!this.area || !this.nodes)
9
12
  throw new Error("bad init data");
10
13
  function onHover(event) {
11
- if (!this.area)
14
+ if (!this.area || this.isSelecting)
12
15
  return;
13
16
  let currentNode;
14
17
  let currentLink;
@@ -17,10 +20,10 @@ function initPointer() {
17
20
  let highlightNode = true;
18
21
  let highlightLink = true;
19
22
  if (checkHighlightNode) {
23
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
20
24
  currentNode = nodeByPointerGetter({
21
- areaRect: this.areaRect,
22
- areaTransform: this.areaTransform,
23
- mouseEvent: event,
25
+ pointerX,
26
+ pointerY,
24
27
  nodes: this.nodes,
25
28
  });
26
29
  if (currentNode?.highlight != undefined)
@@ -30,11 +33,11 @@ function initPointer() {
30
33
  this.area.style.cursor = "pointer";
31
34
  }
32
35
  else if (checkHighlightLink) {
36
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
33
37
  currentLink = linkByPointerGetter({
38
+ pointerX,
39
+ pointerY,
34
40
  linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
35
- areaRect: this.areaRect,
36
- areaTransform: this.areaTransform,
37
- mouseEvent: event,
38
41
  links: this.links,
39
42
  curve: this.linkSettings.curve,
40
43
  });
@@ -50,53 +53,23 @@ function initPointer() {
50
53
  else {
51
54
  this.area.style.cursor = "default";
52
55
  }
53
- if (currentNode && highlightNode && this.highlightedNode !== currentNode) {
54
- this.highlightedNode = currentNode;
55
- this.highlightedLink = null;
56
- this.highlightedNeighbors = new Set(this.highlightedNode?.neighbors ?? []);
57
- this.highlightWorking = true;
58
- if (!this.simulationWorking)
59
- requestAnimationFrame(() => {
60
- this.draw();
61
- });
62
- }
63
- else if (currentLink &&
64
- highlightLink &&
65
- checkType(currentLink.source, isObject(currentLink.source)) &&
66
- checkType(currentLink.target, isObject(currentLink.target)) &&
67
- this.highlightedLink !== currentLink) {
68
- this.highlightProgress = 0;
69
- this.highlightedLink = currentLink;
70
- this.highlightedNode = null;
71
- this.highlightedNeighbors = new Set([currentLink.source.id, currentLink.target.id]);
72
- this.highlightWorking = true;
73
- if (!this.simulationWorking)
74
- requestAnimationFrame(() => {
75
- this.draw();
76
- });
77
- }
78
- else if (!currentNode && !currentLink && (this.highlightedNode || this.highlightedLink)) {
79
- this.highlightWorking = false;
80
- if (!this.simulationWorking)
81
- requestAnimationFrame(() => {
82
- this.draw();
83
- });
84
- }
56
+ this.animateHighlight(highlightNode ? currentNode : undefined, highlightLink ? currentLink : undefined);
85
57
  if (!this.listeners.onMove)
86
58
  return;
87
- if (!currentNode && !checkHighlightNode)
59
+ if (!currentNode && !checkHighlightNode) {
60
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
88
61
  currentNode = nodeByPointerGetter({
89
- areaRect: this.areaRect,
90
- areaTransform: this.areaTransform,
91
- mouseEvent: event,
62
+ pointerX,
63
+ pointerY,
92
64
  nodes: this.nodes,
93
65
  });
66
+ }
94
67
  if (!currentNode && (!checkHighlightNode || (!checkHighlightLink && !currentLink))) {
68
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
95
69
  currentLink = linkByPointerGetter({
70
+ pointerX,
71
+ pointerY,
96
72
  linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
97
- areaRect: this.areaRect,
98
- areaTransform: this.areaTransform,
99
- mouseEvent: event,
100
73
  links: this.links,
101
74
  curve: this.linkSettings.curve,
102
75
  });
@@ -110,18 +83,18 @@ function initPointer() {
110
83
  !("button" in event) ||
111
84
  event.button !== 1)
112
85
  return;
86
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
113
87
  const currentNode = nodeByPointerGetter({
114
- areaRect: this.areaRect,
115
- areaTransform: this.areaTransform,
116
- mouseEvent: event,
88
+ pointerX,
89
+ pointerY,
117
90
  nodes: this.nodes,
118
91
  });
119
92
  if (!currentNode) {
93
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
120
94
  const currentLink = linkByPointerGetter({
95
+ pointerX,
96
+ pointerY,
121
97
  linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
122
- areaRect: this.areaRect,
123
- areaTransform: this.areaTransform,
124
- mouseEvent: event,
125
98
  links: this.links,
126
99
  curve: this.linkSettings.curve,
127
100
  });
@@ -132,18 +105,18 @@ function initPointer() {
132
105
  function onRightClick(event) {
133
106
  if (!this.listeners.onContextMenu)
134
107
  return;
108
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
135
109
  const currentNode = nodeByPointerGetter({
136
- areaRect: this.areaRect,
137
- areaTransform: this.areaTransform,
138
- mouseEvent: event,
110
+ pointerX,
111
+ pointerY,
139
112
  nodes: this.nodes,
140
113
  });
141
114
  if (!currentNode) {
115
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
142
116
  const currentLink = linkByPointerGetter({
117
+ pointerX,
118
+ pointerY,
143
119
  linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
144
- areaRect: this.areaRect,
145
- areaTransform: this.areaTransform,
146
- mouseEvent: event,
147
120
  links: this.links,
148
121
  curve: this.linkSettings.curve,
149
122
  });
@@ -154,18 +127,18 @@ function initPointer() {
154
127
  function onDoubleClick(event) {
155
128
  if (!this.listeners.onDoubleClick)
156
129
  return;
130
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
157
131
  const currentNode = nodeByPointerGetter({
158
- areaRect: this.areaRect,
159
- areaTransform: this.areaTransform,
160
- mouseEvent: event,
132
+ pointerX,
133
+ pointerY,
161
134
  nodes: this.nodes,
162
135
  });
163
136
  if (!currentNode) {
137
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
164
138
  const currentLink = linkByPointerGetter({
139
+ pointerX,
140
+ pointerY,
165
141
  linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
166
- areaRect: this.areaRect,
167
- areaTransform: this.areaTransform,
168
- mouseEvent: event,
169
142
  links: this.links,
170
143
  curve: this.linkSettings.curve,
171
144
  });
@@ -176,18 +149,18 @@ function initPointer() {
176
149
  function onClick(event) {
177
150
  if (this.isDragging || !this.listeners.onClick || ("button" in event && event.button !== 0))
178
151
  return;
152
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
179
153
  const currentNode = nodeByPointerGetter({
180
- areaRect: this.areaRect,
181
- areaTransform: this.areaTransform,
182
- mouseEvent: event,
154
+ pointerX,
155
+ pointerY,
183
156
  nodes: this.nodes,
184
157
  });
185
158
  if (!currentNode) {
159
+ const [pointerX, pointerY] = this.getPointerAreaPosition(event);
186
160
  const currentLink = linkByPointerGetter({
161
+ pointerX,
162
+ pointerY,
187
163
  linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
188
- areaRect: this.areaRect,
189
- areaTransform: this.areaTransform,
190
- mouseEvent: event,
191
164
  links: this.links,
192
165
  curve: this.linkSettings.curve,
193
166
  });