mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 18:11:21 +01:00
Fix setting style properties in settings modal
This commit is contained in:
parent
d16c3f4356
commit
a5307054b3
1 changed files with 13 additions and 10 deletions
|
@ -18,17 +18,20 @@ class SettingsModal extends React.Component {
|
||||||
super(props);
|
super(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange(property, e) {
|
changeStyleProperty(property, value) {
|
||||||
const changedStyle = this.props.mapStyle.set(property, e.target.value)
|
const changedStyle = {
|
||||||
|
...this.props.mapStyle,
|
||||||
|
[property]: value
|
||||||
|
}
|
||||||
this.props.onStyleChanged(changedStyle)
|
this.props.onStyleChanged(changedStyle)
|
||||||
}
|
}
|
||||||
|
|
||||||
onMetadataChange(key, value) {
|
changeMetadataProperty(property, value) {
|
||||||
const changedStyle = {
|
const changedStyle = {
|
||||||
...this.props.mapStyle,
|
...this.props.mapStyle,
|
||||||
metadata: {
|
metadata: {
|
||||||
...this.props.mapStyle.metadata,
|
...this.props.mapStyle.metadata,
|
||||||
[key]: value
|
[property]: value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.props.onStyleChanged(changedStyle)
|
this.props.onStyleChanged(changedStyle)
|
||||||
|
@ -45,33 +48,33 @@ class SettingsModal extends React.Component {
|
||||||
<InputBlock label={"Name"}>
|
<InputBlock label={"Name"}>
|
||||||
<StringInput {...inputProps}
|
<StringInput {...inputProps}
|
||||||
value={this.props.mapStyle.name}
|
value={this.props.mapStyle.name}
|
||||||
onChange={this.onChange.bind(this, "name")}
|
onChange={this.changeStyleProperty.bind(this, "name")}
|
||||||
/>
|
/>
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
<InputBlock label={"Owner"}>
|
<InputBlock label={"Owner"}>
|
||||||
<StringInput {...inputProps}
|
<StringInput {...inputProps}
|
||||||
value={this.props.mapStyle.owner}
|
value={this.props.mapStyle.owner}
|
||||||
onChange={this.onChange.bind(this, "owner")}
|
onChange={this.changeStyleProperty.bind(this, "owner")}
|
||||||
/>
|
/>
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
<InputBlock label={"Sprite URL"}>
|
<InputBlock label={"Sprite URL"}>
|
||||||
<StringInput {...inputProps}
|
<StringInput {...inputProps}
|
||||||
value={this.props.mapStyle.sprite}
|
value={this.props.mapStyle.sprite}
|
||||||
onChange={this.onChange.bind(this, "sprite")}
|
onChange={this.changeStyleProperty.bind(this, "sprite")}
|
||||||
/>
|
/>
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
|
|
||||||
<InputBlock label={"Glyphs URL"}>
|
<InputBlock label={"Glyphs URL"}>
|
||||||
<StringInput {...inputProps}
|
<StringInput {...inputProps}
|
||||||
value={this.props.mapStyle.glyphs}
|
value={this.props.mapStyle.glyphs}
|
||||||
onChange={this.onChange.bind(this, "glyphs")}
|
onChange={this.changeStyleProperty.bind(this, "glyphs")}
|
||||||
/>
|
/>
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
|
|
||||||
<InputBlock label={"Access Token"}>
|
<InputBlock label={"Access Token"}>
|
||||||
<StringInput {...inputProps}
|
<StringInput {...inputProps}
|
||||||
value={metadata['maputnik:access_token']}
|
value={metadata['maputnik:access_token']}
|
||||||
onChange={this.onMetadataChange.bind(this, "maputnik:access_token")}
|
onChange={this.changeMetadataProperty.bind(this, "maputnik:access_token")}
|
||||||
/>
|
/>
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
|
|
||||||
|
@ -83,7 +86,7 @@ class SettingsModal extends React.Component {
|
||||||
['inspection', 'Inspection Mode'],
|
['inspection', 'Inspection Mode'],
|
||||||
]}
|
]}
|
||||||
value={metadata['maputnik:renderer'] || 'mbgljs'}
|
value={metadata['maputnik:renderer'] || 'mbgljs'}
|
||||||
onChange={this.onMetadataChange.bind(this, 'maputnik:renderer')}
|
onChange={this.changeMetadataProperty.bind(this, 'maputnik:renderer')}
|
||||||
/>
|
/>
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
Loading…
Reference in a new issue