Skip to content

Commit

Permalink
Fix image expression (#9668)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Hamley authored May 13, 2020
1 parent fb6d18d commit 498a96b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/source/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ export default class Worker {

setImages(mapId: string, images: Array<string>, 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();
}

Expand Down
1 change: 1 addition & 0 deletions src/source/worker_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export type WorkerDEMTileCallback = (err: ?Error, result: ?DEMData) => void;
* @param layerIndex
*/
export interface WorkerSource {
availableImages: Array<string>,
// Disabled due to https://github.com/facebook/flow/issues/5208
// constructor(actor: Actor, layerIndex: StyleLayerIndex): WorkerSource;

Expand Down
8 changes: 4 additions & 4 deletions src/style/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ export class Transitioning<Props: Object> {
this._values = (Object.create(properties.defaultTransitioningPropertyValues): any);
}

possiblyEvaluate(parameters: EvaluationParameters, availableImages?: Array<string>): PossiblyEvaluated<Props> {
possiblyEvaluate(parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array<string>): PossiblyEvaluated<Props> {
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;
}
Expand Down Expand Up @@ -385,10 +385,10 @@ export class Layout<Props: Object> {
return result;
}

possiblyEvaluate(parameters: EvaluationParameters, availableImages?: Array<string>): PossiblyEvaluated<Props> {
possiblyEvaluate(parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array<string>): PossiblyEvaluated<Props> {
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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/style/style_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, undefined, availableImages);
}

(this: any).paint = this._transitioningPaint.possiblyEvaluate(parameters, availableImages);
(this: any).paint = this._transitioningPaint.possiblyEvaluate(parameters, undefined, availableImages);
}

serialize() {
Expand Down

0 comments on commit 498a96b

Please sign in to comment.