Moved style computation functions out of the BoundingBox component and into a new styleUtils.ts file
Broke computeStyleWithContext up into separate functions for bounding boxes vs page style- computeBoundingBoxStyle and computePageStyle
Also split out getPageHeight and getPageWidth functions because getPageWidth is used in other places and I thought getPageHeight should match despite only being used in one place
Added a 🛥️ load of unit tests for all of these style functions
Type changes:
Broke Size type up into new Dimensions (height and width) and Origin (left and top) types.
Moved Point from scale.ts to types.ts
Renamed context variables pageSize/setPageSize to pageDimensions/setPageDimensions to accurately reflect the new type
Removed bounding box CSS for min-height that was causing issues with scaling
Reviewer Instructions
Don't be discouraged by how many LOC were changed in this PR! Most of it is variable renaming due to the pageSize > pageDimensions thing and the unit tests added 400+ LOC as well. I tried to split my commits up nicely so you can step through those if that's useful.
Testing Plan
Manual testing
Existing functionality works as expected (zoom, rotate, outline, highlight overlay demo, text highlight demo, scroll to demo)
Description
This covers the bulk of https://github.com/allenai/scholar/issues/29577 which is a subtask of the PDF Component Library Loose Ends ticket.
Changes in this PR:
BoundingBox
component and into a newstyleUtils.ts
filecomputeStyleWithContext
up into separate functions for bounding boxes vs page style-computeBoundingBoxStyle
andcomputePageStyle
getPageHeight
andgetPageWidth
functions becausegetPageWidth
is used in other places and I thoughtgetPageHeight
should match despite only being used in one placeSize
type up into newDimensions
(height and width) andOrigin
(left and top) types.Point
fromscale.ts
totypes.ts
pageSize
/setPageSize
topageDimensions
/setPageDimensions
to accurately reflect the new typemin-height
that was causing issues with scalingReviewer Instructions
Don't be discouraged by how many LOC were changed in this PR! Most of it is variable renaming due to the
pageSize
>pageDimensions
thing and the unit tests added 400+ LOC as well. I tried to split my commits up nicely so you can step through those if that's useful.Testing Plan