feat: rotate the exported map by a bearing - #34
Merged
Merged
Conversation
Adds a rotation setting so north need not be at the top of the print. Tiles were already screen-space rects rendered as small MapLibre maps, and MapLibre turns rigidly about the screen centre, so a bearing only changes how a screen offset becomes a world point: tileGrid and the renderer's edge-tile alignment turn their offsets by the bearing, and everything after the renderer is untouched. The bbox is fitted north-up as before and the page turns about its centre. The hidden renderer map now passes a no-op transformConstrain: MapLibre's default pans a camera whose unrotated frame crosses the latitude limit, which would misalign an edge tile of a rotated page. fitsWorld checks all four page corners instead. Raster layers can jog by up to a device pixel at seams of a rotated page because MapLibre snaps them to whole world pixels per map; this is documented rather than fixed. The form gains a Rotation field, the preview map drag-rotates with a compass and the two stay in sync, and the preview draws the page outline alongside the bbox since the bbox corners can fall off a rotated page. The e2e pages use a taller viewport so the longer form needs no scrolling, which WebKit's checkbox click did not survive. Closes #5
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
map-printer | 7b90257 | Commit Preview URL Branch Preview URL |
Sep 17 2026, 02:24 PM |
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.
Adds a rotation setting so north need not be at the top of the print.
Tiles were already screen-space rects rendered as small MapLibre maps, and
MapLibre turns rigidly about the screen centre, so a bearing only changes
how a screen offset becomes a world point: tileGrid and the renderer's
edge-tile alignment turn their offsets by the bearing, and everything after
the renderer is untouched. The bbox is fitted north-up as before and the
page turns about its centre.
The hidden renderer map now passes a no-op transformConstrain: MapLibre's
default pans a camera whose unrotated frame crosses the latitude limit,
which would misalign an edge tile of a rotated page. fitsWorld checks all
four page corners instead. Raster layers can jog by up to a device pixel at
seams of a rotated page because MapLibre snaps them to whole world pixels
per map; this is documented rather than fixed.
The form gains a Rotation field, the preview map drag-rotates with a
compass and the two stay in sync, and the preview draws the page outline
alongside the bbox since the bbox corners can fall off a rotated page. The
e2e pages use a taller viewport so the longer form needs no scrolling,
which WebKit's checkbox click did not survive.
Closes #5
Stack created with GitHub Stacks CLI • Give Feedback 💬