mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-15 08:21:19 +01:00
Allow removal of light/transition properties.
This commit is contained in:
parent
eac7656786
commit
2910efde6e
1 changed files with 28 additions and 14 deletions
|
@ -21,25 +21,39 @@ class SettingsModal extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
changeTransitionProperty(property, value) {
|
changeTransitionProperty(property, value) {
|
||||||
const changedStyle = {
|
const transition = {
|
||||||
...this.props.mapStyle,
|
|
||||||
transition: {
|
|
||||||
...this.props.mapStyle.transition,
|
...this.props.mapStyle.transition,
|
||||||
[property]: value
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value === undefined) {
|
||||||
|
delete transition[property];
|
||||||
}
|
}
|
||||||
this.props.onStyleChanged(changedStyle)
|
else {
|
||||||
|
transition[property] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.props.onStyleChanged({
|
||||||
|
...this.props.mapStyle,
|
||||||
|
transition,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
changeLightProperty(property, value) {
|
changeLightProperty(property, value) {
|
||||||
const changedStyle = {
|
const light = {
|
||||||
...this.props.mapStyle,
|
|
||||||
light: {
|
|
||||||
...this.props.mapStyle.light,
|
...this.props.mapStyle.light,
|
||||||
[property]: value
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value === undefined) {
|
||||||
|
delete light[property];
|
||||||
}
|
}
|
||||||
this.props.onStyleChanged(changedStyle)
|
else {
|
||||||
|
light[property] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.props.onStyleChanged({
|
||||||
|
...this.props.mapStyle,
|
||||||
|
light,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
changeStyleProperty(property, value) {
|
changeStyleProperty(property, value) {
|
||||||
|
|
Loading…
Reference in a new issue