Skip to content
Closed
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
10 changes: 9 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 @@ -90,6 +90,7 @@ class StyleLayer extends Evented {
}

if (properties.paint) {

this._transitionablePaint = new Transitionable(properties.paint);

for (const property in layer.paint) {
Expand All @@ -101,6 +102,13 @@ class StyleLayer extends Evented {

this._transitioningPaint = this._transitionablePaint.untransitioned();
}

if (properties.paint) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: you can remove this if because there's the same condition above.

// init default paint to cover until recalculate is called
// see https://github.com/mapbox/ibm-cognos-collab/issues/154
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this is not a public issue so it shoudn't be included.

// also flow needs a separate undefined check??
this.paint = new PossiblyEvaluated(properties.paint);
}
}

getCrossfadeParameters() {
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();
});