mirror of
https://github.com/maputnik/editor.git
synced 2026-02-12 07:30:00 +00:00
28 lines
585 B
JavaScript
28 lines
585 B
JavaScript
export function deleteSource(mapStyle, sourceId) {
|
|
const remainingSources = { ...mapStyle.sources}
|
|
delete remainingSources[sourceId]
|
|
const changedStyle = {
|
|
...mapStyle,
|
|
sources: remainingSources
|
|
}
|
|
return changedStyle
|
|
}
|
|
|
|
|
|
export function addSource(mapStyle, sourceId, source) {
|
|
return changeSource(mapStyle, sourceId, source)
|
|
}
|
|
|
|
export function changeSource(mapStyle, sourceId, source) {
|
|
const changedSources = {
|
|
...mapStyle.sources,
|
|
[sourceId]: source
|
|
}
|
|
const changedStyle = {
|
|
...mapStyle,
|
|
sources: changedSources
|
|
}
|
|
return changedStyle
|
|
}
|
|
|