Repository navigation
Conversation
LoukasPap
marked this pull request as draft
October 26, 2026 15:07
Commit the drawing in progress before the layer is rotated, since its points are in the coordinate system of the previous viewport. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… a layer The layers are rotated with CSS, hence `getBoundingClientRect()` gives their rotated (visual) rectangle whereas the `left`/`top` percentages of their children are relative to their unrotated one. The new helpers make it possible to switch between those two frames: - `clientRectToLayerLeftBottom` converts a client rectangle into the left-bottom corner in the unrotated frame (as fractions of the layer); - `layerFractionToClientPoint` does the opposite for a point; - `getUnrotatedSize` gives the dimensions of a rectangle in the unrotated frame. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The position of the comment button and of the popup is relative to the layer, which can be rotated, whereas the bounding client rects are in the rotated frame: - `commentButtonWidth` is now the width of the button divided by the width of the layer, both in the unrotated frame; - `commentPopupPosition(InLayer)` is computed from the left-bottom corner of the button in the unrotated frame; - when there is no popup position, the dialog is anchored to the bottom-left corner of the button as it's displayed, otherwise the stored position is converted back to the client coordinates; - the dialog uses the width of the button in the unrotated frame to align itself with the button. This is done for the editors and for the popups of the existing annotations. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…the comment popup The popup position is stored as fractions of the unrotated layer: - the movement of the pointer, which is in the window frame, is now rotated into the axes of the layer before being added to the position; - the width of the popup is divided by the width of the layer in the unrotated frame; - when the popup is kept inside the window, the x-axis of the layer is the horizontal axis of the window for 0° and 180°, and the vertical one for 90° and 270°, and it's reversed for 180° and 270°. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
LoukasPap
force-pushed
the
fix/editors-misplaced-after-rotation
branch
from
October 26, 2026 15:08
d87e65e to
46777ea
Compare
LoukasPap
marked this pull request as ready for review
October 26, 2026 15:14
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22194
After rotating the pages, a drawing in progress and the comment popup/dialog could end up in the wrong place. This happened at zoom values that change on rotation (e.g.
page-fit,auto).dom_utils.jsto convert between the client coordinates (rotated layer) and fractions of the unrotated layer, and use them to:Integration tests
The pages are rotated by 90°, 180°, 270° and back to 0°, with
page-fit:ink_editor_spec.mjscomment_spec.mjsWithout the fixes, all of them fail except "must keep the drawing in place while the pages are rotated": a committed drawing already stays in place. That test is kept to avoid future regressions.