mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-26 17:50:38 +01:00
Added checkbox for cluster attribute (#810)
* Added additional checkbox to set the cluster attribute when adding a GeoJson source * Fixed default source function in the 'geojson_json' case --------- Co-authored-by: shimon <ruisuhsh100@gmail.com>
This commit is contained in:
parent
3727c9ad5e
commit
393f4a38b9
2 changed files with 27 additions and 13 deletions
|
@ -128,6 +128,7 @@ class AddSource extends React.Component {
|
||||||
}
|
}
|
||||||
case 'geojson_json': return {
|
case 'geojson_json': return {
|
||||||
type: 'geojson',
|
type: 'geojson',
|
||||||
|
cluster: source.cluster || false,
|
||||||
data: {}
|
data: {}
|
||||||
}
|
}
|
||||||
case 'tilejson_vector': return {
|
case 'tilejson_vector': return {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import FieldSelect from './FieldSelect'
|
||||||
import FieldDynamicArray from './FieldDynamicArray'
|
import FieldDynamicArray from './FieldDynamicArray'
|
||||||
import FieldArray from './FieldArray'
|
import FieldArray from './FieldArray'
|
||||||
import FieldJson from './FieldJson'
|
import FieldJson from './FieldJson'
|
||||||
|
import FieldCheckbox from './FieldCheckbox'
|
||||||
|
|
||||||
|
|
||||||
class TileJSONSourceEditor extends React.Component {
|
class TileJSONSourceEditor extends React.Component {
|
||||||
|
@ -80,7 +81,7 @@ class TileURLSourceEditor extends React.Component {
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,23 +206,35 @@ class GeoJSONSourceFieldJsonEditor extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <Block label={"GeoJSON"} fieldSpec={latest.source_geojson.data}>
|
return <div>
|
||||||
<FieldJson
|
<Block label={"GeoJSON"} fieldSpec={latest.source_geojson.data}>
|
||||||
layer={this.props.source.data}
|
<FieldJson
|
||||||
maxHeight={200}
|
layer={this.props.source.data}
|
||||||
mode={{
|
maxHeight={200}
|
||||||
name: "javascript",
|
mode={{
|
||||||
json: true
|
name: "javascript",
|
||||||
}}
|
json: true
|
||||||
lint={true}
|
}}
|
||||||
onChange={data => {
|
lint={true}
|
||||||
|
onChange={data => {
|
||||||
|
this.props.onChange({
|
||||||
|
...this.props.source,
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Block>
|
||||||
|
<FieldCheckbox
|
||||||
|
label={'Cluster'}
|
||||||
|
value={this.props.source.cluster}
|
||||||
|
onChange={cluster => {
|
||||||
this.props.onChange({
|
this.props.onChange({
|
||||||
...this.props.source,
|
...this.props.source,
|
||||||
data,
|
cluster: cluster,
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Block>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue