@superrouteca/smap 1.2.0 → 1.2.1
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/CHANGELOG.md +7 -0
- package/dist/SOURCE.json +7 -7
- package/dist/smap-client.cjs +2 -2
- package/dist/smap-client.js +2 -2
- package/dist/smap-client.mjs +2 -2
- package/dist/smap.cjs +73 -32
- package/dist/smap.js +72 -31
- package/dist/smap.mjs +73 -32
- package/package.json +1 -1
- package/types/smap.d.cts +1 -1
- package/types/smap.d.mts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.1 — 2026-10-28
|
|
4
|
+
|
|
5
|
+
- Pins: the number and the count badge are drawn into each pin at every zoom, so where pins overlap the upper pin
|
|
6
|
+
covers the lower one with its number and badge, as on Superroute's route map. Before, further out than zoom 13
|
|
7
|
+
numbers and badges were their own layers above every pin. `bakeZoom` (a zoom) keeps the former drawing further out
|
|
8
|
+
than it; `bakeZoom: false` at every zoom.
|
|
9
|
+
|
|
3
10
|
## 1.2.0 — 2026-10-28
|
|
4
11
|
|
|
5
12
|
- Maps without WebGL: where the browser has no WebGL 2 (old computers, remote desktops, graphics acceleration
|
package/dist/SOURCE.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"sdkVersion": "1.2.
|
|
2
|
+
"sdkVersion": "1.2.1",
|
|
3
3
|
"engine": "maplibre-gl 6.16.0",
|
|
4
4
|
"files": {
|
|
5
|
-
"smap.js": "
|
|
5
|
+
"smap.js": "bbce8821ec3564f5fc7498b0e7973636e98650e956d94a51a2dbd2259b71b89b",
|
|
6
6
|
"smap.css": "9bc4b14821de97da199e6af4f18541eeaf53a2ae91e5831e7224f57fe6b77660",
|
|
7
|
-
"smap-client.js": "
|
|
7
|
+
"smap-client.js": "5c769f3f9e4e82d3e7c25bfbd8b91f85f106161f65328fe6eaf19eab6561e897",
|
|
8
8
|
"smap-client.d.ts": "5f0df11bf60c5a9ced34522a284de81260c27871678ab772f16da9ccf6883f58",
|
|
9
|
-
"smap.mjs": "
|
|
10
|
-
"smap.cjs": "
|
|
11
|
-
"smap-client.cjs": "
|
|
12
|
-
"smap-client.mjs": "
|
|
9
|
+
"smap.mjs": "8edb30186a60969440415b75f6b14b04eea317dc83637dc49e1757ded0c9b0de",
|
|
10
|
+
"smap.cjs": "5bfc4ff01ed19e861ffde2b908f5509c774912fe4d305c6f8269cb4d9f7eeb69",
|
|
11
|
+
"smap-client.cjs": "13a379343810b63bdaa060499d63844e133d28c00649811dcfe107b5dfbabb53",
|
|
12
|
+
"smap-client.mjs": "58f6aa8cb2cec09569606b088247b0e7803cdf225d5ceb733ae3115572a36241",
|
|
13
13
|
"smap-client.d.cts": "e0fe4eb54cd66b831116082f42bd2f7de260f9f12a2741f4004f8cf10c252116",
|
|
14
14
|
"smap-client.d.mts": "96830d316ddb33b4ff8edb8b6f810337479636114f75c4170d95038ffda74103",
|
|
15
15
|
"vendor-licenses.txt": "ee5fc05a0677eaf69601d2c7db0d9ecd6cc27c3abc1d0733bc9ed34707cf8ef2"
|
package/dist/smap-client.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Generated by js/build.mjs from js/src (see SOURCE.json). Do not edit. */
|
|
2
|
-
/*! sMap JS client 1.2.
|
|
2
|
+
/*! sMap JS client 1.2.1 — tokens, the nearest node, styles, tiles and raw reads, without a map view. */
|
|
3
3
|
/*
|
|
4
4
|
* Runs wherever `fetch` exists: browsers, Node.js 18+, workers; elsewhere (mini programs, older runtimes) pass your
|
|
5
5
|
* own `fetch`. UMD: `window.SMapClient`, `require('smap-client')`, or an AMD module.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}(typeof self !== 'undefined' ? self : this, function () {
|
|
20
20
|
'use strict';
|
|
21
21
|
|
|
22
|
-
var VERSION = '1.2.
|
|
22
|
+
var VERSION = '1.2.1';
|
|
23
23
|
var NODE_TTL = 3600 * 1000; // the measured order
|
|
24
24
|
var KNOWN_TTL = 30 * 86400 * 1000; // the last node list received, used when none can be read
|
|
25
25
|
|
package/dist/smap-client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sMap JS client 1.2.
|
|
1
|
+
/*! sMap JS client 1.2.1 — tokens, the nearest node, styles, tiles and raw reads, without a map view. */
|
|
2
2
|
/*
|
|
3
3
|
* Runs wherever `fetch` exists: browsers, Node.js 18+, workers; elsewhere (mini programs, older runtimes) pass your
|
|
4
4
|
* own `fetch`. UMD: `window.SMapClient`, `require('smap-client')`, or an AMD module.
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}(typeof self !== 'undefined' ? self : this, function () {
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
|
-
var VERSION = '1.2.
|
|
21
|
+
var VERSION = '1.2.1';
|
|
22
22
|
var NODE_TTL = 3600 * 1000; // the measured order
|
|
23
23
|
var KNOWN_TTL = 30 * 86400 * 1000; // the last node list received, used when none can be read
|
|
24
24
|
|
package/dist/smap-client.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Generated by js/build.mjs from js/src (see SOURCE.json). Do not edit. */
|
|
2
2
|
var smapClientModule = { exports: {} };
|
|
3
3
|
(function (module, exports, define) {
|
|
4
|
-
/*! sMap JS client 1.2.
|
|
4
|
+
/*! sMap JS client 1.2.1 — tokens, the nearest node, styles, tiles and raw reads, without a map view. */
|
|
5
5
|
/*
|
|
6
6
|
* Runs wherever `fetch` exists: browsers, Node.js 18+, workers; elsewhere (mini programs, older runtimes) pass your
|
|
7
7
|
* own `fetch`. UMD: `window.SMapClient`, `require('smap-client')`, or an AMD module.
|
|
@@ -21,7 +21,7 @@ var smapClientModule = { exports: {} };
|
|
|
21
21
|
}(typeof self !== 'undefined' ? self : this, function () {
|
|
22
22
|
'use strict';
|
|
23
23
|
|
|
24
|
-
var VERSION = '1.2.
|
|
24
|
+
var VERSION = '1.2.1';
|
|
25
25
|
var NODE_TTL = 3600 * 1000; // the measured order
|
|
26
26
|
var KNOWN_TTL = 30 * 86400 * 1000; // the last node list received, used when none can be read
|
|
27
27
|
|
package/dist/smap.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Generated by js/build.mjs from js/src (see SOURCE.json). Do not edit. */
|
|
2
2
|
'use strict';
|
|
3
|
-
/*! sMap Web SDK 1.2.
|
|
3
|
+
/*! sMap Web SDK 1.2.1. Bundles maplibre-gl 6.16.0 (BSD-3-Clause), see vendor-licenses.txt. */
|
|
4
4
|
|
|
5
5
|
var smapCore = null;
|
|
6
6
|
function smapCreateEngine() {
|
|
@@ -28461,7 +28461,7 @@ function smapCreateCanvas() {
|
|
|
28461
28461
|
var exports = module.exports;
|
|
28462
28462
|
var define;
|
|
28463
28463
|
var self = {};
|
|
28464
|
-
// sMap canvas renderer (
|
|
28464
|
+
// sMap canvas renderer (M67): the map drawn on a 2D canvas for browsers without WebGL 2. It answers the part of the
|
|
28465
28465
|
// rendering engine's map interface the Web SDK uses — camera, events, sources, layers of the kinds the SDK makes
|
|
28466
28466
|
// (raster, fill, line, circle, symbol, heatmap), hit tests, controls and popups — so the SDK's calls work unchanged.
|
|
28467
28467
|
// The street map comes as raster tiles. What needs WebGL (3D buildings, terrain, tilting, turning, custom 3D layers,
|
|
@@ -31590,7 +31590,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
31590
31590
|
})(typeof self !== 'undefined' ? self : this, function (engine, interop, canvasLib, plan) {
|
|
31591
31591
|
'use strict';
|
|
31592
31592
|
|
|
31593
|
-
var VERSION = '1.2.
|
|
31593
|
+
var VERSION = '1.2.1';
|
|
31594
31594
|
var FLAVORS = ['light', 'white', 'grayscale', 'dark', 'black'];
|
|
31595
31595
|
var BASEMAP_SOURCE = 'basemap';
|
|
31596
31596
|
var BUILDINGS_LAYER = 'smap-buildings-3d';
|
|
@@ -31815,28 +31815,51 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
31815
31815
|
},
|
|
31816
31816
|
};
|
|
31817
31817
|
},
|
|
31818
|
-
// pinnum|shape|fill|border|borderWidth|size|textColor|text: a pin with its number
|
|
31819
|
-
// pin
|
|
31818
|
+
// pinnum|shape|fill|border|borderWidth|size|textColor|badge|text: a pin with its number and its count badge drawn
|
|
31819
|
+
// in, so a pin above covers a pin below completely, number and badge included, as one element of the route map's
|
|
31820
|
+
// pins does. An empty number or badge is left out; the text comes last because it may hold '|'.
|
|
31820
31821
|
pinnum: function (args, measure) {
|
|
31821
31822
|
var pin = IMAGE_KINDS.pin(args.slice(0, 5));
|
|
31822
|
-
var size = Number(args[4]), color = args[5], text = args.slice(
|
|
31823
|
+
var size = Number(args[4]), color = args[5], badgeText = args[6] || '', text = args.slice(7).join('|');
|
|
31823
31824
|
var px = 14 * size / 32, font = 'bold ' + px + 'px monospace';
|
|
31825
|
+
var badge = badgeText !== '' ? IMAGE_KINDS.badge([badgeText], measure) : null;
|
|
31826
|
+
var g = markerGeometry(args[0], size);
|
|
31827
|
+
// The badge's centre is where its own layer puts it: g.badge from the tip, i.e. from the head's centre for a
|
|
31828
|
+
// pin (the image's centre), so the image is widened on both sides when the badge reaches past it.
|
|
31829
|
+
var w = pin.width, h = pin.height;
|
|
31830
|
+
if (badge) {
|
|
31831
|
+
var reach = Math.abs(g.badge[0]) + badge.width / 2;
|
|
31832
|
+
w = Math.max(w, Math.ceil(2 * reach));
|
|
31833
|
+
}
|
|
31824
31834
|
return {
|
|
31825
|
-
width:
|
|
31835
|
+
width: w, height: h,
|
|
31826
31836
|
draw: function (ctx, ratio) {
|
|
31827
|
-
pin.draw(ctx, ratio);
|
|
31828
|
-
if (text === '') { return; }
|
|
31829
31837
|
ctx.save();
|
|
31830
|
-
ctx.
|
|
31831
|
-
ctx
|
|
31832
|
-
ctx.textBaseline = 'middle';
|
|
31833
|
-
ctx.shadowColor = 'rgba(0,0,0,0.5)';
|
|
31834
|
-
ctx.shadowOffsetX = ratio;
|
|
31835
|
-
ctx.shadowOffsetY = ratio;
|
|
31836
|
-
ctx.shadowBlur = 2 * ratio;
|
|
31837
|
-
ctx.fillStyle = color;
|
|
31838
|
-
ctx.fillText(text, pin.width / 2, pin.height / 2 + 0.5);
|
|
31838
|
+
ctx.translate((w - pin.width) / 2, 0);
|
|
31839
|
+
pin.draw(ctx, ratio);
|
|
31839
31840
|
ctx.restore();
|
|
31841
|
+
if (text !== '') {
|
|
31842
|
+
ctx.save();
|
|
31843
|
+
ctx.font = font;
|
|
31844
|
+
ctx.textAlign = 'center';
|
|
31845
|
+
ctx.textBaseline = 'middle';
|
|
31846
|
+
ctx.shadowColor = 'rgba(0,0,0,0.5)';
|
|
31847
|
+
ctx.shadowOffsetX = ratio;
|
|
31848
|
+
ctx.shadowOffsetY = ratio;
|
|
31849
|
+
ctx.shadowBlur = 2 * ratio;
|
|
31850
|
+
ctx.fillStyle = color;
|
|
31851
|
+
ctx.fillText(text, w / 2, h / 2 + 0.5);
|
|
31852
|
+
ctx.restore();
|
|
31853
|
+
}
|
|
31854
|
+
if (badge) {
|
|
31855
|
+
// A pin's head is the image's centre and its tip half the image height lower; the badge sits g.badge from
|
|
31856
|
+
// the tip (a circle's centre is the image's centre).
|
|
31857
|
+
var tipY = args[0] === 'pin' ? h / 2 + g.tipToHead : h / 2;
|
|
31858
|
+
ctx.save();
|
|
31859
|
+
ctx.translate(w / 2 + g.badge[0] - badge.width / 2, tipY + g.badge[1] - badge.height / 2);
|
|
31860
|
+
badge.draw(ctx, ratio);
|
|
31861
|
+
ctx.restore();
|
|
31862
|
+
}
|
|
31840
31863
|
},
|
|
31841
31864
|
};
|
|
31842
31865
|
},
|
|
@@ -32002,7 +32025,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
32002
32025
|
* minWidth, offset, anchor, closeButton, closeOnClick, focusAfterOpen)
|
|
32003
32026
|
* @param {string|Node} [options.popupLoading] shown while a popup's content is a pending promise (default: dots)
|
|
32004
32027
|
* @param {'auto'|'webgl'|'canvas'} [options.renderer] 'auto' (default): the WebGL map, or the canvas map (raster
|
|
32005
|
-
* tiles, layers drawn in 2D) where the browser has no WebGL 2 (
|
|
32028
|
+
* tiles, layers drawn in 2D) where the browser has no WebGL 2 (M67)
|
|
32006
32029
|
* Every other option (center, zoom, pitch, bearing, minZoom, maxZoom, maxBounds, hash, …) goes to the engine.
|
|
32007
32030
|
*/
|
|
32008
32031
|
function SMap(options) {
|
|
@@ -32058,7 +32081,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
32058
32081
|
this._toolHandlers = [];
|
|
32059
32082
|
|
|
32060
32083
|
var self = this;
|
|
32061
|
-
// The renderer (
|
|
32084
|
+
// The renderer (M67): the WebGL engine, or the canvas map where there is no WebGL 2 (or when asked for).
|
|
32062
32085
|
var want = options.renderer || 'auto';
|
|
32063
32086
|
// Asked of the page itself; without a page (a server, a test) the WebGL engine is kept.
|
|
32064
32087
|
var hasPage = typeof document !== 'undefined' && !!document && typeof document.createElement === 'function';
|
|
@@ -34405,7 +34428,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
34405
34428
|
*/
|
|
34406
34429
|
SMap.prototype.setBaseImagery = function (imagery) {
|
|
34407
34430
|
if (imagery && (!Array.isArray(imagery.tiles) || !imagery.tiles.length)) { throw new Error('sMap: base imagery needs tiles'); }
|
|
34408
|
-
// Google's and Bing's tiles only through their own terms: Google's with setGoogleBase (M31,
|
|
34431
|
+
// Google's and Bing's tiles only through their own terms: Google's with setGoogleBase (M31, M72).
|
|
34409
34432
|
if (imagery) { interop.refuseForbidden(imagery.tiles); }
|
|
34410
34433
|
return this._setBaseImagery(imagery);
|
|
34411
34434
|
};
|
|
@@ -35446,13 +35469,31 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
35446
35469
|
// Opacity of the pin, its number and its badge together (the route map draws settled stops at .72).
|
|
35447
35470
|
var markerPaint = mk.opacity !== undefined ? { 'icon-opacity': valueExpr(mk.opacity, 1) } : undefined;
|
|
35448
35471
|
main = src + '-points';
|
|
35449
|
-
//
|
|
35450
|
-
//
|
|
35451
|
-
// pins
|
|
35472
|
+
// A pin's number and count badge are drawn into its own image (as one element of the route map's pins), so an
|
|
35473
|
+
// upper pin covers a lower one completely, number and badge included. bakeZoom (a zoom) keeps them their own
|
|
35474
|
+
// layers above the pins further out than it — fewer images where thousands of pins are in view, but numbers
|
|
35475
|
+
// over every pin there — and bakeZoom: false keeps them apart at every zoom. textMinzoom / badgeMinzoom start
|
|
35476
|
+
// them at their zoom either way.
|
|
35452
35477
|
var plainPin = drawnImageId('pin', [shape, str(mk.fill, '#ffffff'), str(mk.border, color), String(bw), String(size)]);
|
|
35453
|
-
var
|
|
35454
|
-
var
|
|
35455
|
-
|
|
35478
|
+
var hasText = mk.text !== undefined, hasBadge = mk.badge !== undefined;
|
|
35479
|
+
var bakeZoom = (hasText || hasBadge) && mk.bakeZoom !== false ? (typeof mk.bakeZoom === 'number' ? mk.bakeZoom : 0) : null;
|
|
35480
|
+
var badgeNumber = ['to-number', valueExpr(mk.badge, 0), 0];
|
|
35481
|
+
var textMin = typeof mk.textMinzoom === 'number' ? mk.textMinzoom : 0;
|
|
35482
|
+
var badgeMin = typeof mk.badgeMinzoom === 'number' ? mk.badgeMinzoom : 0;
|
|
35483
|
+
var imageAt = function (z) {
|
|
35484
|
+
if (bakeZoom === null || z < bakeZoom) { return plainPin; }
|
|
35485
|
+
var withText = hasText && z >= textMin, withBadge = hasBadge && z >= badgeMin;
|
|
35486
|
+
if (!withText && !withBadge) { return plainPin; }
|
|
35487
|
+
return drawnImageId('pinnum', [shape, str(mk.fill, '#ffffff'), str(mk.border, color), String(bw), String(size), str(mk.textColor, '#ffffff'),
|
|
35488
|
+
withBadge ? ['case', ['>', badgeNumber, 1], ['to-string', badgeNumber], ''] : '', withText ? str(mk.text, '') : '']);
|
|
35489
|
+
};
|
|
35490
|
+
var breaks = [bakeZoom, textMin, badgeMin].filter(function (z, i, all) { return typeof z === 'number' && z > 0 && all.indexOf(z) === i; })
|
|
35491
|
+
.sort(function (x, y) { return x - y; });
|
|
35492
|
+
var pinImage = imageAt(0);
|
|
35493
|
+
if (breaks.length) {
|
|
35494
|
+
pinImage = ['step', ['zoom'], imageAt(0)];
|
|
35495
|
+
breaks.forEach(function (z) { pinImage.push(z, imageAt(z)); });
|
|
35496
|
+
}
|
|
35456
35497
|
var markerSpecs = [];
|
|
35457
35498
|
var addMarker = function (layer) { markerSpecs.push(JSON.parse(JSON.stringify(layer))); add(layer); };
|
|
35458
35499
|
addMarker({
|
|
@@ -35465,7 +35506,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
35465
35506
|
'icon-allow-overlap': true, 'icon-ignore-placement': true,
|
|
35466
35507
|
},
|
|
35467
35508
|
});
|
|
35468
|
-
if (
|
|
35509
|
+
if (hasText && bakeZoom !== 0) {
|
|
35469
35510
|
var text = str(mk.text, '');
|
|
35470
35511
|
addMarker({
|
|
35471
35512
|
id: src + '-numbers', type: 'symbol', filter: both(['!=', text, '']), minzoom: mk.textMinzoom, maxzoom: bakeZoom === null ? undefined : bakeZoom, paint: markerPaint,
|
|
@@ -35475,10 +35516,10 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
35475
35516
|
},
|
|
35476
35517
|
});
|
|
35477
35518
|
}
|
|
35478
|
-
if (
|
|
35479
|
-
var badge =
|
|
35519
|
+
if (hasBadge && bakeZoom !== 0) {
|
|
35520
|
+
var badge = badgeNumber;
|
|
35480
35521
|
addMarker({
|
|
35481
|
-
id: src + '-badges', type: 'symbol', filter: both(['>', badge, 1]), minzoom: mk.badgeMinzoom, paint: markerPaint,
|
|
35522
|
+
id: src + '-badges', type: 'symbol', filter: both(['>', badge, 1]), minzoom: mk.badgeMinzoom, maxzoom: bakeZoom === null ? undefined : bakeZoom, paint: markerPaint,
|
|
35482
35523
|
layout: {
|
|
35483
35524
|
'icon-image': drawnImageId('badge', [['to-string', badge]]),
|
|
35484
35525
|
'icon-offset': g.badge, 'icon-size': scale,
|
|
@@ -35732,7 +35773,7 @@ function SMapMap(options) {
|
|
|
35732
35773
|
SMapMap.prototype = core.Map.prototype;
|
|
35733
35774
|
return new core.Map(options);
|
|
35734
35775
|
}
|
|
35735
|
-
var smapVersion = "1.2.
|
|
35776
|
+
var smapVersion = "1.2.1";
|
|
35736
35777
|
var smapStyles = ['light', 'white', 'grayscale', 'dark', 'black'];
|
|
35737
35778
|
/** The bundled rendering engine, for anything the SDK does not wrap (loaded on the first call). */
|
|
35738
35779
|
function smapGetEngine() { return smapLoad().engine; }
|
package/dist/smap.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sMap Web SDK 1.2.
|
|
1
|
+
/*! sMap Web SDK 1.2.1. Bundles maplibre-gl 6.16.0 (BSD-3-Clause), see vendor-licenses.txt. */
|
|
2
2
|
(function () {
|
|
3
3
|
function smapCreateEngine() {
|
|
4
4
|
var SMAP_BASE_URL = (typeof document !== 'undefined' && document.baseURI) || (typeof location !== 'undefined' && location.href) || 'about:blank';
|
|
@@ -28458,7 +28458,7 @@ function smapCreateCanvas() {
|
|
|
28458
28458
|
var exports = module.exports;
|
|
28459
28459
|
var define;
|
|
28460
28460
|
var self = {};
|
|
28461
|
-
// sMap canvas renderer (
|
|
28461
|
+
// sMap canvas renderer (M67): the map drawn on a 2D canvas for browsers without WebGL 2. It answers the part of the
|
|
28462
28462
|
// rendering engine's map interface the Web SDK uses — camera, events, sources, layers of the kinds the SDK makes
|
|
28463
28463
|
// (raster, fill, line, circle, symbol, heatmap), hit tests, controls and popups — so the SDK's calls work unchanged.
|
|
28464
28464
|
// The street map comes as raster tiles. What needs WebGL (3D buildings, terrain, tilting, turning, custom 3D layers,
|
|
@@ -31587,7 +31587,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
31587
31587
|
})(typeof self !== 'undefined' ? self : this, function (engine, interop, canvasLib, plan) {
|
|
31588
31588
|
'use strict';
|
|
31589
31589
|
|
|
31590
|
-
var VERSION = '1.2.
|
|
31590
|
+
var VERSION = '1.2.1';
|
|
31591
31591
|
var FLAVORS = ['light', 'white', 'grayscale', 'dark', 'black'];
|
|
31592
31592
|
var BASEMAP_SOURCE = 'basemap';
|
|
31593
31593
|
var BUILDINGS_LAYER = 'smap-buildings-3d';
|
|
@@ -31812,28 +31812,51 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
31812
31812
|
},
|
|
31813
31813
|
};
|
|
31814
31814
|
},
|
|
31815
|
-
// pinnum|shape|fill|border|borderWidth|size|textColor|text: a pin with its number
|
|
31816
|
-
// pin
|
|
31815
|
+
// pinnum|shape|fill|border|borderWidth|size|textColor|badge|text: a pin with its number and its count badge drawn
|
|
31816
|
+
// in, so a pin above covers a pin below completely, number and badge included, as one element of the route map's
|
|
31817
|
+
// pins does. An empty number or badge is left out; the text comes last because it may hold '|'.
|
|
31817
31818
|
pinnum: function (args, measure) {
|
|
31818
31819
|
var pin = IMAGE_KINDS.pin(args.slice(0, 5));
|
|
31819
|
-
var size = Number(args[4]), color = args[5], text = args.slice(
|
|
31820
|
+
var size = Number(args[4]), color = args[5], badgeText = args[6] || '', text = args.slice(7).join('|');
|
|
31820
31821
|
var px = 14 * size / 32, font = 'bold ' + px + 'px monospace';
|
|
31822
|
+
var badge = badgeText !== '' ? IMAGE_KINDS.badge([badgeText], measure) : null;
|
|
31823
|
+
var g = markerGeometry(args[0], size);
|
|
31824
|
+
// The badge's centre is where its own layer puts it: g.badge from the tip, i.e. from the head's centre for a
|
|
31825
|
+
// pin (the image's centre), so the image is widened on both sides when the badge reaches past it.
|
|
31826
|
+
var w = pin.width, h = pin.height;
|
|
31827
|
+
if (badge) {
|
|
31828
|
+
var reach = Math.abs(g.badge[0]) + badge.width / 2;
|
|
31829
|
+
w = Math.max(w, Math.ceil(2 * reach));
|
|
31830
|
+
}
|
|
31821
31831
|
return {
|
|
31822
|
-
width:
|
|
31832
|
+
width: w, height: h,
|
|
31823
31833
|
draw: function (ctx, ratio) {
|
|
31824
|
-
pin.draw(ctx, ratio);
|
|
31825
|
-
if (text === '') { return; }
|
|
31826
31834
|
ctx.save();
|
|
31827
|
-
ctx.
|
|
31828
|
-
ctx
|
|
31829
|
-
ctx.textBaseline = 'middle';
|
|
31830
|
-
ctx.shadowColor = 'rgba(0,0,0,0.5)';
|
|
31831
|
-
ctx.shadowOffsetX = ratio;
|
|
31832
|
-
ctx.shadowOffsetY = ratio;
|
|
31833
|
-
ctx.shadowBlur = 2 * ratio;
|
|
31834
|
-
ctx.fillStyle = color;
|
|
31835
|
-
ctx.fillText(text, pin.width / 2, pin.height / 2 + 0.5);
|
|
31835
|
+
ctx.translate((w - pin.width) / 2, 0);
|
|
31836
|
+
pin.draw(ctx, ratio);
|
|
31836
31837
|
ctx.restore();
|
|
31838
|
+
if (text !== '') {
|
|
31839
|
+
ctx.save();
|
|
31840
|
+
ctx.font = font;
|
|
31841
|
+
ctx.textAlign = 'center';
|
|
31842
|
+
ctx.textBaseline = 'middle';
|
|
31843
|
+
ctx.shadowColor = 'rgba(0,0,0,0.5)';
|
|
31844
|
+
ctx.shadowOffsetX = ratio;
|
|
31845
|
+
ctx.shadowOffsetY = ratio;
|
|
31846
|
+
ctx.shadowBlur = 2 * ratio;
|
|
31847
|
+
ctx.fillStyle = color;
|
|
31848
|
+
ctx.fillText(text, w / 2, h / 2 + 0.5);
|
|
31849
|
+
ctx.restore();
|
|
31850
|
+
}
|
|
31851
|
+
if (badge) {
|
|
31852
|
+
// A pin's head is the image's centre and its tip half the image height lower; the badge sits g.badge from
|
|
31853
|
+
// the tip (a circle's centre is the image's centre).
|
|
31854
|
+
var tipY = args[0] === 'pin' ? h / 2 + g.tipToHead : h / 2;
|
|
31855
|
+
ctx.save();
|
|
31856
|
+
ctx.translate(w / 2 + g.badge[0] - badge.width / 2, tipY + g.badge[1] - badge.height / 2);
|
|
31857
|
+
badge.draw(ctx, ratio);
|
|
31858
|
+
ctx.restore();
|
|
31859
|
+
}
|
|
31837
31860
|
},
|
|
31838
31861
|
};
|
|
31839
31862
|
},
|
|
@@ -31999,7 +32022,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
31999
32022
|
* minWidth, offset, anchor, closeButton, closeOnClick, focusAfterOpen)
|
|
32000
32023
|
* @param {string|Node} [options.popupLoading] shown while a popup's content is a pending promise (default: dots)
|
|
32001
32024
|
* @param {'auto'|'webgl'|'canvas'} [options.renderer] 'auto' (default): the WebGL map, or the canvas map (raster
|
|
32002
|
-
* tiles, layers drawn in 2D) where the browser has no WebGL 2 (
|
|
32025
|
+
* tiles, layers drawn in 2D) where the browser has no WebGL 2 (M67)
|
|
32003
32026
|
* Every other option (center, zoom, pitch, bearing, minZoom, maxZoom, maxBounds, hash, …) goes to the engine.
|
|
32004
32027
|
*/
|
|
32005
32028
|
function SMap(options) {
|
|
@@ -32055,7 +32078,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
32055
32078
|
this._toolHandlers = [];
|
|
32056
32079
|
|
|
32057
32080
|
var self = this;
|
|
32058
|
-
// The renderer (
|
|
32081
|
+
// The renderer (M67): the WebGL engine, or the canvas map where there is no WebGL 2 (or when asked for).
|
|
32059
32082
|
var want = options.renderer || 'auto';
|
|
32060
32083
|
// Asked of the page itself; without a page (a server, a test) the WebGL engine is kept.
|
|
32061
32084
|
var hasPage = typeof document !== 'undefined' && !!document && typeof document.createElement === 'function';
|
|
@@ -34402,7 +34425,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
34402
34425
|
*/
|
|
34403
34426
|
SMap.prototype.setBaseImagery = function (imagery) {
|
|
34404
34427
|
if (imagery && (!Array.isArray(imagery.tiles) || !imagery.tiles.length)) { throw new Error('sMap: base imagery needs tiles'); }
|
|
34405
|
-
// Google's and Bing's tiles only through their own terms: Google's with setGoogleBase (M31,
|
|
34428
|
+
// Google's and Bing's tiles only through their own terms: Google's with setGoogleBase (M31, M72).
|
|
34406
34429
|
if (imagery) { interop.refuseForbidden(imagery.tiles); }
|
|
34407
34430
|
return this._setBaseImagery(imagery);
|
|
34408
34431
|
};
|
|
@@ -35443,13 +35466,31 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
35443
35466
|
// Opacity of the pin, its number and its badge together (the route map draws settled stops at .72).
|
|
35444
35467
|
var markerPaint = mk.opacity !== undefined ? { 'icon-opacity': valueExpr(mk.opacity, 1) } : undefined;
|
|
35445
35468
|
main = src + '-points';
|
|
35446
|
-
//
|
|
35447
|
-
//
|
|
35448
|
-
// pins
|
|
35469
|
+
// A pin's number and count badge are drawn into its own image (as one element of the route map's pins), so an
|
|
35470
|
+
// upper pin covers a lower one completely, number and badge included. bakeZoom (a zoom) keeps them their own
|
|
35471
|
+
// layers above the pins further out than it — fewer images where thousands of pins are in view, but numbers
|
|
35472
|
+
// over every pin there — and bakeZoom: false keeps them apart at every zoom. textMinzoom / badgeMinzoom start
|
|
35473
|
+
// them at their zoom either way.
|
|
35449
35474
|
var plainPin = drawnImageId('pin', [shape, str(mk.fill, '#ffffff'), str(mk.border, color), String(bw), String(size)]);
|
|
35450
|
-
var
|
|
35451
|
-
var
|
|
35452
|
-
|
|
35475
|
+
var hasText = mk.text !== undefined, hasBadge = mk.badge !== undefined;
|
|
35476
|
+
var bakeZoom = (hasText || hasBadge) && mk.bakeZoom !== false ? (typeof mk.bakeZoom === 'number' ? mk.bakeZoom : 0) : null;
|
|
35477
|
+
var badgeNumber = ['to-number', valueExpr(mk.badge, 0), 0];
|
|
35478
|
+
var textMin = typeof mk.textMinzoom === 'number' ? mk.textMinzoom : 0;
|
|
35479
|
+
var badgeMin = typeof mk.badgeMinzoom === 'number' ? mk.badgeMinzoom : 0;
|
|
35480
|
+
var imageAt = function (z) {
|
|
35481
|
+
if (bakeZoom === null || z < bakeZoom) { return plainPin; }
|
|
35482
|
+
var withText = hasText && z >= textMin, withBadge = hasBadge && z >= badgeMin;
|
|
35483
|
+
if (!withText && !withBadge) { return plainPin; }
|
|
35484
|
+
return drawnImageId('pinnum', [shape, str(mk.fill, '#ffffff'), str(mk.border, color), String(bw), String(size), str(mk.textColor, '#ffffff'),
|
|
35485
|
+
withBadge ? ['case', ['>', badgeNumber, 1], ['to-string', badgeNumber], ''] : '', withText ? str(mk.text, '') : '']);
|
|
35486
|
+
};
|
|
35487
|
+
var breaks = [bakeZoom, textMin, badgeMin].filter(function (z, i, all) { return typeof z === 'number' && z > 0 && all.indexOf(z) === i; })
|
|
35488
|
+
.sort(function (x, y) { return x - y; });
|
|
35489
|
+
var pinImage = imageAt(0);
|
|
35490
|
+
if (breaks.length) {
|
|
35491
|
+
pinImage = ['step', ['zoom'], imageAt(0)];
|
|
35492
|
+
breaks.forEach(function (z) { pinImage.push(z, imageAt(z)); });
|
|
35493
|
+
}
|
|
35453
35494
|
var markerSpecs = [];
|
|
35454
35495
|
var addMarker = function (layer) { markerSpecs.push(JSON.parse(JSON.stringify(layer))); add(layer); };
|
|
35455
35496
|
addMarker({
|
|
@@ -35462,7 +35503,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
35462
35503
|
'icon-allow-overlap': true, 'icon-ignore-placement': true,
|
|
35463
35504
|
},
|
|
35464
35505
|
});
|
|
35465
|
-
if (
|
|
35506
|
+
if (hasText && bakeZoom !== 0) {
|
|
35466
35507
|
var text = str(mk.text, '');
|
|
35467
35508
|
addMarker({
|
|
35468
35509
|
id: src + '-numbers', type: 'symbol', filter: both(['!=', text, '']), minzoom: mk.textMinzoom, maxzoom: bakeZoom === null ? undefined : bakeZoom, paint: markerPaint,
|
|
@@ -35472,10 +35513,10 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
35472
35513
|
},
|
|
35473
35514
|
});
|
|
35474
35515
|
}
|
|
35475
|
-
if (
|
|
35476
|
-
var badge =
|
|
35516
|
+
if (hasBadge && bakeZoom !== 0) {
|
|
35517
|
+
var badge = badgeNumber;
|
|
35477
35518
|
addMarker({
|
|
35478
|
-
id: src + '-badges', type: 'symbol', filter: both(['>', badge, 1]), minzoom: mk.badgeMinzoom, paint: markerPaint,
|
|
35519
|
+
id: src + '-badges', type: 'symbol', filter: both(['>', badge, 1]), minzoom: mk.badgeMinzoom, maxzoom: bakeZoom === null ? undefined : bakeZoom, paint: markerPaint,
|
|
35479
35520
|
layout: {
|
|
35480
35521
|
'icon-image': drawnImageId('badge', [['to-string', badge]]),
|
|
35481
35522
|
'icon-offset': g.badge, 'icon-size': scale,
|
package/dist/smap.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Generated by js/build.mjs from js/src (see SOURCE.json). Do not edit. */
|
|
2
|
-
/*! sMap Web SDK 1.2.
|
|
2
|
+
/*! sMap Web SDK 1.2.1. Bundles maplibre-gl 6.16.0 (BSD-3-Clause), see vendor-licenses.txt. */
|
|
3
3
|
|
|
4
4
|
var smapCore = null;
|
|
5
5
|
function smapCreateEngine() {
|
|
@@ -28460,7 +28460,7 @@ function smapCreateCanvas() {
|
|
|
28460
28460
|
var exports = module.exports;
|
|
28461
28461
|
var define;
|
|
28462
28462
|
var self = {};
|
|
28463
|
-
// sMap canvas renderer (
|
|
28463
|
+
// sMap canvas renderer (M67): the map drawn on a 2D canvas for browsers without WebGL 2. It answers the part of the
|
|
28464
28464
|
// rendering engine's map interface the Web SDK uses — camera, events, sources, layers of the kinds the SDK makes
|
|
28465
28465
|
// (raster, fill, line, circle, symbol, heatmap), hit tests, controls and popups — so the SDK's calls work unchanged.
|
|
28466
28466
|
// The street map comes as raster tiles. What needs WebGL (3D buildings, terrain, tilting, turning, custom 3D layers,
|
|
@@ -31589,7 +31589,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
31589
31589
|
})(typeof self !== 'undefined' ? self : this, function (engine, interop, canvasLib, plan) {
|
|
31590
31590
|
'use strict';
|
|
31591
31591
|
|
|
31592
|
-
var VERSION = '1.2.
|
|
31592
|
+
var VERSION = '1.2.1';
|
|
31593
31593
|
var FLAVORS = ['light', 'white', 'grayscale', 'dark', 'black'];
|
|
31594
31594
|
var BASEMAP_SOURCE = 'basemap';
|
|
31595
31595
|
var BUILDINGS_LAYER = 'smap-buildings-3d';
|
|
@@ -31814,28 +31814,51 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
31814
31814
|
},
|
|
31815
31815
|
};
|
|
31816
31816
|
},
|
|
31817
|
-
// pinnum|shape|fill|border|borderWidth|size|textColor|text: a pin with its number
|
|
31818
|
-
// pin
|
|
31817
|
+
// pinnum|shape|fill|border|borderWidth|size|textColor|badge|text: a pin with its number and its count badge drawn
|
|
31818
|
+
// in, so a pin above covers a pin below completely, number and badge included, as one element of the route map's
|
|
31819
|
+
// pins does. An empty number or badge is left out; the text comes last because it may hold '|'.
|
|
31819
31820
|
pinnum: function (args, measure) {
|
|
31820
31821
|
var pin = IMAGE_KINDS.pin(args.slice(0, 5));
|
|
31821
|
-
var size = Number(args[4]), color = args[5], text = args.slice(
|
|
31822
|
+
var size = Number(args[4]), color = args[5], badgeText = args[6] || '', text = args.slice(7).join('|');
|
|
31822
31823
|
var px = 14 * size / 32, font = 'bold ' + px + 'px monospace';
|
|
31824
|
+
var badge = badgeText !== '' ? IMAGE_KINDS.badge([badgeText], measure) : null;
|
|
31825
|
+
var g = markerGeometry(args[0], size);
|
|
31826
|
+
// The badge's centre is where its own layer puts it: g.badge from the tip, i.e. from the head's centre for a
|
|
31827
|
+
// pin (the image's centre), so the image is widened on both sides when the badge reaches past it.
|
|
31828
|
+
var w = pin.width, h = pin.height;
|
|
31829
|
+
if (badge) {
|
|
31830
|
+
var reach = Math.abs(g.badge[0]) + badge.width / 2;
|
|
31831
|
+
w = Math.max(w, Math.ceil(2 * reach));
|
|
31832
|
+
}
|
|
31823
31833
|
return {
|
|
31824
|
-
width:
|
|
31834
|
+
width: w, height: h,
|
|
31825
31835
|
draw: function (ctx, ratio) {
|
|
31826
|
-
pin.draw(ctx, ratio);
|
|
31827
|
-
if (text === '') { return; }
|
|
31828
31836
|
ctx.save();
|
|
31829
|
-
ctx.
|
|
31830
|
-
ctx
|
|
31831
|
-
ctx.textBaseline = 'middle';
|
|
31832
|
-
ctx.shadowColor = 'rgba(0,0,0,0.5)';
|
|
31833
|
-
ctx.shadowOffsetX = ratio;
|
|
31834
|
-
ctx.shadowOffsetY = ratio;
|
|
31835
|
-
ctx.shadowBlur = 2 * ratio;
|
|
31836
|
-
ctx.fillStyle = color;
|
|
31837
|
-
ctx.fillText(text, pin.width / 2, pin.height / 2 + 0.5);
|
|
31837
|
+
ctx.translate((w - pin.width) / 2, 0);
|
|
31838
|
+
pin.draw(ctx, ratio);
|
|
31838
31839
|
ctx.restore();
|
|
31840
|
+
if (text !== '') {
|
|
31841
|
+
ctx.save();
|
|
31842
|
+
ctx.font = font;
|
|
31843
|
+
ctx.textAlign = 'center';
|
|
31844
|
+
ctx.textBaseline = 'middle';
|
|
31845
|
+
ctx.shadowColor = 'rgba(0,0,0,0.5)';
|
|
31846
|
+
ctx.shadowOffsetX = ratio;
|
|
31847
|
+
ctx.shadowOffsetY = ratio;
|
|
31848
|
+
ctx.shadowBlur = 2 * ratio;
|
|
31849
|
+
ctx.fillStyle = color;
|
|
31850
|
+
ctx.fillText(text, w / 2, h / 2 + 0.5);
|
|
31851
|
+
ctx.restore();
|
|
31852
|
+
}
|
|
31853
|
+
if (badge) {
|
|
31854
|
+
// A pin's head is the image's centre and its tip half the image height lower; the badge sits g.badge from
|
|
31855
|
+
// the tip (a circle's centre is the image's centre).
|
|
31856
|
+
var tipY = args[0] === 'pin' ? h / 2 + g.tipToHead : h / 2;
|
|
31857
|
+
ctx.save();
|
|
31858
|
+
ctx.translate(w / 2 + g.badge[0] - badge.width / 2, tipY + g.badge[1] - badge.height / 2);
|
|
31859
|
+
badge.draw(ctx, ratio);
|
|
31860
|
+
ctx.restore();
|
|
31861
|
+
}
|
|
31839
31862
|
},
|
|
31840
31863
|
};
|
|
31841
31864
|
},
|
|
@@ -32001,7 +32024,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
32001
32024
|
* minWidth, offset, anchor, closeButton, closeOnClick, focusAfterOpen)
|
|
32002
32025
|
* @param {string|Node} [options.popupLoading] shown while a popup's content is a pending promise (default: dots)
|
|
32003
32026
|
* @param {'auto'|'webgl'|'canvas'} [options.renderer] 'auto' (default): the WebGL map, or the canvas map (raster
|
|
32004
|
-
* tiles, layers drawn in 2D) where the browser has no WebGL 2 (
|
|
32027
|
+
* tiles, layers drawn in 2D) where the browser has no WebGL 2 (M67)
|
|
32005
32028
|
* Every other option (center, zoom, pitch, bearing, minZoom, maxZoom, maxBounds, hash, …) goes to the engine.
|
|
32006
32029
|
*/
|
|
32007
32030
|
function SMap(options) {
|
|
@@ -32057,7 +32080,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
32057
32080
|
this._toolHandlers = [];
|
|
32058
32081
|
|
|
32059
32082
|
var self = this;
|
|
32060
|
-
// The renderer (
|
|
32083
|
+
// The renderer (M67): the WebGL engine, or the canvas map where there is no WebGL 2 (or when asked for).
|
|
32061
32084
|
var want = options.renderer || 'auto';
|
|
32062
32085
|
// Asked of the page itself; without a page (a server, a test) the WebGL engine is kept.
|
|
32063
32086
|
var hasPage = typeof document !== 'undefined' && !!document && typeof document.createElement === 'function';
|
|
@@ -34404,7 +34427,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
34404
34427
|
*/
|
|
34405
34428
|
SMap.prototype.setBaseImagery = function (imagery) {
|
|
34406
34429
|
if (imagery && (!Array.isArray(imagery.tiles) || !imagery.tiles.length)) { throw new Error('sMap: base imagery needs tiles'); }
|
|
34407
|
-
// Google's and Bing's tiles only through their own terms: Google's with setGoogleBase (M31,
|
|
34430
|
+
// Google's and Bing's tiles only through their own terms: Google's with setGoogleBase (M31, M72).
|
|
34408
34431
|
if (imagery) { interop.refuseForbidden(imagery.tiles); }
|
|
34409
34432
|
return this._setBaseImagery(imagery);
|
|
34410
34433
|
};
|
|
@@ -35445,13 +35468,31 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
35445
35468
|
// Opacity of the pin, its number and its badge together (the route map draws settled stops at .72).
|
|
35446
35469
|
var markerPaint = mk.opacity !== undefined ? { 'icon-opacity': valueExpr(mk.opacity, 1) } : undefined;
|
|
35447
35470
|
main = src + '-points';
|
|
35448
|
-
//
|
|
35449
|
-
//
|
|
35450
|
-
// pins
|
|
35471
|
+
// A pin's number and count badge are drawn into its own image (as one element of the route map's pins), so an
|
|
35472
|
+
// upper pin covers a lower one completely, number and badge included. bakeZoom (a zoom) keeps them their own
|
|
35473
|
+
// layers above the pins further out than it — fewer images where thousands of pins are in view, but numbers
|
|
35474
|
+
// over every pin there — and bakeZoom: false keeps them apart at every zoom. textMinzoom / badgeMinzoom start
|
|
35475
|
+
// them at their zoom either way.
|
|
35451
35476
|
var plainPin = drawnImageId('pin', [shape, str(mk.fill, '#ffffff'), str(mk.border, color), String(bw), String(size)]);
|
|
35452
|
-
var
|
|
35453
|
-
var
|
|
35454
|
-
|
|
35477
|
+
var hasText = mk.text !== undefined, hasBadge = mk.badge !== undefined;
|
|
35478
|
+
var bakeZoom = (hasText || hasBadge) && mk.bakeZoom !== false ? (typeof mk.bakeZoom === 'number' ? mk.bakeZoom : 0) : null;
|
|
35479
|
+
var badgeNumber = ['to-number', valueExpr(mk.badge, 0), 0];
|
|
35480
|
+
var textMin = typeof mk.textMinzoom === 'number' ? mk.textMinzoom : 0;
|
|
35481
|
+
var badgeMin = typeof mk.badgeMinzoom === 'number' ? mk.badgeMinzoom : 0;
|
|
35482
|
+
var imageAt = function (z) {
|
|
35483
|
+
if (bakeZoom === null || z < bakeZoom) { return plainPin; }
|
|
35484
|
+
var withText = hasText && z >= textMin, withBadge = hasBadge && z >= badgeMin;
|
|
35485
|
+
if (!withText && !withBadge) { return plainPin; }
|
|
35486
|
+
return drawnImageId('pinnum', [shape, str(mk.fill, '#ffffff'), str(mk.border, color), String(bw), String(size), str(mk.textColor, '#ffffff'),
|
|
35487
|
+
withBadge ? ['case', ['>', badgeNumber, 1], ['to-string', badgeNumber], ''] : '', withText ? str(mk.text, '') : '']);
|
|
35488
|
+
};
|
|
35489
|
+
var breaks = [bakeZoom, textMin, badgeMin].filter(function (z, i, all) { return typeof z === 'number' && z > 0 && all.indexOf(z) === i; })
|
|
35490
|
+
.sort(function (x, y) { return x - y; });
|
|
35491
|
+
var pinImage = imageAt(0);
|
|
35492
|
+
if (breaks.length) {
|
|
35493
|
+
pinImage = ['step', ['zoom'], imageAt(0)];
|
|
35494
|
+
breaks.forEach(function (z) { pinImage.push(z, imageAt(z)); });
|
|
35495
|
+
}
|
|
35455
35496
|
var markerSpecs = [];
|
|
35456
35497
|
var addMarker = function (layer) { markerSpecs.push(JSON.parse(JSON.stringify(layer))); add(layer); };
|
|
35457
35498
|
addMarker({
|
|
@@ -35464,7 +35505,7 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
35464
35505
|
'icon-allow-overlap': true, 'icon-ignore-placement': true,
|
|
35465
35506
|
},
|
|
35466
35507
|
});
|
|
35467
|
-
if (
|
|
35508
|
+
if (hasText && bakeZoom !== 0) {
|
|
35468
35509
|
var text = str(mk.text, '');
|
|
35469
35510
|
addMarker({
|
|
35470
35511
|
id: src + '-numbers', type: 'symbol', filter: both(['!=', text, '']), minzoom: mk.textMinzoom, maxzoom: bakeZoom === null ? undefined : bakeZoom, paint: markerPaint,
|
|
@@ -35474,10 +35515,10 @@ function smapCreateSdk(engine, interop, canvas, plan) {
|
|
|
35474
35515
|
},
|
|
35475
35516
|
});
|
|
35476
35517
|
}
|
|
35477
|
-
if (
|
|
35478
|
-
var badge =
|
|
35518
|
+
if (hasBadge && bakeZoom !== 0) {
|
|
35519
|
+
var badge = badgeNumber;
|
|
35479
35520
|
addMarker({
|
|
35480
|
-
id: src + '-badges', type: 'symbol', filter: both(['>', badge, 1]), minzoom: mk.badgeMinzoom, paint: markerPaint,
|
|
35521
|
+
id: src + '-badges', type: 'symbol', filter: both(['>', badge, 1]), minzoom: mk.badgeMinzoom, maxzoom: bakeZoom === null ? undefined : bakeZoom, paint: markerPaint,
|
|
35481
35522
|
layout: {
|
|
35482
35523
|
'icon-image': drawnImageId('badge', [['to-string', badge]]),
|
|
35483
35524
|
'icon-offset': g.badge, 'icon-size': scale,
|
|
@@ -35731,7 +35772,7 @@ function SMapMap(options) {
|
|
|
35731
35772
|
SMapMap.prototype = core.Map.prototype;
|
|
35732
35773
|
return new core.Map(options);
|
|
35733
35774
|
}
|
|
35734
|
-
var smapVersion = "1.2.
|
|
35775
|
+
var smapVersion = "1.2.1";
|
|
35735
35776
|
var smapStyles = ['light', 'white', 'grayscale', 'dark', 'black'];
|
|
35736
35777
|
/** The bundled rendering engine, for anything the SDK does not wrap (loaded on the first call). */
|
|
35737
35778
|
function smapGetEngine() { return smapLoad().engine; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superrouteca/smap",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "sMap for the web: maps from Superroute's sMap service, the Web SDK (map view) and the JS client (tokens, nearest node, styles, tiles).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Goodneo Solutions",
|
package/types/smap.d.cts
CHANGED
|
@@ -257,7 +257,7 @@ export interface MarkerOptions {
|
|
|
257
257
|
scale?: number | unknown[];
|
|
258
258
|
/** The pin under the pointer comes to the front (default true). */
|
|
259
259
|
hoverRaise?: boolean;
|
|
260
|
-
/**
|
|
260
|
+
/** Numbers and badges are drawn into each pin, so an upper pin covers a lower one with them. A zoom keeps them their own layers above the pins further out (fewer images where thousands of pins are in view); false keeps them apart at every zoom. */
|
|
261
261
|
bakeZoom?: number | false;
|
|
262
262
|
/**
|
|
263
263
|
* Pins piled up under a click (default on): with `threshold` (4) or more within `radius` (12 px) the map zooms in by
|
package/types/smap.d.mts
CHANGED
|
@@ -257,7 +257,7 @@ export interface MarkerOptions {
|
|
|
257
257
|
scale?: number | unknown[];
|
|
258
258
|
/** The pin under the pointer comes to the front (default true). */
|
|
259
259
|
hoverRaise?: boolean;
|
|
260
|
-
/**
|
|
260
|
+
/** Numbers and badges are drawn into each pin, so an upper pin covers a lower one with them. A zoom keeps them their own layers above the pins further out (fewer images where thousands of pins are in view); false keeps them apart at every zoom. */
|
|
261
261
|
bakeZoom?: number | false;
|
|
262
262
|
/**
|
|
263
263
|
* Pins piled up under a click (default on): with `threshold` (4) or more within `radius` (12 px) the map zooms in by
|