@mapcreator/sdk 1.5.9 → 1.5.11
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/adornments/scalebar.d.ts +5 -2
- package/dist/controls/webControls.d.ts +1 -1
- package/dist/mapcreator-sdk.js +109 -96
- package/dist/mapcreator-sdk.umd.cjs +58 -58
- package/dist/report.html +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { Map } from '@mapcreator/maplibre-gl';
|
|
2
1
|
import { JobObjectScalebar } from '../types/jobObject';
|
|
3
|
-
|
|
2
|
+
import { Map } from '@mapcreator/maplibre-gl';
|
|
3
|
+
export declare function useScalebar(scalebar: JobObjectScalebar, map: Map, vapiUrl: string, accessToken: string, mapScale: number): {
|
|
4
|
+
element: HTMLElement;
|
|
5
|
+
ready: Promise<void>;
|
|
6
|
+
};
|
|
@@ -2,4 +2,4 @@ import { JobObjectWebControls } from '../types/jobObject';
|
|
|
2
2
|
import { InitialPositionInfo } from '../types';
|
|
3
3
|
import { SvgCache } from '../utils/svgHelpers';
|
|
4
4
|
import { Map } from '@mapcreator/maplibre-gl';
|
|
5
|
-
export declare function useWebControls(webControls: JobObjectWebControls, map: Map, svgCache: SvgCache, initialPosition: InitialPositionInfo): HTMLElement;
|
|
5
|
+
export declare function useWebControls(webControls: JobObjectWebControls, map: Map, svgCache: SvgCache, initialPosition: InitialPositionInfo, hasAdornments: boolean): HTMLElement;
|
package/dist/mapcreator-sdk.js
CHANGED
|
@@ -35414,28 +35414,32 @@ function ua() {
|
|
|
35414
35414
|
}
|
|
35415
35415
|
//#endregion
|
|
35416
35416
|
//#region src/controls/webControls.ts
|
|
35417
|
-
function da(e, t, n, r) {
|
|
35418
|
-
let
|
|
35419
|
-
return
|
|
35420
|
-
let
|
|
35421
|
-
if (e === "zoomIn")
|
|
35422
|
-
else if (e === "zoomOut")
|
|
35423
|
-
else if (e === "fullscreen")
|
|
35424
|
-
else if (e === "geolocation")
|
|
35425
|
-
else if (e === "refresh")
|
|
35426
|
-
else if (e === "search")
|
|
35427
|
-
else if (e === "toggleAdornments")
|
|
35417
|
+
function da(e, t, n, r, i) {
|
|
35418
|
+
let a = document.createElement("div");
|
|
35419
|
+
return a.classList.add("web-control", "adornment"), fa(e, i).forEach((e) => {
|
|
35420
|
+
let i;
|
|
35421
|
+
if (e === "zoomIn") i = Ri(t);
|
|
35422
|
+
else if (e === "zoomOut") i = zi(t);
|
|
35423
|
+
else if (e === "fullscreen") i = ea(t);
|
|
35424
|
+
else if (e === "geolocation") i = Ji(t, n);
|
|
35425
|
+
else if (e === "refresh") i = na(t, r);
|
|
35426
|
+
else if (e === "search") i = new la(t).init();
|
|
35427
|
+
else if (e === "toggleAdornments") i = Fi(t, t.getContainer());
|
|
35428
35428
|
else return;
|
|
35429
|
-
|
|
35430
|
-
}),
|
|
35429
|
+
a.appendChild(i);
|
|
35430
|
+
}), a;
|
|
35431
35431
|
}
|
|
35432
|
-
function fa(e) {
|
|
35433
|
-
let
|
|
35432
|
+
function fa(e, t) {
|
|
35433
|
+
let n = e.buttons.flatMap((e) => e === "zoom" ? ["zoomIn", "zoomOut"] : e);
|
|
35434
35434
|
if (ua()) {
|
|
35435
|
-
let e =
|
|
35436
|
-
|
|
35435
|
+
let e = n.filter((e) => e !== "zoomIn" && e !== "zoomOut");
|
|
35436
|
+
if (t) {
|
|
35437
|
+
let t = e[0] === "search" ? 1 : 0;
|
|
35438
|
+
e.splice(t, 0, "toggleAdornments");
|
|
35439
|
+
}
|
|
35440
|
+
return e;
|
|
35437
35441
|
}
|
|
35438
|
-
return
|
|
35442
|
+
return n;
|
|
35439
35443
|
}
|
|
35440
35444
|
//#endregion
|
|
35441
35445
|
//#region src/adornments/copyright.ts
|
|
@@ -38483,121 +38487,128 @@ var Dl = {
|
|
|
38483
38487
|
foot: "ft",
|
|
38484
38488
|
nauticalMile: "nm"
|
|
38485
38489
|
};
|
|
38486
|
-
function Ol(e, t, n) {
|
|
38487
|
-
let
|
|
38488
|
-
|
|
38489
|
-
|
|
38490
|
-
|
|
38490
|
+
function Ol(e, t, n, r, i) {
|
|
38491
|
+
let a = document.createElement("div");
|
|
38492
|
+
a.className = "adornment";
|
|
38493
|
+
let o = "ArialMT";
|
|
38494
|
+
return {
|
|
38495
|
+
element: a,
|
|
38496
|
+
ready: Lr(e.font ?? o, n, r).then(() => {
|
|
38497
|
+
a.innerHTML = kl(t, e, i, o), t.on("move", () => {
|
|
38498
|
+
a.innerHTML = kl(t, e, i, o);
|
|
38499
|
+
});
|
|
38500
|
+
})
|
|
38501
|
+
};
|
|
38491
38502
|
}
|
|
38492
|
-
function kl(e, t, n) {
|
|
38493
|
-
let { maxWidth:
|
|
38494
|
-
let n = j("meter", e,
|
|
38503
|
+
function kl(e, t, n, r) {
|
|
38504
|
+
let { maxWidth: i = 100, fontSize: a = 8, font: o = r, color: s = "#000000", unit: c = "metric_and_imperial" } = t, l = e.getCenter(), u = e.projectWithScaleCorrection(l), d = w(l, e.unprojectWithScaleCorrection([u.x + i, u.y])), f = Object.fromEntries(Object.entries(Dl).map(([e, t]) => {
|
|
38505
|
+
let n = j("meter", e, d), r = Tl(n) || 0;
|
|
38495
38506
|
return [e, {
|
|
38496
38507
|
value: n,
|
|
38497
38508
|
ratio: n ? r / n : 0,
|
|
38498
38509
|
humanized: r < 1 ? `${wl(r).join("/")} ${t}` : `${r} ${t}`
|
|
38499
38510
|
}];
|
|
38500
|
-
})),
|
|
38501
|
-
imperial:
|
|
38502
|
-
metric:
|
|
38503
|
-
nautical:
|
|
38504
|
-
},
|
|
38505
|
-
metric: Math.round(
|
|
38506
|
-
imperial: Math.round(
|
|
38507
|
-
},
|
|
38508
|
-
if (
|
|
38509
|
-
let e =
|
|
38511
|
+
})), p = f.meter.value > 1e3 ? f.kilometer : f.meter, m = f.foot.value > 5280 ? f.mile : f.foot, h = {
|
|
38512
|
+
imperial: m,
|
|
38513
|
+
metric: p,
|
|
38514
|
+
nautical: f.nauticalMile
|
|
38515
|
+
}, g = c === "metric_and_imperial" ? void 0 : h[c], _ = {
|
|
38516
|
+
metric: Math.round(i * p.ratio),
|
|
38517
|
+
imperial: Math.round(i * m.ratio)
|
|
38518
|
+
}, v = c === "metric_and_imperial" ? Math.max(_.metric, _.imperial) : Math.round(i * (g?.ratio ?? 0)), y = a + 7;
|
|
38519
|
+
if (c === "metric_and_imperial") {
|
|
38520
|
+
let e = y + a * 2;
|
|
38510
38521
|
return `
|
|
38511
38522
|
<svg
|
|
38512
38523
|
class="adornment-svg"
|
|
38513
38524
|
xmlns="http://www.w3.org/2000/svg"
|
|
38514
|
-
width="${
|
|
38525
|
+
width="${v * n}"
|
|
38515
38526
|
height="${e * n}"
|
|
38516
|
-
viewBox="0 0 ${
|
|
38527
|
+
viewBox="0 0 ${v} ${e}"
|
|
38517
38528
|
>
|
|
38518
38529
|
<line
|
|
38519
38530
|
x1="0"
|
|
38520
|
-
y1="${
|
|
38521
|
-
x2="${
|
|
38522
|
-
y2="${
|
|
38523
|
-
stroke="${
|
|
38531
|
+
y1="${y - .5}"
|
|
38532
|
+
x2="${v}"
|
|
38533
|
+
y2="${y - .5}"
|
|
38534
|
+
stroke="${s}"
|
|
38524
38535
|
stroke-width="1"
|
|
38525
38536
|
/>
|
|
38526
38537
|
<line
|
|
38527
38538
|
x1="0.5"
|
|
38528
|
-
y1="${
|
|
38539
|
+
y1="${y - 5}"
|
|
38529
38540
|
x2="0.5"
|
|
38530
|
-
y2="${
|
|
38531
|
-
stroke="${
|
|
38541
|
+
y2="${y + 5}"
|
|
38542
|
+
stroke="${s}"
|
|
38532
38543
|
stroke-width="1"
|
|
38533
38544
|
/>
|
|
38534
38545
|
<line
|
|
38535
|
-
x1="${
|
|
38536
|
-
y1="${
|
|
38537
|
-
x2="${
|
|
38538
|
-
y2="${
|
|
38539
|
-
stroke="${
|
|
38546
|
+
x1="${_.imperial - .5}"
|
|
38547
|
+
y1="${y - 5}"
|
|
38548
|
+
x2="${_.imperial - .5}"
|
|
38549
|
+
y2="${y}"
|
|
38550
|
+
stroke="${s}"
|
|
38540
38551
|
stroke-width="1"
|
|
38541
38552
|
/>
|
|
38542
38553
|
<line
|
|
38543
|
-
x1="${
|
|
38544
|
-
y1="${
|
|
38545
|
-
x2="${
|
|
38546
|
-
y2="${
|
|
38547
|
-
stroke="${
|
|
38554
|
+
x1="${_.metric - .5}"
|
|
38555
|
+
y1="${y}"
|
|
38556
|
+
x2="${_.metric - .5}"
|
|
38557
|
+
y2="${y + 5}"
|
|
38558
|
+
stroke="${s}"
|
|
38548
38559
|
stroke-width="1"
|
|
38549
38560
|
/>
|
|
38550
38561
|
<text
|
|
38551
38562
|
x="0"
|
|
38552
|
-
y="${
|
|
38553
|
-
font-size="${
|
|
38554
|
-
font-family="${
|
|
38563
|
+
y="${y + 7 + a}"
|
|
38564
|
+
font-size="${a}px"
|
|
38565
|
+
font-family="${o}"
|
|
38555
38566
|
font-weight="bold"
|
|
38556
|
-
fill="${
|
|
38567
|
+
fill="${s}"
|
|
38557
38568
|
text-anchor="start"
|
|
38558
38569
|
>
|
|
38559
38570
|
0
|
|
38560
38571
|
</text>
|
|
38561
38572
|
<text
|
|
38562
|
-
x="${
|
|
38563
|
-
y="${
|
|
38564
|
-
font-size="${
|
|
38565
|
-
font-family="${
|
|
38573
|
+
x="${_.imperial}"
|
|
38574
|
+
y="${y - 7}"
|
|
38575
|
+
font-size="${a}px"
|
|
38576
|
+
font-family="${o}"
|
|
38566
38577
|
font-weight="bold"
|
|
38567
|
-
fill="${
|
|
38578
|
+
fill="${s}"
|
|
38568
38579
|
text-anchor="end"
|
|
38569
38580
|
>
|
|
38570
|
-
${
|
|
38581
|
+
${m.humanized}
|
|
38571
38582
|
</text>
|
|
38572
38583
|
<text
|
|
38573
|
-
x="${
|
|
38574
|
-
y="${
|
|
38575
|
-
font-size="${
|
|
38576
|
-
font-family="${
|
|
38584
|
+
x="${_.metric}"
|
|
38585
|
+
y="${y + 7 + a}"
|
|
38586
|
+
font-size="${a}px"
|
|
38587
|
+
font-family="${o}"
|
|
38577
38588
|
font-weight="bold"
|
|
38578
|
-
fill="${
|
|
38589
|
+
fill="${s}"
|
|
38579
38590
|
text-anchor="end"
|
|
38580
38591
|
>
|
|
38581
|
-
${
|
|
38592
|
+
${p.humanized}
|
|
38582
38593
|
</text>
|
|
38583
38594
|
</svg>
|
|
38584
38595
|
`;
|
|
38585
38596
|
}
|
|
38586
|
-
let
|
|
38597
|
+
let b = y + a + 5;
|
|
38587
38598
|
return `
|
|
38588
38599
|
<svg
|
|
38589
38600
|
class="adornment-svg"
|
|
38590
38601
|
xmlns="http://www.w3.org/2000/svg"
|
|
38591
|
-
width="${
|
|
38592
|
-
height="${
|
|
38593
|
-
viewBox="0 0 ${
|
|
38602
|
+
width="${v * n}"
|
|
38603
|
+
height="${b * n}"
|
|
38604
|
+
viewBox="0 0 ${v} ${b}"
|
|
38594
38605
|
>
|
|
38595
38606
|
<line
|
|
38596
38607
|
x1="0"
|
|
38597
38608
|
y1="4.5"
|
|
38598
|
-
x2="${
|
|
38609
|
+
x2="${v}"
|
|
38599
38610
|
y2="4.5"
|
|
38600
|
-
stroke="${
|
|
38611
|
+
stroke="${s}"
|
|
38601
38612
|
stroke-width="1"
|
|
38602
38613
|
/>
|
|
38603
38614
|
<line
|
|
@@ -38605,38 +38616,38 @@ function kl(e, t, n) {
|
|
|
38605
38616
|
y1="0"
|
|
38606
38617
|
x2="0.5"
|
|
38607
38618
|
y2="10"
|
|
38608
|
-
stroke="${
|
|
38619
|
+
stroke="${s}"
|
|
38609
38620
|
stroke-width="1"
|
|
38610
38621
|
/>
|
|
38611
38622
|
<line
|
|
38612
|
-
x1="${
|
|
38623
|
+
x1="${v - .5}"
|
|
38613
38624
|
y1="0"
|
|
38614
|
-
x2="${
|
|
38625
|
+
x2="${v - .5}"
|
|
38615
38626
|
y2="10"
|
|
38616
|
-
stroke="${
|
|
38627
|
+
stroke="${s}"
|
|
38617
38628
|
stroke-width="1"
|
|
38618
38629
|
/>
|
|
38619
38630
|
<text
|
|
38620
38631
|
x="0"
|
|
38621
|
-
y="${
|
|
38622
|
-
font-size="${
|
|
38623
|
-
font-family="${
|
|
38632
|
+
y="${a + 12}"
|
|
38633
|
+
font-size="${a}px"
|
|
38634
|
+
font-family="${o}"
|
|
38624
38635
|
font-weight="bold"
|
|
38625
|
-
fill="${
|
|
38636
|
+
fill="${s}"
|
|
38626
38637
|
text-anchor="start"
|
|
38627
38638
|
>
|
|
38628
38639
|
0
|
|
38629
38640
|
</text>
|
|
38630
38641
|
<text
|
|
38631
|
-
x="${
|
|
38632
|
-
y="${
|
|
38633
|
-
font-size="${
|
|
38634
|
-
font-family="${
|
|
38642
|
+
x="${v}"
|
|
38643
|
+
y="${a + 12}"
|
|
38644
|
+
font-size="${a}px"
|
|
38645
|
+
font-family="${o}"
|
|
38635
38646
|
font-weight="bold"
|
|
38636
|
-
fill="${
|
|
38647
|
+
fill="${s}"
|
|
38637
38648
|
text-anchor="end"
|
|
38638
38649
|
>
|
|
38639
|
-
${
|
|
38650
|
+
${g?.humanized ?? ""}
|
|
38640
38651
|
</text>
|
|
38641
38652
|
</svg>
|
|
38642
38653
|
`;
|
|
@@ -38686,8 +38697,8 @@ var Ml = [
|
|
|
38686
38697
|
async function Pl(e, t, n, r, i, a, o, s, c, l) {
|
|
38687
38698
|
let u = [...e.adornments ?? []];
|
|
38688
38699
|
Fl(n, t, c, l);
|
|
38689
|
-
let d = [];
|
|
38690
|
-
ua() && !u.some((e) => e.type === "webControls") && u.unshift({
|
|
38700
|
+
let d = [], f = u.some((e) => !["copyright", "webControls"].includes(e.type));
|
|
38701
|
+
ua() && f && !u.some((e) => e.type === "webControls") && u.unshift({
|
|
38691
38702
|
type: "webControls",
|
|
38692
38703
|
id: "web_controls",
|
|
38693
38704
|
name: "Web controls",
|
|
@@ -38696,10 +38707,12 @@ async function Pl(e, t, n, r, i, a, o, s, c, l) {
|
|
|
38696
38707
|
buttons: []
|
|
38697
38708
|
}), u.forEach((t) => {
|
|
38698
38709
|
if (t.type === "custom") Ll(de(t, c), t.position, t.stacking);
|
|
38699
|
-
else if (t.type === "scalebar") Ll(Ol(t, n, c), t.position, t.stacking);
|
|
38700
38710
|
else if (t.type === "northArrow") Ll(ji(t, n, c), t.position, t.stacking);
|
|
38701
|
-
else if (t.type === "webControls" && t.buttons && l !== "video") Ll(da(t, n, r, i), t.position, t.stacking);
|
|
38702
|
-
else if (t.type === "
|
|
38711
|
+
else if (t.type === "webControls" && t.buttons && l !== "video") Ll(da(t, n, r, i, f), t.position, t.stacking);
|
|
38712
|
+
else if (t.type === "scalebar") {
|
|
38713
|
+
let { element: e, ready: r } = Ol(t, n, a, s, c);
|
|
38714
|
+
Ll(e, t.position, t.stacking), d.push(r);
|
|
38715
|
+
} else if (t.type === "insetMap") {
|
|
38703
38716
|
let { element: e, ready: r } = vl(t, n, o, c);
|
|
38704
38717
|
Ll(e, t.position, t.stacking), d.push(r);
|
|
38705
38718
|
} else if (t.type === "heading") {
|