@krainovsd/graph 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.cjs CHANGED
@@ -1586,8 +1586,13 @@ class GraphCanvas {
1586
1586
  this.nodeOptionsCache[node.id] = nodeOptions;
1587
1587
  }
1588
1588
  }
1589
- if (nodeOptions.nodeDraw) {
1590
- nodeOptions.nodeDraw(node, nodeOptions, state);
1589
+ if (nodeOptions.nodeDraw && nodeOptions.textDraw) {
1590
+ nodeRenders.push(() => {
1591
+ nodeOptions?.nodeDraw?.(node, nodeOptions, state);
1592
+ });
1593
+ textRenders.push(() => {
1594
+ nodeOptions?.textDraw?.(node, nodeOptions, state);
1595
+ });
1591
1596
  return;
1592
1597
  }
1593
1598
  let alpha = nodeOptions.alpha;
@@ -1671,6 +1676,22 @@ class GraphCanvas {
1671
1676
  this.context.fill();
1672
1677
  this.context.stroke();
1673
1678
  });
1679
+ if (nodeOptions.nodeExtraDraw) {
1680
+ nodeRenders.push(() => {
1681
+ nodeOptions?.nodeExtraDraw?.(node, {
1682
+ ...nodeOptions,
1683
+ radius,
1684
+ alpha,
1685
+ color,
1686
+ textAlpha,
1687
+ textSize,
1688
+ textShiftX,
1689
+ textShiftY,
1690
+ textWeight,
1691
+ textWidth,
1692
+ }, state);
1693
+ });
1694
+ }
1674
1695
  /** text */
1675
1696
  if (nodeOptions.textVisible && nodeOptions.text) {
1676
1697
  textRenders.push(() => {
@@ -1725,20 +1746,6 @@ class GraphCanvas {
1725
1746
  }
1726
1747
  });
1727
1748
  }
1728
- if (nodeOptions.nodeExtraDraw) {
1729
- nodeOptions.nodeExtraDraw(node, {
1730
- ...nodeOptions,
1731
- radius,
1732
- alpha,
1733
- color,
1734
- textAlpha,
1735
- textSize,
1736
- textShiftX,
1737
- textShiftY,
1738
- textWeight,
1739
- textWidth,
1740
- }, state);
1741
- }
1742
1749
  };
1743
1750
  }
1744
1751
  if (this.graphSettings.showDrawTime) {