mirror of
https://github.com/maputnik/editor.git
synced 2026-08-25 06:27:25 +00:00
Fixed changing between zoom/data functions.
This commit is contained in:
@@ -91,7 +91,7 @@ export default class DataProperty extends React.Component {
|
||||
|
||||
getDataFunctionTypes(fieldSpec) {
|
||||
if (fieldSpec.expression.interpolated) {
|
||||
return ["categorical", "interval", "exponential", "identity"]
|
||||
return ["interpolate", "categorical", "interval", "exponential", "identity"]
|
||||
}
|
||||
else {
|
||||
return ["categorical", "interval", "identity"]
|
||||
@@ -167,6 +167,18 @@ export default class DataProperty extends React.Component {
|
||||
this.onChange(this.props.fieldName, changedValue)
|
||||
}
|
||||
|
||||
changeDataType(propVal) {
|
||||
if (propVal === "interpolate") {
|
||||
this.props.onChangeToZoomFunction();
|
||||
}
|
||||
else {
|
||||
this.onChange(this.props.fieldName, {
|
||||
...this.props.value,
|
||||
type: propVal,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
changeDataProperty(propName, propVal) {
|
||||
if (propVal) {
|
||||
this.props.value[propName] = propVal
|
||||
@@ -284,7 +296,7 @@ export default class DataProperty extends React.Component {
|
||||
<div className="maputnik-data-spec-property-input">
|
||||
<InputSelect
|
||||
value={this.props.value.type}
|
||||
onChange={propVal => this.changeDataProperty("type", propVal)}
|
||||
onChange={propVal => this.changeDataType(propVal)}
|
||||
title={"Select a type of data scale (default is 'categorical')."}
|
||||
options={this.getDataFunctionTypes(this.props.fieldSpec)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user