mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-30 22:50:32 +01:00
Added support for root level properties
- center - zoom - bearing - pitch
This commit is contained in:
parent
92ee50a4a4
commit
1f77e156e6
1 changed files with 40 additions and 1 deletions
|
@ -3,6 +3,8 @@ import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import InputBlock from '../inputs/InputBlock'
|
import InputBlock from '../inputs/InputBlock'
|
||||||
|
import ArrayInput from '../inputs/ArrayInput'
|
||||||
|
import NumberInput from '../inputs/NumberInput'
|
||||||
import StringInput from '../inputs/StringInput'
|
import StringInput from '../inputs/StringInput'
|
||||||
import SelectInput from '../inputs/SelectInput'
|
import SelectInput from '../inputs/SelectInput'
|
||||||
import Modal from './Modal'
|
import Modal from './Modal'
|
||||||
|
@ -26,7 +28,7 @@ class SettingsModal extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const metadata = this.props.mapStyle.metadata || {}
|
const metadata = this.props.mapStyle.metadata || {}
|
||||||
const {onChangeMetadataProperty} = this.props;
|
const {onChangeMetadataProperty, mapStyle} = this.props;
|
||||||
const inputProps = { }
|
const inputProps = { }
|
||||||
return <Modal
|
return <Modal
|
||||||
data-wd-key="modal-settings"
|
data-wd-key="modal-settings"
|
||||||
|
@ -101,6 +103,43 @@ class SettingsModal extends React.Component {
|
||||||
/>
|
/>
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
|
|
||||||
|
<InputBlock label={"Center"} doc={latest.$root.center.doc}>
|
||||||
|
<ArrayInput
|
||||||
|
length={2}
|
||||||
|
type="number"
|
||||||
|
value={mapStyle.center}
|
||||||
|
default={latest.$root.center.default || [0, 0]}
|
||||||
|
onChange={this.changeStyleProperty.bind(this, "center")}
|
||||||
|
/>
|
||||||
|
</InputBlock>
|
||||||
|
|
||||||
|
<InputBlock label={"Zoom"} doc={latest.$root.zoom.doc}>
|
||||||
|
<NumberInput
|
||||||
|
{...inputProps}
|
||||||
|
value={mapStyle.zoom}
|
||||||
|
default={latest.$root.zoom.default || 0}
|
||||||
|
onChange={this.changeStyleProperty.bind(this, "zoom")}
|
||||||
|
/>
|
||||||
|
</InputBlock>
|
||||||
|
|
||||||
|
<InputBlock label={"Bearing"} doc={latest.$root.bearing.doc}>
|
||||||
|
<NumberInput
|
||||||
|
{...inputProps}
|
||||||
|
value={mapStyle.bearing}
|
||||||
|
default={latest.$root.bearing.default}
|
||||||
|
onChange={this.changeStyleProperty.bind(this, "bearing")}
|
||||||
|
/>
|
||||||
|
</InputBlock>
|
||||||
|
|
||||||
|
<InputBlock label={"Pitch"} doc={latest.$root.pitch.doc}>
|
||||||
|
<NumberInput
|
||||||
|
{...inputProps}
|
||||||
|
value={mapStyle.pitch}
|
||||||
|
default={latest.$root.pitch.default}
|
||||||
|
onChange={this.changeStyleProperty.bind(this, "pitch")}
|
||||||
|
/>
|
||||||
|
</InputBlock>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue