Allow editing source of layer

This commit is contained in:
Lukas Martinelli
2016-12-18 18:58:33 +01:00
parent 4ebc143ed8
commit c4173aa458
3 changed files with 65 additions and 1 deletions
+10
View File
@@ -11,6 +11,7 @@ import FillLayer from './fill.jsx'
import LineLayer from './line.jsx'
import SymbolLayer from './symbol.jsx'
import BackgroundLayer from './background.jsx'
import SourceEditor from './source.jsx'
import MdVisibility from 'react-icons/lib/md/visibility'
import MdVisibilityOff from 'react-icons/lib/md/visibility-off'
@@ -29,6 +30,7 @@ class UnsupportedLayer extends React.Component {
export class LayerEditor extends React.Component {
static propTypes = {
layer: React.PropTypes.object.isRequired,
sources: React.PropTypes.instanceOf(Immutable.Map),
onLayerChanged: React.PropTypes.func,
onLayerDestroyed: React.PropTypes.func,
}
@@ -129,6 +131,7 @@ export class LayerEditor extends React.Component {
visibleIcon = <MdVisibility />
}
console.log(this.props.layer.toJSON())
return <div style={{
padding: theme.scale[0],
}}>
@@ -144,6 +147,13 @@ export class LayerEditor extends React.Component {
<MdDelete />
</NavItem>
</Toolbar>
{this.props.layer.get('type') !== 'background' && <SourceEditor
source={this.props.layer.get('source')}
sourceLayer={this.props.layer.get('source-layer')}
sources={this.props.sources}
onSourceChange={console.log}
onSourceLayerChange={console.log}
/>}
<div style={{padding: theme.scale[2], paddingRight: 0, backgroundColor: theme.colors.black}}>
{this.layerFromType(this.props.layer.get('type'))}
</div>