From 416cf7e0af703696b33e1056a0b42024e8864ac5 Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Fri, 9 Sep 2016 19:23:18 +0200 Subject: [PATCH] Try remove layer --- src/layers.jsx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/layers.jsx b/src/layers.jsx index f7cfd86..aa07d3e 100644 --- a/src/layers.jsx +++ b/src/layers.jsx @@ -79,7 +79,8 @@ export class NoLayer extends React.Component { export class LayerPanel extends React.Component { static propTypes = { layer: React.PropTypes.object.isRequired, - styleManager: React.PropTypes.object.isRequired + styleManager: React.PropTypes.object.isRequired, + destroyLayer: React.PropTypes.func.isRequired, } static childContextTypes = { @@ -184,7 +185,7 @@ export class LayerPanel extends React.Component { {visibleIcon} - + this.props.destroyLayer(this.state.layer.id)}> @@ -202,10 +203,22 @@ export class LayerEditor extends React.Component { styleManager: React.PropTypes.object.isRequired } + destroyLayer(layerId) { + this.props.styleManager.changeStyle({ + command: 'removeLayer', + args: [layerId] + }) + } + render() { const layers = this.props.styleManager.layers() const layerPanels = layers.map(layer => { - return + return }); return
@@ -214,10 +227,6 @@ export class LayerEditor extends React.Component { Layers -