-
Notifications
You must be signed in to change notification settings - Fork 840
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
[Bug]: Multiple inheritance with custom shapes not working (as expected?) #2302
Comments
It is the
class CLink extends CBase {
defaults() {
return joint.util.merge(
{},
super.defaults(),
{
type: "CLink",
attrs: {
line: {
stroke: "#ccc",
strokeWidth: 2
}
}
},
);
}
} |
Ooohh! 🤔 Ok, I have another questions. Why |
The shapes.standard.Link class is defined via the define method which using the extend method of Backbone. If you create a The ES Class I recommend reading this article which should explain this in detail. Also reading this Backbone issue might be helpful. |
Oohh, now I get it. Good thing to know :) |
I have an extra question 🙏 Would it be possible to extend from 2 classes using this method? Lets say that I have class MyLink extends merge(CBaseLinkA, CBaseLinkB) {
defaults() {
return joint.util.merge(
{
attrs: { line: { fill: "red" } }
},
super.defaults() // ????
)
}
} |
Perhaps you can check this discussion. |
Hmmm, I think I saw similar stuff in SO, but I'm not really sure how to handle the |
What happened?
I'm playing with the examples at https://resources.jointjs.com/tutorial/ts-shape and I figured out I'd try to create a
Base
shape that extends fromdia.Link
, which then I'd use to createMyLink
. It turns out this doesn't work.I'm not really sure why (maybe it has something to do with the way
defaults
is being called?).Demo: https://codesandbox.io/s/joint-custom-link-extend-playground-ngs9zn
Note that
Version
3.7.5
What browsers are you seeing the problem on?
Firefox, Chrome, Safari
What operating system are you seeing the problem on?
Mac
The text was updated successfully, but these errors were encountered: