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

Handle NaN as input to step and interpolate expressions #5757

Merged
merged 1 commit into from
Nov 28, 2017
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
4 changes: 4 additions & 0 deletions src/style-spec/expression/stops.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// @flow

const RuntimeError = require('./runtime_error');

import type { Expression } from './expression';

export type Stops = Array<[number, Expression]>;
Expand All @@ -25,6 +27,8 @@ function findStopLessThanOrEqualTo(stops: Array<number>, input: number) {
lowerIndex = currentIndex + 1;
} else if (currentValue > input) {
upperIndex = currentIndex - 1;
} else {
throw new RuntimeError('Input is not a number.');
}
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"version": 8,
"metadata": {
"test": {
"height": 64,
"width": 64
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"zero": 0
},
"geometry": {
"type": "Point",
"coordinates": [
0,
0
]
}
}
]
}
}
},
"layers": [
{
"id": "baseline",
"type": "circle",
"source": "geojson",
"paint": {
"circle-radius": 5,
"circle-translate": [-5, 0]
}
},
{
"id": "interpolate",
"type": "circle",
"source": "geojson",
"paint": {
"circle-radius": ["interpolate", ["linear"], ["/", 0, ["get", "zero"]], 1, 1, 2, 2],
"circle-translate": [0, 0]
}
},
{
"id": "step",
"type": "circle",
"source": "geojson",
"paint": {
"circle-radius": ["step", ["/", 0, ["get", "zero"]], 1, 2, 2],
"circle-translate": [5, 0]
}
}
]
}