-
-
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
feat(perPixelTargetFind
): support not-selected
option
#9167
Conversation
Build Stats
|
This sounds a strong assumption on the desired UX. Fabric should probably be agnostic about it, leaving the decision to the application. Maybe fabric should just tell that both the children and the activeObject are targets of the event. |
Don't get it |
if we turn the usage from a flag check to a method it can be easily overridden
|
I mean that
In that case you can already override the property with a getter |
We talked about refactoring |
i remember when we needed it years ago, was mostly for text, people would see things behind text objects and they were angry they couldn't be selected if text was selected. It could be an option in 6.1, now this shouldn't be touched. |
// http://www.geog.ubc.ca/courses/klink/gis.notes/ncgia/u32.html | ||
// http://idav.ucdavis.edu/~okreylos/TAship/Spring2000/PointInPolygon.html |
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.
we should preserve this comment maybe over the containsPoint function
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.
both are dead, and also the impl has moved forward more than a decade
src/canvas/SelectableCanvas.ts
Outdated
if ( | ||
(this.perPixelTargetFind || obj.perPixelTargetFind) && | ||
!(obj as unknown as IText).isEditing | ||
// if `obj` is selected we want it to be easy to interact with it |
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 can see both ways being reasonable.
this will be a boolean option maybe called preferBoundingBoxWhenActive: boolean
to add.
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.
IMO options less booleans more deleagtes/managers
In this way we take away from simplicity for the purpose of trying to write the perfect flexible code that doesn't exist. You were about to change an IF only, that means that a boolean option is fine. |
So if going in the direction I would change |
perPixelTargetFind
objectperPixelTargetFind
): selected/not-selected object + perPixelTargetFind
perPixelTargetFind
): selected/not-selected object + perPixelTargetFind
perPixelTargetFind
): support not-selected
option
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.
added not-selected
option
(this.perPixelTargetFind === true || | ||
obj.perPixelTargetFind === true || | ||
((this.perPixelTargetFind === 'not-selected' || | ||
obj.perPixelTargetFind === 'not-selected') && |
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 am not sure about combinations between canvas.perPixelTargetFind
and obj.perPixelTargetFind
Shouldn't the object take presedence?
I will update tests once we decide
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.
We should collect the current rules around the code.
But there shouldn't be such precedence is just confusing.
There must a be a documented way to handle that for all objects or just some.
If you can set it on a single object or an entire subclass through default values is good enough imho
I am not sure about this PR. |
This reverts commit cbc0e6b.
how this would behave when you have selected an object inside a group with not-selected? what is the ux like? |
I think we should close this pr. |
my question on the ux is still useful to understand what this features would do. contains point won't be the center of the selection anymore since it doesn't take padding in account. containsPoint can be used for selection with a pointer, but is not a selection function so it should not have selection logic inside. If a point is contained it has to return true, regardless of selection ux. |
i still want to know this if you know: how this would behave when you have selected an object inside a group with 'not-selected'? what is the ux like? |
Motivation
I was looking into this and it doesn't make sense IMO.
If an object is selected I think the user expectation is to iteract with the bbox, whereas if it is not selected
perPixelTargetFind
should be respectedDescription
added an option
not-selected
toperPixelTargetFind
Changes
Gist
In Action