Fixed changing between zoom/data functions.

This commit is contained in:
orangemug
2020-06-10 20:26:39 +01:00
parent c4b05b62b3
commit 09373dda44
3 changed files with 90 additions and 20 deletions
+14 -2
View File
@@ -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)}
/>