• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zooniverse / front-end-monorepo / 13440953185
77%

Build:
DEFAULT BRANCH: master
Ran 20 Feb 2025 05:22PM UTC
Jobs 1
Files 1438
Run time 3min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

20 Feb 2025 05:18PM UTC coverage: 75.515% (-0.03%) from 75.544%
13440953185

push

github

web-flow
refactor(drawing-tools): replace scale prop with useScale hook (#6697)

* refactor(drawing-tools): replace scale prop with useScale hook

Replace the `scale` prop with a `useScale` hook in the drawing tools. It's useful to imitate `vector-effect: non-scaling-size` by inverting any scaling applied to a parent SVG element. The drawing tools remain the same size on the screen, no matter whether the subject image is zoomed in or zoomed out.

The scale it returns is the scale factor of the current subject, calculated from the size of the drawing canvas (client width / intrinsic width.)

```jsx
const scale = useScale();

return (
  <g ref={root} transform={`scale(1 / ${scale})`}>
    <circle cx={0} cy={0} r={10} />
  </g>
);
```

* add useScale to subject viewers

* Docs and example

* type annotations for useScale and SVGContext

* use stored svgContext.rotate in scale calculation

* Remove scale from drawing API readme

* Add DragHandle props for polygon onPointerDown

* clean up DragHandle props

---------

Co-authored-by: Mark Bouslog <mark@zooniverse.org>

10839 of 16550 branches covered (65.49%)

Branch coverage included in aggregate %.

54 of 63 new or added lines in 18 files covered. (85.71%)

1 existing line in 1 file now uncovered.

16952 of 20252 relevant lines covered (83.71%)

398.47 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
23.61
1.69% packages/lib-classifier/src/plugins/drawingTools/experimental/components/LineControls/LineControls.js
2
26.67
-0.61% packages/lib-classifier/src/plugins/drawingTools/components/UndoButton/UndoButton.js
2
14.85
0.27% packages/lib-classifier/src/plugins/drawingTools/experimental/components/FreehandLine/FreehandLine.js
4
56.76
packages/lib-classifier/src/plugins/drawingTools/hooks/useScale.js

Uncovered Existing Lines

Lines Coverage ∆ File
1
58.08
-0.15% packages/lib-classifier/src/components/Classifier/components/SubjectViewer/components/SingleVideoViewer/SingleVideoViewerContainer.js
Subprojects
ID Flag name Job ID Ran Files Coverage
1 /jobs/160718956 13440953185.1 20 Feb 2025 05:22PM UTC 1438
75.51
GitHub Action Run
Source Files on build 13440953185
  • Tree
  • List 1438
  • Changed 74
  • Source Changed 30
  • Coverage Changed 30
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #13440953185
  • f61207d6 on github
  • Prev Build on master (#13416714459)
  • Next Build on master (#13462745198)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc