-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
revert(): rm active selection ref #9561
Conversation
Build Stats
|
ee29db1
to
195b82f
Compare
@asturur please review this so we can decide on the right way forward |
i am ok reverting this feature, i was neutral about it, if the code in this way is simpler i prefer to roll it back |
I think we should use the classRegistry to load the ActiveSelection class and we should avoid to use instanceOf for it. |
I will do it now. |
5b4bec7
to
785db5b
Compare
785db5b
to
aa58ae9
Compare
yes something that can detect withou using the class. if we didn't have selections of objects inside a group we could just say that the activeObject is not in canvas, that would grant is an active selection, but now we have to flag it maybe recognizing the stac property we added recently or something else |
c421e98
to
d72ab68
Compare
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.
All tests should pass now
Remaining is to decide about how to handle instanceof ActiveSelection
Since there is no issue with import cycles I don't mind leaving it as is.
I could re-expose isActiveSelection
using classRegistry
const isActiveSelection = (object: FabricObject) =>
object instanceof
classRegistry.getClass<typeof ActiveSelection>('ActiveSelection');
Is that better?
d72ab68
to
324e0c1
Compare
That would be fine imho, but is slightly different from the others, but does the job. |
not sure typing getClass in that way is a good move, but we can still default to any as it was before and patch where it creates issues |
Can you elaborate? |
My thoughts about |
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 ready
jest just proved that.
|
06eee6f
to
570788d
Compare
Doing isActiveSelection or doing instanceOf ActiveSelection is the same exact thing, at the net of the forced import. |
.getClass(obj.type) | ||
.fromObject(obj, { | ||
signal, | ||
reviver, |
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.
ok i wonder how reviver ended up here in the refactors
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.
just because of the type change
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.
yes but it never was part of fromObject, why did we put it there
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.
a good question for the blame and spare time to answer
src/canvas/SelectableCanvas.ts
Outdated
instance.group === this._activeSelection && | ||
this._activeObject === instance.group | ||
) { | ||
if (instance.group && isActiveSelection(instance.group)) { |
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.
this check is different now, we still have to check that instance.group is activeObject
Being an activeSelection, doesn't mean you are the active one.
using the classRegistry check with Jest is broken because jest imports only what it needs, so i had to revert it to checking a random exclusive property |
i m good to go |
we should follow up with removing the code in the layout manager |
// clear active selection | ||
if (obj === this._activeSelection) { | ||
this._activeSelection.removeAll(); | ||
resetObjectTransform(this._activeSelection); |
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.
So I removed this line but still the layout manager is present and does the same.
Let's see what will happen when I remove it
be mindful that this is not a revert. |
Description
This PR reverts the active selection ref on the canvas.
It was a bad decision that opened odd bugs and bad design
Voids the need for #9525
In Action