From a5307054b3e5523ba55329554f7a8acab686b373 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Thu, 29 Dec 2016 17:32:23 +0100 Subject: [PATCH] Fix setting style properties in settings modal --- src/components/modals/SettingsModal.jsx | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/components/modals/SettingsModal.jsx b/src/components/modals/SettingsModal.jsx index ee0baf8a..c1f96643 100644 --- a/src/components/modals/SettingsModal.jsx +++ b/src/components/modals/SettingsModal.jsx @@ -18,17 +18,20 @@ class SettingsModal extends React.Component { super(props); } - onChange(property, e) { - const changedStyle = this.props.mapStyle.set(property, e.target.value) + changeStyleProperty(property, value) { + const changedStyle = { + ...this.props.mapStyle, + [property]: value + } this.props.onStyleChanged(changedStyle) } - onMetadataChange(key, value) { + changeMetadataProperty(property, value) { const changedStyle = { ...this.props.mapStyle, metadata: { ...this.props.mapStyle.metadata, - [key]: value + [property]: value } } this.props.onStyleChanged(changedStyle) @@ -45,33 +48,33 @@ class SettingsModal extends React.Component { @@ -83,7 +86,7 @@ class SettingsModal extends React.Component { ['inspection', 'Inspection Mode'], ]} value={metadata['maputnik:renderer'] || 'mbgljs'} - onChange={this.onMetadataChange.bind(this, 'maputnik:renderer')} + onChange={this.changeMetadataProperty.bind(this, 'maputnik:renderer')} />