From cab025020e02dda852eea8478bf7ff4a6e77320e Mon Sep 17 00:00:00 2001 From: Jordi Torres Date: Mon, 29 May 2023 13:47:58 +0200 Subject: [PATCH] Fixes constant tile reparse causing flickering and handles http 204 responses (internal-571) --- 3d-style/source/tiled_3d_model_source.js | 8 +++++++- src/util/ajax.js | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/3d-style/source/tiled_3d_model_source.js b/3d-style/source/tiled_3d_model_source.js index f296522c5a1..460e7b28b72 100644 --- a/3d-style/source/tiled_3d_model_source.js +++ b/3d-style/source/tiled_3d_model_source.js @@ -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'; @@ -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); @@ -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; } diff --git a/src/util/ajax.js b/src/util/ajax.js index 6685790b0ca..97b33d01623 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -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));