@craft-native/ts-maps 0.0.247 → 0.0.249
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters.js +694 -702
- package/dist/bridge-protocol.js +2 -10
- package/dist/index.js +1139 -1196
- package/dist/types.js +3 -11
- package/package.json +1 -1
package/dist/adapters.js
CHANGED
|
@@ -1,51 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// src/types.ts
|
|
10
|
-
var defaultMapConfiguration = {
|
|
11
|
-
provider: "ts_maps",
|
|
12
|
-
map_type: "standard",
|
|
13
|
-
shows_user_location: false,
|
|
14
|
-
user_tracking_mode: "none",
|
|
15
|
-
shows_compass: true,
|
|
16
|
-
shows_scale: true,
|
|
17
|
-
shows_traffic: false,
|
|
18
|
-
shows_buildings: true,
|
|
19
|
-
is_rotate_enabled: true,
|
|
20
|
-
is_scroll_enabled: true,
|
|
21
|
-
is_zoom_enabled: true,
|
|
22
|
-
is_pitch_enabled: true,
|
|
23
|
-
min_zoom: 0,
|
|
24
|
-
max_zoom: 22
|
|
25
|
-
};
|
|
26
|
-
var defaultMapCamera = {
|
|
27
|
-
center: { latitude: 0, longitude: 0 },
|
|
28
|
-
zoom: 15,
|
|
29
|
-
pitch: 0,
|
|
30
|
-
heading: 0
|
|
31
|
-
};
|
|
32
|
-
var markerColorHex = {
|
|
33
|
-
red: "#ff3b30",
|
|
34
|
-
green: "#34c759",
|
|
35
|
-
blue: "#007aff",
|
|
36
|
-
yellow: "#ffcc00",
|
|
37
|
-
orange: "#ff9500",
|
|
38
|
-
purple: "#af52de",
|
|
39
|
-
cyan: "#32ade6",
|
|
40
|
-
magenta: "#ff2d55"
|
|
41
|
-
};
|
|
42
|
-
var strokePatternDashes = {
|
|
43
|
-
solid: [],
|
|
44
|
-
dashed: [10, 5],
|
|
45
|
-
dotted: [2, 2],
|
|
46
|
-
dash_dot: [10, 5, 2, 5]
|
|
47
|
-
};
|
|
48
|
-
|
|
49
1
|
// ../../node_modules/ts-maps/dist/index.js
|
|
50
2
|
var __defProp = Object.defineProperty;
|
|
51
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -891,7 +843,7 @@ var Evented;
|
|
|
891
843
|
var init_Events = __esm(() => {
|
|
892
844
|
init_Util();
|
|
893
845
|
init_Class();
|
|
894
|
-
Evented = class
|
|
846
|
+
Evented = class Evented extends Class {
|
|
895
847
|
static __REMOVED_EVENTS = ["mousedown", "mouseup", "mouseover", "mouseout", "mousemove"];
|
|
896
848
|
on(types, fn, context) {
|
|
897
849
|
assertEventTypes("on", types);
|
|
@@ -928,7 +880,7 @@ var init_Events = __esm(() => {
|
|
|
928
880
|
return this;
|
|
929
881
|
}
|
|
930
882
|
_on(type, fn, context, _once) {
|
|
931
|
-
if (
|
|
883
|
+
if (Evented.__REMOVED_EVENTS.includes(type)) {
|
|
932
884
|
console.error(`The event ${type} has been removed. Use the PointerEvent variant instead.`);
|
|
933
885
|
}
|
|
934
886
|
if (typeof fn !== "function") {
|
|
@@ -1152,7 +1104,7 @@ function cubicBezier(x1, y1, x2, y2) {
|
|
|
1152
1104
|
var Animation;
|
|
1153
1105
|
var init_Animation = __esm(() => {
|
|
1154
1106
|
init_Events();
|
|
1155
|
-
Animation = class
|
|
1107
|
+
Animation = class Animation extends Evented {
|
|
1156
1108
|
constructor() {
|
|
1157
1109
|
super();
|
|
1158
1110
|
this._easing = easeInOutCubic;
|
|
@@ -1237,7 +1189,7 @@ var PosAnimation;
|
|
|
1237
1189
|
var init_PosAnimation = __esm(() => {
|
|
1238
1190
|
init_DomUtil();
|
|
1239
1191
|
init_Events();
|
|
1240
|
-
PosAnimation = class
|
|
1192
|
+
PosAnimation = class PosAnimation extends Evented {
|
|
1241
1193
|
run(el, newPos, duration, easeLinearity) {
|
|
1242
1194
|
this.stop();
|
|
1243
1195
|
this._el = el;
|
|
@@ -1654,7 +1606,7 @@ var init_CRS = __esm(() => {
|
|
|
1654
1606
|
var EarthCRS;
|
|
1655
1607
|
var init_EarthCRS = __esm(() => {
|
|
1656
1608
|
init_CRS();
|
|
1657
|
-
EarthCRS = class
|
|
1609
|
+
EarthCRS = class EarthCRS extends CRS {
|
|
1658
1610
|
static wrapLng = [-180, 180];
|
|
1659
1611
|
static R = 6371000;
|
|
1660
1612
|
static distance(latlng1, latlng2) {
|
|
@@ -1792,7 +1744,7 @@ var init_EPSG3857 = __esm(() => {
|
|
|
1792
1744
|
init_Transformation();
|
|
1793
1745
|
init_Projection_SphericalMercator();
|
|
1794
1746
|
init_EarthCRS();
|
|
1795
|
-
EPSG3857 = class
|
|
1747
|
+
EPSG3857 = class EPSG3857 extends EarthCRS {
|
|
1796
1748
|
static code = "EPSG:3857";
|
|
1797
1749
|
static projection = SphericalMercator;
|
|
1798
1750
|
static transformation = (() => {
|
|
@@ -1800,7 +1752,7 @@ var init_EPSG3857 = __esm(() => {
|
|
|
1800
1752
|
return new Transformation(scale, 0.5, -scale, 0.5);
|
|
1801
1753
|
})();
|
|
1802
1754
|
};
|
|
1803
|
-
EPSG900913 = class
|
|
1755
|
+
EPSG900913 = class EPSG900913 extends EPSG3857 {
|
|
1804
1756
|
static code = "EPSG:900913";
|
|
1805
1757
|
};
|
|
1806
1758
|
});
|
|
@@ -1845,10 +1797,10 @@ function parseHex(hex) {
|
|
|
1845
1797
|
function parseRgbComponent(input) {
|
|
1846
1798
|
const s = input.trim();
|
|
1847
1799
|
if (s.endsWith("%")) {
|
|
1848
|
-
const
|
|
1849
|
-
if (Number.isNaN(
|
|
1800
|
+
const n = Number.parseFloat(s.slice(0, -1));
|
|
1801
|
+
if (Number.isNaN(n))
|
|
1850
1802
|
return Number.NaN;
|
|
1851
|
-
return clamp01(
|
|
1803
|
+
return clamp01(n / 100);
|
|
1852
1804
|
}
|
|
1853
1805
|
const n = Number.parseFloat(s);
|
|
1854
1806
|
if (Number.isNaN(n))
|
|
@@ -1858,10 +1810,10 @@ function parseRgbComponent(input) {
|
|
|
1858
1810
|
function parseAlpha(input) {
|
|
1859
1811
|
const s = input.trim();
|
|
1860
1812
|
if (s.endsWith("%")) {
|
|
1861
|
-
const
|
|
1862
|
-
if (Number.isNaN(
|
|
1813
|
+
const n = Number.parseFloat(s.slice(0, -1));
|
|
1814
|
+
if (Number.isNaN(n))
|
|
1863
1815
|
return Number.NaN;
|
|
1864
|
-
return clamp01(
|
|
1816
|
+
return clamp01(n / 100);
|
|
1865
1817
|
}
|
|
1866
1818
|
const n = Number.parseFloat(s);
|
|
1867
1819
|
if (Number.isNaN(n))
|
|
@@ -2137,7 +2089,7 @@ var init_Color = __esm(() => {
|
|
|
2137
2089
|
});
|
|
2138
2090
|
var ExpressionError;
|
|
2139
2091
|
var init_errors = __esm(() => {
|
|
2140
|
-
ExpressionError = class
|
|
2092
|
+
ExpressionError = class ExpressionError extends Error {
|
|
2141
2093
|
constructor(message, expression, path = []) {
|
|
2142
2094
|
const prefix = path.length > 0 ? `[${path.map((p) => JSON.stringify(p)).join("][")}] ` : "";
|
|
2143
2095
|
super(`${prefix}${message}`);
|
|
@@ -3006,11 +2958,11 @@ function registerLogicalOps() {
|
|
|
3006
2958
|
throw new ExpressionError('"in" expects at least 1 argument', ["in", ...args], path);
|
|
3007
2959
|
if (args.length === 2 && Array.isArray(args[1])) {
|
|
3008
2960
|
const needle = compile(args[0], "value", path.concat(1));
|
|
3009
|
-
const
|
|
2961
|
+
const haystack = compile(args[1], "value", path.concat(2));
|
|
3010
2962
|
return {
|
|
3011
2963
|
evaluate: (ctx) => {
|
|
3012
2964
|
const x = needle.evaluate(ctx);
|
|
3013
|
-
const hay =
|
|
2965
|
+
const hay = haystack.evaluate(ctx);
|
|
3014
2966
|
if (Array.isArray(hay))
|
|
3015
2967
|
return hay.some((value) => strictEq(x, value));
|
|
3016
2968
|
if (typeof hay === "string")
|
|
@@ -3018,7 +2970,7 @@ function registerLogicalOps() {
|
|
|
3018
2970
|
return false;
|
|
3019
2971
|
},
|
|
3020
2972
|
returnType: "boolean",
|
|
3021
|
-
...mergeDeps4([needle,
|
|
2973
|
+
...mergeDeps4([needle, haystack])
|
|
3022
2974
|
};
|
|
3023
2975
|
}
|
|
3024
2976
|
const input = compile(args[0], "value", path.concat(1));
|
|
@@ -3354,12 +3306,12 @@ function registerMathOps() {
|
|
|
3354
3306
|
registerOperator("-", (args, compile, path) => {
|
|
3355
3307
|
if (args.length !== 1 && args.length !== 2)
|
|
3356
3308
|
throw new ExpressionError(`"-" expects 1 or 2 arguments, got ${args.length}`, ["-", ...args], path);
|
|
3357
|
-
const children = args.map((
|
|
3309
|
+
const children = args.map((a, i) => compile(a, "number", path.concat(i + 1)));
|
|
3358
3310
|
const expr = ["-", ...args];
|
|
3359
3311
|
if (children.length === 1) {
|
|
3360
|
-
const
|
|
3312
|
+
const a = children[0];
|
|
3361
3313
|
return {
|
|
3362
|
-
evaluate: (ctx) => -expectNumber(
|
|
3314
|
+
evaluate: (ctx) => -expectNumber(a.evaluate(ctx), "-", expr),
|
|
3363
3315
|
returnType: "number",
|
|
3364
3316
|
...mergeDeps5(children)
|
|
3365
3317
|
};
|
|
@@ -4816,7 +4768,7 @@ var init_header = __esm(() => {
|
|
|
4816
4768
|
};
|
|
4817
4769
|
MAGIC = [80, 77, 84, 105, 108, 101, 115];
|
|
4818
4770
|
TWO_32 = 2 ** 32;
|
|
4819
|
-
PMTilesFormatError = class
|
|
4771
|
+
PMTilesFormatError = class PMTilesFormatError extends Error {
|
|
4820
4772
|
constructor(message) {
|
|
4821
4773
|
super(message);
|
|
4822
4774
|
this.name = "PMTilesFormatError";
|
|
@@ -5440,10 +5392,10 @@ function decodeDirectory(bytes) {
|
|
|
5440
5392
|
if (count * 4 > bytes.length)
|
|
5441
5393
|
throw new RangeError(`PMTiles: directory claims ${count} entries in ${bytes.length} bytes`);
|
|
5442
5394
|
const entries = Array.from({ length: count });
|
|
5443
|
-
let
|
|
5395
|
+
let lastId = 0;
|
|
5444
5396
|
for (let i = 0;i < count; i++) {
|
|
5445
|
-
|
|
5446
|
-
entries[i] = { tileId:
|
|
5397
|
+
lastId += read();
|
|
5398
|
+
entries[i] = { tileId: lastId, offset: 0, length: 0, runLength: 1 };
|
|
5447
5399
|
}
|
|
5448
5400
|
for (let i = 0;i < count; i++)
|
|
5449
5401
|
entries[i].runLength = read();
|
|
@@ -5532,7 +5484,7 @@ class FetchSource {
|
|
|
5532
5484
|
var PMTilesChangedError;
|
|
5533
5485
|
var MAX_WHOLE_FILE_BYTES;
|
|
5534
5486
|
var init_sources = __esm(() => {
|
|
5535
|
-
PMTilesChangedError = class
|
|
5487
|
+
PMTilesChangedError = class PMTilesChangedError extends Error {
|
|
5536
5488
|
constructor(key) {
|
|
5537
5489
|
super(`PMTiles: ${key} changed while it was being read`);
|
|
5538
5490
|
this.name = "PMTilesChangedError";
|
|
@@ -6090,7 +6042,7 @@ async function saveOfflineRegion(options, emitter) {
|
|
|
6090
6042
|
const concurrency = Math.max(1, options.concurrency ?? 4);
|
|
6091
6043
|
const coords = computeTileCoords(options.bounds, options.zoomRange);
|
|
6092
6044
|
const total = coords.length;
|
|
6093
|
-
const
|
|
6045
|
+
const template = isPMTilesUrl(options.tileUrl) ? pmtilesTileUrl(options.tileUrl) : options.tileUrl;
|
|
6094
6046
|
const result = { saved: 0, failed: 0, skipped: 0 };
|
|
6095
6047
|
if (isPMTilesUrl(options.tileUrl))
|
|
6096
6048
|
await cachedFetch(pmtilesSourceUrl(options.tileUrl), { cache, signal: options.signal }).catch(() => {});
|
|
@@ -6100,7 +6052,7 @@ async function saveOfflineRegion(options, emitter) {
|
|
|
6100
6052
|
while (cursor < coords.length) {
|
|
6101
6053
|
const idx = cursor++;
|
|
6102
6054
|
const c = coords[idx];
|
|
6103
|
-
const url = fillTileUrl(
|
|
6055
|
+
const url = fillTileUrl(template, c);
|
|
6104
6056
|
try {
|
|
6105
6057
|
const res = await cachedFetch(url, { cache, signal: options.signal });
|
|
6106
6058
|
if (res.fromCache)
|
|
@@ -6478,9 +6430,9 @@ class VectorTile {
|
|
|
6478
6430
|
var init_VectorTile = __esm(() => {
|
|
6479
6431
|
init_VectorTileLayer();
|
|
6480
6432
|
});
|
|
6481
|
-
function glyphUrl(
|
|
6433
|
+
function glyphUrl(template, fontstack, rangeStart) {
|
|
6482
6434
|
const range = `${rangeStart}-${rangeStart + 255}`;
|
|
6483
|
-
return
|
|
6435
|
+
return template.replace("{fontstack}", encodeURIComponent(fontstack)).replace("{range}", range);
|
|
6484
6436
|
}
|
|
6485
6437
|
function rangeStartFor(codePoint) {
|
|
6486
6438
|
return Math.floor(codePoint / 256) * 256;
|
|
@@ -6548,8 +6500,8 @@ class GlyphSource {
|
|
|
6548
6500
|
_fetch;
|
|
6549
6501
|
_ranges;
|
|
6550
6502
|
_pending;
|
|
6551
|
-
constructor(
|
|
6552
|
-
this._template =
|
|
6503
|
+
constructor(template, options = {}) {
|
|
6504
|
+
this._template = template;
|
|
6553
6505
|
this._fetch = options.fetch ?? globalThis.fetch;
|
|
6554
6506
|
this._ranges = new Map;
|
|
6555
6507
|
this._pending = new Map;
|
|
@@ -6703,12 +6655,12 @@ function rangeCount(r) {
|
|
|
6703
6655
|
function isVectorUrl(url) {
|
|
6704
6656
|
return /\.(?:pbf|mvt)(?:$|\?)/i.test(url);
|
|
6705
6657
|
}
|
|
6706
|
-
function fill(
|
|
6707
|
-
return
|
|
6658
|
+
function fill(template, x, y, z) {
|
|
6659
|
+
return template.replace("{z}", String(z)).replace("{x}", String(x)).replace("{y}", String(y));
|
|
6708
6660
|
}
|
|
6709
6661
|
function jobForSource(source, minZoom, maxZoom) {
|
|
6710
|
-
const
|
|
6711
|
-
const kind = source.type ?? (isVectorUrl(
|
|
6662
|
+
const template = isPMTilesUrl(source.url) ? pmtilesTileUrl(source.url) : source.url;
|
|
6663
|
+
const kind = source.type ?? (isVectorUrl(template) || isPMTilesUrl(template) ? "vector" : "raster");
|
|
6712
6664
|
const tileSize = source.tileSize ?? (kind === "vector" ? 512 : 256);
|
|
6713
6665
|
const shift = Math.round(Math.log2(tileSize / 256));
|
|
6714
6666
|
const srcMin = source.minZoom ?? 0;
|
|
@@ -6719,9 +6671,9 @@ function jobForSource(source, minZoom, maxZoom) {
|
|
|
6719
6671
|
zooms.push({ z, gridZ: z, mapZ: z + shift });
|
|
6720
6672
|
return {
|
|
6721
6673
|
kind,
|
|
6722
|
-
template
|
|
6674
|
+
template,
|
|
6723
6675
|
zooms,
|
|
6724
|
-
url: (x, y, z) => fill(
|
|
6676
|
+
url: (x, y, z) => fill(template, x, y, z),
|
|
6725
6677
|
indexAt: kind === "vector" ? top : undefined,
|
|
6726
6678
|
server: (x, y, z) => ({ x, y, z })
|
|
6727
6679
|
};
|
|
@@ -6733,8 +6685,8 @@ function jobForLayer(layer, minZoom, maxZoom) {
|
|
|
6733
6685
|
if (options.localSource)
|
|
6734
6686
|
return;
|
|
6735
6687
|
const vector = typeof layer._subTile === "function";
|
|
6736
|
-
const
|
|
6737
|
-
if (!
|
|
6688
|
+
const template = vector ? options.url : layer._url;
|
|
6689
|
+
if (!template)
|
|
6738
6690
|
return;
|
|
6739
6691
|
const tileSize = layer.getTileSize().x;
|
|
6740
6692
|
const gridShift = Math.round(Math.log2(tileSize / 256));
|
|
@@ -6753,7 +6705,7 @@ function jobForLayer(layer, minZoom, maxZoom) {
|
|
|
6753
6705
|
zooms.push({ z, gridZ: z - gridShift, mapZ: z });
|
|
6754
6706
|
return {
|
|
6755
6707
|
kind: vector ? "vector" : "raster",
|
|
6756
|
-
template
|
|
6708
|
+
template,
|
|
6757
6709
|
zooms,
|
|
6758
6710
|
url: (x, y, z) => layer.getTileUrl({ x, y, z }),
|
|
6759
6711
|
indexAt: vector ? top : undefined,
|
|
@@ -6945,7 +6897,7 @@ function extractTile(bytes, x, y, z, layers = {}) {
|
|
|
6945
6897
|
return { places, roads };
|
|
6946
6898
|
}
|
|
6947
6899
|
const n = 2 ** z;
|
|
6948
|
-
const
|
|
6900
|
+
const toLatLng = (p, extent) => [
|
|
6949
6901
|
unitToLat((y + p[1] / extent) / n),
|
|
6950
6902
|
unitToLng((x + p[0] / extent) / n)
|
|
6951
6903
|
];
|
|
@@ -6999,7 +6951,7 @@ function extractTile(bytes, x, y, z, layers = {}) {
|
|
|
6999
6951
|
const p = anchor(geometry, type, extent);
|
|
7000
6952
|
if (!name || !p)
|
|
7001
6953
|
return;
|
|
7002
|
-
const [lat, lng] =
|
|
6954
|
+
const [lat, lng] = toLatLng(p, extent);
|
|
7003
6955
|
places.push({ name, lat, lng, kind, rank });
|
|
7004
6956
|
};
|
|
7005
6957
|
eachFeature(names.place, (props, g, type, extent) => {
|
|
@@ -7083,18 +7035,18 @@ function extractTile(bytes, x, y, z, layers = {}) {
|
|
|
7083
7035
|
const level = typeof props.layer === "number" && props.layer !== 0 ? props.layer : props.brunnel === "bridge" ? 1 : props.brunnel === "tunnel" ? -1 : 0;
|
|
7084
7036
|
for (const line of g) {
|
|
7085
7037
|
for (const piece of clipLine(line, extent)) {
|
|
7086
|
-
const
|
|
7087
|
-
for (let i = 1;i <
|
|
7088
|
-
if (
|
|
7089
|
-
|
|
7038
|
+
const names = piece.slice(1).map((p, i) => nameFor(piece[i], p, kind, extent));
|
|
7039
|
+
for (let i = 1;i < names.length - 1; i++) {
|
|
7040
|
+
if (names[i] === undefined && names[i - 1] !== undefined && names[i - 1] === names.slice(i + 1).find((n) => n !== undefined))
|
|
7041
|
+
names[i] = names[i - 1];
|
|
7090
7042
|
}
|
|
7091
7043
|
let start = 0;
|
|
7092
|
-
for (let i = 1;i <=
|
|
7093
|
-
if (i <
|
|
7044
|
+
for (let i = 1;i <= names.length; i++) {
|
|
7045
|
+
if (i < names.length && names[i] === names[start])
|
|
7094
7046
|
continue;
|
|
7095
7047
|
const coords = [];
|
|
7096
7048
|
for (const p of piece.slice(start, i + 1)) {
|
|
7097
|
-
const [lat, lng] =
|
|
7049
|
+
const [lat, lng] = toLatLng(p, extent);
|
|
7098
7050
|
coords.push(lat, lng);
|
|
7099
7051
|
}
|
|
7100
7052
|
const road = { coords, kind: kind === "path" && props.subclass ? `path:${props.subclass}` : kind, oneway };
|
|
@@ -7102,8 +7054,8 @@ function extractTile(bytes, x, y, z, layers = {}) {
|
|
|
7102
7054
|
road.ramp = true;
|
|
7103
7055
|
if (level)
|
|
7104
7056
|
road.level = level;
|
|
7105
|
-
if (
|
|
7106
|
-
road.name =
|
|
7057
|
+
if (names[start])
|
|
7058
|
+
road.name = names[start];
|
|
7107
7059
|
roads.push(road);
|
|
7108
7060
|
start = i;
|
|
7109
7061
|
}
|
|
@@ -7544,11 +7496,11 @@ function laneIcon(lane, maneuver) {
|
|
|
7544
7496
|
function maneuverIcon(maneuver) {
|
|
7545
7497
|
const stroke = 'stroke="currentColor" stroke-width="5.5" stroke-linecap="round" stroke-linejoin="round" fill="none"';
|
|
7546
7498
|
const wrap = (body) => `<svg viewBox="0 0 48 48" width="48" height="48" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">${body}</svg>`;
|
|
7547
|
-
const head = (x, y,
|
|
7499
|
+
const head = (x, y, angle) => {
|
|
7548
7500
|
const s = 8;
|
|
7549
|
-
const tip = [x + Math.sin(
|
|
7550
|
-
const left = [x + Math.sin(
|
|
7551
|
-
const right = [x + Math.sin(
|
|
7501
|
+
const tip = [x + Math.sin(angle) * s, y - Math.cos(angle) * s];
|
|
7502
|
+
const left = [x + Math.sin(angle - 2.3) * s * 0.9, y - Math.cos(angle - 2.3) * s * 0.9];
|
|
7503
|
+
const right = [x + Math.sin(angle + 2.3) * s * 0.9, y - Math.cos(angle + 2.3) * s * 0.9];
|
|
7552
7504
|
return `<path d="M${tip[0].toFixed(1)} ${tip[1].toFixed(1)}L${left[0].toFixed(1)} ${left[1].toFixed(1)}L${right[0].toFixed(1)} ${right[1].toFixed(1)}Z" fill="currentColor"/>`;
|
|
7553
7505
|
};
|
|
7554
7506
|
const sign = maneuver.direction === "left" ? -1 : 1;
|
|
@@ -7561,9 +7513,9 @@ function maneuverIcon(maneuver) {
|
|
|
7561
7513
|
}
|
|
7562
7514
|
if (maneuver.kind === "roundabout" || maneuver.kind === "roundabout-exit") {
|
|
7563
7515
|
const exitAngle = maneuver.direction === "straight" ? 0 : sign * Math.PI / 2;
|
|
7564
|
-
const
|
|
7565
|
-
const
|
|
7566
|
-
return wrap(`<circle cx="24" cy="20" r="9" ${stroke}/><path d="M24 42V29" ${stroke}/><path d="M${24 + Math.sin(exitAngle) * 9} ${20 - Math.cos(exitAngle) * 9}L${
|
|
7516
|
+
const ex = 24 + Math.sin(exitAngle) * 18;
|
|
7517
|
+
const ey = 20 - Math.cos(exitAngle) * 18;
|
|
7518
|
+
return wrap(`<circle cx="24" cy="20" r="9" ${stroke}/><path d="M24 42V29" ${stroke}/><path d="M${24 + Math.sin(exitAngle) * 9} ${20 - Math.cos(exitAngle) * 9}L${ex - Math.sin(exitAngle) * 5} ${ey + Math.cos(exitAngle) * 5}" ${stroke}/>${head(ex, ey, exitAngle)}`);
|
|
7567
7519
|
}
|
|
7568
7520
|
let angle = 0;
|
|
7569
7521
|
if (maneuver.direction !== "straight") {
|
|
@@ -7662,7 +7614,7 @@ class RoadGraph {
|
|
|
7662
7614
|
this._junctionDelays();
|
|
7663
7615
|
}
|
|
7664
7616
|
_junctionDelays() {
|
|
7665
|
-
const
|
|
7617
|
+
const delay = JUNCTION_DELAY[this.profile];
|
|
7666
7618
|
const neighbours = this.edges.map(() => new Set);
|
|
7667
7619
|
this.edges.forEach((list, from) => {
|
|
7668
7620
|
for (const edge of list) {
|
|
@@ -7675,7 +7627,7 @@ class RoadGraph {
|
|
|
7675
7627
|
for (const list of this.edges) {
|
|
7676
7628
|
for (const edge of list) {
|
|
7677
7629
|
if (edge.road >= 0 && neighbours[edge.to].size >= 3)
|
|
7678
|
-
edge.cost +=
|
|
7630
|
+
edge.cost += delay;
|
|
7679
7631
|
}
|
|
7680
7632
|
}
|
|
7681
7633
|
}
|
|
@@ -7739,7 +7691,7 @@ class RoadGraph {
|
|
|
7739
7691
|
else
|
|
7740
7692
|
byRoad.set(s.i, [point]);
|
|
7741
7693
|
};
|
|
7742
|
-
const
|
|
7694
|
+
const touch = (px, py, b) => {
|
|
7743
7695
|
const vx = b.bx - b.ax;
|
|
7744
7696
|
const vy = b.by - b.ay;
|
|
7745
7697
|
const len = vx * vx + vy * vy;
|
|
@@ -7781,10 +7733,10 @@ class RoadGraph {
|
|
|
7781
7733
|
}
|
|
7782
7734
|
}
|
|
7783
7735
|
for (const [p, other] of [[a, b], [b, a]]) {
|
|
7784
|
-
const ta =
|
|
7736
|
+
const ta = touch(p.ax, p.ay, other);
|
|
7785
7737
|
if (ta !== undefined)
|
|
7786
7738
|
split(other, ta, p.a[0], p.a[1]);
|
|
7787
|
-
const tb =
|
|
7739
|
+
const tb = touch(p.bx, p.by, other);
|
|
7788
7740
|
if (tb !== undefined)
|
|
7789
7741
|
split(other, tb, p.b[0], p.b[1]);
|
|
7790
7742
|
}
|
|
@@ -8138,14 +8090,14 @@ function describe(graph, found, from, to) {
|
|
|
8138
8090
|
let code = "depart";
|
|
8139
8091
|
const flush = (endHop, nextCode) => {
|
|
8140
8092
|
const slice = hops.slice(stepStart, endHop);
|
|
8141
|
-
const
|
|
8093
|
+
const geometry = [slice[0].from, ...slice.map((h) => h.to)];
|
|
8142
8094
|
const road = slice.find((h) => h.road?.name)?.road ?? slice[0].road;
|
|
8143
8095
|
const name = road?.name;
|
|
8144
8096
|
const step = {
|
|
8145
8097
|
distance: slice.reduce((s, h) => s + h.length, 0),
|
|
8146
8098
|
duration: slice.reduce((s, h) => s + h.cost, 0),
|
|
8147
8099
|
instruction: formatInstruction(parseManeuver(code), { name }),
|
|
8148
|
-
geometry
|
|
8100
|
+
geometry,
|
|
8149
8101
|
maneuver: code
|
|
8150
8102
|
};
|
|
8151
8103
|
if (name)
|
|
@@ -8386,19 +8338,19 @@ function withOfflineFallback(online, offline) {
|
|
|
8386
8338
|
};
|
|
8387
8339
|
const isEmpty = (r) => r.length === 0;
|
|
8388
8340
|
if ("getDirections" in online) {
|
|
8389
|
-
const
|
|
8390
|
-
const
|
|
8341
|
+
const on = online;
|
|
8342
|
+
const off = offline;
|
|
8391
8343
|
return {
|
|
8392
|
-
name: `${
|
|
8393
|
-
getDirections: wrap(
|
|
8344
|
+
name: `${on.name}+offline`,
|
|
8345
|
+
getDirections: wrap(on.getDirections.bind(on), off.getDirections.bind(off), isEmpty)
|
|
8394
8346
|
};
|
|
8395
8347
|
}
|
|
8396
|
-
const
|
|
8397
|
-
const
|
|
8348
|
+
const on = online;
|
|
8349
|
+
const off = offline;
|
|
8398
8350
|
return {
|
|
8399
|
-
name: `${
|
|
8400
|
-
search: wrap(
|
|
8401
|
-
reverse: wrap(
|
|
8351
|
+
name: `${on.name}+offline`,
|
|
8352
|
+
search: wrap(on.search.bind(on), off.search.bind(off), isEmpty),
|
|
8353
|
+
reverse: wrap(on.reverse.bind(on), off.reverse.bind(off), isEmpty)
|
|
8402
8354
|
};
|
|
8403
8355
|
}
|
|
8404
8356
|
var PLACE_TYPES;
|
|
@@ -8486,7 +8438,7 @@ var init_OfflineMaps = __esm(() => {
|
|
|
8486
8438
|
init_plan();
|
|
8487
8439
|
init_router();
|
|
8488
8440
|
init_search();
|
|
8489
|
-
OfflineMaps = class
|
|
8441
|
+
OfflineMaps = class OfflineMaps extends Evented {
|
|
8490
8442
|
store;
|
|
8491
8443
|
concurrency;
|
|
8492
8444
|
maxTiles;
|
|
@@ -8993,7 +8945,7 @@ function buildTerrainMesh(opts) {
|
|
|
8993
8945
|
const upm = opts.unitsPerMeter ?? 1;
|
|
8994
8946
|
const verticesPerSide = resolution + 1;
|
|
8995
8947
|
const vertexCount = verticesPerSide * verticesPerSide;
|
|
8996
|
-
const
|
|
8948
|
+
const positions = new Float32Array(vertexCount * 6);
|
|
8997
8949
|
const step = tileSize / resolution;
|
|
8998
8950
|
const demStep = (demSize - 1) / resolution;
|
|
8999
8951
|
for (let j = 0;j < verticesPerSide; j++) {
|
|
@@ -9005,12 +8957,12 @@ function buildTerrainMesh(opts) {
|
|
|
9005
8957
|
const metres = sampleElevationBilinear(opts.elevation, demSize, du, dv);
|
|
9006
8958
|
const z = metres * exaggeration * upm;
|
|
9007
8959
|
const vi = (j * verticesPerSide + i) * 6;
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
8960
|
+
positions[vi] = x;
|
|
8961
|
+
positions[vi + 1] = y;
|
|
8962
|
+
positions[vi + 2] = z;
|
|
8963
|
+
positions[vi + 3] = 0;
|
|
8964
|
+
positions[vi + 4] = 0;
|
|
8965
|
+
positions[vi + 5] = 1;
|
|
9014
8966
|
}
|
|
9015
8967
|
}
|
|
9016
8968
|
for (let j = 0;j < verticesPerSide; j++) {
|
|
@@ -9019,10 +8971,10 @@ function buildTerrainMesh(opts) {
|
|
|
9019
8971
|
const ip = Math.min(verticesPerSide - 1, i + 1);
|
|
9020
8972
|
const jm = Math.max(0, j - 1);
|
|
9021
8973
|
const jp = Math.min(verticesPerSide - 1, j + 1);
|
|
9022
|
-
const zL =
|
|
9023
|
-
const zR =
|
|
9024
|
-
const zU =
|
|
9025
|
-
const zD =
|
|
8974
|
+
const zL = positions[(j * verticesPerSide + im) * 6 + 2];
|
|
8975
|
+
const zR = positions[(j * verticesPerSide + ip) * 6 + 2];
|
|
8976
|
+
const zU = positions[(jm * verticesPerSide + i) * 6 + 2];
|
|
8977
|
+
const zD = positions[(jp * verticesPerSide + i) * 6 + 2];
|
|
9026
8978
|
const dx = (ip - im) * step || 1;
|
|
9027
8979
|
const dy = (jp - jm) * step || 1;
|
|
9028
8980
|
const nx = -(zR - zL) / dx;
|
|
@@ -9030,9 +8982,9 @@ function buildTerrainMesh(opts) {
|
|
|
9030
8982
|
const nz = 1;
|
|
9031
8983
|
const len = Math.hypot(nx, ny, nz) || 1;
|
|
9032
8984
|
const base = (j * verticesPerSide + i) * 6;
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
8985
|
+
positions[base + 3] = nx / len;
|
|
8986
|
+
positions[base + 4] = ny / len;
|
|
8987
|
+
positions[base + 5] = nz / len;
|
|
9036
8988
|
}
|
|
9037
8989
|
}
|
|
9038
8990
|
const indices = new Uint32Array(resolution * resolution * 6);
|
|
@@ -9052,7 +9004,7 @@ function buildTerrainMesh(opts) {
|
|
|
9052
9004
|
}
|
|
9053
9005
|
}
|
|
9054
9006
|
return {
|
|
9055
|
-
positions
|
|
9007
|
+
positions,
|
|
9056
9008
|
indices,
|
|
9057
9009
|
vertexCount,
|
|
9058
9010
|
indexCount: indices.length,
|
|
@@ -9400,7 +9352,7 @@ function earcutLinked(earIn, triangles, dim, minX, minY, invSize, pass) {
|
|
|
9400
9352
|
let ear = earIn;
|
|
9401
9353
|
if (pass === 0 && invSize)
|
|
9402
9354
|
indexCurve(ear, minX, minY, invSize);
|
|
9403
|
-
let
|
|
9355
|
+
let stop = ear;
|
|
9404
9356
|
while (ear.prev !== ear.next) {
|
|
9405
9357
|
const prev = ear.prev;
|
|
9406
9358
|
const next = ear.next;
|
|
@@ -9408,11 +9360,11 @@ function earcutLinked(earIn, triangles, dim, minX, minY, invSize, pass) {
|
|
|
9408
9360
|
triangles.push(prev.i / dim | 0, ear.i / dim | 0, next.i / dim | 0);
|
|
9409
9361
|
removeNode(ear);
|
|
9410
9362
|
ear = next.next;
|
|
9411
|
-
|
|
9363
|
+
stop = next.next;
|
|
9412
9364
|
continue;
|
|
9413
9365
|
}
|
|
9414
9366
|
ear = next;
|
|
9415
|
-
if (ear ===
|
|
9367
|
+
if (ear === stop) {
|
|
9416
9368
|
if (pass === 0) {
|
|
9417
9369
|
earcutLinked(filterPoints(ear, null), triangles, dim, minX, minY, invSize, 1);
|
|
9418
9370
|
} else if (pass === 1) {
|
|
@@ -9575,7 +9527,7 @@ function findHoleBridge(hole, outerNode) {
|
|
|
9575
9527
|
} while (p !== outerNode);
|
|
9576
9528
|
if (!m)
|
|
9577
9529
|
return null;
|
|
9578
|
-
const
|
|
9530
|
+
const stop = m;
|
|
9579
9531
|
const mx = m.x;
|
|
9580
9532
|
const my = m.y;
|
|
9581
9533
|
let tanMin = Infinity;
|
|
@@ -9590,7 +9542,7 @@ function findHoleBridge(hole, outerNode) {
|
|
|
9590
9542
|
}
|
|
9591
9543
|
}
|
|
9592
9544
|
p = p.next;
|
|
9593
|
-
} while (p !==
|
|
9545
|
+
} while (p !== stop);
|
|
9594
9546
|
return m;
|
|
9595
9547
|
}
|
|
9596
9548
|
function indexCurve(startIn, minX, minY, invSize) {
|
|
@@ -9876,7 +9828,7 @@ ${src}`);
|
|
|
9876
9828
|
}
|
|
9877
9829
|
var WebGLUnsupportedError;
|
|
9878
9830
|
var init_GLContext = __esm(() => {
|
|
9879
|
-
WebGLUnsupportedError = class
|
|
9831
|
+
WebGLUnsupportedError = class WebGLUnsupportedError extends Error {
|
|
9880
9832
|
constructor(message) {
|
|
9881
9833
|
super(message ?? "WebGL2 is not supported in this environment.");
|
|
9882
9834
|
this.name = "WebGLUnsupportedError";
|
|
@@ -10102,8 +10054,8 @@ class WebGLTileRenderer {
|
|
|
10102
10054
|
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
10103
10055
|
this._disposeBuffer(buf);
|
|
10104
10056
|
}
|
|
10105
|
-
drawTerrain(
|
|
10106
|
-
if (
|
|
10057
|
+
drawTerrain(positions, indices, color, opacity, projectionMatrix) {
|
|
10058
|
+
if (positions.length === 0 || indices.length === 0)
|
|
10107
10059
|
return 0;
|
|
10108
10060
|
const prog = this._fillExtrusion ?? (this._fillExtrusion = this._buildFillExtrusionProgram());
|
|
10109
10061
|
const gl = this.ctx.gl;
|
|
@@ -10115,7 +10067,7 @@ class WebGLTileRenderer {
|
|
|
10115
10067
|
gl.uniform4f(prog.u_color, color[0], color[1], color[2], color[3]);
|
|
10116
10068
|
if (prog.u_opacity)
|
|
10117
10069
|
gl.uniform1f(prog.u_opacity, opacity);
|
|
10118
|
-
const vbo = this.ctx.createBuffer(
|
|
10070
|
+
const vbo = this.ctx.createBuffer(positions);
|
|
10119
10071
|
this._buffers.push(vbo);
|
|
10120
10072
|
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
|
|
10121
10073
|
const stride = 6 * 4;
|
|
@@ -10187,11 +10139,11 @@ class WebGLTileRenderer {
|
|
|
10187
10139
|
const cx = centers[i * 2];
|
|
10188
10140
|
const cy = centers[i * 2 + 1];
|
|
10189
10141
|
for (let v = 0;v < 6; v++) {
|
|
10190
|
-
const
|
|
10191
|
-
verts[
|
|
10192
|
-
verts[
|
|
10193
|
-
verts[
|
|
10194
|
-
verts[
|
|
10142
|
+
const off = (i * 6 + v) * 4;
|
|
10143
|
+
verts[off] = cx;
|
|
10144
|
+
verts[off + 1] = cy;
|
|
10145
|
+
verts[off + 2] = quadCorners[v * 2];
|
|
10146
|
+
verts[off + 3] = quadCorners[v * 2 + 1];
|
|
10195
10147
|
}
|
|
10196
10148
|
}
|
|
10197
10149
|
const buf = this.ctx.createBuffer(verts);
|
|
@@ -10294,10 +10246,10 @@ function tessellateLine(linestrip) {
|
|
|
10294
10246
|
ty += dy / len;
|
|
10295
10247
|
}
|
|
10296
10248
|
if (i < n - 1) {
|
|
10297
|
-
const
|
|
10298
|
-
const
|
|
10299
|
-
const dx =
|
|
10300
|
-
const dy =
|
|
10249
|
+
const nx = linestrip[(i + 1) * 2];
|
|
10250
|
+
const ny = linestrip[(i + 1) * 2 + 1];
|
|
10251
|
+
const dx = nx - x;
|
|
10252
|
+
const dy = ny - y;
|
|
10301
10253
|
const len = Math.hypot(dx, dy) || 1;
|
|
10302
10254
|
tx += dx / len;
|
|
10303
10255
|
ty += dy / len;
|
|
@@ -10366,15 +10318,15 @@ class GlyphAtlas {
|
|
|
10366
10318
|
this._shelfH = 0;
|
|
10367
10319
|
}
|
|
10368
10320
|
getOrAddGlyph(codePoint, style) {
|
|
10369
|
-
const
|
|
10321
|
+
const key = {
|
|
10370
10322
|
codePoint,
|
|
10371
10323
|
italic: !!style?.italic,
|
|
10372
10324
|
bold: !!style?.bold
|
|
10373
10325
|
};
|
|
10374
|
-
const existing = this._glyphs.get(cacheKey(
|
|
10326
|
+
const existing = this._glyphs.get(cacheKey(key));
|
|
10375
10327
|
if (existing)
|
|
10376
10328
|
return existing;
|
|
10377
|
-
return this._rasterize(
|
|
10329
|
+
return this._rasterize(key);
|
|
10378
10330
|
}
|
|
10379
10331
|
measure(text, style) {
|
|
10380
10332
|
let width = 0;
|
|
@@ -10528,11 +10480,11 @@ class GlyphAtlas {
|
|
|
10528
10480
|
}
|
|
10529
10481
|
return out;
|
|
10530
10482
|
}
|
|
10531
|
-
_rasterize(
|
|
10483
|
+
_rasterize(key) {
|
|
10532
10484
|
const ctx = this._ctx;
|
|
10533
10485
|
if (!ctx) {
|
|
10534
|
-
const
|
|
10535
|
-
codePoint:
|
|
10486
|
+
const metrics = {
|
|
10487
|
+
codePoint: key.codePoint,
|
|
10536
10488
|
x: 0,
|
|
10537
10489
|
y: 0,
|
|
10538
10490
|
width: 0,
|
|
@@ -10541,12 +10493,12 @@ class GlyphAtlas {
|
|
|
10541
10493
|
bearingX: 0,
|
|
10542
10494
|
bearingY: 0
|
|
10543
10495
|
};
|
|
10544
|
-
this._glyphs.set(cacheKey(
|
|
10545
|
-
return
|
|
10496
|
+
this._glyphs.set(cacheKey(key), metrics);
|
|
10497
|
+
return metrics;
|
|
10546
10498
|
}
|
|
10547
|
-
const font = this._buildFontSpec(
|
|
10499
|
+
const font = this._buildFontSpec(key);
|
|
10548
10500
|
ctx.font = font;
|
|
10549
|
-
const ch = String.fromCodePoint(
|
|
10501
|
+
const ch = String.fromCodePoint(key.codePoint);
|
|
10550
10502
|
const m = ctx.measureText(ch);
|
|
10551
10503
|
const advance = m.width && m.width > 0 ? m.width : this._fontSize * 0.6;
|
|
10552
10504
|
const ascent = m.actualBoundingBoxAscent && m.actualBoundingBoxAscent > 0 ? m.actualBoundingBoxAscent : this._fontSize * 0.8;
|
|
@@ -10585,7 +10537,7 @@ class GlyphAtlas {
|
|
|
10585
10537
|
if (bmpH > this._shelfH)
|
|
10586
10538
|
this._shelfH = bmpH;
|
|
10587
10539
|
const metrics = {
|
|
10588
|
-
codePoint:
|
|
10540
|
+
codePoint: key.codePoint,
|
|
10589
10541
|
x: dx,
|
|
10590
10542
|
y: dy,
|
|
10591
10543
|
width: bmpW,
|
|
@@ -10594,14 +10546,14 @@ class GlyphAtlas {
|
|
|
10594
10546
|
bearingX: -pad,
|
|
10595
10547
|
bearingY: ascent + pad
|
|
10596
10548
|
};
|
|
10597
|
-
this._glyphs.set(cacheKey(
|
|
10549
|
+
this._glyphs.set(cacheKey(key), metrics);
|
|
10598
10550
|
return metrics;
|
|
10599
10551
|
}
|
|
10600
|
-
_buildFontSpec(
|
|
10552
|
+
_buildFontSpec(key) {
|
|
10601
10553
|
const parts = [];
|
|
10602
|
-
if (
|
|
10554
|
+
if (key.italic)
|
|
10603
10555
|
parts.push("italic");
|
|
10604
|
-
if (
|
|
10556
|
+
if (key.bold)
|
|
10605
10557
|
parts.push("bold");
|
|
10606
10558
|
parts.push(`${this._fontSize}px`);
|
|
10607
10559
|
parts.push(this._fontFamily);
|
|
@@ -10695,7 +10647,7 @@ var init_Layer = __esm(() => {
|
|
|
10695
10647
|
init_Util();
|
|
10696
10648
|
init_Events();
|
|
10697
10649
|
init_Map();
|
|
10698
|
-
Layer = class
|
|
10650
|
+
Layer = class Layer extends Evented {
|
|
10699
10651
|
getEvents() {
|
|
10700
10652
|
return {};
|
|
10701
10653
|
}
|
|
@@ -10869,7 +10821,7 @@ var init_GridLayer = __esm(() => {
|
|
|
10869
10821
|
init_Bounds();
|
|
10870
10822
|
init_Point();
|
|
10871
10823
|
init_Layer();
|
|
10872
|
-
GridLayer = class
|
|
10824
|
+
GridLayer = class GridLayer extends Layer {
|
|
10873
10825
|
_onMove;
|
|
10874
10826
|
initialize(options) {
|
|
10875
10827
|
setOptions(this, options);
|
|
@@ -10964,16 +10916,16 @@ var init_GridLayer = __esm(() => {
|
|
|
10964
10916
|
if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null)
|
|
10965
10917
|
this._container.style.zIndex = this.options.zIndex;
|
|
10966
10918
|
}
|
|
10967
|
-
_setAutoZIndex(
|
|
10919
|
+
_setAutoZIndex(compare) {
|
|
10968
10920
|
const layers = this.getPane().children;
|
|
10969
|
-
let edgeZIndex = -
|
|
10921
|
+
let edgeZIndex = -compare(-Infinity, Infinity);
|
|
10970
10922
|
for (const layer of Array.from(layers)) {
|
|
10971
10923
|
const zIndex = layer.style.zIndex;
|
|
10972
10924
|
if (layer !== this._container && zIndex)
|
|
10973
|
-
edgeZIndex =
|
|
10925
|
+
edgeZIndex = compare(edgeZIndex, +zIndex);
|
|
10974
10926
|
}
|
|
10975
10927
|
if (Number.isFinite(edgeZIndex)) {
|
|
10976
|
-
this.options.zIndex = edgeZIndex +
|
|
10928
|
+
this.options.zIndex = edgeZIndex + compare(-1, 1);
|
|
10977
10929
|
this._updateZIndex();
|
|
10978
10930
|
}
|
|
10979
10931
|
}
|
|
@@ -11075,20 +11027,20 @@ var init_GridLayer = __esm(() => {
|
|
|
11075
11027
|
this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2);
|
|
11076
11028
|
}
|
|
11077
11029
|
}
|
|
11078
|
-
for (const [
|
|
11030
|
+
for (const [key, tile] of Object.entries(this._tiles)) {
|
|
11079
11031
|
if (!tile.retain)
|
|
11080
|
-
this._removeTile(
|
|
11032
|
+
this._removeTile(key);
|
|
11081
11033
|
}
|
|
11082
11034
|
}
|
|
11083
11035
|
_removeTilesAtZoom(zoom) {
|
|
11084
|
-
for (const [
|
|
11036
|
+
for (const [key, tile] of Object.entries(this._tiles)) {
|
|
11085
11037
|
if (tile.coords.z === zoom)
|
|
11086
|
-
this._removeTile(
|
|
11038
|
+
this._removeTile(key);
|
|
11087
11039
|
}
|
|
11088
11040
|
}
|
|
11089
11041
|
_removeAllTiles() {
|
|
11090
|
-
for (const
|
|
11091
|
-
this._removeTile(
|
|
11042
|
+
for (const key of Object.keys(this._tiles))
|
|
11043
|
+
this._removeTile(key);
|
|
11092
11044
|
}
|
|
11093
11045
|
_invalidateAll() {
|
|
11094
11046
|
for (const z of Object.keys(this._levels)) {
|
|
@@ -11105,8 +11057,8 @@ var init_GridLayer = __esm(() => {
|
|
|
11105
11057
|
const z2 = z - 1;
|
|
11106
11058
|
const coords2 = new Point(x2, y2);
|
|
11107
11059
|
coords2.z = z2;
|
|
11108
|
-
const
|
|
11109
|
-
const tile = this._tiles[
|
|
11060
|
+
const key = this._tileCoordsToKey(coords2);
|
|
11061
|
+
const tile = this._tiles[key];
|
|
11110
11062
|
if (tile?.active) {
|
|
11111
11063
|
tile.retain = true;
|
|
11112
11064
|
return true;
|
|
@@ -11122,8 +11074,8 @@ var init_GridLayer = __esm(() => {
|
|
|
11122
11074
|
for (let j = 2 * y;j < 2 * y + 2; j++) {
|
|
11123
11075
|
const coords = new Point(i, j);
|
|
11124
11076
|
coords.z = z + 1;
|
|
11125
|
-
const
|
|
11126
|
-
const tile = this._tiles[
|
|
11077
|
+
const key = this._tileCoordsToKey(coords);
|
|
11078
|
+
const tile = this._tiles[key];
|
|
11127
11079
|
if (tile?.active) {
|
|
11128
11080
|
tile.retain = true;
|
|
11129
11081
|
continue;
|
|
@@ -11241,9 +11193,9 @@ var init_GridLayer = __esm(() => {
|
|
|
11241
11193
|
});
|
|
11242
11194
|
const pitch = map._pitch;
|
|
11243
11195
|
const geometry = pitch ? map._cameraGeometry() : null;
|
|
11244
|
-
const
|
|
11245
|
-
const sinB = Math.sin(
|
|
11246
|
-
const cosB = Math.cos(
|
|
11196
|
+
const bearing = -map._bearing * Math.PI / 180;
|
|
11197
|
+
const sinB = Math.sin(bearing);
|
|
11198
|
+
const cosB = Math.cos(bearing);
|
|
11247
11199
|
const sinT = Math.sin(pitch * Math.PI / 180);
|
|
11248
11200
|
const magnification = (x, y) => {
|
|
11249
11201
|
if (!geometry)
|
|
@@ -11262,11 +11214,11 @@ var init_GridLayer = __esm(() => {
|
|
|
11262
11214
|
coords.z = z;
|
|
11263
11215
|
if (!this._isValidTile(coords))
|
|
11264
11216
|
return;
|
|
11265
|
-
const
|
|
11266
|
-
const x0 = x * T *
|
|
11267
|
-
const y0 = y * T *
|
|
11268
|
-
const x1 = x0 + T *
|
|
11269
|
-
const y1 = y0 + T *
|
|
11217
|
+
const k = map.getZoomScale(mapZoom, z);
|
|
11218
|
+
const x0 = x * T * k - centerPx.x;
|
|
11219
|
+
const y0 = y * T * k - centerPx.y;
|
|
11220
|
+
const x1 = x0 + T * k;
|
|
11221
|
+
const y1 = y0 + T * k;
|
|
11270
11222
|
if (!rectTouchesPolygon(x0, y0, x1, y1, poly))
|
|
11271
11223
|
return;
|
|
11272
11224
|
const s = Math.max(magnification(x0, y0), magnification(x1, y0), magnification(x0, y1), magnification(x1, y1));
|
|
@@ -11295,11 +11247,11 @@ var init_GridLayer = __esm(() => {
|
|
|
11295
11247
|
for (let x = Math.floor((centerPx.x + minX) / k);x <= Math.floor((centerPx.x + maxX) / k); x++)
|
|
11296
11248
|
visit(x, y, minZ);
|
|
11297
11249
|
}
|
|
11298
|
-
const
|
|
11250
|
+
const distance = (c) => {
|
|
11299
11251
|
const kk = map.getZoomScale(mapZoom, c.z) * T;
|
|
11300
11252
|
return Math.hypot((c.x + 0.5) * kk - centerPx.x, (c.y + 0.5) * kk - centerPx.y);
|
|
11301
11253
|
};
|
|
11302
|
-
return out.sort((a, b) => b.z - a.z ||
|
|
11254
|
+
return out.sort((a, b) => b.z - a.z || distance(a) - distance(b));
|
|
11303
11255
|
}
|
|
11304
11256
|
_onMoveEnd() {
|
|
11305
11257
|
if (!this._map || this._map._animatingZoom)
|
|
@@ -11338,12 +11290,12 @@ var init_GridLayer = __esm(() => {
|
|
|
11338
11290
|
if (this._tileZoom === undefined)
|
|
11339
11291
|
return;
|
|
11340
11292
|
const pixelBounds = this._getTiledPixelBounds(center);
|
|
11341
|
-
const
|
|
11342
|
-
const tileCenter =
|
|
11293
|
+
const tileRange = this._pxBoundsToTileRange(pixelBounds);
|
|
11294
|
+
const tileCenter = tileRange.getCenter();
|
|
11343
11295
|
const queue = [];
|
|
11344
11296
|
const margin = this.options.keepBuffer;
|
|
11345
|
-
const noPruneRange = new Bounds(
|
|
11346
|
-
if (!(Number.isFinite(
|
|
11297
|
+
const noPruneRange = new Bounds(tileRange.getBottomLeft().subtract([margin, -margin]), tileRange.getTopRight().add([margin, -margin]));
|
|
11298
|
+
if (!(Number.isFinite(tileRange.min.x) && Number.isFinite(tileRange.min.y) && Number.isFinite(tileRange.max.x) && Number.isFinite(tileRange.max.y))) {
|
|
11347
11299
|
throw new Error("Attempted to load an infinite number of tiles");
|
|
11348
11300
|
}
|
|
11349
11301
|
for (const tile of Object.values(this._tiles)) {
|
|
@@ -11359,8 +11311,8 @@ var init_GridLayer = __esm(() => {
|
|
|
11359
11311
|
this._updateCovering(center);
|
|
11360
11312
|
return;
|
|
11361
11313
|
}
|
|
11362
|
-
for (let j =
|
|
11363
|
-
for (let i =
|
|
11314
|
+
for (let j = tileRange.min.y;j <= tileRange.max.y; j++) {
|
|
11315
|
+
for (let i = tileRange.min.x;i <= tileRange.max.x; i++) {
|
|
11364
11316
|
const coords = new Point(i, j);
|
|
11365
11317
|
coords.z = this._tileZoom;
|
|
11366
11318
|
if (!this._isValidTile(coords))
|
|
@@ -11427,8 +11379,8 @@ var init_GridLayer = __esm(() => {
|
|
|
11427
11379
|
const tileBounds = this._tileCoordsToBounds(coords);
|
|
11428
11380
|
return new LatLngBounds(this.options.bounds).overlaps(tileBounds);
|
|
11429
11381
|
}
|
|
11430
|
-
_keyToBounds(
|
|
11431
|
-
return this._tileCoordsToBounds(this._keyToTileCoords(
|
|
11382
|
+
_keyToBounds(key) {
|
|
11383
|
+
return this._tileCoordsToBounds(this._keyToTileCoords(key));
|
|
11432
11384
|
}
|
|
11433
11385
|
_tileCoordsToNwSe(coords) {
|
|
11434
11386
|
const map = this._map;
|
|
@@ -11449,19 +11401,19 @@ var init_GridLayer = __esm(() => {
|
|
|
11449
11401
|
_tileCoordsToKey(coords) {
|
|
11450
11402
|
return `${coords.x}:${coords.y}:${coords.z}`;
|
|
11451
11403
|
}
|
|
11452
|
-
_keyToTileCoords(
|
|
11453
|
-
const k =
|
|
11404
|
+
_keyToTileCoords(key) {
|
|
11405
|
+
const k = key.split(":");
|
|
11454
11406
|
const coords = new Point(+k[0], +k[1]);
|
|
11455
11407
|
coords.z = +k[2];
|
|
11456
11408
|
return coords;
|
|
11457
11409
|
}
|
|
11458
|
-
_removeTile(
|
|
11459
|
-
const tile = this._tiles[
|
|
11410
|
+
_removeTile(key) {
|
|
11411
|
+
const tile = this._tiles[key];
|
|
11460
11412
|
if (!tile)
|
|
11461
11413
|
return;
|
|
11462
11414
|
tile.el.remove();
|
|
11463
|
-
delete this._tiles[
|
|
11464
|
-
this.fire("tileunload", { tile: tile.el, coords: this._keyToTileCoords(
|
|
11415
|
+
delete this._tiles[key];
|
|
11416
|
+
this.fire("tileunload", { tile: tile.el, coords: this._keyToTileCoords(key) });
|
|
11465
11417
|
}
|
|
11466
11418
|
_initTile(tile) {
|
|
11467
11419
|
tile.classList.add("tsmap-tile");
|
|
@@ -11473,21 +11425,21 @@ var init_GridLayer = __esm(() => {
|
|
|
11473
11425
|
}
|
|
11474
11426
|
_addTile(coords, container) {
|
|
11475
11427
|
const tilePos = this._getTilePos(coords);
|
|
11476
|
-
const
|
|
11428
|
+
const key = this._tileCoordsToKey(coords);
|
|
11477
11429
|
const tile = this.createTile(this._wrapCoords(coords), this._tileReady.bind(this, coords));
|
|
11478
11430
|
this._initTile(tile);
|
|
11479
11431
|
if (this.createTile.length < 2)
|
|
11480
11432
|
requestAnimationFrame(this._tileReady.bind(this, coords, null, tile));
|
|
11481
11433
|
setPosition(tile, tilePos);
|
|
11482
|
-
this._tiles[
|
|
11434
|
+
this._tiles[key] = { el: tile, coords, current: true };
|
|
11483
11435
|
container.appendChild(tile);
|
|
11484
11436
|
this.fire("tileloadstart", { tile, coords });
|
|
11485
11437
|
}
|
|
11486
11438
|
_tileReady(coords, err, tile) {
|
|
11487
11439
|
if (err)
|
|
11488
11440
|
this.fire("tileerror", { error: err, tile, coords });
|
|
11489
|
-
const
|
|
11490
|
-
const entry = this._tiles[
|
|
11441
|
+
const key = this._tileCoordsToKey(coords);
|
|
11442
|
+
const entry = this._tiles[key];
|
|
11491
11443
|
if (!entry)
|
|
11492
11444
|
return;
|
|
11493
11445
|
entry.loaded = Date.now();
|
|
@@ -11558,7 +11510,7 @@ var init_TileLayer = __esm(() => {
|
|
|
11558
11510
|
init_OfflineMaps();
|
|
11559
11511
|
init_storage();
|
|
11560
11512
|
init_GridLayer();
|
|
11561
|
-
TileLayer = class
|
|
11513
|
+
TileLayer = class TileLayer extends GridLayer {
|
|
11562
11514
|
initialize(url, options) {
|
|
11563
11515
|
super.initialize(options);
|
|
11564
11516
|
this._url = url;
|
|
@@ -11712,8 +11664,8 @@ var init_TileLayer = __esm(() => {
|
|
|
11712
11664
|
}
|
|
11713
11665
|
}
|
|
11714
11666
|
}
|
|
11715
|
-
_removeTile(
|
|
11716
|
-
const tile = this._tiles[
|
|
11667
|
+
_removeTile(key) {
|
|
11668
|
+
const tile = this._tiles[key];
|
|
11717
11669
|
if (!tile)
|
|
11718
11670
|
return;
|
|
11719
11671
|
const el = tile.el;
|
|
@@ -11725,7 +11677,7 @@ var init_TileLayer = __esm(() => {
|
|
|
11725
11677
|
this._activeBlobUrls.delete(src);
|
|
11726
11678
|
}
|
|
11727
11679
|
el.setAttribute("src", "");
|
|
11728
|
-
super._removeTile(
|
|
11680
|
+
super._removeTile(key);
|
|
11729
11681
|
}
|
|
11730
11682
|
_tileReady(coords, err, tile) {
|
|
11731
11683
|
if (!this._map || tile && tile.getAttribute("src") === "")
|
|
@@ -11773,9 +11725,9 @@ class FlatTileFeature {
|
|
|
11773
11725
|
const start = layer.tagStart[this._index];
|
|
11774
11726
|
const end = layer.tagStart[this._index + 1];
|
|
11775
11727
|
for (let i = start;i + 1 < end; i += 2) {
|
|
11776
|
-
const
|
|
11777
|
-
if (
|
|
11778
|
-
out[
|
|
11728
|
+
const key = layer.keys[layer.tags[i]];
|
|
11729
|
+
if (key !== undefined)
|
|
11730
|
+
out[key] = layer.values[layer.tags[i + 1]];
|
|
11779
11731
|
}
|
|
11780
11732
|
this._properties = out;
|
|
11781
11733
|
return out;
|
|
@@ -11890,33 +11842,33 @@ function decodeMvtFlat(bytes) {
|
|
|
11890
11842
|
value |= (byte & 15) << 28;
|
|
11891
11843
|
high = (byte & 112) >> 4;
|
|
11892
11844
|
if (byte < 128)
|
|
11893
|
-
return
|
|
11845
|
+
return toNum(value, high, isSigned === true);
|
|
11894
11846
|
const shifts = [3, 10, 17, 24];
|
|
11895
11847
|
for (const shift of shifts) {
|
|
11896
11848
|
byte = buf[pos++];
|
|
11897
11849
|
high |= (byte & 127) << shift;
|
|
11898
11850
|
if (byte < 128)
|
|
11899
|
-
return
|
|
11851
|
+
return toNum(value, high, isSigned === true);
|
|
11900
11852
|
}
|
|
11901
11853
|
byte = buf[pos++];
|
|
11902
11854
|
high |= (byte & 1) << 31;
|
|
11903
11855
|
if (byte < 128)
|
|
11904
|
-
return
|
|
11856
|
+
return toNum(value, high, isSigned === true);
|
|
11905
11857
|
throw new Error("Expected varint not more than 10 bytes");
|
|
11906
11858
|
}
|
|
11907
|
-
function
|
|
11908
|
-
const
|
|
11859
|
+
function toNum(low, high, isSigned) {
|
|
11860
|
+
const SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
|
|
11909
11861
|
if (isSigned && (high & 2147483648) !== 0) {
|
|
11910
11862
|
const negLow = ~low + 1 >>> 0;
|
|
11911
11863
|
let negHigh = ~high >>> 0;
|
|
11912
11864
|
if (negLow === 0)
|
|
11913
11865
|
negHigh = negHigh + 1 >>> 0;
|
|
11914
|
-
const mag = negHigh *
|
|
11866
|
+
const mag = negHigh * SHIFT_LEFT_32 + negLow;
|
|
11915
11867
|
if (mag > Number.MAX_SAFE_INTEGER)
|
|
11916
11868
|
throw new Error("Varint exceeds safe integer range");
|
|
11917
11869
|
return -mag;
|
|
11918
11870
|
}
|
|
11919
|
-
const val = (high >>> 0) *
|
|
11871
|
+
const val = (high >>> 0) * SHIFT_LEFT_32 + (low >>> 0);
|
|
11920
11872
|
if (val > Number.MAX_SAFE_INTEGER)
|
|
11921
11873
|
throw new Error("Varint exceeds safe integer range");
|
|
11922
11874
|
return val;
|
|
@@ -11962,9 +11914,9 @@ function decodeMvtFlat(bytes) {
|
|
|
11962
11914
|
const end = readVarint() + pos;
|
|
11963
11915
|
let value = null;
|
|
11964
11916
|
while (pos < end) {
|
|
11965
|
-
const
|
|
11966
|
-
const tag =
|
|
11967
|
-
const wire =
|
|
11917
|
+
const key = readVarint();
|
|
11918
|
+
const tag = key >> 3;
|
|
11919
|
+
const wire = key & 7;
|
|
11968
11920
|
if (tag === 1) {
|
|
11969
11921
|
value = readString(readVarint() + pos);
|
|
11970
11922
|
} else if (tag === 2) {
|
|
@@ -11988,9 +11940,9 @@ function decodeMvtFlat(bytes) {
|
|
|
11988
11940
|
}
|
|
11989
11941
|
const layers = [];
|
|
11990
11942
|
while (pos < len) {
|
|
11991
|
-
const
|
|
11992
|
-
const tag =
|
|
11993
|
-
const wire =
|
|
11943
|
+
const key = readVarint();
|
|
11944
|
+
const tag = key >> 3;
|
|
11945
|
+
const wire = key & 7;
|
|
11994
11946
|
if (tag !== 3) {
|
|
11995
11947
|
skip(wire);
|
|
11996
11948
|
continue;
|
|
@@ -12629,14 +12581,14 @@ class RTree {
|
|
|
12629
12581
|
let minArea = bboxArea(target.bbox);
|
|
12630
12582
|
for (let i = 1;i < children.length; i++) {
|
|
12631
12583
|
const c = children[i];
|
|
12632
|
-
const
|
|
12633
|
-
const enlargement = enlargedArea(c.bbox, record.bbox) -
|
|
12584
|
+
const area = bboxArea(c.bbox);
|
|
12585
|
+
const enlargement = enlargedArea(c.bbox, record.bbox) - area;
|
|
12634
12586
|
if (enlargement < minEnlargement) {
|
|
12635
12587
|
minEnlargement = enlargement;
|
|
12636
|
-
minArea =
|
|
12588
|
+
minArea = area;
|
|
12637
12589
|
target = c;
|
|
12638
|
-
} else if (enlargement === minEnlargement &&
|
|
12639
|
-
minArea =
|
|
12590
|
+
} else if (enlargement === minEnlargement && area < minArea) {
|
|
12591
|
+
minArea = area;
|
|
12640
12592
|
target = c;
|
|
12641
12593
|
}
|
|
12642
12594
|
}
|
|
@@ -12667,11 +12619,11 @@ class RTree {
|
|
|
12667
12619
|
let minArea = bboxArea(target.bbox);
|
|
12668
12620
|
for (let i = 1;i < children.length; i++) {
|
|
12669
12621
|
const c = children[i];
|
|
12670
|
-
const
|
|
12671
|
-
const enlargement = enlargedArea(c.bbox, sub.bbox) -
|
|
12622
|
+
const area = bboxArea(c.bbox);
|
|
12623
|
+
const enlargement = enlargedArea(c.bbox, sub.bbox) - area;
|
|
12672
12624
|
if (enlargement < minEnlargement) {
|
|
12673
12625
|
minEnlargement = enlargement;
|
|
12674
|
-
minArea =
|
|
12626
|
+
minArea = area;
|
|
12675
12627
|
target = c;
|
|
12676
12628
|
}
|
|
12677
12629
|
}
|
|
@@ -12758,13 +12710,13 @@ class RTree {
|
|
|
12758
12710
|
for (let k = i;k < total; k++)
|
|
12759
12711
|
extend(rightBBox, children[k].bbox);
|
|
12760
12712
|
const overlap = intersectionArea(leftBBox, rightBBox);
|
|
12761
|
-
const
|
|
12713
|
+
const area = bboxArea(leftBBox) + bboxArea(rightBBox);
|
|
12762
12714
|
if (overlap < minOverlap) {
|
|
12763
12715
|
minOverlap = overlap;
|
|
12764
|
-
minArea =
|
|
12716
|
+
minArea = area;
|
|
12765
12717
|
index = i;
|
|
12766
|
-
} else if (overlap === minOverlap &&
|
|
12767
|
-
minArea =
|
|
12718
|
+
} else if (overlap === minOverlap && area < minArea) {
|
|
12719
|
+
minArea = area;
|
|
12768
12720
|
index = i;
|
|
12769
12721
|
}
|
|
12770
12722
|
}
|
|
@@ -12831,9 +12783,9 @@ function compareCentroidX(a, b) {
|
|
|
12831
12783
|
function compareCentroidY(a, b) {
|
|
12832
12784
|
return a.bbox[1] + a.bbox[3] - (b.bbox[1] + b.bbox[3]);
|
|
12833
12785
|
}
|
|
12834
|
-
function multiSelectSort(arr, left, right, step,
|
|
12786
|
+
function multiSelectSort(arr, left, right, step, compare) {
|
|
12835
12787
|
const slice = arr.slice(left, right + 1);
|
|
12836
|
-
slice.sort(
|
|
12788
|
+
slice.sort(compare);
|
|
12837
12789
|
for (let i = 0;i < slice.length; i++)
|
|
12838
12790
|
arr[left + i] = slice[i];
|
|
12839
12791
|
}
|
|
@@ -12893,15 +12845,15 @@ class CollisionIndex {
|
|
|
12893
12845
|
const cells = this._ownerCells.get(owner);
|
|
12894
12846
|
if (!cells)
|
|
12895
12847
|
return;
|
|
12896
|
-
for (const
|
|
12897
|
-
const bucket = this._cells.get(
|
|
12848
|
+
for (const key of cells) {
|
|
12849
|
+
const bucket = this._cells.get(key);
|
|
12898
12850
|
if (!bucket)
|
|
12899
12851
|
continue;
|
|
12900
12852
|
const kept = bucket.filter((box) => box.owner !== owner);
|
|
12901
12853
|
if (kept.length)
|
|
12902
|
-
this._cells.set(
|
|
12854
|
+
this._cells.set(key, kept);
|
|
12903
12855
|
else
|
|
12904
|
-
this._cells.delete(
|
|
12856
|
+
this._cells.delete(key);
|
|
12905
12857
|
}
|
|
12906
12858
|
this._ownerCells.delete(owner);
|
|
12907
12859
|
}
|
|
@@ -12937,13 +12889,13 @@ class CollisionIndex {
|
|
|
12937
12889
|
}
|
|
12938
12890
|
for (let cy = range.y0;cy <= range.y1; cy++) {
|
|
12939
12891
|
for (let cx = range.x0;cx <= range.x1; cx++) {
|
|
12940
|
-
const
|
|
12941
|
-
const bucket = this._cells.get(
|
|
12892
|
+
const key = cellKey(cx, cy);
|
|
12893
|
+
const bucket = this._cells.get(key);
|
|
12942
12894
|
if (bucket)
|
|
12943
12895
|
bucket.push(box);
|
|
12944
12896
|
else
|
|
12945
|
-
this._cells.set(
|
|
12946
|
-
ownerCells?.add(
|
|
12897
|
+
this._cells.set(key, [box]);
|
|
12898
|
+
ownerCells?.add(key);
|
|
12947
12899
|
}
|
|
12948
12900
|
}
|
|
12949
12901
|
}
|
|
@@ -13004,22 +12956,22 @@ function drawSections(ctx, atlas, sections, x, y, base) {
|
|
|
13004
12956
|
}
|
|
13005
12957
|
function renderSdfPixels(field, width, height, options) {
|
|
13006
12958
|
const out = new Uint8ClampedArray(width * height * 4);
|
|
13007
|
-
const
|
|
12959
|
+
const fill = parseColor2(options.color);
|
|
13008
12960
|
const haloWidth = options.haloWidth ?? 0;
|
|
13009
12961
|
const halo = options.haloColor && haloWidth > 0 ? parseColor2(options.haloColor) : null;
|
|
13010
12962
|
const haloEdge = halo ? Math.max(0.02, 0.5 - haloWidth / 16) : 0;
|
|
13011
12963
|
const band = 0.06;
|
|
13012
12964
|
for (let i = 0;i < width * height; i++) {
|
|
13013
|
-
const
|
|
13014
|
-
const inside = smoothstep(0.5 - band, 0.5 + band,
|
|
13015
|
-
const outline = halo ? smoothstep(haloEdge - band, haloEdge + band,
|
|
12965
|
+
const distance = field[i * 4 + 3] / 255;
|
|
12966
|
+
const inside = smoothstep(0.5 - band, 0.5 + band, distance);
|
|
12967
|
+
const outline = halo ? smoothstep(haloEdge - band, haloEdge + band, distance) : 0;
|
|
13016
12968
|
const alpha = inside + outline * (1 - inside);
|
|
13017
12969
|
if (alpha <= 0)
|
|
13018
12970
|
continue;
|
|
13019
12971
|
const weight = outline * (1 - inside);
|
|
13020
|
-
out[i * 4] = halo ? (
|
|
13021
|
-
out[i * 4 + 1] = halo ? (
|
|
13022
|
-
out[i * 4 + 2] = halo ? (
|
|
12972
|
+
out[i * 4] = halo ? (fill[0] * inside + halo[0] * weight) / alpha : fill[0];
|
|
12973
|
+
out[i * 4 + 1] = halo ? (fill[1] * inside + halo[1] * weight) / alpha : fill[1];
|
|
12974
|
+
out[i * 4 + 2] = halo ? (fill[2] * inside + halo[2] * weight) / alpha : fill[2];
|
|
13023
12975
|
out[i * 4 + 3] = Math.round(alpha * 255);
|
|
13024
12976
|
}
|
|
13025
12977
|
return out;
|
|
@@ -13060,10 +13012,10 @@ function parseColor2(color) {
|
|
|
13060
13012
|
function probeColor(color) {
|
|
13061
13013
|
if (typeof document === "undefined")
|
|
13062
13014
|
return [0, 0, 0];
|
|
13063
|
-
const
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
const ctx =
|
|
13015
|
+
const probe = document.createElement("canvas");
|
|
13016
|
+
probe.width = 1;
|
|
13017
|
+
probe.height = 1;
|
|
13018
|
+
const ctx = probe.getContext("2d");
|
|
13067
13019
|
if (!ctx)
|
|
13068
13020
|
return [0, 0, 0];
|
|
13069
13021
|
ctx.fillStyle = color;
|
|
@@ -13153,13 +13105,13 @@ class GlyphBitmapCache {
|
|
|
13153
13105
|
this._limit = limit;
|
|
13154
13106
|
}
|
|
13155
13107
|
get(glyph, options) {
|
|
13156
|
-
const
|
|
13157
|
-
if (this._entries.has(
|
|
13158
|
-
return this._entries.get(
|
|
13108
|
+
const key = `${glyph.id}|${options.color}|${options.haloColor ?? ""}|${options.haloWidth ?? 0}`;
|
|
13109
|
+
if (this._entries.has(key))
|
|
13110
|
+
return this._entries.get(key) ?? null;
|
|
13159
13111
|
const bitmap = renderGlyphBitmap(glyph, options);
|
|
13160
13112
|
if (this._entries.size >= this._limit)
|
|
13161
13113
|
this._entries.clear();
|
|
13162
|
-
this._entries.set(
|
|
13114
|
+
this._entries.set(key, bitmap);
|
|
13163
13115
|
return bitmap;
|
|
13164
13116
|
}
|
|
13165
13117
|
clear() {
|
|
@@ -13376,8 +13328,8 @@ class IconAtlas {
|
|
|
13376
13328
|
const color = opts?.color ?? "#000000";
|
|
13377
13329
|
const haloColor = opts?.haloColor;
|
|
13378
13330
|
const haloWidth = opts?.haloWidth ?? 0;
|
|
13379
|
-
const
|
|
13380
|
-
const cached = this._sdfCache.get(
|
|
13331
|
+
const key = `${entry.id}|${color}|${haloColor ?? ""}|${haloWidth}`;
|
|
13332
|
+
const cached = this._sdfCache.get(key);
|
|
13381
13333
|
if (cached)
|
|
13382
13334
|
return cached;
|
|
13383
13335
|
const w = entry.width;
|
|
@@ -13400,7 +13352,7 @@ class IconAtlas {
|
|
|
13400
13352
|
octx.putImageData(pixels, 0, 0);
|
|
13401
13353
|
if (this._sdfCache.size > 128)
|
|
13402
13354
|
this._sdfCache.clear();
|
|
13403
|
-
this._sdfCache.set(
|
|
13355
|
+
this._sdfCache.set(key, out);
|
|
13404
13356
|
return out;
|
|
13405
13357
|
}
|
|
13406
13358
|
_grow(newSide) {
|
|
@@ -13503,8 +13455,8 @@ function lineLength(line) {
|
|
|
13503
13455
|
}
|
|
13504
13456
|
return total;
|
|
13505
13457
|
}
|
|
13506
|
-
function pointAtDistance(line,
|
|
13507
|
-
if (line.length < 2 ||
|
|
13458
|
+
function pointAtDistance(line, distance) {
|
|
13459
|
+
if (line.length < 2 || distance < 0)
|
|
13508
13460
|
return null;
|
|
13509
13461
|
let travelled = 0;
|
|
13510
13462
|
for (let i = 1;i < line.length; i++) {
|
|
@@ -13515,8 +13467,8 @@ function pointAtDistance(line, distance2) {
|
|
|
13515
13467
|
const segment = Math.hypot(dx, dy);
|
|
13516
13468
|
if (segment === 0)
|
|
13517
13469
|
continue;
|
|
13518
|
-
if (travelled + segment >=
|
|
13519
|
-
const t = (
|
|
13470
|
+
if (travelled + segment >= distance) {
|
|
13471
|
+
const t = (distance - travelled) / segment;
|
|
13520
13472
|
return { x: a.x + dx * t, y: a.y + dy * t, angle: Math.atan2(dy, dx) };
|
|
13521
13473
|
}
|
|
13522
13474
|
travelled += segment;
|
|
@@ -13609,10 +13561,10 @@ class LabelPlacer {
|
|
|
13609
13561
|
for (const seen of this._lastSeen.get(label.identity) ?? []) {
|
|
13610
13562
|
const dx = seen.x - x;
|
|
13611
13563
|
const dy = seen.y - y;
|
|
13612
|
-
const
|
|
13613
|
-
if (
|
|
13564
|
+
const distance = dx * dx + dy * dy;
|
|
13565
|
+
if (distance <= bestDistance) {
|
|
13614
13566
|
best = seen.state;
|
|
13615
|
-
bestDistance =
|
|
13567
|
+
bestDistance = distance;
|
|
13616
13568
|
}
|
|
13617
13569
|
}
|
|
13618
13570
|
if (best)
|
|
@@ -13721,9 +13673,9 @@ class LabelPlacer {
|
|
|
13721
13673
|
if (state.opacity > 0)
|
|
13722
13674
|
shown.push(item);
|
|
13723
13675
|
}
|
|
13724
|
-
for (const
|
|
13725
|
-
if (!seen.has(
|
|
13726
|
-
this._states.delete(
|
|
13676
|
+
for (const key of this._states.keys()) {
|
|
13677
|
+
if (!seen.has(key))
|
|
13678
|
+
this._states.delete(key);
|
|
13727
13679
|
}
|
|
13728
13680
|
this._lastSeen = points;
|
|
13729
13681
|
for (let i = shown.length - 1;i >= 0; i--) {
|
|
@@ -13761,25 +13713,25 @@ class LabelPlacer {
|
|
|
13761
13713
|
ctx.drawImage(sprite.canvas, -sprite.ox, -sprite.oy);
|
|
13762
13714
|
}
|
|
13763
13715
|
}
|
|
13764
|
-
_sprite(
|
|
13765
|
-
const cached = this._sprites.get(
|
|
13716
|
+
_sprite(key, build) {
|
|
13717
|
+
const cached = this._sprites.get(key);
|
|
13766
13718
|
if (cached !== undefined) {
|
|
13767
|
-
this._sprites.delete(
|
|
13768
|
-
this._sprites.set(
|
|
13719
|
+
this._sprites.delete(key);
|
|
13720
|
+
this._sprites.set(key, cached);
|
|
13769
13721
|
return cached;
|
|
13770
13722
|
}
|
|
13771
13723
|
const sprite = build();
|
|
13772
|
-
this._sprites.set(
|
|
13724
|
+
this._sprites.set(key, sprite);
|
|
13773
13725
|
return sprite;
|
|
13774
13726
|
}
|
|
13775
13727
|
_trimSprites() {
|
|
13776
13728
|
if (this._sprites.size <= SPRITE_CACHE_LIMIT)
|
|
13777
13729
|
return;
|
|
13778
13730
|
let excess = this._sprites.size - SPRITE_CACHE_LIMIT * 0.75;
|
|
13779
|
-
for (const
|
|
13731
|
+
for (const key of this._sprites.keys()) {
|
|
13780
13732
|
if (excess-- <= 0)
|
|
13781
13733
|
break;
|
|
13782
|
-
this._sprites.delete(
|
|
13734
|
+
this._sprites.delete(key);
|
|
13783
13735
|
}
|
|
13784
13736
|
}
|
|
13785
13737
|
}
|
|
@@ -14101,13 +14053,13 @@ function buildBuildingMesh(buildings, tileSize) {
|
|
|
14101
14053
|
for (const ring of building.rings) {
|
|
14102
14054
|
if (ring.length < 3)
|
|
14103
14055
|
continue;
|
|
14104
|
-
const
|
|
14105
|
-
if (
|
|
14056
|
+
const area = ringArea(ring);
|
|
14057
|
+
if (area === 0)
|
|
14106
14058
|
continue;
|
|
14107
|
-
const
|
|
14059
|
+
const sign = Math.sign(area);
|
|
14108
14060
|
if (outerSign === 0)
|
|
14109
|
-
outerSign =
|
|
14110
|
-
if (
|
|
14061
|
+
outerSign = sign;
|
|
14062
|
+
if (sign === outerSign || polygons.length === 0)
|
|
14111
14063
|
polygons.push([ring]);
|
|
14112
14064
|
else
|
|
14113
14065
|
polygons[polygons.length - 1].push(ring);
|
|
@@ -14383,11 +14335,11 @@ class BuildingOverlay {
|
|
|
14383
14335
|
this.buffers.set(draw.key, { buffer, mesh: draw.mesh });
|
|
14384
14336
|
return buffer;
|
|
14385
14337
|
}
|
|
14386
|
-
release(
|
|
14387
|
-
const cached = this.buffers.get(
|
|
14338
|
+
release(key) {
|
|
14339
|
+
const cached = this.buffers.get(key);
|
|
14388
14340
|
if (cached && this.gl)
|
|
14389
14341
|
this.gl.deleteBuffer(cached.buffer);
|
|
14390
|
-
this.buffers.delete(
|
|
14342
|
+
this.buffers.delete(key);
|
|
14391
14343
|
}
|
|
14392
14344
|
remove() {
|
|
14393
14345
|
const ext = this.gl?.getExtension?.("WEBGL_lose_context");
|
|
@@ -14517,16 +14469,16 @@ class OccluderIndex {
|
|
|
14517
14469
|
return false;
|
|
14518
14470
|
const length = Math.hypot(ex - ax, ey - ay);
|
|
14519
14471
|
const steps = Math.max(1, Math.ceil(length / (CELL / 2)));
|
|
14520
|
-
const
|
|
14472
|
+
const stamp = ++this.query;
|
|
14521
14473
|
for (let s = 0;s <= steps; s++) {
|
|
14522
14474
|
const x = ax + (ex - ax) * s / steps;
|
|
14523
14475
|
const y = ay + (ey - ay) * s / steps;
|
|
14524
14476
|
if (x < lo || x > hi || y < lo || y > hi)
|
|
14525
14477
|
continue;
|
|
14526
14478
|
for (const i of this.cells[this._cell(y) * this.cols + this._cell(x)]) {
|
|
14527
|
-
if (this.stamps[i] ===
|
|
14479
|
+
if (this.stamps[i] === stamp)
|
|
14528
14480
|
continue;
|
|
14529
|
-
this.stamps[i] =
|
|
14481
|
+
this.stamps[i] = stamp;
|
|
14530
14482
|
const b = this.buildings[i];
|
|
14531
14483
|
if (Math.max(ax, ex) < b.minX || Math.min(ax, ex) > b.maxX || Math.max(ay, ey) < b.minY || Math.min(ay, ey) > b.maxY)
|
|
14532
14484
|
continue;
|
|
@@ -14635,12 +14587,12 @@ class GlyphProvider {
|
|
|
14635
14587
|
this.cache = new GlyphBitmapCache;
|
|
14636
14588
|
}
|
|
14637
14589
|
needsServer(fontStack) {
|
|
14638
|
-
const
|
|
14639
|
-
const cached = this._availability.get(
|
|
14590
|
+
const key = stackKey(fontStack);
|
|
14591
|
+
const cached = this._availability.get(key);
|
|
14640
14592
|
if (cached !== undefined)
|
|
14641
14593
|
return !cached;
|
|
14642
14594
|
const available = this._available(fontStack);
|
|
14643
|
-
this._availability.set(
|
|
14595
|
+
this._availability.set(key, available);
|
|
14644
14596
|
return !available;
|
|
14645
14597
|
}
|
|
14646
14598
|
glyphs(fontStack, text) {
|
|
@@ -14661,10 +14613,10 @@ class GlyphProvider {
|
|
|
14661
14613
|
if (codePoint === undefined)
|
|
14662
14614
|
continue;
|
|
14663
14615
|
const start = rangeStartFor(codePoint);
|
|
14664
|
-
const
|
|
14665
|
-
if (this._requested.has(
|
|
14616
|
+
const key = `${stack}/${start}`;
|
|
14617
|
+
if (this._requested.has(key))
|
|
14666
14618
|
continue;
|
|
14667
|
-
this._requested.add(
|
|
14619
|
+
this._requested.add(key);
|
|
14668
14620
|
this._source.load(stack, codePoint).then(() => this._onLoad()).catch(() => {});
|
|
14669
14621
|
}
|
|
14670
14622
|
}
|
|
@@ -14869,12 +14821,12 @@ function wrapText(text, maxWidth, measure) {
|
|
|
14869
14821
|
const words = text.split(/\s+/).filter(Boolean);
|
|
14870
14822
|
if (words.length < 2 || maxWidth <= 0 || measure(text) <= maxWidth)
|
|
14871
14823
|
return [text];
|
|
14872
|
-
const greedy = (
|
|
14824
|
+
const greedy = (limit) => {
|
|
14873
14825
|
const lines = [];
|
|
14874
14826
|
let line = "";
|
|
14875
14827
|
for (const word of words) {
|
|
14876
14828
|
const next = line ? `${line} ${word}` : word;
|
|
14877
|
-
if (line && measure(next) >
|
|
14829
|
+
if (line && measure(next) > limit) {
|
|
14878
14830
|
lines.push(line);
|
|
14879
14831
|
line = word;
|
|
14880
14832
|
} else {
|
|
@@ -14902,34 +14854,34 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
|
|
|
14902
14854
|
return;
|
|
14903
14855
|
const layout = styleLayer.layout;
|
|
14904
14856
|
const paint = styleLayer.paint;
|
|
14905
|
-
const
|
|
14906
|
-
const rawText =
|
|
14857
|
+
const resolve = (value) => resolveLayoutExpression(value, zoom, feature, featureState);
|
|
14858
|
+
const rawText = resolve(layout?.["text-field"]);
|
|
14907
14859
|
const formatted = isFormatted(rawText) && !isUniform(rawText.sections) ? rawText : null;
|
|
14908
|
-
const textTransform =
|
|
14860
|
+
const textTransform = resolve(layout?.["text-transform"]);
|
|
14909
14861
|
const text = formatted ? formatted.toString() : transformText(coerceString(isFormatted(rawText) ? rawText.toString() : rawText), textTransform);
|
|
14910
|
-
const textSize =
|
|
14862
|
+
const textSize = resolve(layout?.["text-size"]) ?? 16;
|
|
14911
14863
|
const font = glyphAtlas.resolveFont(layout?.["text-font"]);
|
|
14912
|
-
const italic = font.italic || !!
|
|
14913
|
-
const bold = font.bold || !!
|
|
14914
|
-
const textColor =
|
|
14915
|
-
const haloColor =
|
|
14916
|
-
const haloWidth =
|
|
14917
|
-
const textOpacity =
|
|
14918
|
-
const iconId = coerceString(
|
|
14919
|
-
const iconSize =
|
|
14920
|
-
const iconRotate =
|
|
14864
|
+
const italic = font.italic || !!resolve(layout?.["text-italic"]);
|
|
14865
|
+
const bold = font.bold || !!resolve(layout?.["text-bold"]);
|
|
14866
|
+
const textColor = resolve(paint?.["text-color"]) ?? "#000";
|
|
14867
|
+
const haloColor = resolve(paint?.["text-halo-color"]);
|
|
14868
|
+
const haloWidth = resolve(paint?.["text-halo-width"]);
|
|
14869
|
+
const textOpacity = resolve(paint?.["text-opacity"]);
|
|
14870
|
+
const iconId = coerceString(resolve(layout?.["icon-image"]));
|
|
14871
|
+
const iconSize = resolve(layout?.["icon-size"]);
|
|
14872
|
+
const iconRotate = resolve(layout?.["icon-rotate"]);
|
|
14921
14873
|
const iconEntry = iconId && iconAtlas ? builtinIcon(iconAtlas, iconId) : undefined;
|
|
14922
|
-
const iconOpacity =
|
|
14923
|
-
const iconColor = iconEntry?.sdf ?
|
|
14924
|
-
const iconHaloColor = iconEntry?.sdf ?
|
|
14925
|
-
const iconHaloWidth = iconEntry?.sdf ?
|
|
14926
|
-
const sortKeyValue =
|
|
14874
|
+
const iconOpacity = resolve(paint?.["icon-opacity"]);
|
|
14875
|
+
const iconColor = iconEntry?.sdf ? resolve(paint?.["icon-color"]) ?? "#000000" : undefined;
|
|
14876
|
+
const iconHaloColor = iconEntry?.sdf ? resolve(paint?.["icon-halo-color"]) : undefined;
|
|
14877
|
+
const iconHaloWidth = iconEntry?.sdf ? resolve(paint?.["icon-halo-width"]) : undefined;
|
|
14878
|
+
const sortKeyValue = resolve(layout?.["symbol-sort-key"]);
|
|
14927
14879
|
const legacyPriority = layout?.["symbol-priority"];
|
|
14928
14880
|
const sortKey = typeof sortKeyValue === "number" ? sortKeyValue : typeof legacyPriority === "number" ? -legacyPriority : 0;
|
|
14929
|
-
const allowOverlap = !!(
|
|
14930
|
-
const ignorePlacement = !!(
|
|
14931
|
-
const padding =
|
|
14932
|
-
const letterSpacing = (
|
|
14881
|
+
const allowOverlap = !!(resolve(layout?.["text-allow-overlap"]) ?? resolve(layout?.["icon-allow-overlap"]));
|
|
14882
|
+
const ignorePlacement = !!(resolve(layout?.["text-ignore-placement"]) ?? resolve(layout?.["icon-ignore-placement"]));
|
|
14883
|
+
const padding = resolve(layout?.["text-padding"]) ?? 2;
|
|
14884
|
+
const letterSpacing = (resolve(layout?.["text-letter-spacing"]) ?? 0) * textSize;
|
|
14933
14885
|
const textStyle = { italic, bold, family: font.family, letterSpacing };
|
|
14934
14886
|
const drawOptions = { color: textColor, haloColor, haloWidth, size: textSize, italic, bold, family: font.family, letterSpacing };
|
|
14935
14887
|
const bleed = Math.ceil((haloWidth ?? 0) + 2);
|
|
@@ -14953,10 +14905,10 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
|
|
|
14953
14905
|
if (labelWidth <= 0)
|
|
14954
14906
|
return;
|
|
14955
14907
|
const height = glyphAtlas.measureText(text, textSize, textStyle).height;
|
|
14956
|
-
const spacing =
|
|
14957
|
-
const maxAngle =
|
|
14908
|
+
const spacing = resolve(layout?.["symbol-spacing"]) ?? 250;
|
|
14909
|
+
const maxAngle = resolve(layout?.["text-max-angle"]) ?? 45;
|
|
14958
14910
|
const centreOnly = layout?.["symbol-placement"] === "line-center";
|
|
14959
|
-
const
|
|
14911
|
+
const signature = `${styleLayer.id}\x00${textSize}\x00${font.family ?? ""}\x00${italic}${bold}\x00${textColor}\x00${haloColor ?? ""}\x00${haloWidth ?? 0}\x00${letterSpacing}\x00${alpha}`;
|
|
14960
14912
|
for (const ring of rings) {
|
|
14961
14913
|
if (ring.length < 2)
|
|
14962
14914
|
continue;
|
|
@@ -14964,8 +14916,8 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
|
|
|
14964
14916
|
const length = lineLength(line);
|
|
14965
14917
|
const starts = centreOnly ? length >= labelWidth ? [(length - labelWidth) / 2] : [] : repeatDistances(length, labelWidth, spacing);
|
|
14966
14918
|
for (const start of starts) {
|
|
14967
|
-
const
|
|
14968
|
-
const at = pointAtDistance(line,
|
|
14919
|
+
const anchor = start + labelWidth / 2;
|
|
14920
|
+
const at = pointAtDistance(line, anchor);
|
|
14969
14921
|
if (!at)
|
|
14970
14922
|
continue;
|
|
14971
14923
|
out.push({
|
|
@@ -14974,7 +14926,7 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
|
|
|
14974
14926
|
key: `${styleLayer.id}\x00${text}\x00${context.spot(at.x, at.y, 18)}`,
|
|
14975
14927
|
order: context.next(),
|
|
14976
14928
|
line,
|
|
14977
|
-
anchor
|
|
14929
|
+
anchor,
|
|
14978
14930
|
text,
|
|
14979
14931
|
repeatDistance: Math.max(labelWidth * 1.5, spacing * 0.75),
|
|
14980
14932
|
chars: advances.map((a) => a.char),
|
|
@@ -14982,7 +14934,7 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
|
|
|
14982
14934
|
width: labelWidth,
|
|
14983
14935
|
height,
|
|
14984
14936
|
maxAngle,
|
|
14985
|
-
signature
|
|
14937
|
+
signature,
|
|
14986
14938
|
paintGlyph: (ctx, char) => {
|
|
14987
14939
|
ctx.globalAlpha = alpha;
|
|
14988
14940
|
glyphAtlas.drawText(ctx, char, 0, height * 0.35, drawOptions);
|
|
@@ -14994,15 +14946,15 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
|
|
|
14994
14946
|
}
|
|
14995
14947
|
if (feature.type !== 1)
|
|
14996
14948
|
return;
|
|
14997
|
-
const anchor =
|
|
14998
|
-
const offset = offsetPixels(
|
|
14999
|
-
const rotateDeg =
|
|
15000
|
-
const
|
|
14949
|
+
const anchor = resolve(layout?.["text-anchor"]) ?? "center";
|
|
14950
|
+
const offset = offsetPixels(resolve(layout?.["text-offset"]), textSize);
|
|
14951
|
+
const rotateDeg = resolve(layout?.["text-rotate"]) ?? 0;
|
|
14952
|
+
const rotate = rotateDeg * Math.PI / 180;
|
|
15001
14953
|
const needsServer = !!text && !formatted && !!glyphProvider?.needsServer(layout?.["text-font"]);
|
|
15002
14954
|
const serverGlyphs = needsServer ? glyphProvider.glyphs(layout?.["text-font"], text) : null;
|
|
15003
14955
|
if (needsServer && serverGlyphs === null)
|
|
15004
14956
|
return;
|
|
15005
|
-
const maxWidthEm =
|
|
14957
|
+
const maxWidthEm = resolve(layout?.["text-max-width"]) ?? 10;
|
|
15006
14958
|
const lines = text && !formatted && !serverGlyphs ? wrapText(text, maxWidthEm * textSize, (s) => glyphAtlas.measureText(s, textSize, textStyle).width) : [text];
|
|
15007
14959
|
let textWidth = 0;
|
|
15008
14960
|
let textHeight = 0;
|
|
@@ -15036,7 +14988,7 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
|
|
|
15036
14988
|
const textY = shift.y + offset.y;
|
|
15037
14989
|
let box = { minX: 0, minY: 0, maxX: 0, maxY: 0 };
|
|
15038
14990
|
if (text && textWidth > 0) {
|
|
15039
|
-
const bounds =
|
|
14991
|
+
const bounds = rotate === 0 ? { minX: textX, minY: textY, maxX: textX + textWidth, maxY: textY + textHeight } : rotatedBounds(textX, textY, textWidth, textHeight, rotate, 0, 0);
|
|
15040
14992
|
box = { ...bounds };
|
|
15041
14993
|
}
|
|
15042
14994
|
if (iconEntry) {
|
|
@@ -15063,8 +15015,8 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
|
|
|
15063
15015
|
return;
|
|
15064
15016
|
ctx.save();
|
|
15065
15017
|
ctx.globalAlpha = alpha;
|
|
15066
|
-
if (
|
|
15067
|
-
ctx.rotate(
|
|
15018
|
+
if (rotate !== 0)
|
|
15019
|
+
ctx.rotate(rotate);
|
|
15068
15020
|
const baselineY = textY + ascent;
|
|
15069
15021
|
if (serverGlyphs)
|
|
15070
15022
|
drawGlyphs(ctx, serverGlyphs, textX, baselineY, drawOptions, glyphProvider?.cache);
|
|
@@ -15080,19 +15032,19 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
|
|
|
15080
15032
|
for (const ring of rings) {
|
|
15081
15033
|
for (const pt of ring) {
|
|
15082
15034
|
const at = context.toTile(pt.x, pt.y);
|
|
15083
|
-
const
|
|
15035
|
+
const key = `${identity}\x00${context.spot(at.x, at.y, 21)}`;
|
|
15084
15036
|
out.push({
|
|
15085
15037
|
...base,
|
|
15086
15038
|
kind: "point",
|
|
15087
15039
|
identity,
|
|
15088
15040
|
occludable: !!iconEntry,
|
|
15089
|
-
key
|
|
15041
|
+
key,
|
|
15090
15042
|
order: context.next(),
|
|
15091
15043
|
x: at.x,
|
|
15092
15044
|
y: at.y,
|
|
15093
15045
|
box,
|
|
15094
15046
|
paint: paintLabel,
|
|
15095
|
-
signature: signature ||
|
|
15047
|
+
signature: signature || key
|
|
15096
15048
|
});
|
|
15097
15049
|
}
|
|
15098
15050
|
}
|
|
@@ -15155,12 +15107,12 @@ function evaluateFilterLegacy(filter, feature) {
|
|
|
15155
15107
|
if (op === "none")
|
|
15156
15108
|
return rest.every((child) => !evaluateFilterLegacy(child, feature));
|
|
15157
15109
|
if (op === "has") {
|
|
15158
|
-
const
|
|
15159
|
-
return typeof
|
|
15110
|
+
const key = rest[0];
|
|
15111
|
+
return typeof key === "string" && key in feature.properties;
|
|
15160
15112
|
}
|
|
15161
15113
|
if (op === "!has") {
|
|
15162
|
-
const
|
|
15163
|
-
return typeof
|
|
15114
|
+
const key = rest[0];
|
|
15115
|
+
return typeof key === "string" && !(key in feature.properties);
|
|
15164
15116
|
}
|
|
15165
15117
|
const left = resolveLegacyKey(rest[0], feature);
|
|
15166
15118
|
if (op === "==" || op === "!=") {
|
|
@@ -15353,8 +15305,8 @@ function pointInPolygon2(p, rings) {
|
|
|
15353
15305
|
const yi = ring[i].y;
|
|
15354
15306
|
const xj = ring[j].x;
|
|
15355
15307
|
const yj = ring[j].y;
|
|
15356
|
-
const
|
|
15357
|
-
if (
|
|
15308
|
+
const intersects = yi > p.y !== yj > p.y && p.x < (xj - xi) * (p.y - yi) / (yj - yi || 1) + xi;
|
|
15309
|
+
if (intersects)
|
|
15358
15310
|
inside = !inside;
|
|
15359
15311
|
}
|
|
15360
15312
|
}
|
|
@@ -15524,7 +15476,7 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
15524
15476
|
init_WebGLTileRenderer();
|
|
15525
15477
|
init_GridLayer();
|
|
15526
15478
|
init_urlTemplate();
|
|
15527
|
-
VectorTileMapLayer = class
|
|
15479
|
+
VectorTileMapLayer = class VectorTileMapLayer extends GridLayer {
|
|
15528
15480
|
initialize(options) {
|
|
15529
15481
|
super.initialize(options);
|
|
15530
15482
|
this._styleLayers = this.options.layers ?? [];
|
|
@@ -15561,12 +15513,12 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
15561
15513
|
return archive.loading;
|
|
15562
15514
|
}
|
|
15563
15515
|
async _loadArchiveTileJSON() {
|
|
15564
|
-
const
|
|
15516
|
+
const key = pmtilesSourceUrl(this.options.url);
|
|
15565
15517
|
const maps = await activeOfflineMaps();
|
|
15566
15518
|
const offline = async () => {
|
|
15567
|
-
const hit = (maps?.enabled ? await maps.lookup(
|
|
15519
|
+
const hit = (maps?.enabled ? await maps.lookup(key).catch(() => {
|
|
15568
15520
|
return;
|
|
15569
|
-
}) : undefined) ?? await this._offlineCache?.get(
|
|
15521
|
+
}) : undefined) ?? await this._offlineCache?.get(key).catch(() => {
|
|
15570
15522
|
return;
|
|
15571
15523
|
});
|
|
15572
15524
|
return hit?.data.byteLength ? JSON.parse(new TextDecoder().decode(hit.data)) : undefined;
|
|
@@ -15574,12 +15526,12 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
15574
15526
|
if (maps?.enabled && maps.onlyOffline) {
|
|
15575
15527
|
const stored = await offline();
|
|
15576
15528
|
if (!stored)
|
|
15577
|
-
throw new Error(`Only using offline maps, and ${
|
|
15529
|
+
throw new Error(`Only using offline maps, and ${key} is not downloaded`);
|
|
15578
15530
|
return stored;
|
|
15579
15531
|
}
|
|
15580
15532
|
try {
|
|
15581
|
-
const tilejson = await pmtilesTileJSON(
|
|
15582
|
-
this._offlineCache?.put(
|
|
15533
|
+
const tilejson = await pmtilesTileJSON(key);
|
|
15534
|
+
this._offlineCache?.put(key, new TextEncoder().encode(JSON.stringify(tilejson)), "application/json").catch(() => {});
|
|
15583
15535
|
return tilejson;
|
|
15584
15536
|
} catch (error) {
|
|
15585
15537
|
const stored = await offline();
|
|
@@ -15764,10 +15716,10 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
15764
15716
|
continue;
|
|
15765
15717
|
const id = feature.id;
|
|
15766
15718
|
if (id !== undefined) {
|
|
15767
|
-
const
|
|
15768
|
-
if (seen.has(
|
|
15719
|
+
const key = `${layerName}|${typeof id}|${id}`;
|
|
15720
|
+
if (seen.has(key))
|
|
15769
15721
|
continue;
|
|
15770
|
-
seen.add(
|
|
15722
|
+
seen.add(key);
|
|
15771
15723
|
}
|
|
15772
15724
|
out.push({ feature, sourceLayer: layerName, tile: entry.coords });
|
|
15773
15725
|
}
|
|
@@ -15839,8 +15791,8 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
15839
15791
|
this._sourceCache.clear();
|
|
15840
15792
|
super.onRemove(map);
|
|
15841
15793
|
}
|
|
15842
|
-
_removeTile(
|
|
15843
|
-
const tile = this._tiles?.[
|
|
15794
|
+
_removeTile(key) {
|
|
15795
|
+
const tile = this._tiles?.[key];
|
|
15844
15796
|
if (tile) {
|
|
15845
15797
|
const entry = this._decodedTiles.get(tile.el);
|
|
15846
15798
|
if (entry) {
|
|
@@ -15850,7 +15802,7 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
15850
15802
|
this._decodedTiles.delete(tile.el);
|
|
15851
15803
|
}
|
|
15852
15804
|
}
|
|
15853
|
-
super._removeTile(
|
|
15805
|
+
super._removeTile(key);
|
|
15854
15806
|
this._refreshSymbols();
|
|
15855
15807
|
}
|
|
15856
15808
|
getTileUrl(coords) {
|
|
@@ -16008,9 +15960,9 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
16008
15960
|
return !!this._buildingOverlay?.active;
|
|
16009
15961
|
}
|
|
16010
15962
|
_buildingsFor(entry, layers) {
|
|
16011
|
-
const
|
|
15963
|
+
const key = this._sourceKey(entry.coords);
|
|
16012
15964
|
this._buildingMeshes ??= new Map;
|
|
16013
|
-
const cached = this._buildingMeshes.get(
|
|
15965
|
+
const cached = this._buildingMeshes.get(key);
|
|
16014
15966
|
if (cached && cached.version === this._labelVersion)
|
|
16015
15967
|
return cached.meshes;
|
|
16016
15968
|
for (const item of cached?.meshes ?? [])
|
|
@@ -16038,12 +15990,12 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
16038
15990
|
let featureState;
|
|
16039
15991
|
if (lookup && feature.id !== undefined)
|
|
16040
15992
|
featureState = lookup(sourceId, styleLayer.sourceLayer, feature.id);
|
|
16041
|
-
const
|
|
16042
|
-
const height = Number(
|
|
16043
|
-
const base = Number(
|
|
15993
|
+
const resolve = (value) => resolvePaintExpression(value, source.z, feature, featureState);
|
|
15994
|
+
const height = Number(resolve(paint?.["fill-extrusion-height"]) ?? 0);
|
|
15995
|
+
const base = Number(resolve(paint?.["fill-extrusion-base"]) ?? 0);
|
|
16044
15996
|
if (!(height > base))
|
|
16045
15997
|
continue;
|
|
16046
|
-
const color = parseCssColor(
|
|
15998
|
+
const color = parseCssColor(resolve(paint?.["fill-extrusion-color"]) ?? "#000", 1);
|
|
16047
15999
|
const rings = feature.loadGeometry().map((ring) => ring.map((pt) => ({ x: pt.x * scale, y: pt.y * scale })));
|
|
16048
16000
|
footprints.push({ rings, height, base, color: [color[0], color[1], color[2], color[3]] });
|
|
16049
16001
|
const outer = rings[0];
|
|
@@ -16068,7 +16020,7 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
16068
16020
|
meshes.push({ layer: styleLayer.id, mesh: buildBuildingMesh(footprints, size) });
|
|
16069
16021
|
}
|
|
16070
16022
|
}
|
|
16071
|
-
this._buildingMeshes.set(
|
|
16023
|
+
this._buildingMeshes.set(key, { version: this._labelVersion, meshes, occluders: new OccluderIndex(occluders, this.getTileSize().x) });
|
|
16072
16024
|
return meshes;
|
|
16073
16025
|
}
|
|
16074
16026
|
_occlusionTest(occlusion) {
|
|
@@ -16078,11 +16030,11 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
16078
16030
|
if (!memo || memo.signature !== signature)
|
|
16079
16031
|
memo = this._occlusionMemo = { signature, results: new Map };
|
|
16080
16032
|
const results = memo.results;
|
|
16081
|
-
return (x, y,
|
|
16082
|
-
let hidden = results.get(
|
|
16033
|
+
return (x, y, key) => {
|
|
16034
|
+
let hidden = results.get(key);
|
|
16083
16035
|
if (hidden === undefined) {
|
|
16084
16036
|
hidden = occluded(occlusion.sources, map.containerPointToLayerPoint([x, y]), occlusion.camera, occlusion.rise);
|
|
16085
|
-
results.set(
|
|
16037
|
+
results.set(key, hidden);
|
|
16086
16038
|
}
|
|
16087
16039
|
return hidden;
|
|
16088
16040
|
};
|
|
@@ -16123,10 +16075,10 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
16123
16075
|
const drawn = new Set;
|
|
16124
16076
|
const ready = (e) => meshes.get(this._sourceKey(e.coords))?.version === this._labelVersion;
|
|
16125
16077
|
for (const entry of this._labelEntries(ready)) {
|
|
16126
|
-
const
|
|
16127
|
-
if (drawn.has(
|
|
16078
|
+
const key = this._sourceKey(entry.coords);
|
|
16079
|
+
if (drawn.has(key))
|
|
16128
16080
|
continue;
|
|
16129
|
-
drawn.add(
|
|
16081
|
+
drawn.add(key);
|
|
16130
16082
|
const { x, y, z } = this._subTile(entry.coords);
|
|
16131
16083
|
const k = map.getZoomScale(mapZoom, z);
|
|
16132
16084
|
const matrix = buildingMatrix(camera, k, [x * tileSize * k - origin.x, y * tileSize * k - origin.y]);
|
|
@@ -16153,7 +16105,7 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
16153
16105
|
if (layerOpacity >= 0.5)
|
|
16154
16106
|
solid = true;
|
|
16155
16107
|
}
|
|
16156
|
-
const cached = meshes.get(
|
|
16108
|
+
const cached = meshes.get(key);
|
|
16157
16109
|
if (solid && cached)
|
|
16158
16110
|
occlusionSources.push({ index: cached.occluders, scale: k, origin: [x * tileSize * k - origin.x, y * tileSize * k - origin.y], pxPerMetre: heightScale });
|
|
16159
16111
|
}
|
|
@@ -16171,12 +16123,12 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
16171
16123
|
const held = new Set;
|
|
16172
16124
|
for (const entry of this._decodedTiles.values())
|
|
16173
16125
|
held.add(this._sourceKey(entry.coords));
|
|
16174
|
-
for (const [
|
|
16175
|
-
if (held.has(
|
|
16126
|
+
for (const [key, cached] of meshes) {
|
|
16127
|
+
if (held.has(key))
|
|
16176
16128
|
continue;
|
|
16177
16129
|
for (const item of cached.meshes)
|
|
16178
16130
|
overlay.release(item);
|
|
16179
|
-
meshes.delete(
|
|
16131
|
+
meshes.delete(key);
|
|
16180
16132
|
}
|
|
16181
16133
|
return pending;
|
|
16182
16134
|
}
|
|
@@ -16313,33 +16265,33 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
16313
16265
|
}
|
|
16314
16266
|
_abortLoading() {
|
|
16315
16267
|
const wanted = new Set;
|
|
16316
|
-
for (const
|
|
16317
|
-
const tile = this._tiles[
|
|
16268
|
+
for (const key of Object.keys(this._tiles ?? {})) {
|
|
16269
|
+
const tile = this._tiles[key];
|
|
16318
16270
|
if (tile?.current && tile.coords)
|
|
16319
16271
|
wanted.add(this._sourceKey(tile.coords));
|
|
16320
16272
|
}
|
|
16321
|
-
for (const [
|
|
16322
|
-
if (wanted.has(
|
|
16273
|
+
for (const [key, pending] of [...this._sourcePending.entries()]) {
|
|
16274
|
+
if (wanted.has(key))
|
|
16323
16275
|
continue;
|
|
16324
16276
|
pending.abort.abort();
|
|
16325
|
-
this._sourcePending.delete(
|
|
16277
|
+
this._sourcePending.delete(key);
|
|
16326
16278
|
}
|
|
16327
16279
|
}
|
|
16328
16280
|
_sourceKey(coords) {
|
|
16329
16281
|
const sub = this._subTile(coords);
|
|
16330
16282
|
return `${sub.z}/${sub.x}/${sub.y}`;
|
|
16331
16283
|
}
|
|
16332
|
-
async _acquireSource(
|
|
16333
|
-
const cached = this._sourceCache.get(
|
|
16284
|
+
async _acquireSource(key, url, entry) {
|
|
16285
|
+
const cached = this._sourceCache.get(key);
|
|
16334
16286
|
if (cached) {
|
|
16335
16287
|
cached.refs += 1;
|
|
16336
|
-
entry.sourceKey =
|
|
16288
|
+
entry.sourceKey = key;
|
|
16337
16289
|
return { tile: cached.tile, index: cached.index };
|
|
16338
16290
|
}
|
|
16339
|
-
const pending = this._sourcePending.get(
|
|
16291
|
+
const pending = this._sourcePending.get(key);
|
|
16340
16292
|
if (pending) {
|
|
16341
16293
|
pending.refs += 1;
|
|
16342
|
-
entry.sourceKey =
|
|
16294
|
+
entry.sourceKey = key;
|
|
16343
16295
|
entry.sourcePending = true;
|
|
16344
16296
|
return pending.promise;
|
|
16345
16297
|
}
|
|
@@ -16351,16 +16303,16 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
16351
16303
|
const bytes = await this._fetchTileBytes(url, { abort });
|
|
16352
16304
|
const decoded = await this._decode(bytes);
|
|
16353
16305
|
const built = { tile: decoded, index: buildTileIndex(decoded) };
|
|
16354
|
-
const waiting = this._sourcePending.get(
|
|
16355
|
-
this._sourcePending.delete(
|
|
16356
|
-
this._sourceCache.set(
|
|
16306
|
+
const waiting = this._sourcePending.get(key)?.refs ?? 1;
|
|
16307
|
+
this._sourcePending.delete(key);
|
|
16308
|
+
this._sourceCache.set(key, { ...built, refs: waiting });
|
|
16357
16309
|
return built;
|
|
16358
16310
|
})()
|
|
16359
16311
|
};
|
|
16360
|
-
this._sourcePending.set(
|
|
16361
|
-
entry.sourceKey =
|
|
16312
|
+
this._sourcePending.set(key, record);
|
|
16313
|
+
entry.sourceKey = key;
|
|
16362
16314
|
entry.sourcePending = true;
|
|
16363
|
-
record.promise.catch(() => this._sourcePending.delete(
|
|
16315
|
+
record.promise.catch(() => this._sourcePending.delete(key));
|
|
16364
16316
|
return record.promise;
|
|
16365
16317
|
}
|
|
16366
16318
|
async _decode(bytes) {
|
|
@@ -16385,23 +16337,23 @@ var init_VectorTileMapLayer = __esm(() => {
|
|
|
16385
16337
|
return pool.size() > 0 ? pool : null;
|
|
16386
16338
|
}
|
|
16387
16339
|
_releaseSource(entry) {
|
|
16388
|
-
const
|
|
16389
|
-
if (!
|
|
16340
|
+
const key = entry.sourceKey;
|
|
16341
|
+
if (!key)
|
|
16390
16342
|
return;
|
|
16391
16343
|
entry.sourceKey = undefined;
|
|
16392
|
-
const cached = this._sourceCache.get(
|
|
16344
|
+
const cached = this._sourceCache.get(key);
|
|
16393
16345
|
if (cached) {
|
|
16394
16346
|
cached.refs -= 1;
|
|
16395
16347
|
if (cached.refs <= 0)
|
|
16396
|
-
this._sourceCache.delete(
|
|
16348
|
+
this._sourceCache.delete(key);
|
|
16397
16349
|
return;
|
|
16398
16350
|
}
|
|
16399
|
-
const pending = this._sourcePending.get(
|
|
16351
|
+
const pending = this._sourcePending.get(key);
|
|
16400
16352
|
if (pending) {
|
|
16401
16353
|
pending.refs -= 1;
|
|
16402
16354
|
if (pending.refs <= 0) {
|
|
16403
16355
|
pending.abort.abort();
|
|
16404
|
-
this._sourcePending.delete(
|
|
16356
|
+
this._sourcePending.delete(key);
|
|
16405
16357
|
}
|
|
16406
16358
|
}
|
|
16407
16359
|
}
|
|
@@ -16621,7 +16573,7 @@ var HillshadeLayer;
|
|
|
16621
16573
|
var init_RasterDEMLayer = __esm(() => {
|
|
16622
16574
|
init_DomEvent();
|
|
16623
16575
|
init_TileLayer();
|
|
16624
|
-
RasterDEMLayer = class
|
|
16576
|
+
RasterDEMLayer = class RasterDEMLayer extends TileLayer {
|
|
16625
16577
|
initialize(url, options) {
|
|
16626
16578
|
super.initialize(url, { tileSize: 512, crossOrigin: true, ...options });
|
|
16627
16579
|
this._encoding = options?.encoding ?? "mapbox";
|
|
@@ -17097,9 +17049,9 @@ function swapItem(ids, coords, i, j) {
|
|
|
17097
17049
|
function rangeKD(ids, coords, minX, minY, maxX, maxY, left, right, axis, nodeSize, out) {
|
|
17098
17050
|
if (right - left <= nodeSize) {
|
|
17099
17051
|
for (let i = left;i <= right; i++) {
|
|
17100
|
-
const
|
|
17101
|
-
const
|
|
17102
|
-
if (
|
|
17052
|
+
const x = coords[2 * i];
|
|
17053
|
+
const y = coords[2 * i + 1];
|
|
17054
|
+
if (x >= minX && x <= maxX && y >= minY && y <= maxY)
|
|
17103
17055
|
out.push(ids[i]);
|
|
17104
17056
|
}
|
|
17105
17057
|
return;
|
|
@@ -17461,7 +17413,7 @@ var init_HeatmapLayer = __esm(() => {
|
|
|
17461
17413
|
0.8: "yellow",
|
|
17462
17414
|
1: "red"
|
|
17463
17415
|
};
|
|
17464
|
-
HeatmapLayer = class
|
|
17416
|
+
HeatmapLayer = class HeatmapLayer extends Layer {
|
|
17465
17417
|
initialize(options) {
|
|
17466
17418
|
setOptions(this, options);
|
|
17467
17419
|
this._data = options?.data ? [...options.data] : [];
|
|
@@ -17615,8 +17567,8 @@ var init_HeatmapLayer = __esm(() => {
|
|
|
17615
17567
|
return this._gradientTexture;
|
|
17616
17568
|
}
|
|
17617
17569
|
const g = ctx.createLinearGradient(0, 0, 0, 256);
|
|
17618
|
-
for (const [
|
|
17619
|
-
g.addColorStop(Number(
|
|
17570
|
+
for (const [stop, colour] of Object.entries(gradient)) {
|
|
17571
|
+
g.addColorStop(Number(stop), colour);
|
|
17620
17572
|
}
|
|
17621
17573
|
ctx.fillStyle = g;
|
|
17622
17574
|
ctx.fillRect(0, 0, 1, 256);
|
|
@@ -17707,10 +17659,10 @@ async function fetchDemTile(url, demSize) {
|
|
|
17707
17659
|
if (!res.ok)
|
|
17708
17660
|
return null;
|
|
17709
17661
|
const blob = await res.blob();
|
|
17710
|
-
const img = await new Promise((
|
|
17662
|
+
const img = await new Promise((resolve, reject) => {
|
|
17711
17663
|
const el = new Image;
|
|
17712
17664
|
el.crossOrigin = "anonymous";
|
|
17713
|
-
el.onload = () =>
|
|
17665
|
+
el.onload = () => resolve(el);
|
|
17714
17666
|
el.onerror = reject;
|
|
17715
17667
|
el.src = URL.createObjectURL(blob);
|
|
17716
17668
|
});
|
|
@@ -17733,13 +17685,13 @@ async function loadSpriteImage(url) {
|
|
|
17733
17685
|
return;
|
|
17734
17686
|
});
|
|
17735
17687
|
const blobUrl = hit?.data.byteLength ? URL.createObjectURL(new Blob([hit.data], { type: hit.mime })) : undefined;
|
|
17736
|
-
return new Promise((
|
|
17688
|
+
return new Promise((resolve, reject) => {
|
|
17737
17689
|
const image = new Image;
|
|
17738
17690
|
image.crossOrigin = "anonymous";
|
|
17739
17691
|
image.onload = () => {
|
|
17740
17692
|
if (blobUrl)
|
|
17741
17693
|
URL.revokeObjectURL(blobUrl);
|
|
17742
|
-
|
|
17694
|
+
resolve(image);
|
|
17743
17695
|
};
|
|
17744
17696
|
image.onerror = () => {
|
|
17745
17697
|
if (blobUrl)
|
|
@@ -17771,7 +17723,7 @@ var init_Map = __esm(() => {
|
|
|
17771
17723
|
init_terrainMesh();
|
|
17772
17724
|
init_TerrainSource();
|
|
17773
17725
|
init_WebGLTileRenderer();
|
|
17774
|
-
TsMap = class
|
|
17726
|
+
TsMap = class TsMap extends Evented {
|
|
17775
17727
|
static _pointerEvents = ["click", "dblclick", "pointerover", "pointerout", "contextmenu"];
|
|
17776
17728
|
_sizeChanged = true;
|
|
17777
17729
|
_initControlPos;
|
|
@@ -17845,8 +17797,8 @@ var init_Map = __esm(() => {
|
|
|
17845
17797
|
const containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng);
|
|
17846
17798
|
if (this._bearing || this._pitch) {
|
|
17847
17799
|
const offset = this._groundOffset(containerPoint).multiplyBy(1 - 1 / scale);
|
|
17848
|
-
const
|
|
17849
|
-
return this.setView(
|
|
17800
|
+
const newCenter = this.layerPointToLatLng(this._getCenterLayerPoint().add(offset));
|
|
17801
|
+
return this.setView(newCenter, zoom, { zoom: options });
|
|
17850
17802
|
}
|
|
17851
17803
|
const centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale);
|
|
17852
17804
|
const newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));
|
|
@@ -18004,7 +17956,7 @@ var init_Map = __esm(() => {
|
|
|
18004
17956
|
const center = this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom);
|
|
18005
17957
|
const zoom = this.getScaleZoom(w0 / w(s), startZoom);
|
|
18006
17958
|
if (bearingChanged)
|
|
18007
|
-
this._bearing =
|
|
17959
|
+
this._bearing = TsMap._lerpBearing(startBearing, targetBearing, t);
|
|
18008
17960
|
if (pitchChanged)
|
|
18009
17961
|
this._pitch = startPitch + (targetPitch - startPitch) * t;
|
|
18010
17962
|
this._move(center, zoom, { flyTo: true });
|
|
@@ -18269,8 +18221,8 @@ var init_Map = __esm(() => {
|
|
|
18269
18221
|
getBearing() {
|
|
18270
18222
|
return this._bearing;
|
|
18271
18223
|
}
|
|
18272
|
-
setBearing(
|
|
18273
|
-
const wrapped = (
|
|
18224
|
+
setBearing(bearing) {
|
|
18225
|
+
const wrapped = (bearing % 360 + 360) % 360;
|
|
18274
18226
|
if (wrapped === this._bearing)
|
|
18275
18227
|
return this;
|
|
18276
18228
|
this.fire("rotatestart", { bearing: this._bearing });
|
|
@@ -18280,11 +18232,11 @@ var init_Map = __esm(() => {
|
|
|
18280
18232
|
this.fire("rotateend", { bearing: wrapped });
|
|
18281
18233
|
return this;
|
|
18282
18234
|
}
|
|
18283
|
-
rotateTo(
|
|
18235
|
+
rotateTo(bearing, options) {
|
|
18284
18236
|
if (!options?.animate)
|
|
18285
|
-
return this.setBearing(
|
|
18237
|
+
return this.setBearing(bearing);
|
|
18286
18238
|
return this.easeTo({
|
|
18287
|
-
bearing
|
|
18239
|
+
bearing,
|
|
18288
18240
|
duration: options.duration ?? 300,
|
|
18289
18241
|
easing: options.easing
|
|
18290
18242
|
});
|
|
@@ -18379,7 +18331,7 @@ var init_Map = __esm(() => {
|
|
|
18379
18331
|
const px = fromPx.add(toPx.subtract(fromPx).multiplyBy(t));
|
|
18380
18332
|
const center = this.unproject(px, startZoom);
|
|
18381
18333
|
if (bearingChanged)
|
|
18382
|
-
this._bearing =
|
|
18334
|
+
this._bearing = TsMap._lerpBearing(startBearing, endBearing, t);
|
|
18383
18335
|
if (pitchChanged)
|
|
18384
18336
|
this._pitch = startPitch + (endPitch - startPitch) * t;
|
|
18385
18337
|
this._move(center, lerpZoom, { easeTo: true });
|
|
@@ -18811,7 +18763,7 @@ var init_Map = __esm(() => {
|
|
|
18811
18763
|
}
|
|
18812
18764
|
for (const t of targets) {
|
|
18813
18765
|
t.fire(type, data, true);
|
|
18814
|
-
if (data.originalEvent._stopped || t.options?.bubblingPointerEvents === false &&
|
|
18766
|
+
if (data.originalEvent._stopped || t.options?.bubblingPointerEvents === false && TsMap._pointerEvents.includes(type)) {
|
|
18815
18767
|
return;
|
|
18816
18768
|
}
|
|
18817
18769
|
}
|
|
@@ -18850,13 +18802,13 @@ var init_Map = __esm(() => {
|
|
|
18850
18802
|
const pos = this._getMapPanePos();
|
|
18851
18803
|
if (this._pitch && (pos.x || pos.y) && this._loaded) {
|
|
18852
18804
|
const pitch = this._pitch;
|
|
18853
|
-
const
|
|
18805
|
+
const bearing = this._bearing;
|
|
18854
18806
|
this._pitch = this._appliedPitch ?? 0;
|
|
18855
|
-
this._bearing = this._appliedBearing ??
|
|
18856
|
-
const
|
|
18807
|
+
this._bearing = this._appliedBearing ?? bearing;
|
|
18808
|
+
const center = this.getCenter();
|
|
18857
18809
|
this._pitch = pitch;
|
|
18858
|
-
this._bearing =
|
|
18859
|
-
this._resetView(
|
|
18810
|
+
this._bearing = bearing;
|
|
18811
|
+
this._resetView(center, this._zoom, true);
|
|
18860
18812
|
}
|
|
18861
18813
|
const size = this.getSize();
|
|
18862
18814
|
const center = size.divideBy(2);
|
|
@@ -19279,8 +19231,8 @@ var init_Map = __esm(() => {
|
|
|
19279
19231
|
if (!names.length)
|
|
19280
19232
|
return true;
|
|
19281
19233
|
try {
|
|
19282
|
-
const
|
|
19283
|
-
const { family } =
|
|
19234
|
+
const probe = new GlyphAtlas;
|
|
19235
|
+
const { family } = probe.resolveFont(names);
|
|
19284
19236
|
return fonts.check(`16px ${family}`);
|
|
19285
19237
|
} catch {
|
|
19286
19238
|
return true;
|
|
@@ -19689,12 +19641,12 @@ var init_Map = __esm(() => {
|
|
|
19689
19641
|
}
|
|
19690
19642
|
setFeatureState(lookup, state) {
|
|
19691
19643
|
const store = this._ensureFeatureStateMap();
|
|
19692
|
-
const
|
|
19693
|
-
const existing = store.get(
|
|
19644
|
+
const key = this._featureStateKey(lookup);
|
|
19645
|
+
const existing = store.get(key);
|
|
19694
19646
|
if (existing)
|
|
19695
19647
|
Object.assign(existing, state);
|
|
19696
19648
|
else
|
|
19697
|
-
store.set(
|
|
19649
|
+
store.set(key, { ...state });
|
|
19698
19650
|
this._repaintSource(lookup.source);
|
|
19699
19651
|
return this;
|
|
19700
19652
|
}
|
|
@@ -19702,20 +19654,20 @@ var init_Map = __esm(() => {
|
|
|
19702
19654
|
const store = this._featureState;
|
|
19703
19655
|
if (!store)
|
|
19704
19656
|
return {};
|
|
19705
|
-
const
|
|
19706
|
-
return store.get(
|
|
19657
|
+
const key = this._featureStateKey(lookup);
|
|
19658
|
+
return store.get(key) ?? {};
|
|
19707
19659
|
}
|
|
19708
|
-
removeFeatureState(lookup,
|
|
19660
|
+
removeFeatureState(lookup, key) {
|
|
19709
19661
|
const store = this._featureState;
|
|
19710
19662
|
if (!store)
|
|
19711
19663
|
return this;
|
|
19712
19664
|
const fullKey = this._featureStateKey(lookup);
|
|
19713
|
-
if (
|
|
19665
|
+
if (key === undefined) {
|
|
19714
19666
|
store.delete(fullKey);
|
|
19715
19667
|
} else {
|
|
19716
19668
|
const existing = store.get(fullKey);
|
|
19717
19669
|
if (existing) {
|
|
19718
|
-
delete existing[
|
|
19670
|
+
delete existing[key];
|
|
19719
19671
|
if (Object.keys(existing).length === 0)
|
|
19720
19672
|
store.delete(fullKey);
|
|
19721
19673
|
}
|
|
@@ -19808,10 +19760,10 @@ var init_Map = __esm(() => {
|
|
|
19808
19760
|
setSky(sky) {
|
|
19809
19761
|
if (sky !== null) {
|
|
19810
19762
|
const numericFields = ["fog-ground-blend", "sun-intensity"];
|
|
19811
|
-
for (const
|
|
19812
|
-
const value = sky[
|
|
19763
|
+
for (const key of numericFields) {
|
|
19764
|
+
const value = sky[key];
|
|
19813
19765
|
if (value !== undefined && Number.isNaN(value))
|
|
19814
|
-
throw new RangeError(`setSky: ${
|
|
19766
|
+
throw new RangeError(`setSky: ${key} is NaN.`);
|
|
19815
19767
|
}
|
|
19816
19768
|
if (sky["sun-position"] !== undefined) {
|
|
19817
19769
|
const [az, alt] = sky["sun-position"];
|
|
@@ -19999,15 +19951,15 @@ var init_Map = __esm(() => {
|
|
|
19999
19951
|
this._theme = theme;
|
|
20000
19952
|
this.options.theme = theme;
|
|
20001
19953
|
if (theme === "auto") {
|
|
20002
|
-
const
|
|
20003
|
-
const
|
|
20004
|
-
const dark =
|
|
19954
|
+
const resolve = () => {
|
|
19955
|
+
const page = this._pageTheme();
|
|
19956
|
+
const dark = page !== undefined ? page === "dark" : Boolean(this._themeQuery?.matches);
|
|
20005
19957
|
if (dark !== this._container?.classList.contains("tsmap-dark"))
|
|
20006
19958
|
this._applyTheme(dark);
|
|
20007
19959
|
};
|
|
20008
19960
|
if (typeof matchMedia === "function") {
|
|
20009
19961
|
const query = matchMedia("(prefers-color-scheme: dark)");
|
|
20010
|
-
const listener = () =>
|
|
19962
|
+
const listener = () => resolve();
|
|
20011
19963
|
if (typeof query.addEventListener === "function")
|
|
20012
19964
|
query.addEventListener("change", listener);
|
|
20013
19965
|
else
|
|
@@ -20017,7 +19969,7 @@ var init_Map = __esm(() => {
|
|
|
20017
19969
|
}
|
|
20018
19970
|
const root = typeof document !== "undefined" ? document.documentElement : undefined;
|
|
20019
19971
|
if (root && typeof MutationObserver === "function") {
|
|
20020
|
-
this._themeObserver = new MutationObserver(
|
|
19972
|
+
this._themeObserver = new MutationObserver(resolve);
|
|
20021
19973
|
this._themeObserver.observe(root, { attributes: true, attributeFilter: ["data-theme", "data-color-mode", "class"] });
|
|
20022
19974
|
}
|
|
20023
19975
|
const page = this._pageTheme();
|
|
@@ -20128,10 +20080,10 @@ var init_Map = __esm(() => {
|
|
|
20128
20080
|
}
|
|
20129
20081
|
toBlob(type = "image/png", quality) {
|
|
20130
20082
|
this._requestExportFrame();
|
|
20131
|
-
return new Promise((
|
|
20083
|
+
return new Promise((resolve) => {
|
|
20132
20084
|
const canvas = this.toCanvas();
|
|
20133
20085
|
if (typeof canvas.toBlob === "function") {
|
|
20134
|
-
canvas.toBlob((blob) =>
|
|
20086
|
+
canvas.toBlob((blob) => resolve(blob), type, quality);
|
|
20135
20087
|
} else {
|
|
20136
20088
|
try {
|
|
20137
20089
|
const dataUrl = canvas.toDataURL(type, quality);
|
|
@@ -20141,9 +20093,9 @@ var init_Map = __esm(() => {
|
|
|
20141
20093
|
const bytes = new Uint8Array(binary.length);
|
|
20142
20094
|
for (let i = 0;i < binary.length; i++)
|
|
20143
20095
|
bytes[i] = binary.charCodeAt(i);
|
|
20144
|
-
|
|
20096
|
+
resolve(new Blob([bytes], { type }));
|
|
20145
20097
|
} catch {
|
|
20146
|
-
|
|
20098
|
+
resolve(null);
|
|
20147
20099
|
}
|
|
20148
20100
|
}
|
|
20149
20101
|
});
|
|
@@ -20325,10 +20277,10 @@ var init_Map = __esm(() => {
|
|
|
20325
20277
|
const spec = this._style.spec.sources?.[this._terrain.source];
|
|
20326
20278
|
if (!spec || spec.type !== "raster-dem")
|
|
20327
20279
|
return;
|
|
20328
|
-
const
|
|
20329
|
-
if (!
|
|
20280
|
+
const template = Array.isArray(spec.tiles) ? spec.tiles[0] : undefined;
|
|
20281
|
+
if (!template || typeof template !== "string")
|
|
20330
20282
|
return;
|
|
20331
|
-
const url =
|
|
20283
|
+
const url = template.replace(/\{z\}/g, String(coord.z)).replace(/\{x\}/g, String(coord.x)).replace(/\{y\}/g, String(coord.y));
|
|
20332
20284
|
if (!this._terrainFetchInFlight)
|
|
20333
20285
|
this._terrainFetchInFlight = new globalThis.Map;
|
|
20334
20286
|
if (this._terrainFetchInFlight.has(url))
|
|
@@ -20981,9 +20933,9 @@ function assemblePolygons(rings) {
|
|
|
20981
20933
|
continue;
|
|
20982
20934
|
if (!pointInRing2(samples[i], kept[j]))
|
|
20983
20935
|
continue;
|
|
20984
|
-
const
|
|
20985
|
-
if (
|
|
20986
|
-
bestArea =
|
|
20936
|
+
const area = Math.abs(ringSignedArea(kept[j]));
|
|
20937
|
+
if (area < bestArea) {
|
|
20938
|
+
bestArea = area;
|
|
20987
20939
|
bestParent = j;
|
|
20988
20940
|
}
|
|
20989
20941
|
depths[i]++;
|
|
@@ -21206,7 +21158,7 @@ function prepareClaim(ring) {
|
|
|
21206
21158
|
}
|
|
21207
21159
|
var InvalidGeometryError;
|
|
21208
21160
|
var init_validate3 = __esm(() => {
|
|
21209
|
-
InvalidGeometryError = class
|
|
21161
|
+
InvalidGeometryError = class InvalidGeometryError extends Error {
|
|
21210
21162
|
constructor(message) {
|
|
21211
21163
|
super(message);
|
|
21212
21164
|
this.name = "InvalidGeometryError";
|
|
@@ -21218,7 +21170,7 @@ var init_TerritoryStore = __esm(() => {
|
|
|
21218
21170
|
init_Events();
|
|
21219
21171
|
init_area();
|
|
21220
21172
|
init_validate3();
|
|
21221
|
-
TerritoryStore = class
|
|
21173
|
+
TerritoryStore = class TerritoryStore extends Evented {
|
|
21222
21174
|
initialize(options = {}) {
|
|
21223
21175
|
this._byOwner = new Map;
|
|
21224
21176
|
this._options = {
|
|
@@ -21807,11 +21759,11 @@ init_Point();
|
|
|
21807
21759
|
|
|
21808
21760
|
class Draggable extends Evented {
|
|
21809
21761
|
static _dragging = false;
|
|
21810
|
-
initialize(element, dragStartTarget,
|
|
21762
|
+
initialize(element, dragStartTarget, preventOutline, options) {
|
|
21811
21763
|
setOptions(this, options);
|
|
21812
21764
|
this._element = element;
|
|
21813
21765
|
this._dragStartTarget = dragStartTarget ?? element;
|
|
21814
|
-
this._preventOutline =
|
|
21766
|
+
this._preventOutline = preventOutline;
|
|
21815
21767
|
}
|
|
21816
21768
|
enable() {
|
|
21817
21769
|
if (this._enabled)
|
|
@@ -22396,16 +22348,16 @@ function distanceToStretch(p, a, b, kx) {
|
|
|
22396
22348
|
}
|
|
22397
22349
|
function cutEvery(points, every) {
|
|
22398
22350
|
const cuts = [0];
|
|
22399
|
-
let
|
|
22351
|
+
let run = 0;
|
|
22400
22352
|
for (let i = 1;i < points.length - 1; i++) {
|
|
22401
|
-
|
|
22402
|
-
if (
|
|
22353
|
+
run += distanceMeters(points[i - 1], points[i]);
|
|
22354
|
+
if (run >= every) {
|
|
22403
22355
|
cuts.push(i);
|
|
22404
|
-
|
|
22356
|
+
run = 0;
|
|
22405
22357
|
}
|
|
22406
22358
|
}
|
|
22407
|
-
|
|
22408
|
-
if (cuts.length > 1 &&
|
|
22359
|
+
run += distanceMeters(points[points.length - 2], points[points.length - 1]);
|
|
22360
|
+
if (cuts.length > 1 && run < every / 2)
|
|
22409
22361
|
cuts.pop();
|
|
22410
22362
|
cuts.push(points.length - 1);
|
|
22411
22363
|
return cuts;
|
|
@@ -22536,7 +22488,7 @@ class RouteBuilder {
|
|
|
22536
22488
|
return this.add(start, opts);
|
|
22537
22489
|
}
|
|
22538
22490
|
outAndBack() {
|
|
22539
|
-
const
|
|
22491
|
+
const run = async () => {
|
|
22540
22492
|
const { waypoints, segments, straight } = this.state;
|
|
22541
22493
|
if (waypoints.length < 2)
|
|
22542
22494
|
return;
|
|
@@ -22547,7 +22499,7 @@ class RouteBuilder {
|
|
|
22547
22499
|
straight: [...straight, ...straight.slice().reverse()]
|
|
22548
22500
|
};
|
|
22549
22501
|
};
|
|
22550
|
-
return this.enqueue(
|
|
22502
|
+
return this.enqueue(run);
|
|
22551
22503
|
}
|
|
22552
22504
|
undo() {
|
|
22553
22505
|
return this.enqueue(async () => {
|
|
@@ -22612,10 +22564,10 @@ class RouteBuilder {
|
|
|
22612
22564
|
const found = await reverse;
|
|
22613
22565
|
return { ...found, segment: found.segment.slice().reverse() };
|
|
22614
22566
|
}
|
|
22615
|
-
const
|
|
22616
|
-
if (!jobs.has(
|
|
22617
|
-
jobs.set(
|
|
22618
|
-
return jobs.get(
|
|
22567
|
+
const key = pairKey(from, to);
|
|
22568
|
+
if (!jobs.has(key))
|
|
22569
|
+
jobs.set(key, this.route(from, to, router));
|
|
22570
|
+
return jobs.get(key);
|
|
22619
22571
|
}));
|
|
22620
22572
|
this.lastError = results.find((r) => r.error)?.error ?? null;
|
|
22621
22573
|
return results.map(({ segment, straight }) => ({ segment, straight }));
|
|
@@ -22725,8 +22677,8 @@ class Navigator extends Evented {
|
|
|
22725
22677
|
const last = points[points.length - 1];
|
|
22726
22678
|
starts.push(first && last && first.lat === last.lat && first.lng === last.lng ? points.length - 1 : points.length);
|
|
22727
22679
|
for (const p of step.geometry) {
|
|
22728
|
-
const
|
|
22729
|
-
if (!
|
|
22680
|
+
const last = points[points.length - 1];
|
|
22681
|
+
if (!last || last.lat !== p.lat || last.lng !== p.lng)
|
|
22730
22682
|
points.push(p);
|
|
22731
22683
|
}
|
|
22732
22684
|
}
|
|
@@ -22754,8 +22706,8 @@ class Navigator extends Evented {
|
|
|
22754
22706
|
get steps() {
|
|
22755
22707
|
return this.route.steps;
|
|
22756
22708
|
}
|
|
22757
|
-
pointAt(
|
|
22758
|
-
const d = Math.max(0, Math.min(this.length,
|
|
22709
|
+
pointAt(distance) {
|
|
22710
|
+
const d = Math.max(0, Math.min(this.length, distance));
|
|
22759
22711
|
let i = 1;
|
|
22760
22712
|
while (i < this.along.length - 1 && this.along[i] < d)
|
|
22761
22713
|
i++;
|
|
@@ -22798,29 +22750,29 @@ class Navigator extends Evented {
|
|
|
22798
22750
|
}
|
|
22799
22751
|
update(fix) {
|
|
22800
22752
|
const time = fix.time ?? Date.now();
|
|
22801
|
-
const { distance
|
|
22753
|
+
const { distance, offset } = this.snap(fix);
|
|
22802
22754
|
let speed = typeof fix.speed === "number" && fix.speed >= 0 ? fix.speed : 0;
|
|
22803
22755
|
if (!(speed > 0) && this._last && time > this._last.time)
|
|
22804
|
-
speed = Math.max(0, (
|
|
22805
|
-
this._last = { distance
|
|
22806
|
-
const stepIndex = this._stepAt(
|
|
22756
|
+
speed = Math.max(0, (distance - this._last.distance) / ((time - this._last.time) / 1000));
|
|
22757
|
+
this._last = { distance, time };
|
|
22758
|
+
const stepIndex = this._stepAt(distance);
|
|
22807
22759
|
const next = this.route.steps[stepIndex + 1];
|
|
22808
22760
|
const stepEnd = this.stepStarts[stepIndex + 1] ?? this.length;
|
|
22809
|
-
const distanceToManeuver = Math.max(0, stepEnd -
|
|
22761
|
+
const distanceToManeuver = Math.max(0, stepEnd - distance);
|
|
22810
22762
|
const nextManeuver = parseManeuver(next?.maneuver ?? "arrive", next?.exit);
|
|
22811
22763
|
const after = this.route.steps[stepIndex + 2];
|
|
22812
22764
|
const afterGap = (this.stepStarts[stepIndex + 2] ?? this.length) - stepEnd;
|
|
22813
22765
|
const thenManeuver = after && afterGap < (this.options.profile === "walking" ? 40 : 150) ? parseManeuver(after.maneuver, after.exit) : undefined;
|
|
22814
|
-
const distanceRemaining = Math.max(0, this.length -
|
|
22815
|
-
const durationRemaining = this._durationFrom(
|
|
22816
|
-
const { heading } = this.pointAt(
|
|
22766
|
+
const distanceRemaining = Math.max(0, this.length - distance);
|
|
22767
|
+
const durationRemaining = this._durationFrom(distance, stepIndex);
|
|
22768
|
+
const { heading } = this.pointAt(distance);
|
|
22817
22769
|
const progress = {
|
|
22818
|
-
location: this.pointAt(
|
|
22770
|
+
location: this.pointAt(distance).location,
|
|
22819
22771
|
raw: fix,
|
|
22820
22772
|
offRouteDistance: offset,
|
|
22821
22773
|
heading,
|
|
22822
22774
|
speed,
|
|
22823
|
-
distanceTraveled:
|
|
22775
|
+
distanceTraveled: distance,
|
|
22824
22776
|
distanceRemaining,
|
|
22825
22777
|
durationRemaining,
|
|
22826
22778
|
arrival: new Date(time + durationRemaining * 1000),
|
|
@@ -22857,19 +22809,19 @@ class Navigator extends Evented {
|
|
|
22857
22809
|
this.fire("progress", { progress });
|
|
22858
22810
|
return progress;
|
|
22859
22811
|
}
|
|
22860
|
-
_stepAt(
|
|
22812
|
+
_stepAt(distance) {
|
|
22861
22813
|
let i = 0;
|
|
22862
|
-
while (i + 1 < this.stepStarts.length && this.stepStarts[i + 1] <=
|
|
22814
|
+
while (i + 1 < this.stepStarts.length && this.stepStarts[i + 1] <= distance)
|
|
22863
22815
|
i++;
|
|
22864
22816
|
return i;
|
|
22865
22817
|
}
|
|
22866
|
-
_durationFrom(
|
|
22818
|
+
_durationFrom(distance, stepIndex) {
|
|
22867
22819
|
const steps = this.route.steps;
|
|
22868
22820
|
if (!steps.length)
|
|
22869
|
-
return this.length > 0 ? this.route.duration * (1 -
|
|
22821
|
+
return this.length > 0 ? this.route.duration * (1 - distance / this.length) : 0;
|
|
22870
22822
|
const start = this.stepStarts[stepIndex] ?? 0;
|
|
22871
22823
|
const end = this.stepStarts[stepIndex + 1] ?? this.length;
|
|
22872
|
-
const fraction = end > start ? (end -
|
|
22824
|
+
const fraction = end > start ? (end - distance) / (end - start) : 0;
|
|
22873
22825
|
let total = (steps[stepIndex]?.duration ?? 0) * Math.max(0, Math.min(1, fraction));
|
|
22874
22826
|
for (let i = stepIndex + 1;i < steps.length; i++)
|
|
22875
22827
|
total += steps[i].duration;
|
|
@@ -22889,8 +22841,8 @@ class Navigator extends Evented {
|
|
|
22889
22841
|
continue;
|
|
22890
22842
|
if (stage === "early" && stepLength < at * 1.2)
|
|
22891
22843
|
return;
|
|
22892
|
-
const
|
|
22893
|
-
if (this._announced.has(
|
|
22844
|
+
const key = `${progress.stepIndex}:${stage}`;
|
|
22845
|
+
if (this._announced.has(key))
|
|
22894
22846
|
return;
|
|
22895
22847
|
for (let j = i;j < stages.length; j++)
|
|
22896
22848
|
this._announced.add(`${progress.stepIndex}:${stages[j][0]}`);
|
|
@@ -22938,11 +22890,11 @@ class RouteSimulator {
|
|
|
22938
22890
|
clearInterval(this._timer);
|
|
22939
22891
|
this._timer = null;
|
|
22940
22892
|
}
|
|
22941
|
-
speedAt(
|
|
22893
|
+
speedAt(distance) {
|
|
22942
22894
|
const starts = this.navigator.stepStarts;
|
|
22943
22895
|
let nearest = Infinity;
|
|
22944
22896
|
for (let i = 1;i < starts.length; i++)
|
|
22945
|
-
nearest = Math.min(nearest, Math.abs(starts[i] -
|
|
22897
|
+
nearest = Math.min(nearest, Math.abs(starts[i] - distance));
|
|
22946
22898
|
const slow = this.speed * 0.35;
|
|
22947
22899
|
const reach = 60;
|
|
22948
22900
|
return nearest >= reach ? this.speed : slow + (this.speed - slow) * (nearest / reach);
|
|
@@ -23143,10 +23095,10 @@ function stepToStep(step) {
|
|
|
23143
23095
|
function routeToRoute(r) {
|
|
23144
23096
|
const legs = r.legs ?? [];
|
|
23145
23097
|
const steps = legs.flatMap((l) => (l.steps ?? []).map(stepToStep));
|
|
23146
|
-
const
|
|
23098
|
+
const distance = legs.reduce((sum, l) => sum + (l.distance?.value ?? 0), 0);
|
|
23147
23099
|
const duration = legs.reduce((sum, l) => sum + (l.duration?.value ?? 0), 0);
|
|
23148
23100
|
const geometry = r.overview_polyline ? decodePolyline(r.overview_polyline.points) : steps.flatMap((s) => s.geometry);
|
|
23149
|
-
return { distance
|
|
23101
|
+
return { distance, duration, geometry, steps };
|
|
23150
23102
|
}
|
|
23151
23103
|
|
|
23152
23104
|
class GoogleDirections {
|
|
@@ -23551,12 +23503,12 @@ class NominatimGeocoder {
|
|
|
23551
23503
|
constructor(opts = {}) {
|
|
23552
23504
|
this.baseUrl = (opts.baseUrl ?? "https://nominatim.openstreetmap.org").replace(/\/$/, "");
|
|
23553
23505
|
this.userAgent = opts.userAgent ?? "ts-maps";
|
|
23554
|
-
this.scheduleRequest = throttle((
|
|
23506
|
+
this.scheduleRequest = throttle((run) => run(), 250);
|
|
23555
23507
|
}
|
|
23556
23508
|
gate(work) {
|
|
23557
|
-
return new Promise((
|
|
23509
|
+
return new Promise((resolve, reject) => {
|
|
23558
23510
|
this.scheduleRequest(() => {
|
|
23559
|
-
work().then(
|
|
23511
|
+
work().then(resolve, reject);
|
|
23560
23512
|
});
|
|
23561
23513
|
});
|
|
23562
23514
|
}
|
|
@@ -23620,8 +23572,8 @@ var profileMap3 = {
|
|
|
23620
23572
|
walking: "foot",
|
|
23621
23573
|
cycling: "bike"
|
|
23622
23574
|
};
|
|
23623
|
-
function coordsToLatLng(
|
|
23624
|
-
return
|
|
23575
|
+
function coordsToLatLng(coords) {
|
|
23576
|
+
return coords.map(([lng, lat]) => ({ lat, lng }));
|
|
23625
23577
|
}
|
|
23626
23578
|
function stepInstruction(step) {
|
|
23627
23579
|
if (step.maneuver?.instruction)
|
|
@@ -23692,13 +23644,13 @@ class OSRMDirections {
|
|
|
23692
23644
|
if (waypoints.length < 2)
|
|
23693
23645
|
throw new Error("OSRM requires at least two waypoints");
|
|
23694
23646
|
const profile = profileMap3[opts?.profile ?? "driving"] ?? "driving";
|
|
23695
|
-
const
|
|
23647
|
+
const coords = waypoints.map((w) => `${w.lng},${w.lat}`).join(";");
|
|
23696
23648
|
const params = new URLSearchParams;
|
|
23697
23649
|
params.set("overview", "full");
|
|
23698
23650
|
params.set("geometries", "geojson");
|
|
23699
23651
|
params.set("steps", "true");
|
|
23700
23652
|
params.set("alternatives", opts?.alternatives ? "true" : "false");
|
|
23701
|
-
const url = `${this.baseUrl}/route/v1/${profile}/${
|
|
23653
|
+
const url = `${this.baseUrl}/route/v1/${profile}/${coords}?${params.toString()}`;
|
|
23702
23654
|
const res = await fetch(url, { signal: opts?.signal });
|
|
23703
23655
|
if (!res.ok)
|
|
23704
23656
|
throw new Error(`OSRM request failed: ${res.status} ${res.statusText}`);
|
|
@@ -23720,7 +23672,7 @@ class OSRMMatrix {
|
|
|
23720
23672
|
throw new Error("OSRM matrix requires at least one origin and one destination");
|
|
23721
23673
|
const profile = profileMap3[opts?.profile ?? "driving"] ?? "driving";
|
|
23722
23674
|
const all = [...origins, ...destinations];
|
|
23723
|
-
const
|
|
23675
|
+
const coords = all.map((w) => `${w.lng},${w.lat}`).join(";");
|
|
23724
23676
|
const sources = origins.map((_, i) => i).join(";");
|
|
23725
23677
|
const destinationsParam = destinations.map((_, i) => origins.length + i).join(";");
|
|
23726
23678
|
const annotations = opts?.metric === "distance" ? "distance" : "duration";
|
|
@@ -23728,7 +23680,7 @@ class OSRMMatrix {
|
|
|
23728
23680
|
params.set("sources", sources);
|
|
23729
23681
|
params.set("destinations", destinationsParam);
|
|
23730
23682
|
params.set("annotations", annotations);
|
|
23731
|
-
const url = `${this.baseUrl}/table/v1/${profile}/${
|
|
23683
|
+
const url = `${this.baseUrl}/table/v1/${profile}/${coords}?${params.toString()}`;
|
|
23732
23684
|
const res = await fetch(url, { signal: opts?.signal });
|
|
23733
23685
|
if (!res.ok)
|
|
23734
23686
|
throw new Error(`OSRM matrix request failed: ${res.status} ${res.statusText}`);
|
|
@@ -23781,10 +23733,10 @@ function buildLabel(props) {
|
|
|
23781
23733
|
return parts.filter(Boolean).join(", ");
|
|
23782
23734
|
}
|
|
23783
23735
|
function toResult4(f) {
|
|
23784
|
-
const
|
|
23736
|
+
const coords = f.geometry?.coordinates ?? [0, 0];
|
|
23785
23737
|
const out = {
|
|
23786
23738
|
text: buildLabel(f.properties),
|
|
23787
|
-
center: { lat:
|
|
23739
|
+
center: { lat: coords[1], lng: coords[0] },
|
|
23788
23740
|
properties: f.properties
|
|
23789
23741
|
};
|
|
23790
23742
|
if (f.properties?.extent) {
|
|
@@ -24216,12 +24168,12 @@ class GeocoderControl extends Control {
|
|
|
24216
24168
|
this._renderList();
|
|
24217
24169
|
return;
|
|
24218
24170
|
}
|
|
24219
|
-
const
|
|
24171
|
+
const run = () => this._request(trimmed);
|
|
24220
24172
|
const wait = options.debounce ?? 300;
|
|
24221
24173
|
if (wait > 0)
|
|
24222
|
-
this._timer = setTimeout(
|
|
24174
|
+
this._timer = setTimeout(run, wait);
|
|
24223
24175
|
else
|
|
24224
|
-
|
|
24176
|
+
run();
|
|
24225
24177
|
}
|
|
24226
24178
|
_request(query) {
|
|
24227
24179
|
const options = this.options;
|
|
@@ -24991,12 +24943,12 @@ class NavigationControl extends Control {
|
|
|
24991
24943
|
if (!map || !needle)
|
|
24992
24944
|
return;
|
|
24993
24945
|
const options = this.options;
|
|
24994
|
-
const
|
|
24995
|
-
const transforms = [`rotate(${-
|
|
24946
|
+
const bearing = map.getBearing?.() ?? 0;
|
|
24947
|
+
const transforms = [`rotate(${-bearing}deg)`];
|
|
24996
24948
|
if (options.visualizePitch)
|
|
24997
24949
|
transforms.unshift(`rotateX(${map.getPitch?.() ?? 0}deg)`);
|
|
24998
24950
|
needle.style.transform = transforms.join(" ");
|
|
24999
|
-
this._compassButton?.setAttribute("data-bearing", String(Math.round(
|
|
24951
|
+
this._compassButton?.setAttribute("data-bearing", String(Math.round(bearing)));
|
|
25000
24952
|
}
|
|
25001
24953
|
_updateDisabled() {
|
|
25002
24954
|
const map = this._map;
|
|
@@ -25063,7 +25015,7 @@ __export(exports_PolyUtil, {
|
|
|
25063
25015
|
init_LatLng();
|
|
25064
25016
|
init_LatLngBounds();
|
|
25065
25017
|
init_Point();
|
|
25066
|
-
function clipPolygon(points, bounds,
|
|
25018
|
+
function clipPolygon(points, bounds, round) {
|
|
25067
25019
|
let clippedPoints;
|
|
25068
25020
|
const edges = [1, 4, 2, 8];
|
|
25069
25021
|
for (let i = 0, len = points.length;i < len; i++) {
|
|
@@ -25077,13 +25029,13 @@ function clipPolygon(points, bounds, round2) {
|
|
|
25077
25029
|
const b = points[j];
|
|
25078
25030
|
if (!(a._code & edge)) {
|
|
25079
25031
|
if (b._code & edge) {
|
|
25080
|
-
const p = _getEdgeIntersection(b, a, edge, bounds,
|
|
25032
|
+
const p = _getEdgeIntersection(b, a, edge, bounds, round);
|
|
25081
25033
|
p._code = _getBitCode(p, bounds);
|
|
25082
25034
|
clippedPoints.push(p);
|
|
25083
25035
|
}
|
|
25084
25036
|
clippedPoints.push(a);
|
|
25085
25037
|
} else if (!(b._code & edge)) {
|
|
25086
|
-
const p = _getEdgeIntersection(b, a, edge, bounds,
|
|
25038
|
+
const p = _getEdgeIntersection(b, a, edge, bounds, round);
|
|
25087
25039
|
p._code = _getBitCode(p, bounds);
|
|
25088
25040
|
clippedPoints.push(p);
|
|
25089
25041
|
}
|
|
@@ -25111,7 +25063,7 @@ function polygonCenter(latlngs, crs) {
|
|
|
25111
25063
|
const latlng = new LatLng(latlngs[i]);
|
|
25112
25064
|
points.push(crs.project(new LatLng(latlng.lat - centroidLatLng.lat, latlng.lng - centroidLatLng.lng)));
|
|
25113
25065
|
}
|
|
25114
|
-
let
|
|
25066
|
+
let area = 0, x = 0, y = 0;
|
|
25115
25067
|
let center;
|
|
25116
25068
|
for (let i = 0, j = len - 1;i < len; j = i++) {
|
|
25117
25069
|
const p1 = points[i];
|
|
@@ -25119,21 +25071,21 @@ function polygonCenter(latlngs, crs) {
|
|
|
25119
25071
|
const f = p1.y * p2.x - p2.y * p1.x;
|
|
25120
25072
|
x += (p1.x + p2.x) * f;
|
|
25121
25073
|
y += (p1.y + p2.y) * f;
|
|
25122
|
-
|
|
25074
|
+
area += f * 3;
|
|
25123
25075
|
}
|
|
25124
|
-
if (
|
|
25076
|
+
if (area === 0) {
|
|
25125
25077
|
center = points[0];
|
|
25126
25078
|
} else {
|
|
25127
|
-
center = [x /
|
|
25079
|
+
center = [x / area, y / area];
|
|
25128
25080
|
}
|
|
25129
25081
|
const latlngCenter = crs.unproject(new Point(center));
|
|
25130
25082
|
return new LatLng(latlngCenter.lat + centroidLatLng.lat, latlngCenter.lng + centroidLatLng.lng);
|
|
25131
25083
|
}
|
|
25132
|
-
function centroid(
|
|
25084
|
+
function centroid(coords) {
|
|
25133
25085
|
let latSum = 0;
|
|
25134
25086
|
let lngSum = 0;
|
|
25135
25087
|
let len = 0;
|
|
25136
|
-
for (const coord of
|
|
25088
|
+
for (const coord of coords) {
|
|
25137
25089
|
const latlng = new LatLng(coord);
|
|
25138
25090
|
latSum += latlng.lat;
|
|
25139
25091
|
lngSum += latlng.lng;
|
|
@@ -25171,10 +25123,10 @@ function _simplifyDPStep(points, markers, sqTolerance, first, last) {
|
|
|
25171
25123
|
let maxSqDist = 0;
|
|
25172
25124
|
let index = 0;
|
|
25173
25125
|
for (let i = first + 1;i <= last - 1; i++) {
|
|
25174
|
-
const
|
|
25175
|
-
if (
|
|
25126
|
+
const sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true);
|
|
25127
|
+
if (sqDist > maxSqDist) {
|
|
25176
25128
|
index = i;
|
|
25177
|
-
maxSqDist =
|
|
25129
|
+
maxSqDist = sqDist;
|
|
25178
25130
|
}
|
|
25179
25131
|
}
|
|
25180
25132
|
if (maxSqDist > sqTolerance) {
|
|
@@ -25197,7 +25149,7 @@ function _reducePoints(points, sqTolerance) {
|
|
|
25197
25149
|
return reducedPoints;
|
|
25198
25150
|
}
|
|
25199
25151
|
var _lastCode;
|
|
25200
|
-
function clipSegment(a, b, bounds, useLastCode,
|
|
25152
|
+
function clipSegment(a, b, bounds, useLastCode, round) {
|
|
25201
25153
|
let codeA = useLastCode ? _lastCode : _getBitCode(a, bounds);
|
|
25202
25154
|
let codeB = _getBitCode(b, bounds);
|
|
25203
25155
|
_lastCode = codeB;
|
|
@@ -25207,7 +25159,7 @@ function clipSegment(a, b, bounds, useLastCode, round2) {
|
|
|
25207
25159
|
if (codeA & codeB)
|
|
25208
25160
|
return false;
|
|
25209
25161
|
const codeOut = codeA || codeB;
|
|
25210
|
-
const p = _getEdgeIntersection(a, b, codeOut, bounds,
|
|
25162
|
+
const p = _getEdgeIntersection(a, b, codeOut, bounds, round);
|
|
25211
25163
|
const newCode = _getBitCode(p, bounds);
|
|
25212
25164
|
if (codeOut === codeA) {
|
|
25213
25165
|
a = p;
|
|
@@ -25218,7 +25170,7 @@ function clipSegment(a, b, bounds, useLastCode, round2) {
|
|
|
25218
25170
|
}
|
|
25219
25171
|
}
|
|
25220
25172
|
}
|
|
25221
|
-
function _getEdgeIntersection(a, b, code, bounds,
|
|
25173
|
+
function _getEdgeIntersection(a, b, code, bounds, round) {
|
|
25222
25174
|
const dx = b.x - a.x;
|
|
25223
25175
|
const dy = b.y - a.y;
|
|
25224
25176
|
const min = bounds.min;
|
|
@@ -25237,7 +25189,7 @@ function _getEdgeIntersection(a, b, code, bounds, round2) {
|
|
|
25237
25189
|
x = min.x;
|
|
25238
25190
|
y = a.y + dy * (min.x - a.x) / dx;
|
|
25239
25191
|
}
|
|
25240
|
-
return new Point(x, y,
|
|
25192
|
+
return new Point(x, y, round);
|
|
25241
25193
|
}
|
|
25242
25194
|
function _getBitCode(p, bounds) {
|
|
25243
25195
|
let code = 0;
|
|
@@ -25256,7 +25208,7 @@ function _sqDist(p1, p2) {
|
|
|
25256
25208
|
const dy = p2.y - p1.y;
|
|
25257
25209
|
return dx * dx + dy * dy;
|
|
25258
25210
|
}
|
|
25259
|
-
function _sqClosestPointOnSegment(p, p1, p2,
|
|
25211
|
+
function _sqClosestPointOnSegment(p, p1, p2, sqDist) {
|
|
25260
25212
|
let { x, y } = p1;
|
|
25261
25213
|
let dx = p2.x - x, dy = p2.y - y;
|
|
25262
25214
|
const dot = dx * dx + dy * dy;
|
|
@@ -25273,7 +25225,7 @@ function _sqClosestPointOnSegment(p, p1, p2, sqDist2) {
|
|
|
25273
25225
|
}
|
|
25274
25226
|
dx = p.x - x;
|
|
25275
25227
|
dy = p.y - y;
|
|
25276
|
-
return
|
|
25228
|
+
return sqDist ? dx * dx + dy * dy : new Point(x, y);
|
|
25277
25229
|
}
|
|
25278
25230
|
function isFlat(latlngs) {
|
|
25279
25231
|
return !Array.isArray(latlngs[0]) || typeof latlngs[0][0] !== "object" && typeof latlngs[0][0] !== "undefined";
|
|
@@ -25355,9 +25307,9 @@ class Polyline extends Path {
|
|
|
25355
25307
|
for (let i = 1, len = points.length;i < len; i++) {
|
|
25356
25308
|
const p1 = points[i - 1];
|
|
25357
25309
|
const p2 = points[i];
|
|
25358
|
-
const
|
|
25359
|
-
if (
|
|
25360
|
-
minDistance =
|
|
25310
|
+
const sqDist = closest(p, p1, p2, true);
|
|
25311
|
+
if (sqDist < minDistance) {
|
|
25312
|
+
minDistance = sqDist;
|
|
25361
25313
|
minPoint = closest(p, p1, p2);
|
|
25362
25314
|
}
|
|
25363
25315
|
}
|
|
@@ -25727,9 +25679,9 @@ class OfflineMapsControl extends Control {
|
|
|
25727
25679
|
this._button?.classList.add(`${CLASS5}-button-active`);
|
|
25728
25680
|
this._nameEdited = false;
|
|
25729
25681
|
this._frame = { top: 0, left: 0, right: 0, bottom: 0 };
|
|
25730
|
-
const
|
|
25731
|
-
|
|
25732
|
-
for (const handle of
|
|
25682
|
+
const select = this._select = create("div", `${CLASS5}-select`, map.getContainer());
|
|
25683
|
+
select.innerHTML = `<div class="${CLASS5}-frame"></div>${["nw", "ne", "sw", "se"].map((c) => `<div class="${CLASS5}-handle ${CLASS5}-handle-${c}" data-corner="${c}"></div>`).join("")}`;
|
|
25684
|
+
for (const handle of select.querySelectorAll(`.${CLASS5}-handle`))
|
|
25733
25685
|
this._dragHandle(handle);
|
|
25734
25686
|
const card = this._card = this._panel(`${CLASS5}-card ${CLASS5}-card-select`);
|
|
25735
25687
|
card.innerHTML = `
|
|
@@ -25897,14 +25849,14 @@ class OfflineMapsControl extends Control {
|
|
|
25897
25849
|
this._outline = undefined;
|
|
25898
25850
|
}
|
|
25899
25851
|
_layoutSelection() {
|
|
25900
|
-
const
|
|
25852
|
+
const select = this._select;
|
|
25901
25853
|
const f = this._frame;
|
|
25902
|
-
if (!
|
|
25854
|
+
if (!select || !f)
|
|
25903
25855
|
return;
|
|
25904
|
-
const frame =
|
|
25856
|
+
const frame = select.querySelector(`.${CLASS5}-frame`);
|
|
25905
25857
|
Object.assign(frame.style, { top: `${f.top}px`, left: `${f.left}px`, right: `${f.right}px`, bottom: `${f.bottom}px` });
|
|
25906
25858
|
const place = (corner, x, y) => {
|
|
25907
|
-
const el =
|
|
25859
|
+
const el = select.querySelector(`.${CLASS5}-handle-${corner}`);
|
|
25908
25860
|
if (el)
|
|
25909
25861
|
Object.assign(el.style, { left: x, top: y });
|
|
25910
25862
|
};
|
|
@@ -25965,7 +25917,7 @@ class OfflineMapsControl extends Control {
|
|
|
25965
25917
|
const card = this._card;
|
|
25966
25918
|
if (!bounds || !card)
|
|
25967
25919
|
return;
|
|
25968
|
-
const
|
|
25920
|
+
const area = { bounds, map: this._map };
|
|
25969
25921
|
const render = (estimate) => {
|
|
25970
25922
|
const el = card.querySelector(`.${CLASS5}-estimate`);
|
|
25971
25923
|
const button = card.querySelector(`.${CLASS5}-download`);
|
|
@@ -25982,10 +25934,10 @@ class OfflineMapsControl extends Control {
|
|
|
25982
25934
|
button.disabled = false;
|
|
25983
25935
|
}
|
|
25984
25936
|
};
|
|
25985
|
-
render(this.maps.quickEstimate(
|
|
25937
|
+
render(this.maps.quickEstimate(area));
|
|
25986
25938
|
if (sample) {
|
|
25987
25939
|
const token = this._estimateToken = (this._estimateToken ?? 0) + 1;
|
|
25988
|
-
this.maps.estimate(
|
|
25940
|
+
this.maps.estimate(area).then((estimate) => {
|
|
25989
25941
|
if (token === this._estimateToken && this._select)
|
|
25990
25942
|
render(estimate);
|
|
25991
25943
|
}, () => {});
|
|
@@ -26079,8 +26031,8 @@ function nameFromLabels(map, bounds) {
|
|
|
26079
26031
|
const lng = unitToLng((sub.x + p.x / feature.extent) / 2 ** z);
|
|
26080
26032
|
if (lng < w || lng > e || lat < s || lat > n)
|
|
26081
26033
|
continue;
|
|
26082
|
-
const
|
|
26083
|
-
const score = rank + (typeof props.rank === "number" ? props.rank / 100 : 0) +
|
|
26034
|
+
const off = Math.hypot((lng - cx) / (e - w || 1), (lat - cy) / (n - s || 1));
|
|
26035
|
+
const score = rank + (typeof props.rank === "number" ? props.rank / 100 : 0) + off;
|
|
26084
26036
|
if (!best || score < best.score)
|
|
26085
26037
|
best = { name, score };
|
|
26086
26038
|
}
|
|
@@ -26359,12 +26311,12 @@ class StreetIndex {
|
|
|
26359
26311
|
const segment = { name: feature.name, a, b };
|
|
26360
26312
|
for (let cx = Math.floor(Math.min(a.lat, b.lat) * 500);cx <= Math.floor(Math.max(a.lat, b.lat) * 500); cx++) {
|
|
26361
26313
|
for (let cy = Math.floor(Math.min(a.lng, b.lng) * 500);cy <= Math.floor(Math.max(a.lng, b.lng) * 500); cy++) {
|
|
26362
|
-
const
|
|
26363
|
-
const list = this._cells.get(
|
|
26314
|
+
const key = `${cx},${cy}`;
|
|
26315
|
+
const list = this._cells.get(key);
|
|
26364
26316
|
if (list)
|
|
26365
26317
|
list.push(segment);
|
|
26366
26318
|
else
|
|
26367
|
-
this._cells.set(
|
|
26319
|
+
this._cells.set(key, [segment]);
|
|
26368
26320
|
}
|
|
26369
26321
|
}
|
|
26370
26322
|
}
|
|
@@ -26449,8 +26401,8 @@ class SearchEngine {
|
|
|
26449
26401
|
return false;
|
|
26450
26402
|
if (typeof navigator !== "undefined" && navigator.onLine === false)
|
|
26451
26403
|
return false;
|
|
26452
|
-
const
|
|
26453
|
-
const maps = this.offline ?? (typeof
|
|
26404
|
+
const shared = offlineMapsNow();
|
|
26405
|
+
const maps = this.offline ?? (typeof shared === "object" ? shared : undefined);
|
|
26454
26406
|
return !maps?.onlyOffline;
|
|
26455
26407
|
}
|
|
26456
26408
|
async local(query, options = {}) {
|
|
@@ -26494,11 +26446,11 @@ class SearchEngine {
|
|
|
26494
26446
|
return out;
|
|
26495
26447
|
}
|
|
26496
26448
|
_score(place, match, near) {
|
|
26497
|
-
const
|
|
26449
|
+
const distance = near ? distanceMeters2(near, place.center) : undefined;
|
|
26498
26450
|
let score = match * 10 - place.rank * 0.3;
|
|
26499
|
-
if (
|
|
26500
|
-
score -= Math.log10(1 +
|
|
26501
|
-
return { ...place, distance
|
|
26451
|
+
if (distance !== undefined)
|
|
26452
|
+
score -= Math.log10(1 + distance / 400) * 1.6;
|
|
26453
|
+
return { ...place, distance, score };
|
|
26502
26454
|
}
|
|
26503
26455
|
async suggest(query, options = {}) {
|
|
26504
26456
|
const limit = options.limit ?? 8;
|
|
@@ -26585,9 +26537,9 @@ class SearchEngine {
|
|
|
26585
26537
|
if (!needs.length || !this.map)
|
|
26586
26538
|
return places;
|
|
26587
26539
|
const c = this.map.getCenter?.();
|
|
26588
|
-
const
|
|
26589
|
-
if (this._streets?.key !==
|
|
26590
|
-
this._streets = { key
|
|
26540
|
+
const key = `${c?.lat.toFixed(3)},${c?.lng.toFixed(3)},${this.map.getZoom?.()?.toFixed(1)}`;
|
|
26541
|
+
if (this._streets?.key !== key)
|
|
26542
|
+
this._streets = { key, index: new StreetIndex(this.map) };
|
|
26591
26543
|
const index = this._streets.index;
|
|
26592
26544
|
for (const place of needs) {
|
|
26593
26545
|
const street = index.nearest(place.center);
|
|
@@ -26613,10 +26565,10 @@ function merge(places) {
|
|
|
26613
26565
|
}
|
|
26614
26566
|
return kept;
|
|
26615
26567
|
}
|
|
26616
|
-
function describePlace(place,
|
|
26568
|
+
function describePlace(place, formatDistance) {
|
|
26617
26569
|
return [
|
|
26618
26570
|
kindLabel(place.kind),
|
|
26619
|
-
place.distance !== undefined &&
|
|
26571
|
+
place.distance !== undefined && formatDistance ? formatDistance(place.distance) : undefined,
|
|
26620
26572
|
place.address
|
|
26621
26573
|
].filter(Boolean).join(" · ");
|
|
26622
26574
|
}
|
|
@@ -26625,8 +26577,8 @@ class SearchHistory {
|
|
|
26625
26577
|
key;
|
|
26626
26578
|
max;
|
|
26627
26579
|
_memory = [];
|
|
26628
|
-
constructor(
|
|
26629
|
-
this.key =
|
|
26580
|
+
constructor(key = "ts-maps-search-recents", max = 8) {
|
|
26581
|
+
this.key = key;
|
|
26630
26582
|
this.max = max;
|
|
26631
26583
|
}
|
|
26632
26584
|
list() {
|
|
@@ -27081,8 +27033,8 @@ class SearchControl extends Control {
|
|
|
27081
27033
|
return;
|
|
27082
27034
|
const units = this._units();
|
|
27083
27035
|
const kind = kindLabel(place.kind);
|
|
27084
|
-
const
|
|
27085
|
-
const
|
|
27036
|
+
const distance = place.distance !== undefined ? formatDistance(place.distance, units) : undefined;
|
|
27037
|
+
const coords = `${place.center.lat.toFixed(5)}, ${place.center.lng.toFixed(5)}`;
|
|
27086
27038
|
this._rows = [];
|
|
27087
27039
|
this._body.dataset.html = "";
|
|
27088
27040
|
this._body.innerHTML = `
|
|
@@ -27091,14 +27043,14 @@ class SearchControl extends Control {
|
|
|
27091
27043
|
${badge(place.icon, 44)}
|
|
27092
27044
|
<div class="${CLASS6}-place-title">
|
|
27093
27045
|
<div class="${CLASS6}-place-name">${escape2(place.name)}</div>
|
|
27094
|
-
<div class="${CLASS6}-place-kind">${escape2([kind,
|
|
27046
|
+
<div class="${CLASS6}-place-kind">${escape2([kind, distance].filter(Boolean).join(" · "))}</div>
|
|
27095
27047
|
</div>
|
|
27096
27048
|
<button type="button" class="${CLASS6}-close" data-action="close-place" aria-label="Close">✕</button>
|
|
27097
27049
|
</div>
|
|
27098
27050
|
${this.options.turnByTurn || this.options.onDirections ? `<button type="button" class="${CLASS6}-directions" data-action="directions">${CAR}<span>Directions</span></button>` : ""}
|
|
27099
27051
|
<div class="${CLASS6}-place-info">
|
|
27100
27052
|
${place.address ? `<div class="${CLASS6}-info-label">Address</div><div class="${CLASS6}-info-value">${escape2(place.address)}</div>` : ""}
|
|
27101
|
-
<div class="${CLASS6}-info-label">Coordinates</div><div class="${CLASS6}-info-value">${
|
|
27053
|
+
<div class="${CLASS6}-info-label">Coordinates</div><div class="${CLASS6}-info-value">${coords}</div>
|
|
27102
27054
|
</div>
|
|
27103
27055
|
</div>`;
|
|
27104
27056
|
}
|
|
@@ -27194,17 +27146,17 @@ class SearchControl extends Control {
|
|
|
27194
27146
|
}
|
|
27195
27147
|
}
|
|
27196
27148
|
function deviceLocation(fallback) {
|
|
27197
|
-
return new Promise((
|
|
27149
|
+
return new Promise((resolve) => {
|
|
27198
27150
|
const geo = typeof navigator !== "undefined" ? navigator.geolocation : undefined;
|
|
27199
27151
|
if (!geo)
|
|
27200
|
-
return
|
|
27201
|
-
const timer = setTimeout(() =>
|
|
27152
|
+
return resolve(fallback);
|
|
27153
|
+
const timer = setTimeout(() => resolve(fallback), 5000);
|
|
27202
27154
|
geo.getCurrentPosition((p) => {
|
|
27203
27155
|
clearTimeout(timer);
|
|
27204
|
-
|
|
27156
|
+
resolve({ lat: p.coords.latitude, lng: p.coords.longitude });
|
|
27205
27157
|
}, () => {
|
|
27206
27158
|
clearTimeout(timer);
|
|
27207
|
-
|
|
27159
|
+
resolve(fallback);
|
|
27208
27160
|
}, { timeout: 5000, maximumAge: 60000 });
|
|
27209
27161
|
});
|
|
27210
27162
|
}
|
|
@@ -27340,7 +27292,7 @@ class TerritoryLog extends Evented {
|
|
|
27340
27292
|
return this._seen.has(id);
|
|
27341
27293
|
}
|
|
27342
27294
|
confirm(id, seq) {
|
|
27343
|
-
const index = this._log.findIndex((
|
|
27295
|
+
const index = this._log.findIndex((event) => event.id === id);
|
|
27344
27296
|
if (index === -1)
|
|
27345
27297
|
return false;
|
|
27346
27298
|
const event = this._log[index];
|
|
@@ -27477,10 +27429,10 @@ function makeLoop(ring, startIndex, endIndex, closure, options) {
|
|
|
27477
27429
|
const perimeter = ringPerimeter(ring, false);
|
|
27478
27430
|
if (perimeter < options.minLoopLength)
|
|
27479
27431
|
return null;
|
|
27480
|
-
const
|
|
27481
|
-
if (
|
|
27432
|
+
const area = Math.abs(ringArea2(ring));
|
|
27433
|
+
if (area < options.minArea)
|
|
27482
27434
|
return null;
|
|
27483
|
-
return { ring, area
|
|
27435
|
+
return { ring, area, perimeter, startIndex, endIndex, closure };
|
|
27484
27436
|
}
|
|
27485
27437
|
function detectLoop(track, options = {}) {
|
|
27486
27438
|
const opts = { ...DEFAULTS, ...options };
|
|
@@ -27490,10 +27442,10 @@ function detectLoop(track, options = {}) {
|
|
|
27490
27442
|
const a1 = track[i - 1];
|
|
27491
27443
|
const a2 = track[i];
|
|
27492
27444
|
for (let j = 1;j < i - 1; j++) {
|
|
27493
|
-
const
|
|
27494
|
-
if (!
|
|
27445
|
+
const cross = segmentCross(a1, a2, track[j - 1], track[j]);
|
|
27446
|
+
if (!cross)
|
|
27495
27447
|
continue;
|
|
27496
|
-
const point = lerp(a1, a2,
|
|
27448
|
+
const point = lerp(a1, a2, cross.t);
|
|
27497
27449
|
const ring = [point, ...track.slice(j, i), point];
|
|
27498
27450
|
const loop = makeLoop(ring, j - 1, i, "crossing", opts);
|
|
27499
27451
|
if (loop)
|
|
@@ -27541,10 +27493,10 @@ class LoopDetector {
|
|
|
27541
27493
|
const a1 = track[i - 1];
|
|
27542
27494
|
const a2 = track[i];
|
|
27543
27495
|
for (let j = 1;j < i - 1; j++) {
|
|
27544
|
-
const
|
|
27545
|
-
if (!
|
|
27496
|
+
const cross = segmentCross(a1, a2, track[j - 1], track[j]);
|
|
27497
|
+
if (!cross)
|
|
27546
27498
|
continue;
|
|
27547
|
-
const crossing = lerp(a1, a2,
|
|
27499
|
+
const crossing = lerp(a1, a2, cross.t);
|
|
27548
27500
|
const ring = [crossing, ...track.slice(j, i), crossing];
|
|
27549
27501
|
const loop = makeLoop(ring, j - 1, i, "crossing", this._options);
|
|
27550
27502
|
if (loop) {
|
|
@@ -27583,9 +27535,9 @@ function simplifyTrack(track, tolerance = 3) {
|
|
|
27583
27535
|
let furthest = -1;
|
|
27584
27536
|
let maxDistance = tolerance;
|
|
27585
27537
|
for (let i = first + 1;i < last; i++) {
|
|
27586
|
-
const
|
|
27587
|
-
if (
|
|
27588
|
-
maxDistance =
|
|
27538
|
+
const distance = perpendicularDistance(track[i], track[first], track[last]);
|
|
27539
|
+
if (distance > maxDistance) {
|
|
27540
|
+
maxDistance = distance;
|
|
27589
27541
|
furthest = i;
|
|
27590
27542
|
}
|
|
27591
27543
|
}
|
|
@@ -27836,8 +27788,8 @@ class BlanketOverlay extends Layer {
|
|
|
27836
27788
|
const p = this.options.padding;
|
|
27837
27789
|
const size = map.getSize();
|
|
27838
27790
|
if (!map._bearing && !map._pitch) {
|
|
27839
|
-
const
|
|
27840
|
-
return new Bounds(
|
|
27791
|
+
const min = map.containerPointToLayerPoint(size.multiplyBy(-p)).round();
|
|
27792
|
+
return new Bounds(min, min.add(size.multiplyBy(1 + p * 2)).round());
|
|
27841
27793
|
}
|
|
27842
27794
|
const corners = [
|
|
27843
27795
|
new Point(-p * size.x, -p * size.y),
|
|
@@ -28270,30 +28222,30 @@ class GeoJSON extends FeatureGroup {
|
|
|
28270
28222
|
}
|
|
28271
28223
|
static geometryToLayer(geojson, options) {
|
|
28272
28224
|
const geometry = geojson.type === "Feature" ? geojson.geometry : geojson;
|
|
28273
|
-
const
|
|
28225
|
+
const coords = geometry?.coordinates;
|
|
28274
28226
|
const layers = [];
|
|
28275
28227
|
const pointToLayer = options?.pointToLayer;
|
|
28276
28228
|
const _coordsToLatLng = options?.coordsToLatLng ?? GeoJSON.coordsToLatLng;
|
|
28277
28229
|
let latlng, latlngs;
|
|
28278
|
-
if (!
|
|
28230
|
+
if (!coords && !geometry)
|
|
28279
28231
|
return null;
|
|
28280
28232
|
switch (geometry.type) {
|
|
28281
28233
|
case "Point":
|
|
28282
|
-
latlng = _coordsToLatLng(
|
|
28234
|
+
latlng = _coordsToLatLng(coords);
|
|
28283
28235
|
return GeoJSON._pointToLayer(pointToLayer, geojson, latlng, options);
|
|
28284
28236
|
case "MultiPoint":
|
|
28285
|
-
for (const coord of
|
|
28237
|
+
for (const coord of coords) {
|
|
28286
28238
|
latlng = _coordsToLatLng(coord);
|
|
28287
28239
|
layers.push(GeoJSON._pointToLayer(pointToLayer, geojson, latlng, options));
|
|
28288
28240
|
}
|
|
28289
28241
|
return new FeatureGroup(layers);
|
|
28290
28242
|
case "LineString":
|
|
28291
28243
|
case "MultiLineString":
|
|
28292
|
-
latlngs = GeoJSON.coordsToLatLngs(
|
|
28244
|
+
latlngs = GeoJSON.coordsToLatLngs(coords, geometry.type === "LineString" ? 0 : 1, _coordsToLatLng);
|
|
28293
28245
|
return new Polyline(latlngs, options);
|
|
28294
28246
|
case "Polygon":
|
|
28295
28247
|
case "MultiPolygon":
|
|
28296
|
-
latlngs = GeoJSON.coordsToLatLngs(
|
|
28248
|
+
latlngs = GeoJSON.coordsToLatLngs(coords, geometry.type === "Polygon" ? 1 : 2, _coordsToLatLng);
|
|
28297
28249
|
return new Polygon(latlngs, options);
|
|
28298
28250
|
case "GeometryCollection":
|
|
28299
28251
|
for (const g of geometry.geometries) {
|
|
@@ -28320,21 +28272,21 @@ class GeoJSON extends FeatureGroup {
|
|
|
28320
28272
|
static _pointToLayer(pointToLayerFn, geojson, latlng, options) {
|
|
28321
28273
|
return pointToLayerFn ? pointToLayerFn(geojson, latlng) : new Marker(latlng, options?.markersInheritOptions && options);
|
|
28322
28274
|
}
|
|
28323
|
-
static coordsToLatLng(
|
|
28324
|
-
return new LatLng(
|
|
28275
|
+
static coordsToLatLng(coords) {
|
|
28276
|
+
return new LatLng(coords[1], coords[0], coords[2]);
|
|
28325
28277
|
}
|
|
28326
|
-
static coordsToLatLngs(
|
|
28327
|
-
return
|
|
28278
|
+
static coordsToLatLngs(coords, levelsDeep, _coordsToLatLng) {
|
|
28279
|
+
return coords.map((coord) => levelsDeep ? GeoJSON.coordsToLatLngs(coord, levelsDeep - 1, _coordsToLatLng) : (_coordsToLatLng || GeoJSON.coordsToLatLng)(coord));
|
|
28328
28280
|
}
|
|
28329
28281
|
static latLngToCoords(latlng, precision) {
|
|
28330
28282
|
const ll = new LatLng(latlng);
|
|
28331
28283
|
return ll.alt !== undefined ? [formatNum(ll.lng, precision), formatNum(ll.lat, precision), formatNum(ll.alt, precision)] : [formatNum(ll.lng, precision), formatNum(ll.lat, precision)];
|
|
28332
28284
|
}
|
|
28333
28285
|
static latLngsToCoords(latlngs, levelsDeep, close, precision) {
|
|
28334
|
-
const
|
|
28335
|
-
if (!levelsDeep && close &&
|
|
28336
|
-
|
|
28337
|
-
return
|
|
28286
|
+
const coords = latlngs.map((latlng) => levelsDeep ? GeoJSON.latLngsToCoords(latlng, isFlat(latlng) ? 0 : levelsDeep - 1, close, precision) : GeoJSON.latLngToCoords(latlng, precision));
|
|
28287
|
+
if (!levelsDeep && close && coords.length > 0)
|
|
28288
|
+
coords.push(coords[0].slice());
|
|
28289
|
+
return coords;
|
|
28338
28290
|
}
|
|
28339
28291
|
static getFeature(layer, newGeometry) {
|
|
28340
28292
|
return layer.feature ? { ...layer.feature, geometry: newGeometry } : GeoJSON.asFeature(newGeometry);
|
|
@@ -28359,10 +28311,10 @@ CircleMarker.include(PointToGeoJSON);
|
|
|
28359
28311
|
Polyline.include({
|
|
28360
28312
|
toGeoJSON(precision) {
|
|
28361
28313
|
const multi = !isFlat(this._latlngs);
|
|
28362
|
-
const
|
|
28314
|
+
const coords = GeoJSON.latLngsToCoords(this._latlngs, multi ? 1 : 0, false, precision);
|
|
28363
28315
|
return GeoJSON.getFeature(this, {
|
|
28364
28316
|
type: `${multi ? "Multi" : ""}LineString`,
|
|
28365
|
-
coordinates:
|
|
28317
|
+
coordinates: coords
|
|
28366
28318
|
});
|
|
28367
28319
|
}
|
|
28368
28320
|
});
|
|
@@ -28370,22 +28322,22 @@ Polygon.include({
|
|
|
28370
28322
|
toGeoJSON(precision) {
|
|
28371
28323
|
const holes = !isFlat(this._latlngs);
|
|
28372
28324
|
const multi = holes && !isFlat(this._latlngs[0]);
|
|
28373
|
-
let
|
|
28325
|
+
let coords = GeoJSON.latLngsToCoords(this._latlngs, multi ? 2 : holes ? 1 : 0, true, precision);
|
|
28374
28326
|
if (!holes)
|
|
28375
|
-
|
|
28327
|
+
coords = [coords];
|
|
28376
28328
|
return GeoJSON.getFeature(this, {
|
|
28377
28329
|
type: `${multi ? "Multi" : ""}Polygon`,
|
|
28378
|
-
coordinates:
|
|
28330
|
+
coordinates: coords
|
|
28379
28331
|
});
|
|
28380
28332
|
}
|
|
28381
28333
|
});
|
|
28382
28334
|
LayerGroup.include({
|
|
28383
28335
|
toMultiPoint(precision) {
|
|
28384
|
-
const
|
|
28336
|
+
const coords = [];
|
|
28385
28337
|
this.eachLayer((layer) => {
|
|
28386
|
-
|
|
28338
|
+
coords.push(layer.toGeoJSON(precision).geometry.coordinates);
|
|
28387
28339
|
});
|
|
28388
|
-
return GeoJSON.getFeature(this, { type: "MultiPoint", coordinates:
|
|
28340
|
+
return GeoJSON.getFeature(this, { type: "MultiPoint", coordinates: coords });
|
|
28389
28341
|
},
|
|
28390
28342
|
toGeoJSON(precision) {
|
|
28391
28343
|
const type = this.feature?.geometry?.type;
|
|
@@ -28595,7 +28547,7 @@ class TerritoryLayer extends Layer {
|
|
|
28595
28547
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28596
28548
|
ctx.setTransform(this._ratio, 0, 0, this._ratio, 0, 0);
|
|
28597
28549
|
const options = this.options;
|
|
28598
|
-
const
|
|
28550
|
+
const project = (position) => map.latLngToContainerPoint([position[1], position[0]]);
|
|
28599
28551
|
const entries = this._territories();
|
|
28600
28552
|
entries.sort(([a], [b]) => {
|
|
28601
28553
|
if (a === options.self)
|
|
@@ -28607,9 +28559,9 @@ class TerritoryLayer extends Layer {
|
|
|
28607
28559
|
for (const [owner, territory] of entries) {
|
|
28608
28560
|
if (territory.length === 0)
|
|
28609
28561
|
continue;
|
|
28610
|
-
this._drawTerritory(ctx, owner, territory,
|
|
28562
|
+
this._drawTerritory(ctx, owner, territory, project);
|
|
28611
28563
|
}
|
|
28612
|
-
this._drawCaptures(ctx,
|
|
28564
|
+
this._drawCaptures(ctx, project);
|
|
28613
28565
|
if (this._animations.length > 0)
|
|
28614
28566
|
this.redraw();
|
|
28615
28567
|
}
|
|
@@ -28626,13 +28578,13 @@ class TerritoryLayer extends Layer {
|
|
|
28626
28578
|
label: style.label ?? true
|
|
28627
28579
|
};
|
|
28628
28580
|
}
|
|
28629
|
-
_drawTerritory(ctx, owner, territory,
|
|
28581
|
+
_drawTerritory(ctx, owner, territory, project) {
|
|
28630
28582
|
const style = this._styleFor(owner);
|
|
28631
28583
|
const path = (polygon) => {
|
|
28632
28584
|
ctx.beginPath();
|
|
28633
28585
|
for (const ring of polygon) {
|
|
28634
28586
|
ring.forEach((position, index) => {
|
|
28635
|
-
const point =
|
|
28587
|
+
const point = project(position);
|
|
28636
28588
|
if (index === 0)
|
|
28637
28589
|
ctx.moveTo(point.x, point.y);
|
|
28638
28590
|
else
|
|
@@ -28664,7 +28616,7 @@ class TerritoryLayer extends Layer {
|
|
|
28664
28616
|
ctx.stroke();
|
|
28665
28617
|
}
|
|
28666
28618
|
if (style.label)
|
|
28667
|
-
this._drawLabels(ctx, territory, style.color,
|
|
28619
|
+
this._drawLabels(ctx, territory, style.color, project);
|
|
28668
28620
|
}
|
|
28669
28621
|
_drawHatch(ctx, color) {
|
|
28670
28622
|
ctx.save();
|
|
@@ -28684,7 +28636,7 @@ class TerritoryLayer extends Layer {
|
|
|
28684
28636
|
ctx.stroke();
|
|
28685
28637
|
ctx.restore();
|
|
28686
28638
|
}
|
|
28687
|
-
_drawLabels(ctx, territory, color,
|
|
28639
|
+
_drawLabels(ctx, territory, color, project) {
|
|
28688
28640
|
const options = this.options;
|
|
28689
28641
|
const map = this._map;
|
|
28690
28642
|
const minZoom = options.labelMinZoom ?? 13;
|
|
@@ -28693,7 +28645,7 @@ class TerritoryLayer extends Layer {
|
|
|
28693
28645
|
for (const polygon of territory) {
|
|
28694
28646
|
if (polygon.length === 0)
|
|
28695
28647
|
continue;
|
|
28696
|
-
const projected = polygon[0].map(
|
|
28648
|
+
const projected = polygon[0].map(project);
|
|
28697
28649
|
const bounds = boundsOf(projected);
|
|
28698
28650
|
const width = bounds.maxX - bounds.minX;
|
|
28699
28651
|
const height = bounds.maxY - bounds.minY;
|
|
@@ -28714,7 +28666,7 @@ class TerritoryLayer extends Layer {
|
|
|
28714
28666
|
ctx.restore();
|
|
28715
28667
|
}
|
|
28716
28668
|
}
|
|
28717
|
-
_drawCaptures(ctx,
|
|
28669
|
+
_drawCaptures(ctx, project) {
|
|
28718
28670
|
const time = now2();
|
|
28719
28671
|
const remaining = [];
|
|
28720
28672
|
for (const animation of this._animations) {
|
|
@@ -28724,7 +28676,7 @@ class TerritoryLayer extends Layer {
|
|
|
28724
28676
|
remaining.push(animation);
|
|
28725
28677
|
const eased = 1 - (1 - progress) ** 3;
|
|
28726
28678
|
const color = this.colorFor(animation.owner);
|
|
28727
|
-
const projected = animation.ring.map(
|
|
28679
|
+
const projected = animation.ring.map(project);
|
|
28728
28680
|
ctx.save();
|
|
28729
28681
|
ctx.beginPath();
|
|
28730
28682
|
projected.forEach((point, index) => {
|
|
@@ -29021,11 +28973,11 @@ class RouteEditor extends Layer {
|
|
|
29021
28973
|
}
|
|
29022
28974
|
onAdd(map) {
|
|
29023
28975
|
const { color, casingColor, weight } = this.options;
|
|
29024
|
-
const
|
|
29025
|
-
this._casing = new Polyline([], { ...
|
|
29026
|
-
this._line = new Polyline([], { ...
|
|
29027
|
-
this._preview = new Polyline([], { ...
|
|
29028
|
-
this._hit = new Polyline([], { ...
|
|
28976
|
+
const round = { lineCap: "round", lineJoin: "round" };
|
|
28977
|
+
this._casing = new Polyline([], { ...round, color: casingColor, weight: weight + 3, opacity: 0.35, interactive: false }).addTo(map);
|
|
28978
|
+
this._line = new Polyline([], { ...round, color, weight, opacity: 1, interactive: false }).addTo(map);
|
|
28979
|
+
this._preview = new Polyline([], { ...round, color, weight: 3, opacity: 0.9, dashArray: "2 8", interactive: false }).addTo(map);
|
|
28980
|
+
this._hit = new Polyline([], { ...round, color, weight: 22, opacity: 0, className: "tsmap-route-hit" }).addTo(map);
|
|
29029
28981
|
this._hit.on("pointerdown", this._onLineDown, this);
|
|
29030
28982
|
this._unsubscribe = this._builder.onChange(() => this._redraw());
|
|
29031
28983
|
this._redraw();
|
|
@@ -29073,10 +29025,10 @@ class RouteEditor extends Layer {
|
|
|
29073
29025
|
this._builder.segments.forEach((segment, i) => {
|
|
29074
29026
|
const from = waypoints[i];
|
|
29075
29027
|
const to = waypoints[i + 1];
|
|
29076
|
-
const
|
|
29077
|
-
if (seen.has(
|
|
29028
|
+
const key = [from, to].map((p) => `${p.lat},${p.lng}`).sort().join("|");
|
|
29029
|
+
if (seen.has(key) || this._pixelLength(segment) < opts.midpointMinPixels)
|
|
29078
29030
|
return;
|
|
29079
|
-
seen.add(
|
|
29031
|
+
seen.add(key);
|
|
29080
29032
|
wanted.push({ kind: "midpoint", point: halfway(segment), leg: [from, to] });
|
|
29081
29033
|
});
|
|
29082
29034
|
}
|
|
@@ -29182,10 +29134,10 @@ class RouteEditor extends Layer {
|
|
|
29182
29134
|
this._redraw();
|
|
29183
29135
|
}
|
|
29184
29136
|
}
|
|
29185
|
-
_at(builder, point,
|
|
29137
|
+
_at(builder, point, run) {
|
|
29186
29138
|
const index = builder.waypoints.findIndex((w) => samePoint2(w, point));
|
|
29187
29139
|
if (index >= 0)
|
|
29188
|
-
return
|
|
29140
|
+
return run(index);
|
|
29189
29141
|
}
|
|
29190
29142
|
_insertInto(builder, leg, point) {
|
|
29191
29143
|
const waypoints = builder.waypoints;
|
|
@@ -30083,9 +30035,9 @@ class WMSTileLayer extends TileLayer {
|
|
|
30083
30035
|
initialize(url, options) {
|
|
30084
30036
|
super.initialize(url, options);
|
|
30085
30037
|
const wmsParams = { ...this.defaultWmsParams };
|
|
30086
|
-
for (const [
|
|
30087
|
-
if (!(
|
|
30088
|
-
wmsParams[
|
|
30038
|
+
for (const [key, value] of Object.entries(options ?? {})) {
|
|
30039
|
+
if (!(key in WMSTileLayer.prototype.options))
|
|
30040
|
+
wmsParams[key] = value;
|
|
30089
30041
|
}
|
|
30090
30042
|
const realRetina = this.options.detectRetina && Browser_default.retina ? 2 : 1;
|
|
30091
30043
|
const tileSize = this.getTileSize();
|
|
@@ -30100,14 +30052,14 @@ class WMSTileLayer extends TileLayer {
|
|
|
30100
30052
|
this.wmsParams[projectionKey] = this._crs.code;
|
|
30101
30053
|
super.onAdd();
|
|
30102
30054
|
}
|
|
30103
|
-
getTileUrl(
|
|
30104
|
-
const tileBounds = this._tileCoordsToNwSe(
|
|
30055
|
+
getTileUrl(coords) {
|
|
30056
|
+
const tileBounds = this._tileCoordsToNwSe(coords);
|
|
30105
30057
|
const crs = this._crs;
|
|
30106
30058
|
const bounds = new Bounds(crs.project(tileBounds[0]), crs.project(tileBounds[1]));
|
|
30107
30059
|
const min = bounds.min;
|
|
30108
30060
|
const max = bounds.max;
|
|
30109
30061
|
const bbox = (this._wmsVersion >= 1.3 && this._crs === EPSG4326 ? [min.y, min.x, max.y, max.x] : [min.x, min.y, max.x, max.y]).join(",");
|
|
30110
|
-
const url = new URL(super.getTileUrl(
|
|
30062
|
+
const url = new URL(super.getTileUrl(coords));
|
|
30111
30063
|
for (const [k, v] of Object.entries({ ...this.wmsParams, bbox }))
|
|
30112
30064
|
url.searchParams.append(this.options.uppercase ? k.toUpperCase() : k, String(v));
|
|
30113
30065
|
return url.toString();
|
|
@@ -30803,15 +30755,15 @@ class CooperativeGesturesHandler extends Handler {
|
|
|
30803
30755
|
return this.active() && e.pointerType === "touch";
|
|
30804
30756
|
}
|
|
30805
30757
|
_onTouchStart = (e) => {
|
|
30806
|
-
const
|
|
30807
|
-
this._touchStart =
|
|
30758
|
+
const touch = e.touches.length === 1 ? e.touches[0] : undefined;
|
|
30759
|
+
this._touchStart = touch ? { x: touch.clientX, y: touch.clientY } : null;
|
|
30808
30760
|
};
|
|
30809
30761
|
_onTouchMove = (e) => {
|
|
30810
30762
|
const start = this._touchStart;
|
|
30811
|
-
const
|
|
30812
|
-
if (!start || !
|
|
30763
|
+
const touch = e.touches.length === 1 ? e.touches[0] : undefined;
|
|
30764
|
+
if (!start || !touch || !this.active())
|
|
30813
30765
|
return;
|
|
30814
|
-
if (Math.abs(
|
|
30766
|
+
if (Math.abs(touch.clientX - start.x) + Math.abs(touch.clientY - start.y) < 10)
|
|
30815
30767
|
return;
|
|
30816
30768
|
this._touchStart = null;
|
|
30817
30769
|
this._show("touch");
|
|
@@ -31145,12 +31097,12 @@ class KeyboardHandler extends Handler {
|
|
|
31145
31097
|
_onKeyDown(e) {
|
|
31146
31098
|
if (e.altKey || e.ctrlKey || e.metaKey)
|
|
31147
31099
|
return;
|
|
31148
|
-
const
|
|
31100
|
+
const key = e.code;
|
|
31149
31101
|
const map = this._map;
|
|
31150
31102
|
let offset;
|
|
31151
|
-
if (
|
|
31103
|
+
if (key in this._panKeys) {
|
|
31152
31104
|
if (!map._panAnim || !map._panAnim._inProgress) {
|
|
31153
|
-
offset = this._panKeys[
|
|
31105
|
+
offset = this._panKeys[key];
|
|
31154
31106
|
if (e.shiftKey)
|
|
31155
31107
|
offset = new Point(offset).multiplyBy(3);
|
|
31156
31108
|
if (map.options.maxBounds)
|
|
@@ -31162,9 +31114,9 @@ class KeyboardHandler extends Handler {
|
|
|
31162
31114
|
map.panBy(offset);
|
|
31163
31115
|
}
|
|
31164
31116
|
}
|
|
31165
|
-
} else if (
|
|
31166
|
-
map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[
|
|
31167
|
-
} else if (
|
|
31117
|
+
} else if (key in this._zoomKeys) {
|
|
31118
|
+
map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);
|
|
31119
|
+
} else if (key === "Escape" && map._popup && map._popup.options.closeOnEscapeKey) {
|
|
31168
31120
|
map.closePopup?.();
|
|
31169
31121
|
} else {
|
|
31170
31122
|
return;
|
|
@@ -32019,8 +31971,8 @@ class LayerEvaluator {
|
|
|
32019
31971
|
this.zoom = zoom;
|
|
32020
31972
|
}
|
|
32021
31973
|
compiled(group, name, type) {
|
|
32022
|
-
const
|
|
32023
|
-
if (!this.cache.has(
|
|
31974
|
+
const key = `${group}:${name}`;
|
|
31975
|
+
if (!this.cache.has(key)) {
|
|
32024
31976
|
const value = this.layer[group]?.[name];
|
|
32025
31977
|
let expression = null;
|
|
32026
31978
|
if (value !== undefined) {
|
|
@@ -32030,9 +31982,9 @@ class LayerEvaluator {
|
|
|
32030
31982
|
expression = null;
|
|
32031
31983
|
}
|
|
32032
31984
|
}
|
|
32033
|
-
this.cache.set(
|
|
31985
|
+
this.cache.set(key, expression);
|
|
32034
31986
|
}
|
|
32035
|
-
return this.cache.get(
|
|
31987
|
+
return this.cache.get(key) ?? null;
|
|
32036
31988
|
}
|
|
32037
31989
|
get(group, name, type, feature) {
|
|
32038
31990
|
const expression = this.compiled(group, name, type);
|
|
@@ -32088,8 +32040,8 @@ async function gunzipIfNeeded(bytes) {
|
|
|
32088
32040
|
const stream = new Blob([bytes]).stream().pipeThrough(new DecompressionStream("gzip"));
|
|
32089
32041
|
return new Uint8Array(await new Response(stream).arrayBuffer());
|
|
32090
32042
|
}
|
|
32091
|
-
function tileUrl(
|
|
32092
|
-
return
|
|
32043
|
+
function tileUrl(template, z, x, y) {
|
|
32044
|
+
return template.replaceAll("{z}", String(z)).replaceAll("{x}", String(x)).replaceAll("{y}", String(y)).replaceAll("{s}", "abc"[(x + y) % 3]);
|
|
32093
32045
|
}
|
|
32094
32046
|
async function resolveSource(source, doFetch, archiveFetch) {
|
|
32095
32047
|
let tiles = Array.isArray(source.tiles) ? source.tiles : [];
|
|
@@ -32159,7 +32111,7 @@ function resolveFont(textFont, fallback) {
|
|
|
32159
32111
|
}
|
|
32160
32112
|
function textOf(value, properties) {
|
|
32161
32113
|
if (typeof value === "string")
|
|
32162
|
-
return value.replace(/\{([^}]+)\}/g, (_,
|
|
32114
|
+
return value.replace(/\{([^}]+)\}/g, (_, key) => String(properties[key] ?? ""));
|
|
32163
32115
|
if (value && typeof value === "object" && Array.isArray(value.sections))
|
|
32164
32116
|
return value.sections.map((section) => section.text ?? "").join("");
|
|
32165
32117
|
return value == null ? "" : String(value);
|
|
@@ -32254,8 +32206,8 @@ async function renderStaticMap(options) {
|
|
|
32254
32206
|
const zoom = staticMapZoom(view);
|
|
32255
32207
|
const fallbackFont = options.fontFamily ?? "Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
|
|
32256
32208
|
const layers = (style.layers ?? []).filter((layer) => {
|
|
32257
|
-
const
|
|
32258
|
-
if (
|
|
32209
|
+
const visibility = layer.layout?.visibility;
|
|
32210
|
+
if (visibility === "none")
|
|
32259
32211
|
return false;
|
|
32260
32212
|
if (typeof layer.minzoom === "number" && zoom < layer.minzoom)
|
|
32261
32213
|
return false;
|
|
@@ -32289,8 +32241,8 @@ async function renderStaticMap(options) {
|
|
|
32289
32241
|
}
|
|
32290
32242
|
const loaded = await Promise.all(wanted.map(async ({ x, y, wrapX }) => {
|
|
32291
32243
|
try {
|
|
32292
|
-
const
|
|
32293
|
-
const response = await tileFetch(tileUrl(
|
|
32244
|
+
const template = resolved.tiles[(wrapX + y) % resolved.tiles.length];
|
|
32245
|
+
const response = await tileFetch(tileUrl(template, z, wrapX, y));
|
|
32294
32246
|
if (!response.ok)
|
|
32295
32247
|
return null;
|
|
32296
32248
|
const bytes = await gunzipIfNeeded(new Uint8Array(await response.arrayBuffer()));
|
|
@@ -32332,7 +32284,7 @@ async function renderStaticMap(options) {
|
|
|
32332
32284
|
continue;
|
|
32333
32285
|
const count = 2 ** loaded.z;
|
|
32334
32286
|
const extent = tileLayer.extent || 4096;
|
|
32335
|
-
const
|
|
32287
|
+
const project = (gx, gy) => [
|
|
32336
32288
|
((loaded.x + gx / extent) / count - view.left) * view.scale,
|
|
32337
32289
|
((loaded.y + gy / extent) / count - view.top) * view.scale
|
|
32338
32290
|
];
|
|
@@ -32365,7 +32317,7 @@ async function renderStaticMap(options) {
|
|
|
32365
32317
|
const font = resolveFont(layer.layout?.["text-font"], fallbackFont);
|
|
32366
32318
|
for (const ring of raw.loadGeometry()) {
|
|
32367
32319
|
for (const point of ring) {
|
|
32368
|
-
let [x, y] =
|
|
32320
|
+
let [x, y] = project(point.x, point.y);
|
|
32369
32321
|
if (Array.isArray(offset) && offset.length === 2) {
|
|
32370
32322
|
x += Number(offset[0]) * size;
|
|
32371
32323
|
y += Number(offset[1]) * size;
|
|
@@ -32423,7 +32375,7 @@ async function renderStaticMap(options) {
|
|
|
32423
32375
|
if (ring.length < 2)
|
|
32424
32376
|
continue;
|
|
32425
32377
|
d += ring.map((point, index) => {
|
|
32426
|
-
const [x, y] =
|
|
32378
|
+
const [x, y] = project(point.x, point.y);
|
|
32427
32379
|
return `${index === 0 ? "M" : "L"}${round2(x)} ${round2(y)}`;
|
|
32428
32380
|
}).join("") + close;
|
|
32429
32381
|
}
|
|
@@ -32466,7 +32418,7 @@ async function renderStaticMap(options) {
|
|
|
32466
32418
|
const [left, top, right, bottom] = box;
|
|
32467
32419
|
if (left < 4 || top < 4 || right > width - 4 || bottom > height - 4)
|
|
32468
32420
|
continue;
|
|
32469
|
-
if (options.reserve?.some((
|
|
32421
|
+
if (options.reserve?.some((area) => overlaps2(box, area, 2)))
|
|
32470
32422
|
continue;
|
|
32471
32423
|
if (options.avoid?.length) {
|
|
32472
32424
|
const grown = [left - avoidPadding, top - avoidPadding, right + avoidPadding, bottom + avoidPadding];
|
|
@@ -32867,28 +32819,28 @@ class TurnByTurn extends Evented {
|
|
|
32867
32819
|
const chosen = i === this.selected;
|
|
32868
32820
|
const latlngs = route.geometry.map((p) => [p.lat, p.lng]);
|
|
32869
32821
|
const casing = new Polyline(latlngs, { color: chosen ? BLUE_CASING : GREY_CASING, weight: 12, opacity: 1, lineCap: "round", lineJoin: "round", interactive: !chosen });
|
|
32870
|
-
const
|
|
32871
|
-
for (const line of [casing,
|
|
32822
|
+
const fill = new Polyline(latlngs, { color: chosen ? BLUE : GREY, weight: 8, opacity: 1, lineCap: "round", lineJoin: "round", interactive: !chosen });
|
|
32823
|
+
for (const line of [casing, fill]) {
|
|
32872
32824
|
line.addTo(this.map);
|
|
32873
32825
|
if (!chosen)
|
|
32874
32826
|
line.on("click", () => this.selectRoute(i));
|
|
32875
32827
|
}
|
|
32876
|
-
this._lines.push(casing,
|
|
32828
|
+
this._lines.push(casing, fill);
|
|
32877
32829
|
}
|
|
32878
32830
|
if (this.state === "navigating" || this.navigator) {
|
|
32879
32831
|
const casing = new Polyline([], { color: TRAVELED_CASING, weight: 12, opacity: 1, lineCap: "round", lineJoin: "round", interactive: false }).addTo(this.map);
|
|
32880
|
-
const
|
|
32881
|
-
this._traveled = [casing,
|
|
32832
|
+
const fill = new Polyline([], { color: TRAVELED, weight: 8, opacity: 1, lineCap: "round", lineJoin: "round", interactive: false }).addTo(this.map);
|
|
32833
|
+
this._traveled = [casing, fill];
|
|
32882
32834
|
}
|
|
32883
32835
|
}
|
|
32884
|
-
_updateTraveled(
|
|
32836
|
+
_updateTraveled(distance) {
|
|
32885
32837
|
const nav = this.navigator;
|
|
32886
32838
|
if (!nav || !this._traveled.length)
|
|
32887
32839
|
return;
|
|
32888
32840
|
const latlngs = [];
|
|
32889
|
-
for (let i = 0;i < nav.points.length && nav.along[i] <
|
|
32841
|
+
for (let i = 0;i < nav.points.length && nav.along[i] < distance; i++)
|
|
32890
32842
|
latlngs.push([nav.points[i].lat, nav.points[i].lng]);
|
|
32891
|
-
const here = nav.pointAt(
|
|
32843
|
+
const here = nav.pointAt(distance).location;
|
|
32892
32844
|
latlngs.push([here.lat, here.lng]);
|
|
32893
32845
|
for (const line of this._traveled)
|
|
32894
32846
|
line.setLatLngs(latlngs);
|
|
@@ -33155,6 +33107,46 @@ var tsMap = {
|
|
|
33155
33107
|
if (typeof window !== "undefined")
|
|
33156
33108
|
window.tsMap ??= tsMap;
|
|
33157
33109
|
|
|
33110
|
+
// src/types.ts
|
|
33111
|
+
var defaultMapConfiguration = {
|
|
33112
|
+
provider: "ts_maps",
|
|
33113
|
+
map_type: "standard",
|
|
33114
|
+
shows_user_location: false,
|
|
33115
|
+
user_tracking_mode: "none",
|
|
33116
|
+
shows_compass: true,
|
|
33117
|
+
shows_scale: true,
|
|
33118
|
+
shows_traffic: false,
|
|
33119
|
+
shows_buildings: true,
|
|
33120
|
+
is_rotate_enabled: true,
|
|
33121
|
+
is_scroll_enabled: true,
|
|
33122
|
+
is_zoom_enabled: true,
|
|
33123
|
+
is_pitch_enabled: true,
|
|
33124
|
+
min_zoom: 0,
|
|
33125
|
+
max_zoom: 22
|
|
33126
|
+
};
|
|
33127
|
+
var defaultMapCamera = {
|
|
33128
|
+
center: { latitude: 0, longitude: 0 },
|
|
33129
|
+
zoom: 15,
|
|
33130
|
+
pitch: 0,
|
|
33131
|
+
heading: 0
|
|
33132
|
+
};
|
|
33133
|
+
var markerColorHex = {
|
|
33134
|
+
red: "#ff3b30",
|
|
33135
|
+
green: "#34c759",
|
|
33136
|
+
blue: "#007aff",
|
|
33137
|
+
yellow: "#ffcc00",
|
|
33138
|
+
orange: "#ff9500",
|
|
33139
|
+
purple: "#af52de",
|
|
33140
|
+
cyan: "#32ade6",
|
|
33141
|
+
magenta: "#ff2d55"
|
|
33142
|
+
};
|
|
33143
|
+
var strokePatternDashes = {
|
|
33144
|
+
solid: [],
|
|
33145
|
+
dashed: [10, 5],
|
|
33146
|
+
dotted: [2, 2],
|
|
33147
|
+
dash_dot: [10, 5, 2, 5]
|
|
33148
|
+
};
|
|
33149
|
+
|
|
33158
33150
|
// src/adapters.ts
|
|
33159
33151
|
function craftCoordToLatLng(coord) {
|
|
33160
33152
|
return new LatLng(coord.latitude, coord.longitude);
|
|
@@ -33218,48 +33210,48 @@ function craftMarkerToMarker(m) {
|
|
|
33218
33210
|
}
|
|
33219
33211
|
function craftPolylineToPolyline(pl) {
|
|
33220
33212
|
const latlngs = pl.coordinates.map(craftCoordToLatLng);
|
|
33221
|
-
const
|
|
33213
|
+
const polyline = new Polyline(latlngs, {
|
|
33222
33214
|
color: markerColorHex[pl.stroke_color],
|
|
33223
33215
|
weight: pl.stroke_width,
|
|
33224
33216
|
dashArray: strokePatternDashes[pl.stroke_pattern].join(",") || undefined
|
|
33225
33217
|
});
|
|
33226
|
-
|
|
33227
|
-
|
|
33228
|
-
return
|
|
33218
|
+
polyline.__craftPolylineId = pl.id;
|
|
33219
|
+
polyline.__craftZIndex = pl.z_index;
|
|
33220
|
+
return polyline;
|
|
33229
33221
|
}
|
|
33230
33222
|
function craftPolygonToPolygon(pg) {
|
|
33231
33223
|
const rings = [pg.exterior_ring.map(craftCoordToLatLng)];
|
|
33232
33224
|
for (const ring of pg.interior_rings)
|
|
33233
33225
|
rings.push(ring.map(craftCoordToLatLng));
|
|
33234
|
-
const
|
|
33226
|
+
const polygon = new Polygon(rings, {
|
|
33235
33227
|
color: markerColorHex[pg.stroke_color],
|
|
33236
33228
|
weight: pg.stroke_width,
|
|
33237
33229
|
fillColor: markerColorHex[pg.fill_color],
|
|
33238
33230
|
fillOpacity: pg.fill_opacity
|
|
33239
33231
|
});
|
|
33240
|
-
|
|
33241
|
-
|
|
33242
|
-
return
|
|
33232
|
+
polygon.__craftPolygonId = pg.id;
|
|
33233
|
+
polygon.__craftZIndex = pg.z_index;
|
|
33234
|
+
return polygon;
|
|
33243
33235
|
}
|
|
33244
33236
|
function craftCircleToCircle(c) {
|
|
33245
|
-
const
|
|
33237
|
+
const circle = new Circle(craftCoordToLatLng(c.center), {
|
|
33246
33238
|
radius: c.radius_meters,
|
|
33247
33239
|
color: markerColorHex[c.stroke_color],
|
|
33248
33240
|
weight: c.stroke_width,
|
|
33249
33241
|
fillColor: markerColorHex[c.fill_color],
|
|
33250
33242
|
fillOpacity: c.fill_opacity
|
|
33251
33243
|
});
|
|
33252
|
-
|
|
33253
|
-
return
|
|
33244
|
+
circle.__craftCircleId = c.id;
|
|
33245
|
+
return circle;
|
|
33254
33246
|
}
|
|
33255
|
-
function regionFromBounds(
|
|
33256
|
-
if (
|
|
33247
|
+
function regionFromBounds(coords) {
|
|
33248
|
+
if (coords.length === 0)
|
|
33257
33249
|
return null;
|
|
33258
33250
|
let minLat = 90;
|
|
33259
33251
|
let maxLat = -90;
|
|
33260
33252
|
let minLng = 180;
|
|
33261
33253
|
let maxLng = -180;
|
|
33262
|
-
for (const c of
|
|
33254
|
+
for (const c of coords) {
|
|
33263
33255
|
if (c.latitude < minLat)
|
|
33264
33256
|
minLat = c.latitude;
|
|
33265
33257
|
if (c.latitude > maxLat)
|
|
@@ -33281,16 +33273,16 @@ function regionFromBounds(coords2) {
|
|
|
33281
33273
|
};
|
|
33282
33274
|
}
|
|
33283
33275
|
export {
|
|
33284
|
-
|
|
33285
|
-
latLngToCraftCoord,
|
|
33286
|
-
craftRegionToBounds,
|
|
33287
|
-
craftPolylineToPolyline,
|
|
33288
|
-
craftPolygonToPolygon,
|
|
33289
|
-
craftMarkerToMarker,
|
|
33290
|
-
craftCoordToLatLng,
|
|
33291
|
-
craftCircleToCircle,
|
|
33292
|
-
craftCameraToOptions,
|
|
33293
|
-
craftBoundingBoxToBounds,
|
|
33276
|
+
boundsToCraftRegion,
|
|
33294
33277
|
cameraToCamera,
|
|
33295
|
-
|
|
33278
|
+
craftBoundingBoxToBounds,
|
|
33279
|
+
craftCameraToOptions,
|
|
33280
|
+
craftCircleToCircle,
|
|
33281
|
+
craftCoordToLatLng,
|
|
33282
|
+
craftMarkerToMarker,
|
|
33283
|
+
craftPolygonToPolygon,
|
|
33284
|
+
craftPolylineToPolyline,
|
|
33285
|
+
craftRegionToBounds,
|
|
33286
|
+
latLngToCraftCoord,
|
|
33287
|
+
regionFromBounds
|
|
33296
33288
|
};
|