mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-02 22:48:09 +01:00
Assigning default function type from spec
This commit is contained in:
parent
d502d9b1bb
commit
d32b15d425
1 changed files with 13 additions and 0 deletions
|
@ -89,6 +89,16 @@ export default class FunctionSpecProperty extends React.Component {
|
||||||
this.props.onChange(this.props.fieldName, zoomFunc)
|
this.props.onChange(this.props.fieldName, zoomFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFieldFunctionType(fieldSpec) {
|
||||||
|
if (fieldSpec.function === "interpolated") {
|
||||||
|
return "exponential"
|
||||||
|
}
|
||||||
|
if (fieldSpec.type === "number") {
|
||||||
|
return "interval"
|
||||||
|
}
|
||||||
|
return "categorical"
|
||||||
|
}
|
||||||
|
|
||||||
getDataFunctionTypes(functionType) {
|
getDataFunctionTypes(functionType) {
|
||||||
if (functionType === "interpolated") {
|
if (functionType === "interpolated") {
|
||||||
return ["categorical", "interval", "exponential"]
|
return ["categorical", "interval", "exponential"]
|
||||||
|
@ -131,6 +141,9 @@ export default class FunctionSpecProperty extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderDataProperty() {
|
renderDataProperty() {
|
||||||
|
if (typeof this.props.value.type === "undefined") {
|
||||||
|
this.props.value.type = this.getFieldFunctionType(this.props.fieldSpec)
|
||||||
|
}
|
||||||
const dataFields = this.props.value.stops.map((stop, idx) => {
|
const dataFields = this.props.value.stops.map((stop, idx) => {
|
||||||
const zoomLevel = stop[0].zoom
|
const zoomLevel = stop[0].zoom
|
||||||
const dataLevel = stop[0].value
|
const dataLevel = stop[0].value
|
||||||
|
|
Loading…
Reference in a new issue