mirror of
https://github.com/maputnik/editor.git
synced 2026-06-09 16:57:26 +00:00
Initial work to convert from Mapbox GL v1.13 to MapLibre v2.4.0.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import style from './style.js'
|
||||
import {format} from '@mapbox/mapbox-gl-style-spec'
|
||||
import {format} from '@maplibre/maplibre-gl-style-spec'
|
||||
import ReconnectingWebSocket from 'reconnecting-websocket'
|
||||
|
||||
export class ApiStyleStore {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {diff} from '@mapbox/mapbox-gl-style-spec'
|
||||
import {diff} from '@maplibre/maplibre-gl-style-spec'
|
||||
|
||||
export function diffMessages(beforeStyle, afterStyle) {
|
||||
const changes = diff(beforeStyle, afterStyle)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
||||
export const combiningFilterOps = ['all', 'any', 'none']
|
||||
export const setFilterOps = ['in', '!in']
|
||||
export const otherFilterOps = Object
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
||||
|
||||
export function changeType(layer, newType) {
|
||||
const changedPaintProps = { ...layer.paint }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import MapboxGl from 'mapbox-gl'
|
||||
import MapLibreGl from "maplibre-gl"
|
||||
import {readFileSync} from 'fs'
|
||||
|
||||
const data = readFileSync(__dirname+"/../../node_modules/@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.js", "utf8");
|
||||
@@ -8,4 +8,4 @@ const blob = new window.Blob([data], {
|
||||
});
|
||||
const objectUrl = window.URL.createObjectURL(blob);
|
||||
|
||||
MapboxGl.setRTLTextPlugin(objectUrl);
|
||||
MapLibreGl.setRTLTextPlugin(objectUrl, () => {});
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
function asBool(queryObj, key) {
|
||||
if(queryObj.hasOwnProperty(key)) {
|
||||
if(queryObj[key].match(/^false|0$/)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return !queryObj[key].match(/^false|0$/);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default function(a, b) {
|
||||
a = parseFloat(a, 10);
|
||||
b = parseFloat(b, 10);
|
||||
a = parseFloat(a);
|
||||
b = parseFloat(b);
|
||||
|
||||
if(a < b) {
|
||||
return -1
|
||||
|
||||
+2
-4
@@ -1,11 +1,10 @@
|
||||
export function deleteSource(mapStyle, sourceId) {
|
||||
const remainingSources = { ...mapStyle.sources}
|
||||
delete remainingSources[sourceId]
|
||||
const changedStyle = {
|
||||
return {
|
||||
...mapStyle,
|
||||
sources: remainingSources
|
||||
}
|
||||
return changedStyle
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +17,9 @@ export function changeSource(mapStyle, sourceId, source) {
|
||||
...mapStyle.sources,
|
||||
[sourceId]: source
|
||||
}
|
||||
const changedStyle = {
|
||||
return {
|
||||
...mapStyle,
|
||||
sources: changedSources
|
||||
}
|
||||
return changedStyle
|
||||
}
|
||||
|
||||
|
||||
+4
-6
@@ -1,4 +1,4 @@
|
||||
import deref from '@mapbox/mapbox-gl-style-spec/deref'
|
||||
import {derefLayers} from '@maplibre/maplibre-gl-style-spec'
|
||||
import tokens from '../config/tokens.json'
|
||||
|
||||
// Empty style is always used if no style could be restored or fetched
|
||||
@@ -25,19 +25,17 @@ function ensureHasNoInteractive(style) {
|
||||
return changedLayer
|
||||
})
|
||||
|
||||
const nonInteractiveStyle = {
|
||||
return {
|
||||
...style,
|
||||
layers: changedLayers
|
||||
}
|
||||
return nonInteractiveStyle
|
||||
}
|
||||
|
||||
function ensureHasNoRefs(style) {
|
||||
const derefedStyle = {
|
||||
return {
|
||||
...style,
|
||||
layers: deref(style.layers)
|
||||
layers: derefLayers(style.layers)
|
||||
}
|
||||
return derefedStyle
|
||||
}
|
||||
|
||||
function ensureStyleValidity(style) {
|
||||
|
||||
@@ -30,7 +30,7 @@ function loadStoredStyles() {
|
||||
|
||||
function isStyleKey(key) {
|
||||
const parts = key.split(":")
|
||||
return parts.length == 3 && parts[0] === storagePrefix && parts[1] === stylePrefix
|
||||
return parts.length === 3 && parts[0] === storagePrefix && parts[1] === stylePrefix
|
||||
}
|
||||
|
||||
// Load style id from key
|
||||
|
||||
Reference in New Issue
Block a user