-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
fix(): typeAssertions not respecting subclasses
#8931
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
Conversation
|
Build Stats
|
ShaMan123
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok
|
mmm this is like isType but different. I would prefer we detect the classes by a specific class property instead of having our own tag system. So the bug is that this isType can't work because of course your subclass name is different. I don't want to add custom systems to do this. |
|
Hmm... |
|
Well if we manage one day to flatten the object tree instanceof will be possible. But until then... |
|
the empty methods could be good enough but is just like a tag. |
|
I have a different concept, using class registry. I will POC |
|
So the concept isn't that good |
|
@ShaMan123 it feels unsafe but is not. |
|
I see it as a design issue. |
Motivation
Was working on a subclass of IText when selection rendering started having bugs, being cleared because passing this condition (should pass
isInteractiveTextObjectandisEditing):fabric.js/src/canvas/Canvas.ts
Lines 890 to 896 in 0f0ed96
fabric.js/src/util/typeAssertions.ts
Lines 54 to 60 in 0f0ed96
Of course it will because types are deprecated and the name of the class doesn't match.
Indeed this line is more types than logic but the rest aren't
Description
Came up with a solution in the form of static TAGS and an
ismethod that is extremely similar toisTypeChanges
Gist
There is no decent way for me to test this
In Action