-
-
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
fix(): Avoid firing twice in subselection #9329
Conversation
Great catch, thanks! (saying it again) Now question is how we should handle this. Currently, I think it will contain itself and its children in case it is flagged with |
This is an opportunity to define what should happen and refactor |
this helped find another severe bug |
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.
_searchPossibleTargets
=>fintTargetsTraversal
, now returns an array of hits- fixed
searchPossibleTargets
bug cause d by confusion ofsubTargetCheck
andinteractive
- added tests
src/canvas/SelectableCanvas.ts
Outdated
return target && | ||
isCollection(target) && | ||
target.interactive && | ||
this.targets[0] | ||
? this.targets[0] | ||
: target; |
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 was wrong, added a test that fails on master
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.
Can you define in which way this is wrong?
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.
@asturur this.
If there is a target under a subTargetChec group under and interactive group the middle group should be selected but actually the target will be wrongly selected
see the test
6867240
to
6368234
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.
OK
This is stabilizing.
I now think that subTargets
should be renamed into path
or hits
or something since target
can indeed be part of it, and the name doesn't reflect the fact that target's parent are part of the array as well.
The fix is done.
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.
dreadful work
but at least now when these tests fail it will have ameaning for a human being and it will take a second to understand what failed instead of trying to find in the massive dump something worthwhile
test/unit/canvas.js
Outdated
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.
moved all findTarget tests to jest
test/unit/canvas_events.js
Outdated
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.
moved to jest
c5d4275
to
b1e5144
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.
refactored _hovreredTarget
, _hovreredTargets
=> hoveringState
squashed _fireEnterLeaveEvents
, _fireOverOutEvents
=> handleSyntheticInOutEvents
src/canvas/Canvas.ts
Outdated
* @type FabricObject | ||
* @private | ||
*/ | ||
private declare _draggedoverTarget?: FabricObject; |
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.
very weird artifact
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.
I found where it was set, thought it was only read. but still redundant
src/canvas/Canvas.ts
Outdated
// TODO: verify if those should loop in inverse order then? | ||
// what is the order of subtargets? |
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.
targets from the search are in correct order
src/canvas/Canvas.ts
Outdated
// ISSUE 4115: should we consider subTargets here? | ||
// this._hoveredTargets = []; | ||
// this._hoveredTargets = this.targets.concat(); |
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.
what is this?
For me this is on hold until the layout manager refactor, and after considering a dumb fix to avoid the double firing before considering other changes. |
Which one? |
I think first I will extract the migrated tests to a PR because it is impossible working with the old draggable text tests |
I would like to understand why this one: |
You can if you want to monkey patch and leave the real bug in the code base |
There are no real bugs and fake bugs. |
it can |
Why can't we talk about the problem? |
It is exactly what i was asking, what the other bug is. |
So what is the impact of the bug and why you consider it severe? One is a double event firing, the other is an incorrect target? another double firing? Really isn't clear. |
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.
look here at the events recorded by the test
dragenter is called too much and dragleave too little - might be it is caused by this PR.
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.
I couldn't know what was wrong because of the draggable_text test that just fails without outputting something decent
fc3ba50
to
8fae21f
Compare
Whatever relies on |
I reverted everything |
8fae21f
to
2a95437
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.
restored
Maybe we should go ahead with my simple and harmless fix, then take time to understand the implications of Once we all have a clear picture of what |
I have found more bugs. As I said, this is part of the group rewrite. (Redoing coords is as well). I never understood this part until now because how it is written. Scatterred changes in so many place I could not wrap my head around it.
Also take into account that since the group rewrite there is a valid case where you will want to hit a sibling of what was found. Currently, subTargets will contain only the ancestors and if In other words I find subTargets useless as it is. |
Rethinking and Reconsidering
|
Take a look at #9343 |
I'll ask it for @asturur: what are the bugs? |
|
In Group subselection, mouse events are fired twice because the target is both
target
and insubTargets
. This is the quick fix, the proper one should probably be evaluating whether it's intended for the target to appear in both states.cc @ShaMan123