@krainovsd/graph 0.12.0-beta.3 → 0.12.0-beta.5

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 (35) hide show
  1. package/lib/cjs/index.cjs +303 -270
  2. package/lib/cjs/index.cjs.map +1 -1
  3. package/lib/esm/constants/link-controls.js +0 -6
  4. package/lib/esm/constants/link-controls.js.map +1 -1
  5. package/lib/esm/constants/node-controls.js +71 -24
  6. package/lib/esm/constants/node-controls.js.map +1 -1
  7. package/lib/esm/index.js +1 -1
  8. package/lib/esm/module/GraphCanvas/GraphCanvas.js +15 -17
  9. package/lib/esm/module/GraphCanvas/GraphCanvas.js.map +1 -1
  10. package/lib/esm/module/GraphCanvas/constants/link-settings.js +0 -1
  11. package/lib/esm/module/GraphCanvas/constants/link-settings.js.map +1 -1
  12. package/lib/esm/module/GraphCanvas/constants/node-settings.js +10 -5
  13. package/lib/esm/module/GraphCanvas/constants/node-settings.js.map +1 -1
  14. package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js +20 -4
  15. package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js.map +1 -1
  16. package/lib/esm/module/GraphCanvas/lib/utils/is-overlaps-node.js +1 -1
  17. package/lib/esm/module/GraphCanvas/lib/utils/is-overlaps-node.js.map +1 -1
  18. package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js +4 -1
  19. package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js.map +1 -1
  20. package/lib/esm/module/GraphCanvas/slices/draw-links.js +7 -20
  21. package/lib/esm/module/GraphCanvas/slices/draw-links.js.map +1 -1
  22. package/lib/esm/module/GraphCanvas/slices/draw-nodes.js +29 -117
  23. package/lib/esm/module/GraphCanvas/slices/draw-nodes.js.map +1 -1
  24. package/lib/esm/module/GraphCanvas/slices/draw-text.js +1 -24
  25. package/lib/esm/module/GraphCanvas/slices/draw-text.js.map +1 -1
  26. package/lib/esm/module/GraphCanvas/slices/init-simulation.js +7 -55
  27. package/lib/esm/module/GraphCanvas/slices/init-simulation.js.map +1 -1
  28. package/lib/esm/module/GraphCanvas/slices/init-zoom.js +4 -2
  29. package/lib/esm/module/GraphCanvas/slices/init-zoom.js.map +1 -1
  30. package/lib/esm/module/GraphCanvas/slices/update-link-cache.js +19 -0
  31. package/lib/esm/module/GraphCanvas/slices/update-link-cache.js.map +1 -0
  32. package/lib/esm/module/GraphCanvas/slices/update-node-cache.js +136 -0
  33. package/lib/esm/module/GraphCanvas/slices/update-node-cache.js.map +1 -0
  34. package/lib/index.d.ts +28 -28
  35. package/package.json +1 -1
@@ -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 {\n isNodeVisible,\n nodeFade,\n nodeHighlight,\n nodeIterationExtractor,\n nodeOptionsGetter,\n nodeRadiusGetter,\n nodeSizeGetter,\n} from \"../lib\";\nimport type {\n CachedTextNodeParametersInterface,\n NodeInterface,\n NodeOptionsInterface,\n} from \"../types\";\nimport { drawText, getTextLines } 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) return;\n\n let nodeOptions: Required<NodeOptionsInterface<NodeData, LinkData>>;\n if (this.nodeSettings.cacheOptions && this.nodeOptionsCache[node.id]) {\n nodeOptions = this.nodeOptionsCache[node.id];\n } else {\n nodeOptions = nodeIterationExtractor(\n node,\n index,\n this.nodes,\n this,\n this.nodeSettings.options ?? {},\n nodeOptionsGetter,\n );\n if (this.nodeSettings.cacheOptions) {\n this.nodeOptionsCache[node.id] = nodeOptions;\n }\n }\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 alpha = nodeOptions.alpha;\n let color = nodeOptions.color;\n let borderColor = nodeOptions.borderColor;\n let borderWidth = nodeOptions.borderWidth;\n let radiusInitial = nodeOptions.radius;\n let widthInitial = nodeOptions.width;\n let heightInitial = nodeOptions.height;\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 radiusInitial = highlightOptions.radiusInitial;\n widthInitial = highlightOptions.widthInitial;\n heightInitial = 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 radiusInitial = highlightOptions.radiusInitial;\n widthInitial = highlightOptions.widthInitial;\n heightInitial = 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 /** Flex radius */\n const radius =\n nodeOptions.shape === \"circle\"\n ? nodeRadiusGetter({\n radiusFlexible: this.nodeSettings.nodeRadiusFlexible,\n radiusInitial,\n radiusCoefficient: this.nodeSettings.nodeRadiusCoefficient,\n radiusFactor: this.nodeSettings.nodeRadiusFactor,\n linkCount: node.linkCount,\n })\n : radiusInitial;\n /** Flex size */\n let height: number = heightInitial;\n let width: number = widthInitial;\n if (nodeOptions.shape === \"square\") {\n const size = nodeSizeGetter({\n heightInitial,\n widthInitial,\n linkCount: node.linkCount,\n sizeCoefficient: this.nodeSettings.nodeSizeCoefficient,\n sizeFactor: this.nodeSettings.nodeSizeFactor,\n sizeFlexible: this.nodeSettings.nodeSizeFlexible,\n });\n width = size.width;\n height = size.height;\n }\n if (nodeOptions.shape === \"text\") {\n width = nodeOptions.width;\n\n const size = nodeSizeGetter({\n heightInitial,\n widthInitial: width,\n linkCount: node.linkCount,\n sizeCoefficient: this.nodeSettings.nodeSizeCoefficient,\n sizeFactor: this.nodeSettings.nodeSizeFactor,\n sizeFlexible: this.nodeSettings.nodeSizeFlexible,\n });\n\n labelSize *= size.additionalSizeCoefficient;\n }\n /** Size by text in textNode */\n if (nodeOptions.shape === \"text\" && nodeOptions.label) {\n let lines: string[];\n\n let textNodeParameters: CachedTextNodeParametersInterface;\n\n const cachedLines = this.cachedNodeLabel[node.id];\n const cachedTextNodeParameters = this.cachedTextNodeParameters[node.id];\n if (cachedLines != undefined && cachedTextNodeParameters != undefined) {\n lines = cachedLines;\n textNodeParameters = cachedTextNodeParameters;\n } else {\n const textInfo = getTextLines({\n context: this.context,\n text: nodeOptions.label,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textSize: labelSize,\n maxWidth: nodeOptions.labelWidth,\n textStyle: nodeOptions.labelStyle,\n textWeight,\n });\n textNodeParameters = [textInfo.currentMaxSize, labelSize];\n lines = textInfo.lines;\n this.cachedNodeLabel[node.id] = lines;\n this.cachedTextNodeParameters[node.id] = textNodeParameters;\n }\n\n const textSizeCoefficient = labelSize / textNodeParameters[1];\n const maxSize = textNodeParameters[0] * textSizeCoefficient;\n\n height =\n lines.length * labelSize +\n (lines.length - 1) * nodeOptions.labelGap +\n nodeOptions.labelYPadding;\n\n width = maxSize + nodeOptions.labelXPadding;\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\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) {\n this.context.globalAlpha = labelAlpha;\n drawText({\n context: this.context,\n cachedNodeText: this.cachedNodeLabel,\n id: node.id,\n text: node.label,\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 maxWidth: nodeOptions.labelWidth,\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) {\n this.context.globalAlpha = labelAlpha;\n drawText({\n context: this.context,\n cachedNodeText: this.cachedNodeLabel,\n id: node.id,\n text: node.label,\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 maxWidth: nodeOptions.labelWidth,\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 const lines = this.cachedNodeLabel[node.id];\n if (nodeOptions.label && lines)\n drawText({\n id: node.id,\n cachedNodeText: this.cachedNodeLabel,\n context: this.context,\n text: nodeOptions.label,\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 - (lines.length - 1) * (textSize / 2),\n maxWidth: nodeOptions.labelWidth,\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 if (nodeOptions.textVisible && nodeOptions.text) {\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 id: node.id,\n cachedNodeText: this.cachedNodeText,\n context: this.context,\n text: nodeOptions.text,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize,\n x: node.x + textShiftX,\n y,\n maxWidth: nodeOptions.textWidth,\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":";;;;;;;;AAkBgB,SAAA,WAAW,CAGzB,WAA2B,EAAE,WAA2B,EAAA;AACxD,IAAA,OAAO,SAAS,QAAQ,CAEtB,IAA6B,EAC7B,KAAa,EAAA;AAEb,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,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AA,IAAI,WAAW,CAAC,KAAK,KAAK,QAAQ,EAAE;oBAClC,CAAC,IAAI,MAAM;;AAEb,gBAAA,IAAI,WAAW,CAAC,KAAK,KAAK,QAAQ,IAAI,WAAW,CAAC,KAAK,KAAK,MAAM,EAAE;AAClE,oBAAA,CAAC,IAAI,MAAM,GAAG,CAAC;;AAGjB,gBAAA,QAAQ,CAAC;oBACP,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,cAAc,EAAE,IAAI,CAAC,cAAc;oBACnC,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,IAAI,EAAE,WAAW,CAAC,IAAI;oBACtB,SAAS,EAAE,WAAW,CAAC,SAAS;oBAChC,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,QAAQ,EAAE,WAAW,CAAC,SAAS;oBAC/B,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;;;;"}
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,OAAO,EAAE;AAC9C,YAAA,IAAI,CAAC,OAAO,GAAG,CAAC;AAChB,YAAA,IAAI,CAAC,MAAM,GAAG,CAAC;AACf,YAAA,IAAI,CAAC,OAAO,GAAG,CAAC;YAEhB;;QAGF,MAA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AAQ;wBACR,UAAU;wBACV,UAAU;wBACV,UAAU;AACX,qBAAA,CAAC;;AAEN,aAAC,CAAC;;AAEN,KAAC;AACH;;;;"}
@@ -1,31 +1,8 @@
1
1
  const SPACE = " ";
2
- function drawText({ context, id, textAlign, textColor, textFont, textStyle, textGap, textWeight, textSize, text, x, y, cachedNodeText, maxWidth, }) {
2
+ function drawText({ context, textAlign, textColor, textFont, textStyle, textGap, textWeight, textSize, x, y, lines, }) {
3
3
  context.font = `${textStyle} normal ${textWeight} ${textSize}px ${textFont}`;
4
4
  context.fillStyle = textColor;
5
5
  context.textAlign = textAlign;
6
- if (cachedNodeText[id] != undefined) {
7
- cachedNodeText[id].forEach((line, index) => {
8
- context.fillText(line, x, y + index * textSize + index * textGap);
9
- });
10
- return;
11
- }
12
- if (maxWidth == undefined || context.measureText(text).width <= maxWidth) {
13
- cachedNodeText[id] = [text];
14
- context.fillText(text, x, y);
15
- return;
16
- }
17
- const { lines } = getTextLines({
18
- context,
19
- maxWidth,
20
- text,
21
- textAlign,
22
- textColor,
23
- textFont,
24
- textSize,
25
- textStyle,
26
- textWeight,
27
- });
28
- cachedNodeText[id] = lines;
29
6
  lines.forEach((line, index) => {
30
7
  context.fillText(line, x, y + index * textSize + index * textGap);
31
8
  });
@@ -1 +1 @@
1
- {"version":3,"file":"draw-text.js","sources":["../../../../../src/module/GraphCanvas/slices/draw-text.ts"],"sourcesContent":["import type { CachedNodeTextInterface, TextStyleEnum } from \"../types\";\n\nexport type DrawTextOptions = {\n id: string | number;\n x: number;\n y: number;\n text: string;\n textSize: number;\n textStyle: TextStyleEnum;\n textWeight: number;\n textFont: string;\n textColor: string;\n textGap: number;\n textAlign: CanvasTextAlign;\n context: CanvasRenderingContext2D;\n cachedNodeText: CachedNodeTextInterface;\n maxWidth?: number;\n};\n\nconst SPACE = \" \";\n\nexport function drawText({\n context,\n id,\n textAlign,\n textColor,\n textFont,\n textStyle,\n textGap,\n textWeight,\n textSize,\n text,\n x,\n y,\n cachedNodeText,\n maxWidth,\n}: DrawTextOptions) {\n context.font = `${textStyle} normal ${textWeight} ${textSize}px ${textFont}`;\n context.fillStyle = textColor;\n context.textAlign = textAlign;\n\n if (cachedNodeText[id] != undefined) {\n cachedNodeText[id].forEach((line, index) => {\n context.fillText(line, x, y + index * textSize + index * textGap);\n });\n\n return;\n }\n\n if (maxWidth == undefined || context.measureText(text).width <= maxWidth) {\n cachedNodeText[id] = [text];\n context.fillText(text, x, y);\n\n return;\n }\n\n const { lines } = getTextLines({\n context,\n maxWidth,\n text,\n textAlign,\n textColor,\n textFont,\n textSize,\n textStyle,\n textWeight,\n });\n\n cachedNodeText[id] = lines;\n lines.forEach((line, index) => {\n context.fillText(line, x, y + index * textSize + index * textGap);\n });\n}\n\nexport type GetTextLines = {\n text: string;\n textSize: number;\n textStyle: TextStyleEnum;\n textWeight: number;\n textFont: string;\n textColor: string;\n textAlign: CanvasTextAlign;\n context: CanvasRenderingContext2D;\n maxWidth: number;\n};\nexport function getTextLines({\n context,\n textAlign,\n textColor,\n textFont,\n textStyle,\n textWeight,\n textSize,\n text,\n maxWidth,\n}: GetTextLines) {\n context.font = `${textStyle} normal ${textWeight} ${textSize}px ${textFont}`;\n context.fillStyle = textColor;\n context.textAlign = textAlign;\n\n const spaceWidth = context.measureText(\" \").width;\n const lines: string[] = [];\n let lineWidth = 0;\n let line = \"\";\n let currentMaxSize = 0;\n\n for (const word of text.split(\" \")) {\n const size = context.measureText(word).width;\n lineWidth += size + spaceWidth;\n\n if (line === \"\") {\n line = word;\n\n continue;\n }\n if (lineWidth > maxWidth) {\n const initialSize = lineWidth - size - spaceWidth;\n if (initialSize > currentMaxSize) currentMaxSize = initialSize;\n\n lineWidth = size;\n lines.push(line);\n line = word;\n } else {\n lineWidth += spaceWidth;\n line += `${SPACE}${word}`;\n }\n }\n\n if (line !== \"\") lines.push(line);\n if (lineWidth > currentMaxSize) currentMaxSize = lineWidth;\n\n return { lines, currentMaxSize };\n}\n"],"names":[],"mappings":"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AAI,CAAC;YAChB,IAAI,GAAG,IAAI;;aACN;YACL,SAAS,IAAI,UAAU;AACvB,YAAA,IAAI,IAAI,CAAG,EAAA,KAAK,CAAG,EAAA,IAAI,EAAE;;;IAI7B,IAAI,IAAI,KAAK,EAAE;AAAE,QAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;IACjC,IAAI,SAAS,GAAG,cAAc;QAAE,cAAc,GAAG,SAAS;AAE1D,IAAA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE;AAClC;;;;"}
1
+ {"version":3,"file":"draw-text.js","sources":["../../../../../src/module/GraphCanvas/slices/draw-text.ts"],"sourcesContent":["import type { TextStyleEnum } from \"../types\";\n\nexport type DrawTextOptions = {\n lines: string[];\n x: number;\n y: number;\n textSize: number;\n textStyle: TextStyleEnum;\n textWeight: number;\n textFont: string;\n textColor: string;\n textGap: number;\n textAlign: CanvasTextAlign;\n context: CanvasRenderingContext2D;\n};\n\nconst SPACE = \" \";\n\nexport function drawText({\n context,\n textAlign,\n textColor,\n textFont,\n textStyle,\n textGap,\n textWeight,\n textSize,\n x,\n y,\n lines,\n}: DrawTextOptions) {\n context.font = `${textStyle} normal ${textWeight} ${textSize}px ${textFont}`;\n context.fillStyle = textColor;\n context.textAlign = textAlign;\n\n lines.forEach((line, index) => {\n context.fillText(line, x, y + index * textSize + index * textGap);\n });\n}\n\nexport type GetTextLines = {\n text: string;\n textSize: number;\n textStyle: TextStyleEnum;\n textWeight: number;\n textFont: string;\n textColor: string;\n textAlign: CanvasTextAlign;\n context: CanvasRenderingContext2D;\n maxWidth: number;\n};\nexport function getTextLines({\n context,\n textAlign,\n textColor,\n textFont,\n textStyle,\n textWeight,\n textSize,\n text,\n maxWidth,\n}: GetTextLines) {\n context.font = `${textStyle} normal ${textWeight} ${textSize}px ${textFont}`;\n context.fillStyle = textColor;\n context.textAlign = textAlign;\n\n const spaceWidth = context.measureText(\" \").width;\n const lines: string[] = [];\n let lineWidth = 0;\n let line = \"\";\n let currentMaxSize = 0;\n\n for (const word of text.split(\" \")) {\n const size = context.measureText(word).width;\n lineWidth += size + spaceWidth;\n\n if (line === \"\") {\n line = word;\n\n continue;\n }\n if (lineWidth > maxWidth) {\n const initialSize = lineWidth - size - spaceWidth;\n if (initialSize > currentMaxSize) currentMaxSize = initialSize;\n\n lineWidth = size;\n lines.push(line);\n line = word;\n } else {\n lineWidth += spaceWidth;\n line += `${SPACE}${word}`;\n }\n }\n\n if (line !== \"\") lines.push(line);\n if (lineWidth > currentMaxSize) currentMaxSize = lineWidth;\n\n return { lines, currentMaxSize };\n}\n"],"names":[],"mappings":"AAgBA,MAAM,KAAK,GAAG,GAAG;AAEX,SAAU,QAAQ,CAAC,EACvB,OAAO,EACP,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAAO,EACP,UAAU,EACV,QAAQ,EACR,CAAC,EACD,CAAC,EACD,KAAK,GACW,EAAA;AAChB,IAAA,OAAO,CAAC,IAAI,GAAG,CAAA,EAAG,SAAS,CAAA,QAAA,EAAW,UAAU,CAAA,CAAA,EAAI,QAAQ,CAAA,GAAA,EAAM,QAAQ,CAAA,CAAE;AAC5E,IAAA,OAAO,CAAC,SAAS,GAAG,SAAS;AAC7B,IAAA,OAAO,CAAC,SAAS,GAAG,SAAS;IAE7B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,KAAI;AAC5B,QAAA,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;AACnE,KAAC,CAAC;AACJ;AAaM,SAAU,YAAY,CAAC,EAC3B,OAAO,EACP,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,QAAQ,GACK,EAAA;AACb,IAAA,OAAO,CAAC,IAAI,GAAG,CAAA,EAAG,SAAS,CAAA,QAAA,EAAW,UAAU,CAAA,CAA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
2
  import '@krainovsd/js-helpers';
3
3
  import { getDrawTime, resetDrawTime } from '../../../lib/draw-time.js';
4
- import { nodeOptionsGetter, nodeRadiusGetter, nodeSizeGetter } from '../lib/settings/node-settings-getter.js';
5
4
  import 'd3-array';
6
5
  import { nodeIterationExtractor } from '../lib/utils/node-iteration-extractor.js';
7
- import { getTextLines } from './draw-text.js';
8
6
 
9
7
  function initSimulation() {
10
8
  if (!this.simulation) {
@@ -89,75 +87,29 @@ function initCollideForce(forceUpdate) {
89
87
  else if (!this.simulation.force("collide") || forceUpdate) {
90
88
  this.simulation.force("collide", forceCollide()
91
89
  .radius((node, index) => {
92
- const nodeOptions = nodeIterationExtractor(node, index, this.nodes, this, this.nodeSettings.options ?? {}, nodeOptionsGetter);
90
+ const nodeOptions = this.nodeOptionsCache[node.id];
91
+ if (!nodeOptions)
92
+ return 0;
93
93
  switch (nodeOptions.shape) {
94
94
  case "circle": {
95
95
  if (this.forceSettings.collideRadius) {
96
96
  return nodeIterationExtractor(node, index, this.nodes, this, this.forceSettings.collideRadius, undefined);
97
97
  }
98
- const radius = nodeRadiusGetter({
99
- radiusFlexible: this.nodeSettings.nodeRadiusFlexible,
100
- radiusInitial: nodeOptions.radius,
101
- radiusCoefficient: this.nodeSettings.nodeRadiusCoefficient,
102
- radiusFactor: this.nodeSettings.nodeRadiusFactor,
103
- linkCount: node.linkCount,
104
- });
105
- return radius + this.forceSettings.collideAdditionalRadius;
98
+ return nodeOptions.radius + this.forceSettings.collideAdditionalRadius;
106
99
  }
107
100
  case "square": {
108
- const { height, width } = nodeSizeGetter({
109
- heightInitial: nodeOptions.width,
110
- widthInitial: nodeOptions.height,
111
- linkCount: node.linkCount,
112
- sizeCoefficient: this.nodeSettings.nodeSizeCoefficient,
113
- sizeFactor: this.nodeSettings.nodeSizeFactor,
114
- sizeFlexible: this.nodeSettings.nodeSizeFlexible,
115
- });
116
- return (Math.sqrt(width ** 2 + height ** 2) / 2 +
101
+ return (Math.sqrt(nodeOptions.width ** 2 + nodeOptions.height ** 2) / 2 +
117
102
  this.forceSettings.collideAdditionalRadius);
118
103
  }
119
104
  case "text": {
120
- let { height, width } = nodeSizeGetter({
121
- heightInitial: nodeOptions.width,
122
- widthInitial: nodeOptions.height,
123
- linkCount: node.linkCount,
124
- sizeCoefficient: this.nodeSettings.nodeSizeCoefficient,
125
- sizeFactor: this.nodeSettings.nodeSizeFactor,
126
- sizeFlexible: this.nodeSettings.nodeSizeFlexible,
127
- });
128
- if (this.context && nodeOptions.text) {
129
- const textInfo = getTextLines({
130
- context: this.context,
131
- text: nodeOptions.text,
132
- textAlign: nodeOptions.textAlign,
133
- textColor: nodeOptions.textColor,
134
- textFont: nodeOptions.textFont,
135
- textSize: nodeOptions.textSize,
136
- maxWidth: width,
137
- textStyle: nodeOptions.textStyle,
138
- textWeight: nodeOptions.textWeight,
139
- });
140
- height =
141
- textInfo.lines.length * nodeOptions.textSize +
142
- (textInfo.lines.length - 1) * nodeOptions.textGap +
143
- nodeOptions.labelYPadding;
144
- width = textInfo.currentMaxSize + nodeOptions.labelXPadding;
145
- }
146
- return (Math.sqrt(width ** 2 + height ** 2) / 2 +
105
+ return (Math.sqrt(nodeOptions.width ** 2 + nodeOptions.height ** 2) / 2 +
147
106
  this.forceSettings.collideAdditionalRadius);
148
107
  }
149
108
  default: {
150
109
  if (this.forceSettings.collideRadius) {
151
110
  return nodeIterationExtractor(node, index, this.nodes, this, this.forceSettings.collideRadius, undefined);
152
111
  }
153
- const radius = nodeRadiusGetter({
154
- radiusFlexible: this.nodeSettings.nodeRadiusFlexible,
155
- radiusInitial: nodeOptions.radius,
156
- radiusCoefficient: this.nodeSettings.nodeRadiusCoefficient,
157
- radiusFactor: this.nodeSettings.nodeRadiusFactor,
158
- linkCount: node.linkCount,
159
- });
160
- return radius + this.forceSettings.collideAdditionalRadius;
112
+ return nodeOptions.radius + this.forceSettings.collideAdditionalRadius;
161
113
  }
162
114
  }
163
115
  })
@@ -1 +1 @@
1
- {"version":3,"file":"init-simulation.js","sources":["../../../../../src/module/GraphCanvas/slices/init-simulation.ts"],"sourcesContent":["import {\n type ForceLink,\n forceCenter,\n forceCollide,\n forceLink,\n forceManyBody,\n forceSimulation,\n forceX,\n forceY,\n} from \"d3-force\";\nimport { getDrawTime, resetDrawTime } from \"@/lib\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport {\n nodeIterationExtractor,\n nodeOptionsGetter,\n nodeRadiusGetter,\n nodeSizeGetter,\n} from \"../lib\";\nimport type { LinkInterface, NodeInterface } from \"../types\";\nimport { getTextLines } from \"./draw-text\";\n\nexport function initSimulation<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n if (!this.simulation) {\n this.simulation = forceSimulation<NodeInterface<NodeData>, LinkInterface<NodeData, LinkData>>()\n .nodes(this.nodes)\n .force(\n \"link\",\n forceLink<NodeInterface<NodeData>, LinkInterface<NodeData, LinkData>>(this.links).id(\n this.nodeSettings.idGetter.bind(this),\n ),\n )\n .on(\"tick\", () => {\n this.draw();\n })\n .on(\"end\", () => {\n this.listeners.onSimulationEnd?.call?.(this);\n\n if (this.graphSettings.showDrawTime) {\n getDrawTime();\n // eslint-disable-next-line no-console\n console.log(`nodes: ${this.nodes.length} | links: ${this.links.length}`);\n resetDrawTime();\n }\n });\n\n initSimulationForces.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initSimulationForces>,\n ReturnType<typeof initSimulationForces>\n >(this);\n }\n}\n\nexport function initSimulationForces<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n if (!this.simulation) return;\n\n const linkForce = this.simulation.force(\"link\") as\n | ForceLink<NodeInterface<NodeData>, LinkInterface<NodeData, LinkData>>\n | undefined;\n\n if (!linkForce) return;\n\n if ((!this.forceSettings.forces || !this.forceSettings.xForce) && this.simulation.force(\"x\")) {\n this.simulation.force(\"x\", null);\n }\n if ((!this.forceSettings.forces || !this.forceSettings.yForce) && this.simulation.force(\"y\")) {\n this.simulation.force(\"y\", null);\n }\n if (\n (!this.forceSettings.forces || !this.forceSettings.chargeForce) &&\n this.simulation.force(\"charge\")\n ) {\n this.simulation.force(\"charge\", null);\n }\n if (\n (!this.forceSettings.forces || !this.forceSettings.centerForce) &&\n this.simulation.force(\"center\")\n ) {\n this.simulation.force(\"center\", null);\n }\n if (!this.forceSettings.forces || !this.forceSettings.linkForce) {\n linkForce.distance(0).strength(0).iterations(0);\n }\n\n if (this.forceSettings.forces && this.forceSettings.linkForce) {\n linkForce\n .distance(this.forceSettings.linkDistance)\n .strength(this.forceSettings.linkStrength)\n .iterations(this.forceSettings.linkIterations);\n }\n if (this.forceSettings.forces && this.forceSettings.xForce) {\n this.simulation.force(\n \"x\",\n forceX<NodeInterface<NodeData>>(this.forceSettings.xPosition).strength(\n this.forceSettings.xStrength,\n ),\n );\n }\n if (this.forceSettings.forces && this.forceSettings.yForce) {\n this.simulation.force(\n \"y\",\n forceY<NodeInterface<NodeData>>(this.forceSettings.yPosition).strength(\n this.forceSettings.yStrength,\n ),\n );\n }\n if (this.forceSettings.forces && this.forceSettings.chargeForce) {\n this.simulation.force(\n \"charge\",\n forceManyBody<NodeInterface<NodeData>>()\n .strength(this.forceSettings.chargeStrength)\n .distanceMax(Infinity)\n .distanceMin(this.forceSettings.chargeDistanceMin),\n );\n }\n if (this.forceSettings.forces && this.forceSettings.centerForce) {\n this.simulation.force(\n \"center\",\n forceCenter<NodeInterface<NodeData>>(\n this.forceSettings.centerPosition.x ?? 0,\n this.forceSettings.centerPosition.y ?? 0,\n ).strength(this.forceSettings.centerStrength),\n );\n }\n\n initCollideForce.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initCollideForce>,\n ReturnType<typeof initCollideForce>\n >(this, true);\n}\n\nexport function initCollideForce<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>, forceUpdate: boolean) {\n if (!this.simulation) return;\n\n if (\n (!this.forceSettings.collideForce || !this.forceSettings.forces) &&\n this.simulation.force(\"collide\")\n ) {\n this.simulation.force(\"collide\", null);\n }\n\n if (this.forceSettings.forces && this.forceSettings.collideForce) {\n const isHasMax =\n this.forceSettings.collideOffMax.links != 0 && this.forceSettings.collideOffMax.nodes != 0;\n const isMaxCollideNodes =\n isHasMax && this.forceSettings.collideOffMax.nodes < this.nodes.length;\n const isMaxCollideLinks =\n isHasMax && this.forceSettings.collideOffMax.links < this.links.length;\n if (isMaxCollideNodes && isMaxCollideLinks) {\n this.simulation.force(\"collide\", null);\n } else if (!this.simulation.force(\"collide\") || forceUpdate) {\n this.simulation.force(\n \"collide\",\n forceCollide<NodeInterface<NodeData>>()\n .radius((node, index) => {\n const nodeOptions = nodeIterationExtractor(\n node,\n index,\n this.nodes,\n this,\n this.nodeSettings.options ?? {},\n nodeOptionsGetter,\n );\n\n switch (nodeOptions.shape) {\n case \"circle\": {\n if (this.forceSettings.collideRadius) {\n return nodeIterationExtractor(\n node,\n index,\n this.nodes,\n this,\n this.forceSettings.collideRadius,\n undefined,\n );\n }\n const radius = nodeRadiusGetter({\n radiusFlexible: this.nodeSettings.nodeRadiusFlexible,\n radiusInitial: nodeOptions.radius,\n radiusCoefficient: this.nodeSettings.nodeRadiusCoefficient,\n radiusFactor: this.nodeSettings.nodeRadiusFactor,\n linkCount: node.linkCount,\n });\n\n return radius + this.forceSettings.collideAdditionalRadius;\n }\n case \"square\": {\n const { height, width } = nodeSizeGetter({\n heightInitial: nodeOptions.width,\n widthInitial: nodeOptions.height,\n linkCount: node.linkCount,\n sizeCoefficient: this.nodeSettings.nodeSizeCoefficient,\n sizeFactor: this.nodeSettings.nodeSizeFactor,\n sizeFlexible: this.nodeSettings.nodeSizeFlexible,\n });\n\n return (\n Math.sqrt(width ** 2 + height ** 2) / 2 +\n this.forceSettings.collideAdditionalRadius\n );\n }\n case \"text\": {\n let { height, width } = nodeSizeGetter({\n heightInitial: nodeOptions.width,\n widthInitial: nodeOptions.height,\n linkCount: node.linkCount,\n sizeCoefficient: this.nodeSettings.nodeSizeCoefficient,\n sizeFactor: this.nodeSettings.nodeSizeFactor,\n sizeFlexible: this.nodeSettings.nodeSizeFlexible,\n });\n\n if (this.context && nodeOptions.text) {\n const textInfo = getTextLines({\n context: this.context,\n text: nodeOptions.text,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize: nodeOptions.textSize,\n maxWidth: width,\n textStyle: nodeOptions.textStyle,\n textWeight: nodeOptions.textWeight,\n });\n\n height =\n textInfo.lines.length * nodeOptions.textSize +\n (textInfo.lines.length - 1) * nodeOptions.textGap +\n nodeOptions.labelYPadding;\n width = textInfo.currentMaxSize + nodeOptions.labelXPadding;\n }\n\n return (\n Math.sqrt(width ** 2 + height ** 2) / 2 +\n this.forceSettings.collideAdditionalRadius\n );\n }\n default: {\n if (this.forceSettings.collideRadius) {\n return nodeIterationExtractor(\n node,\n index,\n this.nodes,\n this,\n this.forceSettings.collideRadius,\n undefined,\n );\n }\n const radius = nodeRadiusGetter({\n radiusFlexible: this.nodeSettings.nodeRadiusFlexible,\n radiusInitial: nodeOptions.radius,\n radiusCoefficient: this.nodeSettings.nodeRadiusCoefficient,\n radiusFactor: this.nodeSettings.nodeRadiusFactor,\n linkCount: node.linkCount,\n });\n\n return radius + this.forceSettings.collideAdditionalRadius;\n }\n }\n })\n .strength(this.forceSettings.collideStrength)\n .iterations(this.forceSettings.collideIterations),\n );\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;SAqBgB,cAAc,GAAA;AAI5B,IAAA,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;AACpB,QAAA,IAAI,CAAC,UAAU,GAAG,eAAe;AAC9B,aAAA,KAAK,CAAC,IAAI,CAAC,KAAK;aAChB,KAAK,CACJ,MAAM,EACN,SAAS,CAA6D,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAClF,IAA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C,kBAAkB;4BACpD,aAAa,EAAE,WAAW,CAAC,MAAM;AACjC,4BAAA,iBAAiB,EAAE,IAAI,CAAC,YAAY,CAAC,qBAAqB;AAC1D,4BAAA,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,gBAAgB;4BAChD,SAAS,EAAE,IAAI,CAAC,SAAS;AAC1B,yBAAA,CAAC;AAEF,wBAAA,OAAO,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,uBAAuB;;;AAGhE,aAAC;AACA,iBAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,eAAe;iBAC3C,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,CACpD;;;AAGP;;;;"}
1
+ {"version":3,"file":"init-simulation.js","sources":["../../../../../src/module/GraphCanvas/slices/init-simulation.ts"],"sourcesContent":["import {\n type ForceLink,\n forceCenter,\n forceCollide,\n forceLink,\n forceManyBody,\n forceSimulation,\n forceX,\n forceY,\n} from \"d3-force\";\nimport { getDrawTime, resetDrawTime } from \"@/lib\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport { nodeIterationExtractor } from \"../lib\";\nimport type { LinkInterface, NodeInterface } from \"../types\";\n\nexport function initSimulation<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n if (!this.simulation) {\n this.simulation = forceSimulation<NodeInterface<NodeData>, LinkInterface<NodeData, LinkData>>()\n .nodes(this.nodes)\n .force(\n \"link\",\n forceLink<NodeInterface<NodeData>, LinkInterface<NodeData, LinkData>>(this.links).id(\n this.nodeSettings.idGetter.bind(this),\n ),\n )\n .on(\"tick\", () => {\n this.draw();\n })\n .on(\"end\", () => {\n this.listeners.onSimulationEnd?.call?.(this);\n\n if (this.graphSettings.showDrawTime) {\n getDrawTime();\n // eslint-disable-next-line no-console\n console.log(`nodes: ${this.nodes.length} | links: ${this.links.length}`);\n resetDrawTime();\n }\n });\n\n initSimulationForces.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initSimulationForces>,\n ReturnType<typeof initSimulationForces>\n >(this);\n }\n}\n\nexport function initSimulationForces<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n if (!this.simulation) return;\n\n const linkForce = this.simulation.force(\"link\") as\n | ForceLink<NodeInterface<NodeData>, LinkInterface<NodeData, LinkData>>\n | undefined;\n\n if (!linkForce) return;\n\n if ((!this.forceSettings.forces || !this.forceSettings.xForce) && this.simulation.force(\"x\")) {\n this.simulation.force(\"x\", null);\n }\n if ((!this.forceSettings.forces || !this.forceSettings.yForce) && this.simulation.force(\"y\")) {\n this.simulation.force(\"y\", null);\n }\n if (\n (!this.forceSettings.forces || !this.forceSettings.chargeForce) &&\n this.simulation.force(\"charge\")\n ) {\n this.simulation.force(\"charge\", null);\n }\n if (\n (!this.forceSettings.forces || !this.forceSettings.centerForce) &&\n this.simulation.force(\"center\")\n ) {\n this.simulation.force(\"center\", null);\n }\n if (!this.forceSettings.forces || !this.forceSettings.linkForce) {\n linkForce.distance(0).strength(0).iterations(0);\n }\n\n if (this.forceSettings.forces && this.forceSettings.linkForce) {\n linkForce\n .distance(this.forceSettings.linkDistance)\n .strength(this.forceSettings.linkStrength)\n .iterations(this.forceSettings.linkIterations);\n }\n if (this.forceSettings.forces && this.forceSettings.xForce) {\n this.simulation.force(\n \"x\",\n forceX<NodeInterface<NodeData>>(this.forceSettings.xPosition).strength(\n this.forceSettings.xStrength,\n ),\n );\n }\n if (this.forceSettings.forces && this.forceSettings.yForce) {\n this.simulation.force(\n \"y\",\n forceY<NodeInterface<NodeData>>(this.forceSettings.yPosition).strength(\n this.forceSettings.yStrength,\n ),\n );\n }\n if (this.forceSettings.forces && this.forceSettings.chargeForce) {\n this.simulation.force(\n \"charge\",\n forceManyBody<NodeInterface<NodeData>>()\n .strength(this.forceSettings.chargeStrength)\n .distanceMax(Infinity)\n .distanceMin(this.forceSettings.chargeDistanceMin),\n );\n }\n if (this.forceSettings.forces && this.forceSettings.centerForce) {\n this.simulation.force(\n \"center\",\n forceCenter<NodeInterface<NodeData>>(\n this.forceSettings.centerPosition.x ?? 0,\n this.forceSettings.centerPosition.y ?? 0,\n ).strength(this.forceSettings.centerStrength),\n );\n }\n\n initCollideForce.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initCollideForce>,\n ReturnType<typeof initCollideForce>\n >(this, true);\n}\n\nexport function initCollideForce<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>, forceUpdate: boolean) {\n if (!this.simulation) return;\n\n if (\n (!this.forceSettings.collideForce || !this.forceSettings.forces) &&\n this.simulation.force(\"collide\")\n ) {\n this.simulation.force(\"collide\", null);\n }\n\n if (this.forceSettings.forces && this.forceSettings.collideForce) {\n const isHasMax =\n this.forceSettings.collideOffMax.links != 0 && this.forceSettings.collideOffMax.nodes != 0;\n const isMaxCollideNodes =\n isHasMax && this.forceSettings.collideOffMax.nodes < this.nodes.length;\n const isMaxCollideLinks =\n isHasMax && this.forceSettings.collideOffMax.links < this.links.length;\n if (isMaxCollideNodes && isMaxCollideLinks) {\n this.simulation.force(\"collide\", null);\n } else if (!this.simulation.force(\"collide\") || forceUpdate) {\n this.simulation.force(\n \"collide\",\n forceCollide<NodeInterface<NodeData>>()\n .radius((node, index) => {\n const nodeOptions = this.nodeOptionsCache[node.id];\n if (!nodeOptions) return 0;\n\n switch (nodeOptions.shape) {\n case \"circle\": {\n if (this.forceSettings.collideRadius) {\n return nodeIterationExtractor(\n node,\n index,\n this.nodes,\n this,\n this.forceSettings.collideRadius,\n undefined,\n );\n }\n\n return nodeOptions.radius + this.forceSettings.collideAdditionalRadius;\n }\n case \"square\": {\n return (\n Math.sqrt(nodeOptions.width ** 2 + nodeOptions.height ** 2) / 2 +\n this.forceSettings.collideAdditionalRadius\n );\n }\n case \"text\": {\n return (\n Math.sqrt(nodeOptions.width ** 2 + nodeOptions.height ** 2) / 2 +\n this.forceSettings.collideAdditionalRadius\n );\n }\n default: {\n if (this.forceSettings.collideRadius) {\n return nodeIterationExtractor(\n node,\n index,\n this.nodes,\n this,\n this.forceSettings.collideRadius,\n undefined,\n );\n }\n\n return nodeOptions.radius + this.forceSettings.collideAdditionalRadius;\n }\n }\n })\n .strength(this.forceSettings.collideStrength)\n .iterations(this.forceSettings.collideIterations),\n );\n }\n }\n}\n"],"names":[],"mappings":";;;;;;SAegB,cAAc,GAAA;AAI5B,IAAA,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;AACpB,QAAA,IAAI,CAAC,UAAU,GAAG,eAAe;AAC9B,aAAA,KAAK,CAAC,IAAI,CAAC,KAAK;aAChB,KAAK,CACJ,MAAM,EACN,SAAS,CAA6D,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAClF,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CACtC;AAEF,aAAA,EAAE,CAAC,MAAM,EAAE,MAAK;YACf,IAAI,CAAC,IAAI,EAAE;AACb,SAAC;AACA,aAAA,EAAE,CAAC,KAAK,EAAE,MAAK;YACd,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,GAAG,IAAI,CAAC;AAE5C,YAAA,IAAI,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE;AACnC,gBAAA,WAAW,EAAE;;AAEb,gBAAA,OAAO,CAAC,GAAG,CAAC,CAAU,OAAA,EAAA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAA,UAAA,EAAa,IAAI,CAAC,KAAK,CAAC,MAAM,CAAA,CAAE,CAAC;AACxE,gBAAA,aAAa,EAAE;;AAEnB,SAAC,CAAC;AAEJ,QAAA,oBAAoB,CAAC,IAAI,CAIvB,IAAI,CAAC;;AAEX;SAEgB,oBAAoB,GAAA;IAIlC,IAAI,CAAC,IAAI,CAAC,UAAU;QAAE;IAEtB,MAAM,SAAS,GAAG,IAAI,CAAC,U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AAC,uBAAuB;;;AAG5E,aAAC;AACA,iBAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,eAAe;iBAC3C,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,CACpD;;;AAGP;;;;"}
@@ -1,6 +1,8 @@
1
1
  import { isArray } from '@krainovsd/js-helpers';
2
2
  import { select } from 'd3-selection';
3
3
  import { zoom, ZoomTransform } from 'd3-zoom';
4
+ import { updateLinkCache } from './update-link-cache.js';
5
+ import { updateNodeCache } from './update-node-cache.js';
4
6
 
5
7
  function initZoom(currentZoom) {
6
8
  if (!this.area)
@@ -10,8 +12,8 @@ function initZoom(currentZoom) {
10
12
  .on("zoom", (event) => {
11
13
  this.listeners.onZoom?.call?.(this, event);
12
14
  this.areaTransform = event.transform;
13
- this.linkOptionsCache = {};
14
- this.nodeOptionsCache = {};
15
+ updateLinkCache.call(this);
16
+ updateNodeCache.call(this);
15
17
  if (!this.simulationWorking && !this.highlightWorking)
16
18
  requestAnimationFrame(() => this.draw());
17
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"init-zoom.js","sources":["../../../../../src/module/GraphCanvas/slices/init-zoom.ts"],"sourcesContent":["import { isArray } from \"@krainovsd/js-helpers\";\nimport { select as d3Select } from \"d3-selection\";\nimport { ZoomTransform, zoom } from \"d3-zoom\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport type { ZoomEventInterface } from \"../types\";\n\nexport function initZoom<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>, currentZoom?: ZoomTransform) {\n if (!this.area) throw new Error(\"bad init data\");\n\n const zoomInstance = zoom<HTMLCanvasElement, unknown>()\n .scaleExtent(this.graphSettings.zoomExtent)\n .on(\"zoom\", (event: ZoomEventInterface) => {\n this.listeners.onZoom?.call?.(this, event);\n this.areaTransform = event.transform;\n this.linkOptionsCache = {};\n this.nodeOptionsCache = {};\n\n if (!this.simulationWorking && !this.highlightWorking)\n requestAnimationFrame(() => this.draw());\n });\n\n if (this.graphSettings.translateExtentEnable) {\n const coefficient = this.graphSettings.translateExtentCoefficient;\n const [coefficientX, coefficientY] = isArray(coefficient)\n ? coefficient\n : [coefficient, coefficient];\n\n const [\n [minX = -this.width * coefficientX, minY = -this.height * coefficientY],\n [maxX = this.width * coefficientX, maxY = this.height * coefficientY],\n ] = this.graphSettings.translateExtent;\n\n zoomInstance.translateExtent([\n [minX, minY],\n [maxX, maxY],\n ]);\n }\n\n d3Select(this.area).call(zoomInstance).on(\"dblclick.zoom\", null);\n\n const zoomInitial = currentZoom ?? this.graphSettings.zoomInitial;\n this.areaTransform = new ZoomTransform(\n zoomInitial?.k ?? 1,\n zoomInitial?.x ?? this.width / 2,\n zoomInitial?.y ?? this.height / 2,\n );\n zoom<HTMLCanvasElement, unknown>().transform(d3Select(this.area), this.areaTransform);\n}\n"],"names":["d3Select"],"mappings":";;;;AAMM,SAAU,QAAQ,CAGiB,WAA2B,EAAA;IAClE,IAAI,CAAC,IAAI,CAAC,IAAI;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC;IAEhD,MAAM,YAAY,GAAG,IAAI;AACtB,SAAA,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU;AACzC,SAAA,EAAE,CAAC,MAAM,EAAE,CAAC,KAAyB,KAAI;AACxC,QAAA,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,CAAC;AAC1C,QAAA,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,SAAS;AACpC,QAAA,IAAI,CAAC,gBAAgB,GAAG,EAAE;AAC1B,QAAA,IAAI,CAAC,gBAAgB,GAAG,EAAE;QAE1B,IAAI,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,gBAAgB;YACnD,qBAAqB,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAC5C,KAAC,CAAC;AAEJ,IAAA,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Content":["import { isArray } from \"@krainovsd/js-helpers\";\nimport { select as d3Select } from \"d3-selection\";\nimport { ZoomTransform, zoom } from \"d3-zoom\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport type { ZoomEventInterface } from \"../types\";\nimport { updateLinkCache } from \"./update-link-cache\";\nimport { updateNodeCache } from \"./update-node-cache\";\n\nexport function initZoom<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>, currentZoom?: ZoomTransform) {\n if (!this.area) throw new Error(\"bad init data\");\n\n const zoomInstance = zoom<HTMLCanvasElement, unknown>()\n .scaleExtent(this.graphSettings.zoomExtent)\n .on(\"zoom\", (event: ZoomEventInterface) => {\n this.listeners.onZoom?.call?.(this, event);\n this.areaTransform = event.transform;\n updateLinkCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateLinkCache>,\n ReturnType<typeof updateLinkCache>\n >(this);\n updateNodeCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateNodeCache>,\n ReturnType<typeof updateNodeCache>\n >(this);\n\n if (!this.simulationWorking && !this.highlightWorking)\n requestAnimationFrame(() => this.draw());\n });\n\n if (this.graphSettings.translateExtentEnable) {\n const coefficient = this.graphSettings.translateExtentCoefficient;\n const [coefficientX, coefficientY] = isArray(coefficient)\n ? coefficient\n : [coefficient, coefficient];\n\n const [\n [minX = -this.width * coefficientX, minY = -this.height * coefficientY],\n [maxX = this.width * coefficientX, maxY = this.height * coefficientY],\n ] = this.graphSettings.translateExtent;\n\n zoomInstance.translateExtent([\n [minX, minY],\n [maxX, maxY],\n ]);\n }\n\n d3Select(this.area).call(zoomInstance).on(\"dblclick.zoom\", null);\n\n const zoomInitial = currentZoom ?? this.graphSettings.zoomInitial;\n this.areaTransform = new ZoomTransform(\n zoomInitial?.k ?? 1,\n zoomInitial?.x ?? this.width / 2,\n zoomInitial?.y ?? this.height / 2,\n );\n zoom<HTMLCanvasElement, unknown>().transform(d3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YAAY,CAAC,eAAe,CAAC;YAC3B,CAAC,IAAI,EAAE,IAAI,CAAC;YACZ,CAAC,IAAI,EAAE,IAAI,CAAC;AACb,SAAA,CAAC;;AAGJ,IAAAA,MAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC;IAEhE,MAAM,WAAW,GAAG,WAAW,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW;AACjE,IAAA,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CACpC,WAAW,EAAE,CAAC,IAAI,CAAC,EACnB,WAAW,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,EAChC,WAAW,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAClC;AACD,IAAA,IAAI,EAA8B,CAAC,SAAS,CAACA,MAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC;AACvF;;;;"}
@@ -0,0 +1,19 @@
1
+ import { linkOptionsGetter } from '../lib/settings/link-settings-getter.js';
2
+ import '@krainovsd/js-helpers';
3
+ import { linkIterationExtractor } from '../lib/utils/link-iteration-extractor.js';
4
+ import 'd3-array';
5
+ import { extractLinkPointIds } from '../lib/utils/extract-link-point-ids.js';
6
+
7
+ function updateLinkCache() {
8
+ this.linkOptionsCache = {};
9
+ for (let i = 0; i < this.links.length; i++) {
10
+ const link = this.links[i];
11
+ const { sourceId, targetId } = extractLinkPointIds(link);
12
+ const linkOptions = linkIterationExtractor(link, i, this.links, this, this.linkSettings.options ?? {}, linkOptionsGetter);
13
+ const id = `${targetId}${sourceId}`;
14
+ this.linkOptionsCache[id] = linkOptions;
15
+ }
16
+ }
17
+
18
+ export { updateLinkCache };
19
+ //# sourceMappingURL=update-link-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-link-cache.js","sources":["../../../../../src/module/GraphCanvas/slices/update-link-cache.ts"],"sourcesContent":["import type { GraphCanvas } from \"../GraphCanvas\";\nimport { extractLinkPointIds, linkIterationExtractor, linkOptionsGetter } from \"../lib\";\n\nexport function updateLinkCache<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n this.linkOptionsCache = {};\n\n for (let i = 0; i < this.links.length; i++) {\n const link = this.links[i];\n const { sourceId, targetId } = extractLinkPointIds(link);\n\n const linkOptions = linkIterationExtractor(\n link,\n i,\n this.links,\n this,\n this.linkSettings.options ?? {},\n linkOptionsGetter,\n );\n const id = `${targetId}${sourceId}`;\n this.linkOptionsCache[id] = linkOptions;\n }\n}\n"],"names":[],"mappings":";;;;;;SAGgB,eAAe,GAAA;AAI7B,IAAA,IAAI,CAAC,gBAAgB,GAAG,EAAE;AAE1B,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC;QAExD,MAAM,WAAW,GAAG,sBAAsB,CACxC,IAAI,EACJ,CAAC,EACD,IAAI,CAAC,KAAK,EACV,IAAI,EACJ,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,EAAE,EAC/B,iBAAiB,CAClB;AACD,QAAA,MAAM,EAAE,GAAG,CAAA,EAAG,QAAQ,CAAG,EAAA,QAAQ,EAAE;AACnC,QAAA,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,WAAW;;AAE3C;;;;"}
@@ -0,0 +1,136 @@
1
+ import { nodeOptionsGetter, nodeRadiusGetter, nodeSizeGetter } from '../lib/settings/node-settings-getter.js';
2
+ import '@krainovsd/js-helpers';
3
+ import 'd3-array';
4
+ import { nodeIterationExtractor } from '../lib/utils/node-iteration-extractor.js';
5
+ import { getTextLines } from './draw-text.js';
6
+
7
+ function updateNodeCache() {
8
+ this.nodeOptionsCache = {};
9
+ if (!this.context)
10
+ return;
11
+ for (let i = 0; i < this.nodes.length; i++) {
12
+ const node = this.nodes[i];
13
+ const nodeOptions = nodeIterationExtractor(node, i, this.nodes, this, this.nodeSettings.options ?? {}, nodeOptionsGetter);
14
+ const radius = nodeOptions.shape === "circle"
15
+ ? nodeRadiusGetter({
16
+ radiusFlexible: this.nodeSettings.nodeRadiusFlexible,
17
+ radiusInitial: nodeOptions.radius,
18
+ radiusIncrementByStep: this.nodeSettings.nodeRadiusIncrementByStep,
19
+ radiusLinkCountForStep: this.nodeSettings.nodeRadiusLinkCountForStep,
20
+ radiusMaxLinearSteps: this.nodeSettings.nodeRadiusMaxLinearSteps,
21
+ radiusLogFactor: this.nodeSettings.nodeRadiusLogFactor,
22
+ radiusLinkCountDividerForLog: this.nodeSettings.nodeRadiusLinkCountDividerForLog,
23
+ linkCount: node.linkCount,
24
+ })
25
+ : nodeOptions.radius;
26
+ let width = nodeOptions.width;
27
+ let height = nodeOptions.height;
28
+ let labelSize = nodeOptions.labelSize;
29
+ if (nodeOptions.shape === "square") {
30
+ const size = nodeSizeGetter({
31
+ heightInitial: nodeOptions.height,
32
+ widthInitial: nodeOptions.width,
33
+ linkCount: node.linkCount,
34
+ sizeFlexible: this.nodeSettings.nodeSizeFlexible,
35
+ sizeIncrementByStep: this.nodeSettings.nodeSizeIncrementByStep,
36
+ sizeLinkCountForStep: this.nodeSettings.nodeSizeLinkCountForStep,
37
+ sizeMaxLinearSteps: this.nodeSettings.nodeSizeMaxLinearSteps,
38
+ sizeLogFactor: this.nodeSettings.nodeSizeLogFactor,
39
+ sizeLinkCountDividerForLog: this.nodeSettings.nodeSizeLinkCountDividerForLog,
40
+ });
41
+ width = size.width;
42
+ height = size.height;
43
+ }
44
+ if (nodeOptions.shape === "text") {
45
+ width = nodeOptions.width;
46
+ const size = nodeSizeGetter({
47
+ heightInitial: nodeOptions.height,
48
+ widthInitial: width,
49
+ linkCount: node.linkCount,
50
+ sizeFlexible: this.nodeSettings.nodeSizeFlexible,
51
+ sizeIncrementByStep: this.nodeSettings.nodeSizeIncrementByStep,
52
+ sizeLinkCountForStep: this.nodeSettings.nodeSizeLinkCountForStep,
53
+ sizeMaxLinearSteps: this.nodeSettings.nodeSizeMaxLinearSteps,
54
+ sizeLogFactor: this.nodeSettings.nodeSizeLogFactor,
55
+ sizeLinkCountDividerForLog: this.nodeSettings.nodeSizeLinkCountDividerForLog,
56
+ });
57
+ labelSize *= size.additionalSizeCoefficient;
58
+ }
59
+ /** label in not text shape */
60
+ if (nodeOptions.shape !== "text" && nodeOptions.label) {
61
+ this.context.font = `${nodeOptions.labelStyle} normal ${nodeOptions.labelWeight} ${nodeOptions.labelSize}px ${nodeOptions.labelFont}`;
62
+ this.context.fillStyle = nodeOptions.labelColor;
63
+ this.context.textAlign = nodeOptions.labelAlign;
64
+ if (nodeOptions.labelWidth == undefined ||
65
+ this.context.measureText(nodeOptions.label).width <= nodeOptions.labelWidth) {
66
+ this.cachedNodeLabel[node.id] = [nodeOptions.label];
67
+ }
68
+ const { lines } = getTextLines({
69
+ context: this.context,
70
+ maxWidth: nodeOptions.labelWidth,
71
+ text: nodeOptions.label,
72
+ textAlign: nodeOptions.labelAlign,
73
+ textColor: nodeOptions.labelColor,
74
+ textFont: nodeOptions.labelFont,
75
+ textSize: nodeOptions.labelSize,
76
+ textStyle: nodeOptions.labelStyle,
77
+ textWeight: nodeOptions.labelWeight,
78
+ });
79
+ this.cachedNodeLabel[node.id] = lines;
80
+ }
81
+ /** label in text shape */
82
+ if (nodeOptions.shape === "text" && nodeOptions.label) {
83
+ const textInfo = getTextLines({
84
+ context: this.context,
85
+ text: nodeOptions.label,
86
+ textAlign: nodeOptions.labelAlign,
87
+ textColor: nodeOptions.labelColor,
88
+ textFont: nodeOptions.labelFont,
89
+ textSize: labelSize,
90
+ maxWidth: nodeOptions.labelWidth,
91
+ textStyle: nodeOptions.labelStyle,
92
+ textWeight: nodeOptions.textWeight,
93
+ });
94
+ const textNodeParameters = [textInfo.currentMaxSize, labelSize];
95
+ const lines = textInfo.lines;
96
+ const textSizeCoefficient = labelSize / textNodeParameters[1];
97
+ const maxSize = textNodeParameters[0] * textSizeCoefficient;
98
+ height =
99
+ lines.length * labelSize +
100
+ (lines.length - 1) * nodeOptions.labelGap +
101
+ nodeOptions.labelYPadding;
102
+ width = maxSize + nodeOptions.labelXPadding;
103
+ this.cachedNodeLabel[node.id] = lines;
104
+ }
105
+ nodeOptions.width = node.visible === false ? 0 : width;
106
+ nodeOptions.height = node.visible === false ? 0 : height;
107
+ nodeOptions.radius = node.visible === false ? 0 : radius;
108
+ nodeOptions.labelSize = labelSize;
109
+ /** text */
110
+ if (nodeOptions.text) {
111
+ this.context.font = `${nodeOptions.textStyle} normal ${nodeOptions.textWeight} ${nodeOptions.textSize}px ${nodeOptions.textFont}`;
112
+ this.context.fillStyle = nodeOptions.textColor;
113
+ this.context.textAlign = nodeOptions.textAlign;
114
+ if (nodeOptions.textWidth == undefined ||
115
+ this.context.measureText(nodeOptions.text).width <= nodeOptions.textWidth) {
116
+ this.cachedNodeText[node.id] = [nodeOptions.text];
117
+ }
118
+ const { lines } = getTextLines({
119
+ context: this.context,
120
+ maxWidth: nodeOptions.textWidth,
121
+ text: nodeOptions.text,
122
+ textAlign: nodeOptions.textAlign,
123
+ textColor: nodeOptions.textColor,
124
+ textFont: nodeOptions.textFont,
125
+ textSize: nodeOptions.textSize,
126
+ textStyle: nodeOptions.textStyle,
127
+ textWeight: nodeOptions.textWeight,
128
+ });
129
+ this.cachedNodeText[node.id] = lines;
130
+ }
131
+ this.nodeOptionsCache[node.id] = nodeOptions;
132
+ }
133
+ }
134
+
135
+ export { updateNodeCache };
136
+ //# sourceMappingURL=update-node-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-node-cache.js","sources":["../../../../../src/module/GraphCanvas/slices/update-node-cache.ts"],"sourcesContent":["import type { GraphCanvas } from \"../GraphCanvas\";\nimport {\n nodeIterationExtractor,\n nodeOptionsGetter,\n nodeRadiusGetter,\n nodeSizeGetter,\n} from \"../lib\";\nimport { getTextLines } from \"./draw-text\";\n\nexport function updateNodeCache<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n this.nodeOptionsCache = {};\n if (!this.context) return;\n\n for (let i = 0; i < this.nodes.length; i++) {\n const node = this.nodes[i];\n const nodeOptions = nodeIterationExtractor(\n node,\n i,\n this.nodes,\n this,\n this.nodeSettings.options ?? {},\n nodeOptionsGetter,\n );\n const radius =\n nodeOptions.shape === \"circle\"\n ? nodeRadiusGetter({\n radiusFlexible: this.nodeSettings.nodeRadiusFlexible,\n radiusInitial: nodeOptions.radius,\n radiusIncrementByStep: this.nodeSettings.nodeRadiusIncrementByStep,\n radiusLinkCountForStep: this.nodeSettings.nodeRadiusLinkCountForStep,\n radiusMaxLinearSteps: this.nodeSettings.nodeRadiusMaxLinearSteps,\n radiusLogFactor: this.nodeSettings.nodeRadiusLogFactor,\n radiusLinkCountDividerForLog: this.nodeSettings.nodeRadiusLinkCountDividerForLog,\n linkCount: node.linkCount,\n })\n : nodeOptions.radius;\n\n let width = nodeOptions.width;\n let height = nodeOptions.height;\n let labelSize = nodeOptions.labelSize;\n if (nodeOptions.shape === \"square\") {\n const size = nodeSizeGetter({\n heightInitial: nodeOptions.height,\n widthInitial: nodeOptions.width,\n linkCount: node.linkCount,\n sizeFlexible: this.nodeSettings.nodeSizeFlexible,\n sizeIncrementByStep: this.nodeSettings.nodeSizeIncrementByStep,\n sizeLinkCountForStep: this.nodeSettings.nodeSizeLinkCountForStep,\n sizeMaxLinearSteps: this.nodeSettings.nodeSizeMaxLinearSteps,\n sizeLogFactor: this.nodeSettings.nodeSizeLogFactor,\n sizeLinkCountDividerForLog: this.nodeSettings.nodeSizeLinkCountDividerForLog,\n });\n width = size.width;\n height = size.height;\n }\n if (nodeOptions.shape === \"text\") {\n width = nodeOptions.width;\n const size = nodeSizeGetter({\n heightInitial: nodeOptions.height,\n widthInitial: width,\n linkCount: node.linkCount,\n sizeFlexible: this.nodeSettings.nodeSizeFlexible,\n sizeIncrementByStep: this.nodeSettings.nodeSizeIncrementByStep,\n sizeLinkCountForStep: this.nodeSettings.nodeSizeLinkCountForStep,\n sizeMaxLinearSteps: this.nodeSettings.nodeSizeMaxLinearSteps,\n sizeLogFactor: this.nodeSettings.nodeSizeLogFactor,\n sizeLinkCountDividerForLog: this.nodeSettings.nodeSizeLinkCountDividerForLog,\n });\n\n labelSize *= size.additionalSizeCoefficient;\n }\n /** label in not text shape */\n if (nodeOptions.shape !== \"text\" && nodeOptions.label) {\n this.context.font = `${nodeOptions.labelStyle} normal ${nodeOptions.labelWeight} ${nodeOptions.labelSize}px ${nodeOptions.labelFont}`;\n this.context.fillStyle = nodeOptions.labelColor;\n this.context.textAlign = nodeOptions.labelAlign;\n\n if (\n nodeOptions.labelWidth == undefined ||\n this.context.measureText(nodeOptions.label).width <= nodeOptions.labelWidth\n ) {\n this.cachedNodeLabel[node.id] = [nodeOptions.label];\n }\n\n const { lines } = getTextLines({\n context: this.context,\n maxWidth: nodeOptions.labelWidth,\n text: nodeOptions.label,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textSize: nodeOptions.labelSize,\n textStyle: nodeOptions.labelStyle,\n textWeight: nodeOptions.labelWeight,\n });\n this.cachedNodeLabel[node.id] = lines;\n }\n /** label in text shape */\n if (nodeOptions.shape === \"text\" && nodeOptions.label) {\n const textInfo = getTextLines({\n context: this.context,\n text: nodeOptions.label,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textSize: labelSize,\n maxWidth: nodeOptions.labelWidth,\n textStyle: nodeOptions.labelStyle,\n textWeight: nodeOptions.textWeight,\n });\n const textNodeParameters = [textInfo.currentMaxSize, labelSize];\n const lines = textInfo.lines;\n const textSizeCoefficient = labelSize / textNodeParameters[1];\n const maxSize = textNodeParameters[0] * textSizeCoefficient;\n\n height =\n lines.length * labelSize +\n (lines.length - 1) * nodeOptions.labelGap +\n nodeOptions.labelYPadding;\n\n width = maxSize + nodeOptions.labelXPadding;\n this.cachedNodeLabel[node.id] = lines;\n }\n\n nodeOptions.width = node.visible === false ? 0 : width;\n nodeOptions.height = node.visible === false ? 0 : height;\n nodeOptions.radius = node.visible === false ? 0 : radius;\n nodeOptions.labelSize = labelSize;\n\n /** text */\n if (nodeOptions.text) {\n this.context.font = `${nodeOptions.textStyle} normal ${nodeOptions.textWeight} ${nodeOptions.textSize}px ${nodeOptions.textFont}`;\n this.context.fillStyle = nodeOptions.textColor;\n this.context.textAlign = nodeOptions.textAlign;\n\n if (\n nodeOptions.textWidth == undefined ||\n this.context.measureText(nodeOptions.text).width <= nodeOptions.textWidth\n ) {\n this.cachedNodeText[node.id] = [nodeOptions.text];\n }\n\n const { lines } = getTextLines({\n context: this.context,\n maxWidth: nodeOptions.textWidth,\n text: nodeOptions.text,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize: nodeOptions.textSize,\n textStyle: nodeOptions.textStyle,\n textWeight: nodeOptions.textWeight,\n });\n this.cachedNodeText[node.id] = lines;\n }\n\n this.nodeOptionsCache[node.id] = nodeOptions;\n }\n}\n"],"names":[],"mappings":";;;;;;SASgB,eAAe,GAAA;AAI7B,IAAA,IAAI,CAAC,gBAAgB,GAAG,EAAE;IAC1B,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE;AAEnB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1B,MAAM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