Skip to content

Commit

Permalink
feat(node-ctx-renderer): add node id (#1000)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomaash authored Aug 31, 2020
1 parent e5cce3c commit 21aa7d0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/network/nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ <h3>Options</h3>
<td>
<p>The function inputs and outputs look like:</p>
<pre class="code">
function ctxRenderer({ ctx, x, y, state: { selected, hover }, style, label }) {
function ctxRenderer({ ctx, id, x, y, state: { selected, hover }, style, label }) {
// do some math here
return {
// bellow arrows
Expand Down
2 changes: 1 addition & 1 deletion examples/network/nodeStyles/shapes.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
id: 36,
label: 'custom',
shape: 'custom',
ctxRenderer: ({ ctx, x, y, state: { selected, hover }, style }) => {
ctxRenderer: ({ ctx, id, x, y, state: { selected, hover }, style }) => {
const r = style.size;
const drawNode = () => {
ctx.beginPath();
Expand Down
1 change: 1 addition & 0 deletions lib/network/modules/components/nodes/shapes/CustomShape.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class CustomShape extends ShapeBase {
ctx.save();
const drawLater = this.ctxRenderer({
ctx,
id: this.options.id,
x,
y,
state: { selected, hover },
Expand Down

0 comments on commit 21aa7d0

Please sign in to comment.