Use latest MapLibre Style Spec (#2756)
This commit is contained in:
@@ -42,15 +42,6 @@ export function unhyphenate (/** @type {string} **/ str) {
|
||||
return str.replace(/-/g, " ");
|
||||
};
|
||||
|
||||
// Write out a list of files that this script is modifying so that we can check
|
||||
/** @type {string[]} **/
|
||||
let files = [];
|
||||
process.on('exit', function() {
|
||||
const list = path.join(path.dirname(process.argv[1]), path.basename(process.argv[1], '.js') + '.list');
|
||||
console.log(`Writing files that this script modifies to: ${list}`);
|
||||
fs.writeFileSync(list, files.join("\n"));
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} filename
|
||||
@@ -67,7 +58,6 @@ export function writeIfModified(filename, newContent, output) {
|
||||
fs.mkdirSync(info.dir, {recursive: true});
|
||||
}
|
||||
|
||||
files.push(filename);
|
||||
try {
|
||||
const oldContent = fs.readFileSync(filename, 'utf8');
|
||||
if (oldContent == newContent) {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
import spec from './v8.json';
|
||||
export default spec;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,184 +1,204 @@
|
||||
import referenceSpec from "../scripts/style-spec-reference/v8.json" with { type: "json" };
|
||||
import referenceSpec from './style-spec-reference/v8.json' with { type: "json" };
|
||||
|
||||
// https://github.com/maplibre/maplibre-native/issues/2368
|
||||
referenceSpec['layout_symbol']['icon-padding']['type'] = 'number';
|
||||
// @ts-ignore
|
||||
referenceSpec['layout_symbol']['icon-padding']['default'] = 2;
|
||||
|
||||
// https://github.com/maplibre/maplibre-native/issues/2754
|
||||
referenceSpec['layout_symbol']['icon-padding']['property-type'] = 'data constant';
|
||||
|
||||
/** @type {any} */
|
||||
let modifiedReferenceSpec = referenceSpec;
|
||||
|
||||
// https://github.com/maplibre/maplibre-native/issues/250
|
||||
delete modifiedReferenceSpec['layout_symbol']['text-rotation-alignment']["values"]['viewport-glyph']
|
||||
|
||||
// https://github.com/maplibre/maplibre-native/issues/2358
|
||||
delete modifiedReferenceSpec['layout_symbol']['text-variable-anchor-offset'];
|
||||
|
||||
// https://github.com/maplibre/maplibre-native/issues/251
|
||||
delete modifiedReferenceSpec['layout_symbol']['icon-overlap'];
|
||||
delete modifiedReferenceSpec['layout_symbol']['text-overlap'];
|
||||
modifiedReferenceSpec["layout_symbol"]["text-allow-overlap"]["requires"] = referenceSpec["layout_symbol"]["text-allow-overlap"]["requires"].filter(val => JSON.stringify(val) !== '{"!":"text-overlap"}');
|
||||
modifiedReferenceSpec["layout_symbol"]["text-allow-overlap"]["requires"] = referenceSpec["layout_symbol"]["icon-allow-overlap"]["requires"].filter(val => JSON.stringify(val) !== '{"!":"icon-overlap"}');
|
||||
|
||||
modifiedReferenceSpec.layer.type.values["location-indicator"] = {};
|
||||
modifiedReferenceSpec["layout_location-indicator"] = {
|
||||
"top-image": {
|
||||
"type": "resolvedImage",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": false,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"doc": "Name of image in sprite to use as the top of the location indicator."
|
||||
},
|
||||
"bearing-image": {
|
||||
"type": "resolvedImage",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": false,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"doc": "Name of image in sprite to use as the middle of the location indicator."
|
||||
},
|
||||
"shadow-image": {
|
||||
"type": "resolvedImage",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": false,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"doc": "Name of image in sprite to use as the background of the location indicator."
|
||||
}
|
||||
"top-image": {
|
||||
"type": "resolvedImage",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": false,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"doc": "Name of image in sprite to use as the top of the location indicator."
|
||||
},
|
||||
"bearing-image": {
|
||||
"type": "resolvedImage",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": false,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"doc": "Name of image in sprite to use as the middle of the location indicator."
|
||||
},
|
||||
"shadow-image": {
|
||||
"type": "resolvedImage",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": false,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"doc": "Name of image in sprite to use as the background of the location indicator."
|
||||
}
|
||||
};
|
||||
|
||||
modifiedReferenceSpec["paint_location-indicator"] = {
|
||||
"perspective-compensation": {
|
||||
"type": "number",
|
||||
"default": "0.85",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"doc": "The amount of the perspective compensation, between 0 and 1. A value of 1 produces a location indicator of constant width across the screen. A value of 0 makes it scale naturally according to the viewing projection."
|
||||
},
|
||||
"image-tilt-displacement": {
|
||||
"type": "number",
|
||||
"property-type": "data-constant",
|
||||
"default": "0",
|
||||
"units": "pixels",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"doc": "The displacement off the center of the top image and the shadow image when the pitch of the map is greater than 0. This helps producing a three-dimensional appearence."
|
||||
},
|
||||
"bearing": {
|
||||
"type": "number",
|
||||
"default": 0,
|
||||
"period": 360,
|
||||
"units": "degrees",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": false,
|
||||
"parameters": [ ]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The bearing of the location indicator."
|
||||
},
|
||||
"location": {
|
||||
"type": "array",
|
||||
"default": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"length": 3,
|
||||
"value": "number",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": []
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "An array of [latitude, longitude, altitude] position of the location indicator."
|
||||
},
|
||||
"accuracy-radius": {
|
||||
"type": "number",
|
||||
"units": "meters",
|
||||
"default": 0,
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The accuracy, in meters, of the position source used to retrieve the position of the location indicator."
|
||||
},
|
||||
"top-image-size": {
|
||||
"type": "number",
|
||||
"units": "factor of the original icon size",
|
||||
"property-type": "data-constant",
|
||||
"default": 1,
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The size of the top image, as a scale factor applied to the size of the specified image."
|
||||
},
|
||||
"bearing-image-size": {
|
||||
"type": "number",
|
||||
"units": "factor of the original icon size",
|
||||
"property-type": "data-constant",
|
||||
"default": 1,
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The size of the bearing image, as a scale factor applied to the size of the specified image."
|
||||
},
|
||||
"shadow-image-size": {
|
||||
"type": "number",
|
||||
"units": "factor of the original icon size",
|
||||
"property-type": "data-constant",
|
||||
"default": 1,
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The size of the shadow image, as a scale factor applied to the size of the specified image."
|
||||
},
|
||||
"accuracy-radius-color": {
|
||||
"type": "color",
|
||||
"property-type": "data-constant",
|
||||
"default": "#ffffff",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The color for drawing the accuracy radius, as a circle. To adjust transparency, set the alpha component of the color accordingly."
|
||||
"perspective-compensation": {
|
||||
"type": "number",
|
||||
"default": "0.85",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"doc": "The amount of the perspective compensation, between 0 and 1. A value of 1 produces a location indicator of constant width across the screen. A value of 0 makes it scale naturally according to the viewing projection."
|
||||
},
|
||||
"image-tilt-displacement": {
|
||||
"type": "number",
|
||||
"property-type": "data-constant",
|
||||
"default": "0",
|
||||
"units": "pixels",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"doc": "The displacement off the center of the top image and the shadow image when the pitch of the map is greater than 0. This helps producing a three-dimensional appearence."
|
||||
},
|
||||
"bearing": {
|
||||
"type": "number",
|
||||
"default": 0,
|
||||
"period": 360,
|
||||
"units": "degrees",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": false,
|
||||
"parameters": [ ]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The bearing of the location indicator."
|
||||
},
|
||||
"location": {
|
||||
"type": "array",
|
||||
"default": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"length": 3,
|
||||
"value": "number",
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": []
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "An array of [latitude, longitude, altitude] position of the location indicator."
|
||||
},
|
||||
"accuracy-radius": {
|
||||
"type": "number",
|
||||
"units": "meters",
|
||||
"default": 0,
|
||||
"property-type": "data-constant",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The accuracy, in meters, of the position source used to retrieve the position of the location indicator."
|
||||
},
|
||||
"top-image-size": {
|
||||
"type": "number",
|
||||
"units": "factor of the original icon size",
|
||||
"property-type": "data-constant",
|
||||
"default": 1,
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The size of the top image, as a scale factor applied to the size of the specified image."
|
||||
},
|
||||
"bearing-image-size": {
|
||||
"type": "number",
|
||||
"units": "factor of the original icon size",
|
||||
"property-type": "data-constant",
|
||||
"default": 1,
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The size of the bearing image, as a scale factor applied to the size of the specified image."
|
||||
},
|
||||
"shadow-image-size": {
|
||||
"type": "number",
|
||||
"units": "factor of the original icon size",
|
||||
"property-type": "data-constant",
|
||||
"default": 1,
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The size of the shadow image, as a scale factor applied to the size of the specified image."
|
||||
},
|
||||
"accuracy-radius-color": {
|
||||
"type": "color",
|
||||
"property-type": "data-constant",
|
||||
"default": "#ffffff",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The color for drawing the accuracy radius, as a circle. To adjust transparency, set the alpha component of the color accordingly."
|
||||
|
||||
},
|
||||
"accuracy-radius-border-color": {
|
||||
"type": "color",
|
||||
"property-type": "data-constant",
|
||||
"default": "#ffffff",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The color for drawing the accuracy radius border. To adjust transparency, set the alpha component of the color accordingly."
|
||||
}
|
||||
},
|
||||
"accuracy-radius-border-color": {
|
||||
"type": "color",
|
||||
"property-type": "data-constant",
|
||||
"default": "#ffffff",
|
||||
"expression": {
|
||||
"interpolated": true,
|
||||
"parameters": [
|
||||
"zoom"
|
||||
]
|
||||
},
|
||||
"transition": true,
|
||||
"doc": "The color for drawing the accuracy radius border. To adjust transparency, set the alpha component of the color accordingly."
|
||||
}
|
||||
};
|
||||
|
||||
export default modifiedReferenceSpec;
|
||||
Reference in New Issue
Block a user