Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can MapController._onWheel change non-smooth zoom to use transitionDuration 0? #1586

Closed
Jamie5 opened this issue Oct 7, 2021 · 2 comments
Closed
Labels

Comments

@Jamie5
Copy link
Contributor

Jamie5 commented Oct 7, 2021

Description

I believe before 53390c9#diff-f53fd0b612f6ac98e4426c8b523b49c5b28b497f6c474cf22dec791666ff8c46 the non-smooth zoom (the only one at that point) had transitionDuration 0.

The reason for this request (besides that it preserves the previous behavior): We override MapController._onWheel to debounce the requests, because otherwise, on Firefox, it seems like the amount of wheel events causes significant lag. (Presumably because some handling on our end ends up being rather slow, but let's ignore that).

In this override, we collect a number of calls, adjusting the total delta, and run it each animation frame.

When trying to upgrade from 5.2.12 to 5.3.17, we experience an issue where the map will appear to zoom in and out in zigzag fashion even if the user is only zooming in with their trackpad. This seems to be (but not really sure) due to a zoom not completing before the next zoom happens, or something like that. However, changing the non-smooth transitionDuration to 0 will avoid this zig-zag motion, presumably because the zoom happens immediately and finishes before the next event comes in to be processed.

NOTE: It seems like we also have to, in the non-smooth case, eventually call the old _onWheelEnd as per

// Wheel events are discrete, let's wait a little before resetting isZooming
this._onWheelEnd();
return true;
}
_onWheelEnd() {
this.setState({isZooming: false});
}
(which would now reset panning as well)

Repro Steps

See above

Environment (please complete the following information):

  • Library Version: 5.3.17
  • Mapbox Version: 2.3.0 (but has been observed on others)
  • React Version: [e.g. react 17.0.1]
  • Browser Version: Firefox 93.0, Chrome recent
  • OS: [e.g. Mac OS X 11.2]

Logs

@Jamie5 Jamie5 added the bug label Oct 7, 2021
@underfisk
Copy link

I've run into the same issue where from 5.2.11 upgrading to 5.3.0 introduces a shifting when zooming in/out and not working as intended

@Pessimistress
Copy link
Collaborator

MapController is being abandoned in v7.0. Please follow #1646

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants