Deref style on open

This commit is contained in:
Lukas Martinelli
2016-12-26 12:21:41 +01:00
parent acac314d27
commit 0dc335ea5f
5 changed files with 20 additions and 14 deletions

View File

@@ -119,11 +119,13 @@ export default class LayerEditor extends React.Component {
onIdChange={newId => this.props.onLayerIdChange(this.props.layer.id, newId)}
/>
case 'source': return <div>
{this.props.layer.filter &&
<FilterEditor
filter={this.props.layer.filter}
properties={this.props.vectorLayers[this.props.layer['source-layer']]}
onChange={f => this.onFilterChange(f)}
/>
}
<SourceEditor
source={this.props.layer.source}
sourceLayer={this.props.layer['source-layer']}

View File

@@ -76,7 +76,7 @@ class OpenModal extends React.Component {
withCredentials: false,
}, (error, response, body) => {
if (!error && response.statusCode == 200) {
const mapStyle = style.ensureMetadataExists(JSON.parse(body))
const mapStyle = style.ensureStyleValidity(JSON.parse(body))
console.log('Loaded style ', mapStyle.id)
this.props.onStyleOpen(mapStyle)
} else {
@@ -91,7 +91,7 @@ class OpenModal extends React.Component {
reader.readAsText(file, "UTF-8");
reader.onload = e => {
let mapStyle = JSON.parse(e.target.result)
mapStyle = style.ensureMetadataExists(mapStyle)
mapStyle = style.ensureStyleValidity(mapStyle)
this.props.onStyleOpen(mapStyle);
}
reader.onerror = e => console.log(e.target);