From 81abe9cee39ae03a4792009aa2fac7facdd2c096 Mon Sep 17 00:00:00 2001 From: ryanhamley Date: Thu, 7 May 2020 18:08:17 -0700 Subject: [PATCH 1/3] Add missing argument for transitioning and layout expression evaluation --- src/style/properties.js | 8 ++++---- src/style/style_layer.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/style/properties.js b/src/style/properties.js index 1f6f971ec0f..57829f85bdf 100644 --- a/src/style/properties.js +++ b/src/style/properties.js @@ -317,10 +317,10 @@ export class Transitioning { this._values = (Object.create(properties.defaultTransitioningPropertyValues): any); } - possiblyEvaluate(parameters: EvaluationParameters, availableImages?: Array): PossiblyEvaluated { + possiblyEvaluate(parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array): PossiblyEvaluated { const result = new PossiblyEvaluated(this._properties); // eslint-disable-line no-use-before-define for (const property of Object.keys(this._values)) { - result._values[property] = this._values[property].possiblyEvaluate(parameters, availableImages); + result._values[property] = this._values[property].possiblyEvaluate(parameters, canonical, availableImages); } return result; } @@ -385,10 +385,10 @@ export class Layout { return result; } - possiblyEvaluate(parameters: EvaluationParameters, availableImages?: Array): PossiblyEvaluated { + possiblyEvaluate(parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array): PossiblyEvaluated { const result = new PossiblyEvaluated(this._properties); // eslint-disable-line no-use-before-define for (const property of Object.keys(this._values)) { - result._values[property] = this._values[property].possiblyEvaluate(parameters, availableImages); + result._values[property] = this._values[property].possiblyEvaluate(parameters, canonical, availableImages); } return result; } diff --git a/src/style/style_layer.js b/src/style/style_layer.js index 82c3f68df4d..f096b9ba7ad 100644 --- a/src/style/style_layer.js +++ b/src/style/style_layer.js @@ -199,10 +199,10 @@ class StyleLayer extends Evented { } if (this._unevaluatedLayout) { - (this: any).layout = this._unevaluatedLayout.possiblyEvaluate(parameters, availableImages); + (this: any).layout = this._unevaluatedLayout.possiblyEvaluate(parameters, null, availableImages); } - (this: any).paint = this._transitioningPaint.possiblyEvaluate(parameters, availableImages); + (this: any).paint = this._transitioningPaint.possiblyEvaluate(parameters, null, availableImages); } serialize() { From ceebac432e1937d28ebaa4ba5033977679fa892d Mon Sep 17 00:00:00 2001 From: ryanhamley Date: Thu, 7 May 2020 18:08:47 -0700 Subject: [PATCH 2/3] Update available images in workers --- src/source/worker.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/source/worker.js b/src/source/worker.js index ab6827e3afc..27a10fa3a54 100644 --- a/src/source/worker.js +++ b/src/source/worker.js @@ -77,6 +77,12 @@ export default class Worker { setImages(mapId: string, images: Array, callback: WorkerTileCallback) { this.availableImages[mapId] = images; + for (const workerSource in this.workerSources[mapId]) { + const ws = this.workerSources[mapId][workerSource]; + for (const source in ws) { + ws[source].availableImages = images; + } + } callback(); } From cd8c0f5dd1a2d6af48cb9760396bbf44ad6d44ef Mon Sep 17 00:00:00 2001 From: ryanhamley Date: Mon, 11 May 2020 14:43:28 -0700 Subject: [PATCH 3/3] Fix Flow issues --- src/source/worker_source.js | 1 + src/style/style_layer.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/source/worker_source.js b/src/source/worker_source.js index 7acc8140728..c800049e3b3 100644 --- a/src/source/worker_source.js +++ b/src/source/worker_source.js @@ -71,6 +71,7 @@ export type WorkerDEMTileCallback = (err: ?Error, result: ?DEMData) => void; * @param layerIndex */ export interface WorkerSource { + availableImages: Array, // Disabled due to https://github.com/facebook/flow/issues/5208 // constructor(actor: Actor, layerIndex: StyleLayerIndex): WorkerSource; diff --git a/src/style/style_layer.js b/src/style/style_layer.js index f096b9ba7ad..ce06dcb9ace 100644 --- a/src/style/style_layer.js +++ b/src/style/style_layer.js @@ -199,10 +199,10 @@ class StyleLayer extends Evented { } if (this._unevaluatedLayout) { - (this: any).layout = this._unevaluatedLayout.possiblyEvaluate(parameters, null, availableImages); + (this: any).layout = this._unevaluatedLayout.possiblyEvaluate(parameters, undefined, availableImages); } - (this: any).paint = this._transitioningPaint.possiblyEvaluate(parameters, null, availableImages); + (this: any).paint = this._transitioningPaint.possiblyEvaluate(parameters, undefined, availableImages); } serialize() {