Skip to content

Commit

Permalink
Fixes constant tile reparse causing flickering and handles http 204 r…
Browse files Browse the repository at this point in the history
…esponses (internal-571)
  • Loading branch information
jtorresfabra authored and mourner committed Aug 7, 2023
1 parent 9118f5d commit cab0250
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 3d-style/source/tiled_3d_model_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import loadTileJSON from '../../src/source/load_tilejson.js';
import TileBounds from '../../src/source/tile_bounds.js';
import {extend} from '../../src/util/util.js';
import {postTurnstileEvent} from '../../src/util/mapbox.js';
import type {OverscaledTileID} from '../../src/source/tile_id.js';

class Tiled3DModelSource extends Evented implements Source {
type: 'batched-model';
Expand Down Expand Up @@ -49,7 +50,7 @@ class Tiled3DModelSource extends Evented implements Source {
this.roundZoom = true;
this.usedInConflation = true;
this.dispatcher = dispatcher;
this.reparseOverscaled = true;
this.reparseOverscaled = false;
this.scheme = 'xyz';
this._loaded = false;
this.setEventedParent(eventedParent);
Expand Down Expand Up @@ -93,6 +94,11 @@ class Tiled3DModelSource extends Evented implements Source {
return false;
}

// $FlowFixMe[method-unbinding]
hasTile(tileID: OverscaledTileID): boolean {
return !this.tileBounds || this.tileBounds.contains(tileID.canonical);
}

loaded(): boolean {
return this._loaded;
}
Expand Down
1 change: 1 addition & 0 deletions src/util/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ function makeFetchRequest(requestParameters: RequestParameters, callback: Respon
cachePut(request, cacheableResponse, requestTime);
}
complete = true;
if (response.status === 204) return; // No content
callback(null, result, response.headers.get('Cache-Control'), response.headers.get('Expires'));
}).catch(err => {
if (!aborted) callback(new Error(err.message));
Expand Down

0 comments on commit cab0250

Please sign in to comment.