mirror of
https://github.com/maputnik/editor.git
synced 2026-01-06 13:30:03 +00:00
Moved to using @mapbox/mapbox-gl-style-spec
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import diffStyles from 'mapbox-gl/src/style-spec/diff'
|
||||
import styleSpec from '@mapbox/mapbox-gl-style-spec'
|
||||
|
||||
export function diffMessages(beforeStyle, afterStyle) {
|
||||
const changes = diffStyles(beforeStyle, afterStyle)
|
||||
const changes = styleSpec.diff(beforeStyle, afterStyle)
|
||||
return changes.map(cmd => cmd.command + ' ' + cmd.args.join(' '))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import GlSpec from 'mapbox-gl/src/style-spec/reference/latest'
|
||||
import styleSpec from '@mapbox/mapbox-gl-style-spec'
|
||||
export const combiningFilterOps = ['all', 'any', 'none']
|
||||
export const setFilterOps = ['in', '!in']
|
||||
export const otherFilterOps = Object
|
||||
.keys(GlSpec.filter_operator.values)
|
||||
.keys(styleSpec.latest.filter_operator.values)
|
||||
.filter(op => combiningFilterOps.indexOf(op) < 0)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import GlSpec from 'mapbox-gl/src/style-spec/reference/latest'
|
||||
import styleSpec from '@mapbox/mapbox-gl-style-spec'
|
||||
|
||||
export function changeType(layer, newType) {
|
||||
const changedPaintProps = { ...layer.paint }
|
||||
Object.keys(changedPaintProps).forEach(propertyName => {
|
||||
if(!(propertyName in GlSpec['paint_' + newType])) {
|
||||
if(!(propertyName in styleSpec.latest['paint_' + newType])) {
|
||||
delete changedPaintProps[propertyName]
|
||||
}
|
||||
})
|
||||
|
||||
const changedLayoutProps = { ...layer.layout }
|
||||
Object.keys(changedLayoutProps).forEach(propertyName => {
|
||||
if(!(propertyName in GlSpec['layout_' + newType])) {
|
||||
if(!(propertyName in styleSpec.latest['layout_' + newType])) {
|
||||
delete changedLayoutProps[propertyName]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
import spec from 'mapbox-gl/src/style-spec/reference/latest'
|
||||
import derefLayers from 'mapbox-gl/src/style-spec/deref'
|
||||
import deref from '@mapbox/mapbox-gl-style-spec/deref'
|
||||
import tokens from '../config/tokens.json'
|
||||
|
||||
// Empty style is always used if no style could be restored or fetched
|
||||
@@ -37,7 +36,7 @@ function ensureHasNoInteractive(style) {
|
||||
function ensureHasNoRefs(style) {
|
||||
const derefedStyle = {
|
||||
...style,
|
||||
layers: derefLayers(style.layers)
|
||||
layers: deref(style.layers)
|
||||
}
|
||||
return derefedStyle
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user