-
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
fix missing repeats of CanvasSource when it crosses the antimeridian #7273
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.
awesomeeee! thanks @ansis
let's get this backported into release-frappe
as well 🎉
This is probably a major edge case, but I noticed this behavior while randomly playing around with the map. In fact, it happens on In normal usage, this PR seems to work like a charm. |
@ryanhamley good catch, a54e774 adds a fix for that as well |
const utl = this.pointCoordinate(new Point(0, 0), 0); | ||
const utr = this.pointCoordinate(new Point(this.width, 0), 0); | ||
const ubl = this.pointCoordinate(new Point(this.width, this.height), 0); | ||
const ubr = this.pointCoordinate(new Point(0, this.height), 0); |
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.
Can you explain how this fixes the rotation issue, @ansis?
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.
Using all four corners is necessary since the leftmost/rightmost points could be any of the corners. The following two lines with the Math.min and Math.max handle the case when the map is upside down
This fixes #7271 by including an extra copy of image sources and canvas sources on either side of the world. In almost all cases this extra copy is necessary, but it shouldn't add any overhead because rendering two offscreen triangles should be negligible.
It might be slightly nicer to have an approach that actually calculates how many copies we need to render but I think this would be significantly more complex and probably slower.
Launch Checklist
@mapbox/studio
and/or@mapbox/maps-design
if this PR includes style spec changes