-
Notifications
You must be signed in to change notification settings - Fork 852
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
Delay the binding of paper for ToolView #1419
Comments
Hi, could you please post here an example when this is an issue? |
It's a structural issue rather than a functional issue. In my opinnion, link tools are attachments to links so they should be subject to links instead of papers. Therefore, I tried to encapsulate the link tools into links' constructor(initialize) but found that it failed without any errors (the guard method always returns true if paper is null or undefined). |
I see. Would this help for the time being? Object.defineProperty(joint.dia.ToolView.prototype, 'paper', {
enumerable: true,
get: function() {
return this.relatedView.paper;
},
set: function() {
// noop
}
}); |
This polyfill works. However, there's another issue. If I put link tools in links' constructor, the link tools are always shown at the first time. I further found the following code: Lines 57 to 62 in 68481bc
If the link tools are rendered the first time, it's always visible. At present, I use a |
Extending the class MyToolsView extends joint.dia.ToolsView {
get paper() {
return this.relatedView.paper;
}
blurTool(...args) {
if (!this.isRendered) {
return; // do nothing.
}
super.blurTool(...args);
}
} |
This issue is stale because it has been open 60 days with no activity. Please remove stale label or comment or this will be closed in 14 days. |
This issue is stale because it has been open 60 days with no activity. Please remove stale label or comment or this will be closed in 14 days. |
This issue is stale because it has been open 60 days with no activity. Please remove stale label or comment or this will be closed in 14 days. |
See the code below. The
paper
binding could be derived fromrelatedView
instead of binding directly. By delaying the binding of paper, theToolView
could be initialized within the initialization procedure ofLink
.joint/src/dia/ToolView.mjs
Lines 62 to 67 in 7b6080d
The text was updated successfully, but these errors were encountered: