During a flyTo, the zoom level changes out of its boundaries.
@mourner is already working on this.
Since Sep 24, 2018.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
mapbox-gl-js version: 0.49
browser: Chrome 69.0.3497.100
Steps to Trigger Behavior
Add this test case to the unit test camera.test.js:
t.test('Zoom out with animation without over out-zooming', (t) => {
const pos = { lng: 0, lat: 0 };
const startZoom = 19;
const endZoom = 18;
const camera = createCamera({zoom: startZoom, center: pos});
const stub = t.stub(browser, 'now');
stub.callsFake(() => 0);
camera.flyTo({ zoom: endZoom, center: pos, duration: 1000 });
stub.callsFake(() => 999);
camera.simulateFrame();
t.ok(camera.getZoom() >= endZoom && camera.getZoom() < startZoom);
t.end();
});
Almost at the end of the flight, the zoom level is equal to 17.4, much lower than 18.
Expected Behavior
The zoom level does not go below the final zoom level during the flight.
Actual Behavior
The zoom level goes below the final zoom level during the flight, but it gets corrected instantly at the end of the flight. This produces a strange effect from the user
Note that changing the initial and final zoom level (e.g. 20 -> 19) may not show the problem.
I tried to look a the code the compute the easing function parameter, but without any luck (the computations are beyond my knowledge :-) )
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.