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 image expression #9668

Merged
merged 3 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
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