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

fix missing repeats of CanvasSource when it crosses the antimeridian #7273

Merged
merged 3 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/geo/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,12 @@ class Transform {
const w1 = Math.floor(ur.column);
const result = [new UnwrappedTileID(0, tileID)];
if (this._renderWorldCopies) {
for (let w = w0; w <= w1; w++) {
// Add an extra copy of the world on each side to properly render ImageSources and CanvasSources.
// Both sources draw outside the tile boundaries of the tile that "contains them" so we need
// to add extra copies on both sides in case offscreen tiles need to draw into on-screen ones.
const extraWorldCopy = 1;

for (let w = w0 - extraWorldCopy; w <= w1 + extraWorldCopy; w++) {
if (w === 0) continue;
result.push(new UnwrappedTileID(w, tileID));
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"version": 8,
"metadata": {
"test": {
"width": 512,
"height": 64
}
},
"center": [
-10,
0
],
"zoom": 0,
"sources": {
"image": {
"type": "image",
"coordinates": [
[
-270,
-80
],
[
90,
-80
],
[
90,
80
],
[
-270,
80
]
],
"url": "local://image/0.png"
}
},
"layers": [
{
"id": "image",
"type": "raster",
"source": "image",
"paint": {
"raster-fade-duration": 0
}
}
]
}
2 changes: 1 addition & 1 deletion test/unit/geo/transform.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ test('transform', (t) => {
transform.center = { lng: -170.01, lat: 0.01 };

let unwrappedCoords = transform.getVisibleUnwrappedCoordinates(new CanonicalTileID(0, 0, 0));
t.equal(unwrappedCoords.length, 2);
t.equal(unwrappedCoords.length, 4);

//getVisibleUnwrappedCoordinates should honor _renderWorldCopies
transform._renderWorldCopies = false;
Expand Down