-
Notifications
You must be signed in to change notification settings - Fork 30
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(classifier): Polygon tool drag handles #6550
base: master
Are you sure you want to change the base?
fix(classifier): Polygon tool drag handles #6550
Conversation
@@ -72,7 +72,6 @@ function Polygon({ active, mark, scale, onFinish }) { | |||
strokeWidth={strokeWidth} | |||
strokeDasharray={strokeDasharray} | |||
/> | |||
)} |
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.
The polygon tool code is actually broken here, and has been for a while. 😳
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.
While I can move the drag point by running this PR with https://localhost.zooniverse.org:3000/projects/eatyourgreens/-project-testing-ground/classify/workflow/3370?env=staging, when I release the drag point then move my mouse around the subject viewer, hovering sometimes picks up the drag point again. Do you see that behavior too? I'm using Brave Browser on MacOS.
I haven’t seen that, but it sounds like a bug where pointer capture isn’t automatically released on pointer up. @goplayoutside3 do you see that same bug on other shapes that use drag handles; lines, rectangles, or ellipses? Are you using a mouse or a trackpad? I'm using a trackpad, which might be the difference. EDIT: I've just been able to reproduce it in the storybook in Firefox. I'll add a comment to the code diff. |
f7435ad
to
c791810
Compare
@@ -84,7 +83,7 @@ function Polygon({ active, mark, scale, onFinish }) { | |||
y={point.y} | |||
fill='currentColor' | |||
dragMove={point.moveTo} | |||
onPointerDown={handleClosePolygon} | |||
onPointerUp={handleClosePolygon} |
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.
Previously this overrode onPointerDown
for draggable elements, which stopped dragging from happening at all. Now it overrides onPointerUp
which means dragging is never canceled once it has started. 😳
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.
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.
b3b8304 might be a better fix. It decorates existing event handlers with draggable behaviour, rather than replacing or overriding them.
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.
Tested in Chrome and Firefox with a few different drawing tools. Seems to work OK, and dragging is now cancelled on pointer up, while also running the mark's pointerup
handler.
https://localhost:8080/?project=eatyourgreens%2F-project-testing-ground&workflow=3370
Drawing while zoomed-in still triggers #6490 in Firefox, but that's a separate issue.
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.
The ellipse tool still seems to work as expected in I Fancy Cats.
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've updated the PR description too, as the scope has changed from the polygon tool to the draggable
decorator.
09e19d6
to
9f60321
Compare
Refactor the polygon tool drag handles so that `pointerdown` does not close and finish the shape, overriding the pointer dragging behaviour. Instead, the shape is closed and finished on `pointerup`.
9f60321
to
61e6b16
Compare
Refactor the polygon tool drag handles so that
pointerdown
does not close and finish the shape, overriding the pointer dragging behaviour. Instead, the shape is closed and finished onpointerup
.Refactor the
draggable
decorator so that it decorates any existingonPointerDown
,onPointerMove
, andonPointerUp
handlers with draggable behaviour. The draggable behaviour is run before the existing handler, for each event.Please request review from
@zooniverse/frontend
team or an individual member of that team.Package
Linked Issue and/or Talk Post
How to Review
Screen.Recording.2024-12-12.at.16.06.48.mov
Clicking a drag handle should still close and finish a polygon, but
pointerdown
should now start dragging where previously it was cancelled.Checklist
PR Creator - Please cater the checklist to fit the review needed for your code changes.
PR Reviewer - Use the checklist during your review. Each point should be checkmarked or discussed before PR approval.
General
yarn panic && yarn bootstrap
ordocker-compose up --build
and FEM works as expectedGeneral UX
Example Staging Project: i-fancy-cats
Bug Fix