Skip to content
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

refactor(classifier): use native browser SVG scaling for drawing tools #6066

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eatyourgreens
Copy link
Contributor

@eatyourgreens eatyourgreens commented Apr 28, 2024

  • remove manual scaling code from strokeWidth for all the SVG drawing marks. To be honest, it has never worked very well. When I wrote it, I didn't know that you can disable stroke scaling programmatically in SVG.
  • add vector-effect="non-scaling-stroke" to all the SVG drawing marks. This will make the displayed stroke width independent of the scaling of the SVG <image>, at all zoom levels.
  • style marks with :focus-visible so that the focus ring is only shown for keyboard interactions.
Screen.Recording.2024-04-28.at.12.06.37.mov

Package

  • lib-classifier/plugins/drawingTools

How to Review

This staging workflow has a mixture of drawing tools:
https://localhost:8080/?project=908&workflow=3370

You can also try out the drawing step in the I Fancy Cats workflow or try out a transcription task, with annotations from Caesar:
https://localhost:8080/?project=mainehistory/beyond-borders-transcribing-historic-maine-land-documents&env=production

You can test the focus styling by tabbing through the page, to check that drawn marks have focus styling when focused (WCAG Success Criterion 2.4.7: focus visible.) When a mark has keyboard focus, Enter will open any associated subtask popup, which should also be fully keyboard accessible. Backspace will delete the focused mark (WCAG Success Criterion 2.1.1: Keyboard.)

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

  • Tests are passing locally and on Github
  • Documentation is up to date and changelog has been updated if appropriate
  • You can yarn panic && yarn bootstrap or docker-compose up --build and FEM works as expected
  • FEM works in all major desktop browsers: Firefox, Chrome, Edge, Safari (Use Browserstack account as needed)
  • FEM works in a mobile browser

General UX

Example Staging Project: i-fancy-cats

  • All pages of a FEM project load: Home Page, Classify Page, and About Pages
  • Can submit a classification
  • Can sign-in and sign-out
  • The component is accessible

Refactoring

  • The PR creator has described the reason for refactoring
  • The refactored component(s) continue to work as expected

@coveralls
Copy link

coveralls commented Apr 28, 2024

Coverage Status

coverage: 79.285% (-0.04%) from 79.323%
when pulling 4fa507f on eatyourgreens:drawing-non-scaling-stroke
into 9a7a630 on zooniverse:master.

@eatyourgreens eatyourgreens force-pushed the drawing-non-scaling-stroke branch 7 times, most recently from e2181da to 6c6bd0e Compare May 3, 2024 22:37
@eatyourgreens eatyourgreens changed the title refactor: use native browser SVG scaling for drawing tools refactor(classifier): use native browser SVG scaling for drawing tools May 19, 2024
- remove manual scaling code from `strokeWidth` for all the SVG drawing marks. To be honest, it has never worked very well.
- add `vector-effect="non-scaling-stroke"` to all the SVG drawing marks. This will make the displayed stroke width independent of the scaling of the SVG element, at all zoom levels.
- style marks with `:focus-visible` so that the focus ring is only shown for keyboard interactions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants