mirror of
https://github.com/maputnik/editor.git
synced 2026-08-27 15:37:27 +00:00
Try remove layer
This commit is contained in:
+16
-7
@@ -79,7 +79,8 @@ export class NoLayer extends React.Component {
|
|||||||
export class LayerPanel extends React.Component {
|
export class LayerPanel extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
layer: React.PropTypes.object.isRequired,
|
layer: React.PropTypes.object.isRequired,
|
||||||
styleManager: React.PropTypes.object.isRequired
|
styleManager: React.PropTypes.object.isRequired,
|
||||||
|
destroyLayer: React.PropTypes.func.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
static childContextTypes = {
|
static childContextTypes = {
|
||||||
@@ -184,7 +185,7 @@ export class LayerPanel extends React.Component {
|
|||||||
<NavItem onClick={this.toggleVisibility.bind(this)}>
|
<NavItem onClick={this.toggleVisibility.bind(this)}>
|
||||||
{visibleIcon}
|
{visibleIcon}
|
||||||
</NavItem>
|
</NavItem>
|
||||||
<NavItem>
|
<NavItem onClick={(e) => this.props.destroyLayer(this.state.layer.id)}>
|
||||||
<MdDelete />
|
<MdDelete />
|
||||||
</NavItem>
|
</NavItem>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
@@ -202,10 +203,22 @@ export class LayerEditor extends React.Component {
|
|||||||
styleManager: React.PropTypes.object.isRequired
|
styleManager: React.PropTypes.object.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroyLayer(layerId) {
|
||||||
|
this.props.styleManager.changeStyle({
|
||||||
|
command: 'removeLayer',
|
||||||
|
args: [layerId]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const layers = this.props.styleManager.layers()
|
const layers = this.props.styleManager.layers()
|
||||||
const layerPanels = layers.map(layer => {
|
const layerPanels = layers.map(layer => {
|
||||||
return <LayerPanel key={layer.id} layer={layer} styleManager={this.props.styleManager} />
|
return <LayerPanel
|
||||||
|
key={layer.id}
|
||||||
|
layer={layer}
|
||||||
|
destroyLayer={this.destroyLayer.bind(this)}
|
||||||
|
styleManager={this.props.styleManager}
|
||||||
|
/>
|
||||||
});
|
});
|
||||||
|
|
||||||
return <div>
|
return <div>
|
||||||
@@ -214,10 +227,6 @@ export class LayerEditor extends React.Component {
|
|||||||
<Heading>Layers</Heading>
|
<Heading>Layers</Heading>
|
||||||
</NavItem>
|
</NavItem>
|
||||||
<Space auto x={1} />
|
<Space auto x={1} />
|
||||||
<Button>
|
|
||||||
<MdAddToPhotos />
|
|
||||||
Add Layer
|
|
||||||
</Button>
|
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
|
||||||
<div className={scrollbars.darkScrollbar} style={{
|
<div className={scrollbars.darkScrollbar} style={{
|
||||||
|
|||||||
Reference in New Issue
Block a user