@watergis/maplibre-gl-terradraw 0.1.0 → 0.1.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/dist/maplibre-gl-terradraw.es.js +26 -18
- package/dist/maplibre-gl-terradraw.es.js.map +1 -1
- package/dist/maplibre-gl-terradraw.umd.js +1 -1
- package/dist/maplibre-gl-terradraw.umd.js.map +1 -1
- package/dist/types/MaplibreTerradrawControl.d.ts +2 -4
- package/dist/types/MaplibreTerradrawControl.d.ts.map +1 -1
- package/dist/types/interfaces/ControlOptions.d.ts +2 -0
- package/dist/types/interfaces/ControlOptions.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -523,13 +523,13 @@ class V extends Qt {
|
|
|
523
523
|
} });
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
const Ft = [new V("EPSG:3857"), new V("EPSG:102100"), new V("EPSG:102113"), new V("EPSG:900913"), new V("http://www.opengis.net/def/crs/EPSG/0/3857"), new V("http://www.opengis.net/gml/srs/epsg.xml#3857")],
|
|
526
|
+
const Ft = [new V("EPSG:3857"), new V("EPSG:102100"), new V("EPSG:102113"), new V("EPSG:900913"), new V("http://www.opengis.net/def/crs/EPSG/0/3857"), new V("http://www.opengis.net/gml/srs/epsg.xml#3857")], Ot = [-180, -90, 180, 90], _e = 6378137 * Math.PI / 180;
|
|
527
527
|
class N extends Qt {
|
|
528
528
|
constructor(t, e) {
|
|
529
|
-
super({ code: t, units: "degrees", extent:
|
|
529
|
+
super({ code: t, units: "degrees", extent: Ot, axisOrientation: e, global: !0, metersPerUnit: _e, worldExtent: Ot });
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
-
const
|
|
532
|
+
const kt = [new N("CRS:84"), new N("EPSG:4326", "neu"), new N("urn:ogc:def:crs:OGC:1.3:CRS84"), new N("urn:ogc:def:crs:OGC:2:84"), new N("http://www.opengis.net/def/crs/OGC/1.3/CRS84"), new N("http://www.opengis.net/gml/srs/epsg.xml#4326", "neu"), new N("http://www.opengis.net/def/crs/EPSG/0/4326", "neu")];
|
|
533
533
|
let mt = {};
|
|
534
534
|
function at(s, t, e) {
|
|
535
535
|
const i = s.getCode(), o = t.getCode();
|
|
@@ -553,7 +553,7 @@ function jt(s) {
|
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
555
|
var Lt, Wt, Bt, C;
|
|
556
|
-
jt(Ft), jt(
|
|
556
|
+
jt(Ft), jt(kt), Lt = Ft, Wt = function(s, t, e) {
|
|
557
557
|
const i = s.length;
|
|
558
558
|
e = e > 1 ? e : 2, t === void 0 && (t = e > 2 ? s.slice() : new Array(i));
|
|
559
559
|
for (let o = 0; o < i; o += e) {
|
|
@@ -567,7 +567,7 @@ jt(Ft), jt(Ot), Lt = Ft, Wt = function(s, t, e) {
|
|
|
567
567
|
e = e > 1 ? e : 2, t === void 0 && (t = e > 2 ? s.slice() : new Array(i));
|
|
568
568
|
for (let o = 0; o < i; o += e) t[o] = 180 * s[o] / X, t[o + 1] = 360 * Math.atan(Math.exp(s[o + 1] / J)) / Math.PI - 90;
|
|
569
569
|
return t;
|
|
570
|
-
},
|
|
570
|
+
}, kt.forEach(function(s) {
|
|
571
571
|
Lt.forEach(function(t) {
|
|
572
572
|
at(s, t, Wt), at(t, s, Bt);
|
|
573
573
|
});
|
|
@@ -1039,7 +1039,7 @@ class Fe extends D {
|
|
|
1039
1039
|
function $(s, t) {
|
|
1040
1040
|
return s[0] === t[0] && s[1] === t[1];
|
|
1041
1041
|
}
|
|
1042
|
-
class
|
|
1042
|
+
class Oe extends O {
|
|
1043
1043
|
constructor(t) {
|
|
1044
1044
|
super(t), this.mode = "linestring", this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.keyEvents = void 0, this.snappingEnabled = void 0, this.cursors = void 0, this.mouseMove = !1, this.insertCoordinates = void 0, this.lastCommitedCoordinates = void 0, this.snapping = void 0, this.insertPoint = void 0;
|
|
1045
1045
|
const e = { start: "crosshair", close: "pointer" };
|
|
@@ -1153,7 +1153,7 @@ class ke extends O {
|
|
|
1153
1153
|
function ne(s, t) {
|
|
1154
1154
|
return s.geometry.type === "Point" && gt(s.geometry.coordinates, t);
|
|
1155
1155
|
}
|
|
1156
|
-
class
|
|
1156
|
+
class ke extends O {
|
|
1157
1157
|
constructor(t) {
|
|
1158
1158
|
super(t), this.mode = "point", this.cursors = void 0;
|
|
1159
1159
|
const e = { create: "crosshair" };
|
|
@@ -2756,8 +2756,8 @@ const si = {
|
|
|
2756
2756
|
modeName: "render",
|
|
2757
2757
|
styles: {}
|
|
2758
2758
|
}),
|
|
2759
|
-
point: new
|
|
2760
|
-
linestring: new
|
|
2759
|
+
point: new ke(),
|
|
2760
|
+
linestring: new Oe(),
|
|
2761
2761
|
polygon: new Le({
|
|
2762
2762
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2763
2763
|
// @ts-ignore
|
|
@@ -2850,21 +2850,17 @@ class ai {
|
|
|
2850
2850
|
/**
|
|
2851
2851
|
* Constructor
|
|
2852
2852
|
* @param options Plugin control options
|
|
2853
|
-
* @param modeOptions Overwrite Terra Draw mode options if you specified.
|
|
2854
|
-
*
|
|
2855
2853
|
*/
|
|
2856
|
-
constructor(t
|
|
2854
|
+
constructor(t) {
|
|
2857
2855
|
k(this, "controlContainer");
|
|
2858
2856
|
k(this, "map");
|
|
2859
2857
|
k(this, "addButton");
|
|
2860
2858
|
k(this, "modeButtons", {});
|
|
2861
2859
|
k(this, "deleteButton");
|
|
2862
2860
|
k(this, "isExpanded", !1);
|
|
2863
|
-
k(this, "activeMode");
|
|
2864
2861
|
k(this, "terradraw");
|
|
2865
2862
|
k(this, "options", si);
|
|
2866
|
-
|
|
2867
|
-
this.modeButtons = {}, this.activeMode = "render", t && (this.options = Object.assign(this.options, t)), this.modeOptions = e;
|
|
2863
|
+
this.modeButtons = {}, t && (this.options = Object.assign(this.options, t));
|
|
2868
2864
|
}
|
|
2869
2865
|
getDefaultPosition() {
|
|
2870
2866
|
return "top-right";
|
|
@@ -2876,7 +2872,19 @@ class ai {
|
|
|
2876
2872
|
this.map = t;
|
|
2877
2873
|
const e = ni(), i = [e.render];
|
|
2878
2874
|
return (n = (o = this.options) == null ? void 0 : o.modes) == null || n.forEach((r) => {
|
|
2879
|
-
this.modeOptions && this.
|
|
2875
|
+
if (this.options.modeOptions && this.options.modeOptions[r]) {
|
|
2876
|
+
const a = this.options.modeOptions[r];
|
|
2877
|
+
if (r === "select") {
|
|
2878
|
+
const l = e[r];
|
|
2879
|
+
if (l) {
|
|
2880
|
+
const d = l.flags;
|
|
2881
|
+
Object.keys(d).forEach((h) => {
|
|
2882
|
+
a.flags[h] || (a.flags[h] = d[h]);
|
|
2883
|
+
});
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
i.push(a);
|
|
2887
|
+
} else e[r] && i.push(e[r]);
|
|
2880
2888
|
}), this.isExpanded = this.options.open === !0, this.terradraw = new oi({
|
|
2881
2889
|
adapter: new pe({ map: t }),
|
|
2882
2890
|
modes: i
|
|
@@ -2937,7 +2945,7 @@ class ai {
|
|
|
2937
2945
|
const o = t.item(i);
|
|
2938
2946
|
o && o.classList.remove("active");
|
|
2939
2947
|
}
|
|
2940
|
-
|
|
2948
|
+
(e = this.terradraw) == null || e.setMode("render");
|
|
2941
2949
|
}
|
|
2942
2950
|
/**
|
|
2943
2951
|
* Add Terra Draw drawing mode button
|
|
@@ -2948,7 +2956,7 @@ class ai {
|
|
|
2948
2956
|
e.classList.add("maplibregl-terradraw-add-control"), e.classList.add(`maplibregl-terradraw-add-${t}-button`), this.isExpanded || e.classList.add("hidden"), e.type = "button", e.addEventListener("click", () => {
|
|
2949
2957
|
if (!this.terradraw) return;
|
|
2950
2958
|
const i = e.classList.contains("active");
|
|
2951
|
-
this.activate(), this.resetActiveMode(), i || (this.terradraw.setMode(t),
|
|
2959
|
+
this.activate(), this.resetActiveMode(), i || (this.terradraw.setMode(t), e.classList.add("active"));
|
|
2952
2960
|
}), this.modeButtons[t] = e;
|
|
2953
2961
|
}
|
|
2954
2962
|
}
|