mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-26 18:50:38 +01:00
Try remove layer
This commit is contained in:
parent
2978210a4d
commit
416cf7e0af
1 changed files with 16 additions and 7 deletions
|
@ -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 {
|
|||
<NavItem onClick={this.toggleVisibility.bind(this)}>
|
||||
{visibleIcon}
|
||||
</NavItem>
|
||||
<NavItem>
|
||||
<NavItem onClick={(e) => this.props.destroyLayer(this.state.layer.id)}>
|
||||
<MdDelete />
|
||||
</NavItem>
|
||||
</Toolbar>
|
||||
|
@ -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 <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>
|
||||
|
@ -214,10 +227,6 @@ export class LayerEditor extends React.Component {
|
|||
<Heading>Layers</Heading>
|
||||
</NavItem>
|
||||
<Space auto x={1} />
|
||||
<Button>
|
||||
<MdAddToPhotos />
|
||||
Add Layer
|
||||
</Button>
|
||||
</Toolbar>
|
||||
|
||||
<div className={scrollbars.darkScrollbar} style={{
|
||||
|
|
Loading…
Reference in a new issue