Added additional checkbox to set the cluster attribute when adding a GeoJson source

This commit is contained in:
shimon
2023-06-10 15:46:43 +03:00
parent 2ff3d08bb0
commit d9b1e7e97c
2 changed files with 28 additions and 14 deletions
+2 -1
View File
@@ -128,7 +128,8 @@ class AddSource extends React.Component {
}
case 'geojson_json': return {
type: 'geojson',
data: {}
data: {},
cluster: false
}
case 'tilejson_vector': return {
type: 'vector',
+14 -1
View File
@@ -8,6 +8,7 @@ import FieldSelect from './FieldSelect'
import FieldDynamicArray from './FieldDynamicArray'
import FieldArray from './FieldArray'
import FieldJson from './FieldJson'
import FieldCheckbox from './FieldCheckbox'
class TileJSONSourceEditor extends React.Component {
@@ -205,7 +206,8 @@ class GeoJSONSourceFieldJsonEditor extends React.Component {
}
render() {
return <Block label={"GeoJSON"} fieldSpec={latest.source_geojson.data}>
return <div>
<Block label={"GeoJSON"} fieldSpec={latest.source_geojson.data}>
<FieldJson
layer={this.props.source.data}
maxHeight={200}
@@ -222,6 +224,17 @@ class GeoJSONSourceFieldJsonEditor extends React.Component {
}}
/>
</Block>
<FieldCheckbox
label={'Cluster'}
value={this.props.source.cluster}
onChange={cluster => {
this.props.onChange({
...this.props.source,
cluster: cluster,
})
}}
/>
</div>
}
}