WIP fix(): searchPossibleTargets
targets
value
#5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This code was not FF correctly, needs work
Motivation
Trying to impl a fix for the problem presented in fabricjs#9329
Being that the group rewrite made
searchPossibleTargets
return a sub target instead of the found taregt to allow deep selection. This surfaced an issue that the use ofCanvas#targets
akasubTargets
is wrong and confusing.closes fabricjs#9329
Description
Rethinking and Reconsidering
subTargets
If I go by the name and from what I understand was the original intention I believe
subTargets
should populate the sub targets of the found target.Parents of the found target should not be part of
subTargets
, that is what makes the name confusing. They should not be part mainly because it is clear that they are in the hit region or else the found target would not be found. If anyone including fabric needs the parents it is very simple to walk up the tree.The main use in fabric of
subTargets
is for events. So we need to fix that.I think it is unclear what is expected from the synthetic events.
Changes
_searchPossibleTargets
=>findTargetsTraversal
+ added a flag to allow searching for all hitssearchPossibleTargets
return value to consider an case wheresubTargetCheck: true, interactive: false
group were travesred, so returning the first hit is wrongsearchPossibleTargets
=>findTargets
targets
tofindTarget
because it varies on the case and is a step towards refactoring the use ofCanvas#targets
Gist
The tests came from fabricjs#9333 if you wish to merge that first, conflicts should resolve to
ours
In Action