@krainovsd/graph 0.10.0-rc2 → 0.10.0-rc3
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.
|
@@ -26,10 +26,14 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
26
26
|
}
|
|
27
27
|
if (nodeOptions.nodeDraw && nodeOptions.textDraw) {
|
|
28
28
|
nodeRenders.push(() => {
|
|
29
|
-
nodeOptions
|
|
29
|
+
if (nodeOptions.nodeDraw) {
|
|
30
|
+
nodeOptions.nodeDraw.bind(this)(node, nodeOptions);
|
|
31
|
+
}
|
|
30
32
|
});
|
|
31
33
|
textRenders.push(() => {
|
|
32
|
-
nodeOptions
|
|
34
|
+
if (nodeOptions.textDraw) {
|
|
35
|
+
nodeOptions.textDraw.bind(this)(node, nodeOptions);
|
|
36
|
+
}
|
|
33
37
|
});
|
|
34
38
|
return;
|
|
35
39
|
}
|
|
@@ -285,7 +289,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
285
289
|
});
|
|
286
290
|
if (nodeOptions.nodeExtraDraw) {
|
|
287
291
|
nodeRenders.push(() => {
|
|
288
|
-
nodeOptions?.nodeExtraDraw?.(node, {
|
|
292
|
+
nodeOptions?.nodeExtraDraw?.bind?.(this)?.(node, {
|
|
289
293
|
...nodeOptions,
|
|
290
294
|
radius,
|
|
291
295
|
alpha,
|
|
@@ -296,14 +300,14 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
296
300
|
textShiftY,
|
|
297
301
|
textWeight,
|
|
298
302
|
textWidth,
|
|
299
|
-
}
|
|
303
|
+
});
|
|
300
304
|
});
|
|
301
305
|
}
|
|
302
306
|
/** Text draw */
|
|
303
307
|
if (nodeOptions.textVisible && nodeOptions.text && nodeOptions.shape !== "text") {
|
|
304
308
|
textRenders.push(() => {
|
|
305
309
|
if (nodeOptions.textDraw) {
|
|
306
|
-
nodeOptions.textDraw(node, {
|
|
310
|
+
nodeOptions.textDraw.bind(this)(node, {
|
|
307
311
|
...nodeOptions,
|
|
308
312
|
radius,
|
|
309
313
|
alpha,
|
|
@@ -314,7 +318,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
314
318
|
textShiftY,
|
|
315
319
|
textWeight,
|
|
316
320
|
textWidth,
|
|
317
|
-
}
|
|
321
|
+
});
|
|
318
322
|
return;
|
|
319
323
|
}
|
|
320
324
|
if (!this.context || !node.x || !node.y || !nodeOptions.text)
|
|
@@ -345,7 +349,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
345
349
|
textGap: nodeOptions.textGap,
|
|
346
350
|
});
|
|
347
351
|
if (nodeOptions.textExtraDraw) {
|
|
348
|
-
nodeOptions.textExtraDraw(node, {
|
|
352
|
+
nodeOptions.textExtraDraw.bind(this)(node, {
|
|
349
353
|
...nodeOptions,
|
|
350
354
|
radius,
|
|
351
355
|
alpha,
|
|
@@ -356,7 +360,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
|
|
|
356
360
|
textShiftY,
|
|
357
361
|
textWeight,
|
|
358
362
|
textWidth,
|
|
359
|
-
}
|
|
363
|
+
});
|
|
360
364
|
}
|
|
361
365
|
});
|
|
362
366
|
}
|
|
@@ -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 { colorToRgb, extractRgb, fadeRgb, rgbAnimationByProgress } from \"@/lib\";\nimport type { CachedTextNodeParametersInterface, NodeInterface } from \"@/types\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport {\n animationByProgress,\n isNodeVisible,\n nodeIterationExtractor,\n nodeOptionsGetter,\n nodeRadiusGetter,\n nodeSizeGetter,\n} from \"../lib\";\nimport type { GraphState, NodeOptionsInterface } 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)[], state: GraphState<NodeData, LinkData>) {\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\n let nodeOptions: Required<NodeOptionsInterface<NodeData, LinkData>>;\n if (this.nodeSettings.cache && this.nodeOptionsCache[node.id]) {\n nodeOptions = this.nodeOptionsCache[node.id];\n } else {\n nodeOptions = nodeIterationExtractor(\n node,\n index,\n this.nodes,\n state,\n this.nodeSettings.options ?? {},\n nodeOptionsGetter,\n );\n if (this.nodeSettings.cache) {\n this.nodeOptionsCache[node.id] = nodeOptions;\n }\n }\n\n if (nodeOptions.nodeDraw && nodeOptions.textDraw) {\n nodeRenders.push(() => {\n nodeOptions?.nodeDraw?.(node, nodeOptions, state);\n });\n\n textRenders.push(() => {\n nodeOptions?.textDraw?.(node, nodeOptions, state);\n });\n\n return;\n }\n\n let alpha = nodeOptions.alpha;\n let color = nodeOptions.color;\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 textWidth = nodeOptions.textWidth;\n let sizeCoefficient = 1;\n /** Node Highlight */\n if (this.highlightedNeighbors && this.highlightedNode) {\n /** Not highlighted */\n if (!this.highlightedNeighbors.has(node.id) && this.highlightedNode.id != node.id) {\n if (this.nodeSettings.highlightByNodeNodeFading) {\n const min =\n this.nodeSettings.highlightByNodeNodeFadingMin < alpha\n ? this.nodeSettings.highlightByNodeNodeFadingMin\n : alpha;\n alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByNodeTextFading) {\n const min =\n this.nodeSettings.highlightByNodeTextFadingMin < textAlpha\n ? this.nodeSettings.highlightByNodeTextFadingMin\n : textAlpha;\n textAlpha = animationByProgress(min, textAlpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByNodeNodeColor) {\n const colorRgb = extractRgb(colorToRgb(color));\n if (colorRgb) {\n const colorRgbFade = fadeRgb(\n colorRgb,\n this.nodeSettings.highlightByNodeNodeColorFadingMin,\n );\n const colorFadeAnimation = rgbAnimationByProgress(\n colorRgb,\n colorRgbFade,\n this.highlightProgress,\n );\n color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;\n }\n }\n } else if (\n !this.nodeSettings.highlightByNodeOnlyRoot ||\n (this.nodeSettings.highlightByNodeOnlyRoot && this.highlightedNode.id === node.id)\n ) {\n /** Highlighted */\n\n if (this.nodeSettings.highlightByNodeNodeSizing && nodeOptions.shape === \"circle\") {\n radiusInitial = animationByProgress(\n radiusInitial,\n this.nodeSettings.highlightByNodeNodeSizingAdditional,\n this.highlightProgress,\n );\n }\n if (\n this.nodeSettings.highlightByNodeNodeSizing &&\n (nodeOptions.shape === \"square\" || nodeOptions.shape === \"text\")\n ) {\n sizeCoefficient = animationByProgress(\n sizeCoefficient,\n this.nodeSettings.highlightByNodeNodeSizingAdditionalCoefficient,\n this.highlightProgress,\n );\n\n widthInitial *= sizeCoefficient;\n heightInitial *= sizeCoefficient;\n }\n if (this.nodeSettings.highlightByNodeTextSizing) {\n textSize = animationByProgress(\n textSize,\n this.nodeSettings.highlightByNodeTextSizingAdditional,\n this.highlightProgress,\n );\n textShiftX = animationByProgress(\n textShiftX,\n this.nodeSettings.highlightByNodeTextShiftXAdditional,\n this.highlightProgress,\n );\n textShiftY = animationByProgress(\n textShiftY,\n this.nodeSettings.highlightByNodeTextShiftYAdditional,\n this.highlightProgress,\n );\n textWeight = animationByProgress(\n textWeight,\n this.nodeSettings.highlightByNodeTextWeightAdditional,\n this.highlightProgress,\n );\n textWidth = animationByProgress(\n textWidth,\n this.nodeSettings.highlightByNodeTextWidthAdditional,\n this.highlightProgress,\n );\n }\n }\n }\n /** LinkHighlight */\n if (this.highlightedNeighbors && this.highlightedLink) {\n /** Not highlighted */\n if (\n !this.highlightedNeighbors.has(node.id) &&\n this.highlightedLink.source !== node &&\n this.highlightedLink.target !== node\n ) {\n if (this.nodeSettings.highlightByLinkNodeFading) {\n const min =\n this.nodeSettings.highlightByLinkNodeFadingMin < alpha\n ? this.nodeSettings.highlightByLinkNodeFadingMin\n : alpha;\n alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByLinkTextFading) {\n const min =\n this.nodeSettings.highlightByLinkTextFadingMin < textAlpha\n ? this.nodeSettings.highlightByLinkTextFadingMin\n : textAlpha;\n textAlpha = animationByProgress(min, textAlpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByLinkNodeColor) {\n const colorRgb = extractRgb(colorToRgb(color));\n if (colorRgb) {\n const colorRgbFade = fadeRgb(\n colorRgb,\n this.nodeSettings.highlightByLinkNodeColorFadingMin,\n );\n const colorFadeAnimation = rgbAnimationByProgress(\n colorRgb,\n colorRgbFade,\n this.highlightProgress,\n );\n color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;\n }\n }\n } else {\n /** Highlighted */\n\n if (this.nodeSettings.highlightByLinkNodeSizing && nodeOptions.shape === \"circle\") {\n radiusInitial = animationByProgress(\n radiusInitial,\n this.nodeSettings.highlightByLinkNodeSizingAdditional,\n this.highlightProgress,\n );\n }\n if (\n this.nodeSettings.highlightByLinkNodeSizing &&\n (nodeOptions.shape === \"square\" ||\n nodeOptions.shape === \"text\" ||\n nodeOptions.shape === \"icon\")\n ) {\n sizeCoefficient = animationByProgress(\n sizeCoefficient,\n this.nodeSettings.highlightByNodeNodeSizingAdditionalCoefficient,\n this.highlightProgress,\n );\n\n widthInitial *= sizeCoefficient;\n heightInitial *= sizeCoefficient;\n }\n if (this.nodeSettings.highlightByLinkTextSizing) {\n textSize = animationByProgress(\n textSize,\n this.nodeSettings.highlightByLinkTextSizingAdditional,\n this.highlightProgress,\n );\n textShiftX = animationByProgress(\n textShiftX,\n this.nodeSettings.highlightByLinkTextShiftXAdditional,\n this.highlightProgress,\n );\n textShiftY = animationByProgress(\n textShiftY,\n this.nodeSettings.highlightByLinkTextShiftYAdditional,\n this.highlightProgress,\n );\n textWeight = animationByProgress(\n textWeight,\n this.nodeSettings.highlightByLinkTextWeightAdditional,\n this.highlightProgress,\n );\n textWidth = animationByProgress(\n textWidth,\n this.nodeSettings.highlightByLinkTextWidthAdditional,\n this.highlightProgress,\n );\n }\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 textSize *= size.additionalSizeCoefficient;\n }\n /** Size by text in textNode */\n if (nodeOptions.shape === \"text\" && nodeOptions.text) {\n textWidth = width;\n let lines: string[];\n\n let textNodeParameters: CachedTextNodeParametersInterface;\n\n const cachedLines = this.cachedNodeText[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.text,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize,\n maxWidth: textWidth,\n textStyle: nodeOptions.textStyle,\n textWeight,\n });\n textNodeParameters = [textInfo.currentMaxSize, textSize];\n lines = textInfo.lines;\n this.cachedNodeText[node.id] = lines;\n this.cachedTextNodeParameters[node.id] = textNodeParameters;\n }\n\n const textSizeCoefficient = textSize / textNodeParameters[1];\n const maxSize = textNodeParameters[0] * textSizeCoefficient;\n\n height =\n lines.length * textSize +\n (lines.length - 1) * nodeOptions.textGap +\n nodeOptions.textNodeYPadding;\n\n width = maxSize + nodeOptions.textNodeXPadding;\n }\n\n /** Node parameters */\n node._radius = radius;\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 = nodeOptions.borderWidth;\n this.context.strokeStyle = nodeOptions.borderColor;\n this.context.fillStyle = color;\n\n switch (nodeOptions.shape) {\n case \"circle\": {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n break;\n }\n case \"square\": {\n this.context.roundRect(\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n node._borderRadius,\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.cachedNodeText[node.id];\n if (nodeOptions.text && lines)\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,\n y: node.y + textSize / 4 - (lines.length - 1) * (textSize / 2),\n maxWidth: textWidth,\n textStyle: nodeOptions.textStyle,\n textWeight,\n textGap: nodeOptions.textGap,\n });\n break;\n }\n default: {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n break;\n }\n }\n\n this.context.fill();\n this.context.stroke();\n });\n\n if (nodeOptions.nodeExtraDraw) {\n nodeRenders.push(() => {\n nodeOptions?.nodeExtraDraw?.(\n node,\n {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n textWidth,\n },\n state,\n );\n });\n }\n\n /** Text draw */\n if (nodeOptions.textVisible && nodeOptions.text && nodeOptions.shape !== \"text\") {\n textRenders.push(() => {\n if (nodeOptions.textDraw) {\n nodeOptions.textDraw(\n node,\n {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n textWidth,\n },\n state,\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\") {\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: textWidth,\n textStyle: nodeOptions.textStyle,\n textWeight,\n textGap: nodeOptions.textGap,\n });\n\n if (nodeOptions.textExtraDraw) {\n nodeOptions.textExtraDraw(\n node,\n {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n textWidth,\n },\n state,\n );\n }\n });\n }\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;SAegB,WAAW,CAGzB,WAA2B,EAAE,WAA2B,EAAE,KAAqC,EAAA;AAC/F,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;AAEzC,QAAA,IAAI,WAA+D;AACnE,QAAA,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YAC7D,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;;aACvC;YACL,WAAW,GAAG,sBAAsB,CAClC,IAAI,EACJ,KAAK,EACL,IAAI,CAAC,KAAK,EACV,KAAK,EACL,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,EAAE,EAC/B,iBAAiB,CAClB;AACD,YAAA,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE;gBAC3B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,WAAW;;;QAIhD,IAAI,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,EAAE;AAChD,YAAA,WAAW,CAAC,IAAI,CAAC,MAAK;gBACpB,WAAW,EAAE,QAAQ,GAAG,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC;AACnD,aAAC,CAAC;AAEF,YAAA,WAAW,CAAC,IAAI,CAAC,MAAK;gBACpB,WA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AC,CAAC,GAAG,UAAU;AAC3B,gBAAA,IAAI,WAAW,CAAC,KAAK,KAAK,QAAQ,EAAE;oBAClC,CAAC,IAAI,MAAM;;AAEb,gBAAA,IAAI,WAAW,CAAC,KAAK,KAAK,QAAQ,EAAE;AAClC,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;AACD,oBAAA,QAAQ,EAAE,SAAS;oBACnB,SAAS,EAAE,WAAW,CAAC,SAAS;oBAChC,UAAU;oBACV,OAAO,EAAE,WAAW,CAAC,OAAO;AAC7B,iBAAA,CAAC;AAEF,gBAAA,IAAI,WAAW,CAAC,aAAa,EAAE;AAC7B,oBAAA,WAAW,CAAC,aAAa,CACvB,IAAI,EACJ;AACE,wBAAA,GAAG,WAAW;wBACd,MAAM;wBACN,KAAK;wBACL,KAAK;wBACL,SAAS;wBACT,QAAQ;wBACR,UAAU;wBACV,UAAU;wBACV,UAAU;wBACV,SAAS;qBACV,EACD,KAAK,CACN;;AAEL,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 { colorToRgb, extractRgb, fadeRgb, rgbAnimationByProgress } from \"@/lib\";\nimport type { CachedTextNodeParametersInterface, NodeInterface } from \"@/types\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport {\n animationByProgress,\n isNodeVisible,\n nodeIterationExtractor,\n nodeOptionsGetter,\n nodeRadiusGetter,\n nodeSizeGetter,\n} from \"../lib\";\nimport type { GraphState, NodeOptionsInterface } 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)[], state: GraphState<NodeData, LinkData>) {\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\n let nodeOptions: Required<NodeOptionsInterface<NodeData, LinkData>>;\n if (this.nodeSettings.cache && this.nodeOptionsCache[node.id]) {\n nodeOptions = this.nodeOptionsCache[node.id];\n } else {\n nodeOptions = nodeIterationExtractor(\n node,\n index,\n this.nodes,\n state,\n this.nodeSettings.options ?? {},\n nodeOptionsGetter,\n );\n if (this.nodeSettings.cache) {\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 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 textWidth = nodeOptions.textWidth;\n let sizeCoefficient = 1;\n /** Node Highlight */\n if (this.highlightedNeighbors && this.highlightedNode) {\n /** Not highlighted */\n if (!this.highlightedNeighbors.has(node.id) && this.highlightedNode.id != node.id) {\n if (this.nodeSettings.highlightByNodeNodeFading) {\n const min =\n this.nodeSettings.highlightByNodeNodeFadingMin < alpha\n ? this.nodeSettings.highlightByNodeNodeFadingMin\n : alpha;\n alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByNodeTextFading) {\n const min =\n this.nodeSettings.highlightByNodeTextFadingMin < textAlpha\n ? this.nodeSettings.highlightByNodeTextFadingMin\n : textAlpha;\n textAlpha = animationByProgress(min, textAlpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByNodeNodeColor) {\n const colorRgb = extractRgb(colorToRgb(color));\n if (colorRgb) {\n const colorRgbFade = fadeRgb(\n colorRgb,\n this.nodeSettings.highlightByNodeNodeColorFadingMin,\n );\n const colorFadeAnimation = rgbAnimationByProgress(\n colorRgb,\n colorRgbFade,\n this.highlightProgress,\n );\n color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;\n }\n }\n } else if (\n !this.nodeSettings.highlightByNodeOnlyRoot ||\n (this.nodeSettings.highlightByNodeOnlyRoot && this.highlightedNode.id === node.id)\n ) {\n /** Highlighted */\n\n if (this.nodeSettings.highlightByNodeNodeSizing && nodeOptions.shape === \"circle\") {\n radiusInitial = animationByProgress(\n radiusInitial,\n this.nodeSettings.highlightByNodeNodeSizingAdditional,\n this.highlightProgress,\n );\n }\n if (\n this.nodeSettings.highlightByNodeNodeSizing &&\n (nodeOptions.shape === \"square\" || nodeOptions.shape === \"text\")\n ) {\n sizeCoefficient = animationByProgress(\n sizeCoefficient,\n this.nodeSettings.highlightByNodeNodeSizingAdditionalCoefficient,\n this.highlightProgress,\n );\n\n widthInitial *= sizeCoefficient;\n heightInitial *= sizeCoefficient;\n }\n if (this.nodeSettings.highlightByNodeTextSizing) {\n textSize = animationByProgress(\n textSize,\n this.nodeSettings.highlightByNodeTextSizingAdditional,\n this.highlightProgress,\n );\n textShiftX = animationByProgress(\n textShiftX,\n this.nodeSettings.highlightByNodeTextShiftXAdditional,\n this.highlightProgress,\n );\n textShiftY = animationByProgress(\n textShiftY,\n this.nodeSettings.highlightByNodeTextShiftYAdditional,\n this.highlightProgress,\n );\n textWeight = animationByProgress(\n textWeight,\n this.nodeSettings.highlightByNodeTextWeightAdditional,\n this.highlightProgress,\n );\n textWidth = animationByProgress(\n textWidth,\n this.nodeSettings.highlightByNodeTextWidthAdditional,\n this.highlightProgress,\n );\n }\n }\n }\n /** LinkHighlight */\n if (this.highlightedNeighbors && this.highlightedLink) {\n /** Not highlighted */\n if (\n !this.highlightedNeighbors.has(node.id) &&\n this.highlightedLink.source !== node &&\n this.highlightedLink.target !== node\n ) {\n if (this.nodeSettings.highlightByLinkNodeFading) {\n const min =\n this.nodeSettings.highlightByLinkNodeFadingMin < alpha\n ? this.nodeSettings.highlightByLinkNodeFadingMin\n : alpha;\n alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByLinkTextFading) {\n const min =\n this.nodeSettings.highlightByLinkTextFadingMin < textAlpha\n ? this.nodeSettings.highlightByLinkTextFadingMin\n : textAlpha;\n textAlpha = animationByProgress(min, textAlpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByLinkNodeColor) {\n const colorRgb = extractRgb(colorToRgb(color));\n if (colorRgb) {\n const colorRgbFade = fadeRgb(\n colorRgb,\n this.nodeSettings.highlightByLinkNodeColorFadingMin,\n );\n const colorFadeAnimation = rgbAnimationByProgress(\n colorRgb,\n colorRgbFade,\n this.highlightProgress,\n );\n color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;\n }\n }\n } else {\n /** Highlighted */\n\n if (this.nodeSettings.highlightByLinkNodeSizing && nodeOptions.shape === \"circle\") {\n radiusInitial = animationByProgress(\n radiusInitial,\n this.nodeSettings.highlightByLinkNodeSizingAdditional,\n this.highlightProgress,\n );\n }\n if (\n this.nodeSettings.highlightByLinkNodeSizing &&\n (nodeOptions.shape === \"square\" ||\n nodeOptions.shape === \"text\" ||\n nodeOptions.shape === \"icon\")\n ) {\n sizeCoefficient = animationByProgress(\n sizeCoefficient,\n this.nodeSettings.highlightByNodeNodeSizingAdditionalCoefficient,\n this.highlightProgress,\n );\n\n widthInitial *= sizeCoefficient;\n heightInitial *= sizeCoefficient;\n }\n if (this.nodeSettings.highlightByLinkTextSizing) {\n textSize = animationByProgress(\n textSize,\n this.nodeSettings.highlightByLinkTextSizingAdditional,\n this.highlightProgress,\n );\n textShiftX = animationByProgress(\n textShiftX,\n this.nodeSettings.highlightByLinkTextShiftXAdditional,\n this.highlightProgress,\n );\n textShiftY = animationByProgress(\n textShiftY,\n this.nodeSettings.highlightByLinkTextShiftYAdditional,\n this.highlightProgress,\n );\n textWeight = animationByProgress(\n textWeight,\n this.nodeSettings.highlightByLinkTextWeightAdditional,\n this.highlightProgress,\n );\n textWidth = animationByProgress(\n textWidth,\n this.nodeSettings.highlightByLinkTextWidthAdditional,\n this.highlightProgress,\n );\n }\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 textSize *= size.additionalSizeCoefficient;\n }\n /** Size by text in textNode */\n if (nodeOptions.shape === \"text\" && nodeOptions.text) {\n textWidth = width;\n let lines: string[];\n\n let textNodeParameters: CachedTextNodeParametersInterface;\n\n const cachedLines = this.cachedNodeText[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.text,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize,\n maxWidth: textWidth,\n textStyle: nodeOptions.textStyle,\n textWeight,\n });\n textNodeParameters = [textInfo.currentMaxSize, textSize];\n lines = textInfo.lines;\n this.cachedNodeText[node.id] = lines;\n this.cachedTextNodeParameters[node.id] = textNodeParameters;\n }\n\n const textSizeCoefficient = textSize / textNodeParameters[1];\n const maxSize = textNodeParameters[0] * textSizeCoefficient;\n\n height =\n lines.length * textSize +\n (lines.length - 1) * nodeOptions.textGap +\n nodeOptions.textNodeYPadding;\n\n width = maxSize + nodeOptions.textNodeXPadding;\n }\n\n /** Node parameters */\n node._radius = radius;\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 = nodeOptions.borderWidth;\n this.context.strokeStyle = nodeOptions.borderColor;\n this.context.fillStyle = color;\n\n switch (nodeOptions.shape) {\n case \"circle\": {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n break;\n }\n case \"square\": {\n this.context.roundRect(\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n node._borderRadius,\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.cachedNodeText[node.id];\n if (nodeOptions.text && lines)\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,\n y: node.y + textSize / 4 - (lines.length - 1) * (textSize / 2),\n maxWidth: textWidth,\n textStyle: nodeOptions.textStyle,\n textWeight,\n textGap: nodeOptions.textGap,\n });\n break;\n }\n default: {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n break;\n }\n }\n\n this.context.fill();\n this.context.stroke();\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 textWidth,\n });\n });\n }\n\n /** Text draw */\n if (nodeOptions.textVisible && nodeOptions.text && nodeOptions.shape !== \"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 textWidth,\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\") {\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: 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 textWidth,\n });\n }\n });\n }\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;SAegB,WAAW,CAGzB,WAA2B,EAAE,WAA2B,EAAE,KAAqC,EAAA;AAC/F,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;AAEzC,QAAA,IAAI,WAA+D;AACnE,QAAA,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YAC7D,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;;aACvC;YACL,WAAW,GAAG,sBAAsB,CAClC,IAAI,EACJ,KAAK,EACL,IAAI,CAAC,KAAK,EACV,KAAK,EACL,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,EAAE,EAC/B,iBAAiB,CAClB;AACD,YAAA,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE;gBAC3B,IAAI,CAAC,gBAAgB,CAAC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;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;wBACV,SAAS;AACV,qBAAA,CAAC;;AAEN,aAAC,CAAC;;AAEN,KAAC;AACH;;;;"}
|
package/lib/index.d.ts
CHANGED
|
@@ -174,10 +174,10 @@ type NodeSettingsInterface<NodeData extends Record<string, unknown>, LinkData ex
|
|
|
174
174
|
options?: NodeIterationPropsInterface<NodeData, LinkData, NodeOptionsInterface<NodeData, LinkData>> | NodeOptionsInterface<NodeData, LinkData>;
|
|
175
175
|
};
|
|
176
176
|
type NodeOptionsInterface<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>> = {
|
|
177
|
-
nodeDraw?: ((node: NodeInterface<NodeData>, options: Required<NodeOptionsInterface<NodeData, LinkData
|
|
178
|
-
textDraw?: ((node: NodeInterface<NodeData>, options: Required<NodeOptionsInterface<NodeData, LinkData
|
|
179
|
-
nodeExtraDraw?: ((node: NodeInterface<NodeData>, options: Required<NodeOptionsInterface<NodeData, LinkData
|
|
180
|
-
textExtraDraw?: ((node: NodeInterface<NodeData>, options: Required<NodeOptionsInterface<NodeData, LinkData
|
|
177
|
+
nodeDraw?: ((this: GraphCanvas<NodeData, LinkData>, node: NodeInterface<NodeData>, options: Required<NodeOptionsInterface<NodeData, LinkData>>) => void) | null;
|
|
178
|
+
textDraw?: ((this: GraphCanvas<NodeData, LinkData>, node: NodeInterface<NodeData>, options: Required<NodeOptionsInterface<NodeData, LinkData>>) => void) | null;
|
|
179
|
+
nodeExtraDraw?: ((this: GraphCanvas<NodeData, LinkData>, node: NodeInterface<NodeData>, options: Required<NodeOptionsInterface<NodeData, LinkData>>) => void) | null;
|
|
180
|
+
textExtraDraw?: ((this: GraphCanvas<NodeData, LinkData>, node: NodeInterface<NodeData>, options: Required<NodeOptionsInterface<NodeData, LinkData>>) => void) | null;
|
|
181
181
|
shape?: NodeShape;
|
|
182
182
|
width?: number;
|
|
183
183
|
height?: number;
|