@krainovsd/graph 0.12.0-beta.4 → 0.12.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.cjs +51 -71
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/module/GraphCanvas/GraphCanvas.js +31 -0
- package/lib/esm/module/GraphCanvas/GraphCanvas.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/is-overlaps-node.js +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/is-overlaps-node.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js +4 -1
- package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/draw-nodes.js +5 -1
- package/lib/esm/module/GraphCanvas/slices/draw-nodes.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-simulation.js +7 -67
- package/lib/esm/module/GraphCanvas/slices/init-simulation.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/update-node-cache.js +3 -3
- package/lib/esm/module/GraphCanvas/slices/update-node-cache.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +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 = width;\n nodeOptions.height = height;\n nodeOptions.radius = 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,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,MAAM,GACV,WAAW,CAAC,KAAK,KAAK;cAClB,gBAAgB,CAAC;AACf,gBAAA,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,kBAAkB;gBACpD,aAAa,EAAE,WAAW,CAAC,MAAM;AACjC,gBAAA,qBAAqB,EAAE,IAAI,CAAC,YAAY,CAAC,yBAAyB;AAClE,gBAAA,sBAAsB,EAAE,IAAI,CAAC,YAAY,CAAC,0BA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E,WAAW,CAAC,QAAQ;gBAC9B,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,UAAU,EAAE,WAAW,CAAC,UAAU;AACnC,aAAA,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK;;QAGtC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,WAAW;;AAEhD;;;;"}
|
|
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 }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