Open eatyourgreens opened 4 days ago
This bug means that Etch-A-Cell must be almost impossible in Firefox. 😳
Updating the context so that all transformations reference the same SVG rect
element fixes this.
Here's a screen recording from Etch-A-Cell, showing this bug in Firefox when you edit a line.
https://github.com/user-attachments/assets/ad402ed7-81c2-41fd-b41a-22337c46edcb
You can also reproduce this bug on any transcription project in Firefox.
https://github.com/user-attachments/assets/7f5866b7-e6af-4a54-9688-19b371dd826e
Package
Examples
Describe the bug
Dragging a drawn mark, in Firefox, doesn't correctly map the cursor position to the enlarged SVG image. It looks like the cursor position is mapped to the original (not zoomed-in) viewport.
https://github.com/user-attachments/assets/0eb80883-8c49-4700-bd00-6f6bc88fca17
To Reproduce
https://frontend.preview.zooniverse.org/projects/eatyourgreens/-project-testing-ground/classify/workflow/3370?env=staging
In Firefox, zoom in, place a point mark, then drag the point to a new position.
Alternatively, zoom in, draw a line, then drag one of the end points to a new position.
Expected behavior
Drawing works as expected in Chrome and Safari. The dragged element should follow the pointer position.
Additional context
Dragging interactions get the current transformation matrix from a
svg
element stored inSVGContext
here: https://github.com/zooniverse/front-end-monorepo/blob/1862adebef4ddfde8d071669c99038bf3343383c/packages/lib-classifier/src/plugins/drawingTools/components/draggable/draggable.js#L51Creating a mark here gets the CTM from the
DrawingCanvas
component in theInteractionLayer
component. https://github.com/zooniverse/front-end-monorepo/blob/1862adebef4ddfde8d071669c99038bf3343383c/packages/lib-classifier/src/components/Classifier/components/SubjectViewer/components/InteractionLayer/InteractionLayer.js#L88I don't think those are referencing the same DOM node, so that could account for differences in behaviour between creating a mark and dragging a mark. They probably should be using the same DOM node and transformation matrix.