mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 01:35:25 +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 {
|
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={{
|
||||||
|
|
Loading…
Reference in a new issue