mirror of
https://github.com/rastapasta/mapscii.git
synced 2024-11-28 19:13:42 +01:00
🎨 adding ref(erence) support for layer styles
This commit is contained in:
parent
e3f42e46c9
commit
caea4c6aec
@ -22,13 +22,15 @@ module.exports = class Styler
|
|||||||
@_replaceConstants json.constants, json.layers if json.constants
|
@_replaceConstants json.constants, json.layers if json.constants
|
||||||
|
|
||||||
for style in json.layers
|
for style in json.layers
|
||||||
continue if style.ref
|
if style.ref and @styleById[style.ref]
|
||||||
|
for ref in ['type', 'source-layer', 'minzoom', 'maxzoom', 'filter']
|
||||||
|
if @styleById[style.ref][ref] and not style[ref]
|
||||||
|
style[ref] = @styleById[style.ref][ref]
|
||||||
|
|
||||||
style.appliesTo = @_compileFilter style.filter
|
style.appliesTo = @_compileFilter style.filter
|
||||||
|
|
||||||
@styleByLayer[style['source-layer']] ?= []
|
@styleByLayer[style['source-layer']] ?= []
|
||||||
@styleByLayer[style['source-layer']].push style
|
@styleByLayer[style['source-layer']].push style
|
||||||
|
|
||||||
@styleById[style.id] = style
|
@styleById[style.id] = style
|
||||||
|
|
||||||
getStyleFor: (layer, feature, zoom) ->
|
getStyleFor: (layer, feature, zoom) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user