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

Shift+Zoom only zoom 1 level by 1 level under Windows #3334

Closed
Pipoupi opened this issue Oct 10, 2016 · 14 comments
Closed

Shift+Zoom only zoom 1 level by 1 level under Windows #3334

Pipoupi opened this issue Oct 10, 2016 · 14 comments

Comments

@Pipoupi
Copy link

Pipoupi commented Oct 10, 2016

Steps to Trigger Behavior

  1. Go to https://www.mapbox.com/mapbox-gl-js/examples/
  2. Try to Shift Zoom

Expected Behavior

Should high zoom to the selected area

Actual Behavior

Zoom 1 level by 1 level

EDIT : Actually the shift-zoom works the 2nd time you shift-zoom

@mourner
Copy link
Member

mourner commented Oct 10, 2016

I can't reproduce — shift-zoom works as expected the first time and all subsequent ones.

Can you reproduce consistently? What browser/OS are you using?

@Pipoupi
Copy link
Author

Pipoupi commented Oct 10, 2016

Well I can't reproduce it either... I close the issue & re-open if it happens again

@Pipoupi Pipoupi closed this as completed Oct 10, 2016
@blq
Copy link

blq commented Nov 15, 2016

I can reproduce this in 0.27.0 - in the examples page. In my own test with a fullscreen div it works.
Maybe it's simply something odd with the example page?
Chrome 54 & Firefox 49, Windows 10.

@lucaswoj
Copy link
Contributor

I am unable to reproduce this on my machine (OSX + Chrome 54)

@blq
Copy link

blq commented Nov 29, 2016

I think I got it now!
If you hold down shift key + mouse button and drag the rectangle and keep the shift button pressed after releasing the mouse button it fails. Releasing shift before mouse button and it works.

@jfirebaugh
Copy link
Contributor

I don't see any difference between keeping shift pressed or not. Both behave as expected.

@Pipoupi
Copy link
Author

Pipoupi commented Dec 21, 2016

I can confirm though. Without releasing shift, I've got the bug. Sometimes nothing happens, sometimes it zooms for one level.
I'm on Windows 10 & Chrome Version 55.0.2883.87

@mourner
Copy link
Member

mourner commented Jan 12, 2017

Got another report of this in #3961. The common theme among all reported instances here seems to be Windows, although I'm quite puzzled why this can happen. Anyone with a Windows machine that can debug this further?

@mourner mourner changed the title Shift+Zoom only zoom 1 level by 1 level Shift+Zoom only zoom 1 level by 1 level under Windows Jan 12, 2017
@jasonpepper
Copy link
Contributor

The problem is that, when the shift key is down, the KeyboardHandler._onKeyDown() method is being called repeatedly which calls the easeTo() method each time. This interferes with the call to easeTo() by the BoxZoomHandler.

To fix this all you need to do is put a return statement in the default case in the KeyboardHandler._onKeyDown() switch statement, so that it doesn't call easeTo() unless one of the zoom/pan keys is pressed.

@lucaswoj
Copy link
Contributor

Thanks for the diagnosis Jason! Would you mind putting together a PR? I can make the change you describe but would be unable to verify that it fixes the problem.

@jasonpepper
Copy link
Contributor

Sure, but I'm not sure how to create a PR.

@jasonpepper
Copy link
Contributor

I made the code change and am ready to push my branch, but I don't seem to have access rights.

@mollymerp
Copy link
Contributor

@x9xjdzz9 I think you'll need to make a personal fork and then use that to make your PR. thanks for working on this!

@mourner
Copy link
Member

mourner commented Apr 18, 2017

This was fixed by #4533

@mourner mourner closed this as completed Apr 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants