From d1b8f8d63e4623b1e142880e6ee312ca4150bded Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Thu, 29 Dec 2016 15:35:07 +0100 Subject: [PATCH] Change map style to add layer --- src/components/Toolbar.jsx | 2 +- src/components/modals/AddModal.jsx | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/components/Toolbar.jsx b/src/components/Toolbar.jsx index 3425f86..e9d6c26 100644 --- a/src/components/Toolbar.jsx +++ b/src/components/Toolbar.jsx @@ -159,9 +159,9 @@ export default class Toolbar extends React.Component { 0) { this.state.source = Object.keys(this.props.sources)[0] + this.state['source-layer'] = this.props.sources[this.state.source][0] } } @@ -39,6 +59,7 @@ class AddModal extends React.Component { if(!this.state.source && sourceIds.length > 0) { this.setState({ source: sourceIds[0], + 'source-layer': this.state['source-layer'] || nextProps.sources[sourceIds[0]][0] }) } } @@ -68,6 +89,9 @@ class AddModal extends React.Component { value={this.state['source-layer']} onChange={v => this.setState({ 'source-layer': v })} /> + } }