-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
map#isMoving #3068
map#isMoving #3068
Conversation
this.rotating || | ||
this.pitching || | ||
this.dragPan._active || | ||
this.dragRotate._active) return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting that we need to mix the "interaction handler" layer of abstraction the "camera" layer of abstraction to compute Map#isMoving
. Should Map#isMoving
return true
if the user starts a "drag rotate" interaction but doesn't actually rotate the map? Or if the user starts a "drag pan" interaction but doesn't pan the map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good questions! I'm not familiar enough with these interactions enough to know the differences. The only way I was able to capture "pan" and "rotate" actions was through those dragPan
and dragRotate
parameters, though. Are there other places to look for them?
Should Map#isMoving return true if the user starts a "drag rotate" interaction but doesn't actually rotate the map?
I'm not sure - any chance you could provide a case where this happens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only way I was able to capture "pan" and "rotate" actions was through those
dragPan
anddragRotate
parameters, though. Are there other places to look for them?
We may need to create the place to look for this state by
- creating
map.panning
property - ensuring that
map.rotating
andmap.rotating
works with thedragRotate
handler
I'm not sure - any chance you could provide a case where this happens?
Imagine I click and drag the map by 5 pixels, initiating a "drag pan" gesture, put a rock on my mouse button, and go for lunch. Map#isMoving
will be true
the whole time I'm gone but the map won't be moving. Is that the behaviour we want? I'm not sure. It deserves some discussion.
Using The default duration of Perhaps the |
@lucaswoj just added Since I also moved the Next up, tests! |
Let's define a "moving" map as a map whose center coordinate, bearing, zoom, or pitch is expected to be different in the next frame. Whether or not we "expect" these parameters to be different on the next frame during an interaction is an open question. The word "easing" feels overloaded:
Let's think carefully about how we're using these words and how we can refactor to make their use more clear :-) #2801 To answer your original question:
Looks like this would work 👍 |
Sure thing @lucaswoj. Since we already have the Since all of the potential "movements" have their own |
@lucaswoj I've added a test that checks if the map is moving before, during, and after a |
Closing this. I've got a better grasp on the camera movement, and think this can be better implemented once #3583 lands. |
Adds a method
Map#isMoving
that checks for the states ofthis.zooming
,this.rotating
,this.pitching
,map.dragPan._active
, andmap.dragRotate._active
. If any of them istrue
, the map is considered "moving" and the method returnstrue
.refs: #2792
TODO
But not having any luck with it so far.
cc @mollymerp @jfirebaugh