Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #2171 Unable to update ctxRenderer for custom shapes #2172

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/network/modules/components/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,7 @@ class Node {
this.shape = new CustomShape(
this.options,
this.body,
this.labelModule,
this.options.ctxRenderer
this.labelModule
);
break;
case "database":
Expand Down
8 changes: 3 additions & 5 deletions lib/network/modules/components/nodes/shapes/CustomShape.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ class CustomShape extends ShapeBase {
* @param {object} options
* @param {object} body
* @param {Label} labelModule
* @param {Function} ctxRenderer
*/
constructor(options, body, labelModule, ctxRenderer) {
super(options, body, labelModule, ctxRenderer);
this.ctxRenderer = ctxRenderer;
constructor(options, body, labelModule) {
super(options, body, labelModule);
}

/**
Expand All @@ -36,7 +34,7 @@ class CustomShape extends ShapeBase {

// Guard right away because someone may just draw in the function itself.
ctx.save();
const drawLater = this.ctxRenderer({
const drawLater = this.options.ctxRenderer({
ctx,
id: this.options.id,
x,
Expand Down