Skip to content

Apply paddings by shifting the camera centre - #31

Merged
wf9a5m75 merged 1 commit into
developfrom
fix/padding-emulation
Nov 12, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
fix/padding-emulation

Conversation

@wf9a5m75

Copy link
Copy Markdown
Contributor

Summary

Apply MapCameraPosition.paddings by shifting the camera centre (core padding emulation with the provider's fov) instead of the engine's own padding, which is now always reset to zero.

The engine's padding widens the frustum toward the top. Under tilt, a large top padding pushed the top edge past the horizon and the engine loaded tiles out to it: on the web playground's editor layout (map ~350 px high, top padding ~500 px) frames went to 130–200 ms with stalls of several seconds. Shifting the centre puts the target at the padded-area centre with the same frustum as without padding.

Reading the camera back undoes the shift and reports the requested paddings. Initial-camera paddings are applied by the first move.

Verification

Tilt 0 and 60, top padding 300 and larger than the map: the target lands at the padded centre (within ~1 px when on screen), read-back ≈ target, frame times the same as without padding.

Commits

  • Emulate camera paddings by shifting the centre

Native padding widens the frustum upward. Under tilt a large top padding reaches past the horizon: the engine loads tiles out to it and stalls, and MapLibre also lowers the pitch (60 -> 55.4 deg) and clamps the padding. The target is now placed at the padded centre by moving the camera centre with CameraPaddingEmulation and the provider's fov; native padding is always zero. Read-back undoes the shift, and padding on the initial camera is applied once the map has a size.
@wf9a5m75
wf9a5m75 merged commit b3261aa into develop Nov 12, 2026
2 checks passed
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.

1 participant