Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Contextmenu events not blocked by scrolling ([#5683](https://github.com/maplibre/maplibre-gl-js/issues/5683)
- Mousemove events are not blocked by scrolling ([#6302](https://github.com/maplibre/maplibre-gl-js/issues/6302))
- Dashed lines have blurry rounded caps ([#6554](https://github.com/maplibre/maplibre-gl-js/pull/6554))
- Preserve flyTo padding when prefers-reduced-motion is enabled ([#6576](https://github.com/maplibre/maplibre-gl-js/issues/6576))
- Fix setClusterOptions not triggering recluster when no data changes are pending ([#6603](https://github.com/maplibre/maplibre-gl-js/pull/6603))

## 5.9.0
Expand Down
11 changes: 10 additions & 1 deletion src/ui/camera.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ describe('easeTo', () => {
stubNow.mockImplementation(() => 0);

camera.easeTo({bearing: 97, duration: 500});

stubNow.mockImplementation(() => 100);
camera.simulateFrame();

Expand Down Expand Up @@ -2030,6 +2030,15 @@ describe('flyTo', () => {
expect(timeDiff >= 0 && timeDiff < 10).toBeTruthy();
});

test('applies the padding option when prefers-reduce-motion:reduce is set', async () => {
const camera = createCamera();
Object.defineProperty(browser, 'prefersReducedMotion', {value: true});

camera.flyTo({padding: {top: 50, right: 30}});

expect(camera.getPadding()).toEqual({top: 50, bottom: 0, left: 0, right: 30});
});

test('check elevation events freezeElevation=false', async () => {
const camera = createCamera();
const stub = vi.spyOn(timeControl, 'now');
Expand Down
2 changes: 1 addition & 1 deletion src/ui/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ export abstract class Camera extends Evented {
flyTo(options: FlyToOptions, eventData?: any): this {
// Fall through to jumpTo if user has set prefers-reduced-motion
if (!options.essential && browser.prefersReducedMotion) {
const coercedOptions = pick(options, ['center', 'zoom', 'bearing', 'pitch', 'roll', 'elevation']) as CameraOptions;
const coercedOptions = pick(options, ['center', 'zoom', 'bearing', 'pitch', 'roll', 'elevation', 'padding']) as JumpToOptions;
return this.jumpTo(coercedOptions, eventData);
}

Expand Down