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

Review nits: set an interim paint in style_layer #9688

Merged
merged 4 commits into from
May 14, 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
2 changes: 1 addition & 1 deletion src/source/tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class Tile {

bucket.update(sourceLayerStates, sourceLayer, this.imageAtlas && this.imageAtlas.patternPositions || {});
const layer = painter && painter.style && painter.style.getLayer(id);
if (layer && layer.paint) {
if (layer) {
this.queryPadding = Math.max(this.queryPadding, layer.queryRadius(bucket));
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/style/style_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
emitValidationErrors
} from './validate_style';
import {Evented} from '../util/evented';
import {Layout, Transitionable, Transitioning, Properties, PossiblyEvaluatedPropertyValue} from './properties';
import {Layout, Transitionable, Transitioning, Properties, PossiblyEvaluated, PossiblyEvaluatedPropertyValue} from './properties';
import {supportsPropertyExpression} from '../style-spec/util/properties';

import type {FeatureState} from '../style-spec/expression';
Expand Down Expand Up @@ -100,6 +100,8 @@ class StyleLayer extends Evented {
}

this._transitioningPaint = this._transitionablePaint.untransitioned();
//$FlowFixMe
this.paint = new PossiblyEvaluated(properties.paint);
}
}

Expand Down
7 changes: 7 additions & 0 deletions test/unit/style/style_layer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,5 +403,12 @@ test('StyleLayer#serialize', (t) => {
t.end();
});

t.test('layer.paint is never undefined', (t) => {
const layer = createStyleLayer({type: 'fill'});
// paint is never undefined
t.ok(layer.paint);
t.end();
});

t.end();
});