-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
make flyTo check if it can fly to worldCopies #4459
Conversation
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.
Thank you for contributing @huaruiwu.
I manually tested the debug page (yarn start
) and can confirm this fixes the linked issue!
There is still an issue where calling map.flyTo({center:[lng greater than 180, lat]})
will cause the map to fly to an unrendered world.
@jfirebaugh @lucaswoj do you think we should normalize all calls to flyTo in unrendered worlds, or fire a warning of some sort?
@mollymerp With the changes I've proposed in #4451 calling |
@huaruiwu when |
@andrewharvey great thank you! #4451 takes care of my earlier comment. @huaruiwu sorry I missed your comment about the debug page - the default is |
@mollymerp @andrewharvey Thanks! It does say |
@mollymerp @huaruiwu I made some changes to #4451 to deal with a false I think this circles back to your original question @mollymerp. What should the expected behaviour be here? I don't think it blocks this PR since it's a separate issue. I'm leaning towards leaving it as is, flyingTo to the white space. API users can always wrap their input to flyTo to prevent this. Leaving as is means that a box zoom outside the main world zooms in to that white area which I think is best. |
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.
Thanks @huaruiwu. Just a couple of code quality issues to take care of.
test/unit/ui/camera.test.js
Outdated
@@ -1011,6 +1011,46 @@ test('camera', (t) => { | |||
camera.flyTo({ center: [170, 0], duration: 10 }); | |||
}); | |||
|
|||
t.test('does not pan eastward across the antimeridian if no world copies', (t) => { | |||
const camera = createCamera(); | |||
camera.transform._renderWorldCopies = false; |
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.
Please adjust the test so that it sets this option via the public API (an argument to the Transform
constructor) rather than a private property.
src/ui/camera.js
Outdated
@@ -667,7 +667,7 @@ class Camera extends Evented { | |||
|
|||
// If a path crossing the antimeridian would be shorter, extend the final coordinate so that | |||
// interpolating between the two endpoints will cross it. | |||
if (Math.abs(tr.center.lng) + Math.abs(center.lng) > 180) { | |||
if (tr._renderWorldCopies && Math.abs(tr.center.lng) + Math.abs(center.lng) > 180) { |
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.
Please create a public renderWorldCopies
getter on Transform
rather than using an underscored (private) property.
@jfirebaugh Thanks for the review! updated |
a9720a9
to
a6a2b1b
Compare
@jfirebaugh thanks for the merge |
Launch Checklist
Issue is described here: #4449.
For some reason I just get a
Not Found
when I try the debug page.