mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 17:21:18 +01:00
Ensure editor does not crash with raster layers
This commit is contained in:
parent
08854cd88f
commit
e7b11d8bc9
4 changed files with 8 additions and 5 deletions
|
@ -16,6 +16,7 @@ class LayerIcon extends React.Component {
|
||||||
const iconProps = { style: this.props.style }
|
const iconProps = { style: this.props.style }
|
||||||
switch(this.props.type) {
|
switch(this.props.type) {
|
||||||
case 'fill-extrusion': return <BackgroundIcon {...iconProps} />
|
case 'fill-extrusion': return <BackgroundIcon {...iconProps} />
|
||||||
|
case 'raster': return <FillIcon {...iconProps} />
|
||||||
case 'fill': return <FillIcon {...iconProps} />
|
case 'fill': return <FillIcon {...iconProps} />
|
||||||
case 'background': return <BackgroundIcon {...iconProps} />
|
case 'background': return <BackgroundIcon {...iconProps} />
|
||||||
case 'line': return <LineIcon {...iconProps} />
|
case 'line': return <LineIcon {...iconProps} />
|
||||||
|
|
|
@ -93,9 +93,10 @@ export default class MapboxGlMap extends React.Component {
|
||||||
style={{
|
style={{
|
||||||
position: "fixed",
|
position: "fixed",
|
||||||
top: 0,
|
top: 0,
|
||||||
|
left: 550,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
height: "100%",
|
height: "100%",
|
||||||
width: "100%",
|
width: "75%",
|
||||||
...this.props.style,
|
...this.props.style,
|
||||||
}}>
|
}}>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -31,12 +31,14 @@ export class ApiStyleStore {
|
||||||
connection.onmessage = e => {
|
connection.onmessage = e => {
|
||||||
if(!e.data) return
|
if(!e.data) return
|
||||||
console.log('Received style update from API')
|
console.log('Received style update from API')
|
||||||
|
let parsedStyle = style.emptyStyle
|
||||||
try {
|
try {
|
||||||
const updatedStyle = style.ensureStyleValidity(JSON.parse(e.data))
|
parsedStyle = JSON.parse(e.data)
|
||||||
this.onLocalStyleChange(updatedStyle)
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.error('Could not parse local style')
|
console.error(err)
|
||||||
}
|
}
|
||||||
|
const updatedStyle = style.ensureStyleValidity(parsedStyle)
|
||||||
|
this.onLocalStyleChange(updatedStyle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import style from './style.js'
|
||||||
|
|
||||||
export function initialStyleUrl() {
|
export function initialStyleUrl() {
|
||||||
const initialUrl = url.parse(window.location.href, true)
|
const initialUrl = url.parse(window.location.href, true)
|
||||||
console.log(initialUrl)
|
|
||||||
return (initialUrl.query || {}).style
|
return (initialUrl.query || {}).style
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue