mapboxgl-tools 2.0.0 → 2.0.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/ui.es.js +239 -252
- package/dist/ui.umd.js +1 -1
- package/package.json +5 -5
package/dist/ui.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".wbiokr-com-checkbox.wbiokr-com-checked .wbiokr-com-checkbox-content{margin-bottom:1px}.wbiokr-com-checkbox .wbiokr-com-checkbox-content.w-5.h-5{width:7px;height:7px}.wbiokr-ctrl-main{transition:all ease .4s;transform:scale(0);opacity:0;background-color:#fff;box-shadow:0 0 3px 1px #8e8e8e;border-radius:4px;overflow:hidden;padding:0 10px}.wbiokr-ctrl-entry path{transition:all ease-in .5s}.wbiokr-ctrl-active .wbiokr-ctrl-main{transform:none;opacity:1}.wbiokr-ctrl-active .wbiokr-ctrl-entry path{fill:#189fff}.wbiokr-ctrl-close{cursor:pointer;background:rgba(241,37,37,.91)!important;color:#fff;font-size:16px}.mapboxgl-ctrl-top-left .wbiokr-ctrl-absolute{position:absolute!important;left:33px;top:0;transform-origin:left top}.mapboxgl-ctrl-bottom-left .wbiokr-ctrl-absolute{position:absolute!important;left:33px;bottom:0;transform-origin:left bottom}.mapboxgl-ctrl-top-right .wbiokr-ctrl-absolute{position:absolute!important;right:33px;top:0;transform-origin:right top}.mapboxgl-ctrl-bottom-right .wbiokr-ctrl-absolute{position:absolute!important;right:33px;bottom:0;transform-origin:right bottom}.wbiokr-control-measureDistance-result,.wbiokr-control-measureArea-result{padding:1px 5px;background:#ffffffe8;border-radius:5px;box-shadow:0 0 4px 1px #999}.wbiokr-control-pick .wbiokr-control-pick-main{min-width:115px;height:29px;display:flex;justify-content:flex-start;align-items:center}.mapboxgl-wbkrect-control .mapboxgl-wbkrect-control-entry{transition:all ease .3s}.mapboxgl-wbkrect-control .mapboxgl-wbkrect-control-entry.wbk-show path{fill:#189fff}.wbiokr-control-positionControl-main textarea{border:1px solid #eee}.wbiokr-control-positionControl-main textarea:hover,.wbiokr-control-positionControl-main textarea:focus{border:1px solid #189fff}.wbiokr-control-positionControl-main textarea:focus{box-shadow:0 0 3px #189fff}.wbiokr-control-positionControl-main ul{max-height:200px}.wbiokr-control-positionControl-main ul li:hover .wbiokr-position-loc{color:#189fff}.wbiokr-control-positionControl-main .wbiokr-position-tag{color:#389e0d;height:24px;min-width:30px;background:#e6f7ff;border:1px solid #b7eb8f;border-radius:3px;padding:0 2px}.wbiokr-control-positionControl-main .wbokr-position-selected .wbiokr-position-tag{color:#096dd9;border-color:#91d5ff}.wbiokr-control-positionControl-main .wbokr-position-selected .wbiokr-position-loc{color:#189fff}.wbiokr-control-layersTree-main{background-color:#fffffff2}.wbiokr-control-layersTree-main-ul li{color:#ccc}.wbiokr-control-layersTree-main-ul li.wbiokr-active{color:#333}.wbiokr-control-layersTree-main-ul li:not(.wbiokr-active) svg{fill:#ccc!important}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();import "@wbiokr/css-class";
|
|
2
|
-
import { coordListByStr } from "
|
|
2
|
+
import { coordListByStr } from "@wbiokr/geo";
|
|
3
3
|
function createUuid(num) {
|
|
4
4
|
function S4() {
|
|
5
5
|
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
@@ -48,10 +48,10 @@ const options$6 = {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
class Checkbox {
|
|
51
|
-
constructor(container,
|
|
51
|
+
constructor(container, e2) {
|
|
52
52
|
this.options = {
|
|
53
53
|
...options$6,
|
|
54
|
-
...
|
|
54
|
+
...e2
|
|
55
55
|
};
|
|
56
56
|
this._container = container;
|
|
57
57
|
this._wrapper = null;
|
|
@@ -282,12 +282,12 @@ function coordEach(geojson, callback, excludeWrapCoord) {
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
function geomEach(geojson, callback) {
|
|
285
|
-
var
|
|
286
|
-
for (
|
|
287
|
-
geometryMaybeCollection = isFeatureCollection ? geojson.features[
|
|
288
|
-
featureProperties = isFeatureCollection ? geojson.features[
|
|
289
|
-
featureBBox = isFeatureCollection ? geojson.features[
|
|
290
|
-
featureId = isFeatureCollection ? geojson.features[
|
|
285
|
+
var i2, j, g, geometry, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
|
|
286
|
+
for (i2 = 0; i2 < stop; i2++) {
|
|
287
|
+
geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
|
|
288
|
+
featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
|
|
289
|
+
featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
|
|
290
|
+
featureId = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
|
|
291
291
|
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
292
292
|
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
293
293
|
for (g = 0; g < stopG; g++) {
|
|
@@ -491,8 +491,8 @@ function distance(from, to, options2) {
|
|
|
491
491
|
var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
|
|
492
492
|
var lat1 = degreesToRadians(coordinates1[1]);
|
|
493
493
|
var lat2 = degreesToRadians(coordinates2[1]);
|
|
494
|
-
var
|
|
495
|
-
return radiansToLength(2 * Math.atan2(Math.sqrt(
|
|
494
|
+
var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
|
|
495
|
+
return radiansToLength(2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)), options2.units);
|
|
496
496
|
}
|
|
497
497
|
var RADIUS = 6378137;
|
|
498
498
|
function area(geojson) {
|
|
@@ -502,13 +502,13 @@ function area(geojson) {
|
|
|
502
502
|
}
|
|
503
503
|
function calculateArea(geom) {
|
|
504
504
|
var total = 0;
|
|
505
|
-
var
|
|
505
|
+
var i2;
|
|
506
506
|
switch (geom.type) {
|
|
507
507
|
case "Polygon":
|
|
508
508
|
return polygonArea(geom.coordinates);
|
|
509
509
|
case "MultiPolygon":
|
|
510
|
-
for (
|
|
511
|
-
total += polygonArea(geom.coordinates[
|
|
510
|
+
for (i2 = 0; i2 < geom.coordinates.length; i2++) {
|
|
511
|
+
total += polygonArea(geom.coordinates[i2]);
|
|
512
512
|
}
|
|
513
513
|
return total;
|
|
514
514
|
case "Point":
|
|
@@ -523,8 +523,8 @@ function polygonArea(coords) {
|
|
|
523
523
|
var total = 0;
|
|
524
524
|
if (coords && coords.length > 0) {
|
|
525
525
|
total += Math.abs(ringArea(coords[0]));
|
|
526
|
-
for (var
|
|
527
|
-
total -= Math.abs(ringArea(coords[
|
|
526
|
+
for (var i2 = 1; i2 < coords.length; i2++) {
|
|
527
|
+
total -= Math.abs(ringArea(coords[i2]));
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
530
|
return total;
|
|
@@ -536,23 +536,23 @@ function ringArea(coords) {
|
|
|
536
536
|
var lowerIndex;
|
|
537
537
|
var middleIndex;
|
|
538
538
|
var upperIndex;
|
|
539
|
-
var
|
|
539
|
+
var i2;
|
|
540
540
|
var total = 0;
|
|
541
541
|
var coordsLength = coords.length;
|
|
542
542
|
if (coordsLength > 2) {
|
|
543
|
-
for (
|
|
544
|
-
if (
|
|
543
|
+
for (i2 = 0; i2 < coordsLength; i2++) {
|
|
544
|
+
if (i2 === coordsLength - 2) {
|
|
545
545
|
lowerIndex = coordsLength - 2;
|
|
546
546
|
middleIndex = coordsLength - 1;
|
|
547
547
|
upperIndex = 0;
|
|
548
|
-
} else if (
|
|
548
|
+
} else if (i2 === coordsLength - 1) {
|
|
549
549
|
lowerIndex = coordsLength - 1;
|
|
550
550
|
middleIndex = 0;
|
|
551
551
|
upperIndex = 1;
|
|
552
552
|
} else {
|
|
553
|
-
lowerIndex =
|
|
554
|
-
middleIndex =
|
|
555
|
-
upperIndex =
|
|
553
|
+
lowerIndex = i2;
|
|
554
|
+
middleIndex = i2 + 1;
|
|
555
|
+
upperIndex = i2 + 2;
|
|
556
556
|
}
|
|
557
557
|
p1 = coords[lowerIndex];
|
|
558
558
|
p2 = coords[middleIndex];
|
|
@@ -594,9 +594,9 @@ var namespaces = {
|
|
|
594
594
|
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
595
595
|
};
|
|
596
596
|
function namespace(name) {
|
|
597
|
-
var prefix = name += "",
|
|
598
|
-
if (
|
|
599
|
-
name = name.slice(
|
|
597
|
+
var prefix = name += "", i2 = prefix.indexOf(":");
|
|
598
|
+
if (i2 >= 0 && (prefix = name.slice(0, i2)) !== "xmlns")
|
|
599
|
+
name = name.slice(i2 + 1);
|
|
600
600
|
return namespaces.hasOwnProperty(prefix) ? { space: namespaces[prefix], local: name } : name;
|
|
601
601
|
}
|
|
602
602
|
function creatorInherit(name) {
|
|
@@ -621,15 +621,15 @@ function selector(selector2) {
|
|
|
621
621
|
return this.querySelector(selector2);
|
|
622
622
|
};
|
|
623
623
|
}
|
|
624
|
-
function selection_select(
|
|
625
|
-
if (typeof
|
|
626
|
-
|
|
624
|
+
function selection_select(select) {
|
|
625
|
+
if (typeof select !== "function")
|
|
626
|
+
select = selector(select);
|
|
627
627
|
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
628
|
-
for (var group = groups[j],
|
|
629
|
-
if ((node = group[
|
|
628
|
+
for (var group = groups[j], n2 = group.length, subgroup = subgroups[j] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2) {
|
|
629
|
+
if ((node = group[i2]) && (subnode = select.call(node, node.__data__, i2, group))) {
|
|
630
630
|
if ("__data__" in node)
|
|
631
631
|
subnode.__data__ = node.__data__;
|
|
632
|
-
subgroup[
|
|
632
|
+
subgroup[i2] = subnode;
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
635
|
}
|
|
@@ -646,20 +646,20 @@ function selectorAll(selector2) {
|
|
|
646
646
|
return this.querySelectorAll(selector2);
|
|
647
647
|
};
|
|
648
648
|
}
|
|
649
|
-
function arrayAll(
|
|
649
|
+
function arrayAll(select) {
|
|
650
650
|
return function() {
|
|
651
|
-
return array(
|
|
651
|
+
return array(select.apply(this, arguments));
|
|
652
652
|
};
|
|
653
653
|
}
|
|
654
|
-
function selection_selectAll(
|
|
655
|
-
if (typeof
|
|
656
|
-
|
|
654
|
+
function selection_selectAll(select) {
|
|
655
|
+
if (typeof select === "function")
|
|
656
|
+
select = arrayAll(select);
|
|
657
657
|
else
|
|
658
|
-
|
|
658
|
+
select = selectorAll(select);
|
|
659
659
|
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
|
660
|
-
for (var group = groups[j],
|
|
661
|
-
if (node = group[
|
|
662
|
-
subgroups.push(
|
|
660
|
+
for (var group = groups[j], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
|
|
661
|
+
if (node = group[i2]) {
|
|
662
|
+
subgroups.push(select.call(node, node.__data__, i2, group));
|
|
663
663
|
parents.push(node);
|
|
664
664
|
}
|
|
665
665
|
}
|
|
@@ -704,8 +704,8 @@ function selection_filter(match) {
|
|
|
704
704
|
if (typeof match !== "function")
|
|
705
705
|
match = matcher(match);
|
|
706
706
|
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
|
707
|
-
for (var group = groups[j],
|
|
708
|
-
if ((node = group[
|
|
707
|
+
for (var group = groups[j], n2 = group.length, subgroup = subgroups[j] = [], node, i2 = 0; i2 < n2; ++i2) {
|
|
708
|
+
if ((node = group[i2]) && match.call(node, node.__data__, i2, group)) {
|
|
709
709
|
subgroup.push(node);
|
|
710
710
|
}
|
|
711
711
|
}
|
|
@@ -746,46 +746,46 @@ function constant(x) {
|
|
|
746
746
|
};
|
|
747
747
|
}
|
|
748
748
|
function bindIndex(parent, group, enter, update, exit, data) {
|
|
749
|
-
var
|
|
750
|
-
for (;
|
|
751
|
-
if (node = group[
|
|
752
|
-
node.__data__ = data[
|
|
753
|
-
update[
|
|
749
|
+
var i2 = 0, node, groupLength = group.length, dataLength = data.length;
|
|
750
|
+
for (; i2 < dataLength; ++i2) {
|
|
751
|
+
if (node = group[i2]) {
|
|
752
|
+
node.__data__ = data[i2];
|
|
753
|
+
update[i2] = node;
|
|
754
754
|
} else {
|
|
755
|
-
enter[
|
|
755
|
+
enter[i2] = new EnterNode(parent, data[i2]);
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
|
-
for (;
|
|
759
|
-
if (node = group[
|
|
760
|
-
exit[
|
|
758
|
+
for (; i2 < groupLength; ++i2) {
|
|
759
|
+
if (node = group[i2]) {
|
|
760
|
+
exit[i2] = node;
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
function bindKey(parent, group, enter, update, exit, data, key) {
|
|
765
|
-
var
|
|
766
|
-
for (
|
|
767
|
-
if (node = group[
|
|
768
|
-
keyValues[
|
|
765
|
+
var i2, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
|
|
766
|
+
for (i2 = 0; i2 < groupLength; ++i2) {
|
|
767
|
+
if (node = group[i2]) {
|
|
768
|
+
keyValues[i2] = keyValue = key.call(node, node.__data__, i2, group) + "";
|
|
769
769
|
if (nodeByKeyValue.has(keyValue)) {
|
|
770
|
-
exit[
|
|
770
|
+
exit[i2] = node;
|
|
771
771
|
} else {
|
|
772
772
|
nodeByKeyValue.set(keyValue, node);
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
775
|
}
|
|
776
|
-
for (
|
|
777
|
-
keyValue = key.call(parent, data[
|
|
776
|
+
for (i2 = 0; i2 < dataLength; ++i2) {
|
|
777
|
+
keyValue = key.call(parent, data[i2], i2, data) + "";
|
|
778
778
|
if (node = nodeByKeyValue.get(keyValue)) {
|
|
779
|
-
update[
|
|
780
|
-
node.__data__ = data[
|
|
779
|
+
update[i2] = node;
|
|
780
|
+
node.__data__ = data[i2];
|
|
781
781
|
nodeByKeyValue.delete(keyValue);
|
|
782
782
|
} else {
|
|
783
|
-
enter[
|
|
783
|
+
enter[i2] = new EnterNode(parent, data[i2]);
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
|
-
for (
|
|
787
|
-
if ((node = group[
|
|
788
|
-
exit[
|
|
786
|
+
for (i2 = 0; i2 < groupLength; ++i2) {
|
|
787
|
+
if ((node = group[i2]) && nodeByKeyValue.get(keyValues[i2]) === node) {
|
|
788
|
+
exit[i2] = node;
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
791
|
}
|
|
@@ -845,9 +845,9 @@ function selection_join(onenter, onupdate, onexit) {
|
|
|
845
845
|
function selection_merge(context) {
|
|
846
846
|
var selection = context.selection ? context.selection() : context;
|
|
847
847
|
for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
|
|
848
|
-
for (var group0 = groups0[j], group1 = groups1[j],
|
|
849
|
-
if (node = group0[
|
|
850
|
-
merge[
|
|
848
|
+
for (var group0 = groups0[j], group1 = groups1[j], n2 = group0.length, merge = merges[j] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
|
|
849
|
+
if (node = group0[i2] || group1[i2]) {
|
|
850
|
+
merge[i2] = node;
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
853
|
}
|
|
@@ -858,8 +858,8 @@ function selection_merge(context) {
|
|
|
858
858
|
}
|
|
859
859
|
function selection_order() {
|
|
860
860
|
for (var groups = this._groups, j = -1, m = groups.length; ++j < m; ) {
|
|
861
|
-
for (var group = groups[j],
|
|
862
|
-
if (node = group[
|
|
861
|
+
for (var group = groups[j], i2 = group.length - 1, next = group[i2], node; --i2 >= 0; ) {
|
|
862
|
+
if (node = group[i2]) {
|
|
863
863
|
if (next && node.compareDocumentPosition(next) ^ 4)
|
|
864
864
|
next.parentNode.insertBefore(node, next);
|
|
865
865
|
next = node;
|
|
@@ -871,21 +871,21 @@ function selection_order() {
|
|
|
871
871
|
function selection_sort(compare) {
|
|
872
872
|
if (!compare)
|
|
873
873
|
compare = ascending;
|
|
874
|
-
function compareNode(
|
|
875
|
-
return
|
|
874
|
+
function compareNode(a2, b) {
|
|
875
|
+
return a2 && b ? compare(a2.__data__, b.__data__) : !a2 - !b;
|
|
876
876
|
}
|
|
877
877
|
for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
|
|
878
|
-
for (var group = groups[j],
|
|
879
|
-
if (node = group[
|
|
880
|
-
sortgroup[
|
|
878
|
+
for (var group = groups[j], n2 = group.length, sortgroup = sortgroups[j] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
|
|
879
|
+
if (node = group[i2]) {
|
|
880
|
+
sortgroup[i2] = node;
|
|
881
881
|
}
|
|
882
882
|
}
|
|
883
883
|
sortgroup.sort(compareNode);
|
|
884
884
|
}
|
|
885
885
|
return new Selection(sortgroups, this._parents).order();
|
|
886
886
|
}
|
|
887
|
-
function ascending(
|
|
888
|
-
return
|
|
887
|
+
function ascending(a2, b) {
|
|
888
|
+
return a2 < b ? -1 : a2 > b ? 1 : a2 >= b ? 0 : NaN;
|
|
889
889
|
}
|
|
890
890
|
function selection_call() {
|
|
891
891
|
var callback = arguments[0];
|
|
@@ -898,8 +898,8 @@ function selection_nodes() {
|
|
|
898
898
|
}
|
|
899
899
|
function selection_node() {
|
|
900
900
|
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
|
901
|
-
for (var group = groups[j],
|
|
902
|
-
var node = group[
|
|
901
|
+
for (var group = groups[j], i2 = 0, n2 = group.length; i2 < n2; ++i2) {
|
|
902
|
+
var node = group[i2];
|
|
903
903
|
if (node)
|
|
904
904
|
return node;
|
|
905
905
|
}
|
|
@@ -917,9 +917,9 @@ function selection_empty() {
|
|
|
917
917
|
}
|
|
918
918
|
function selection_each(callback) {
|
|
919
919
|
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
|
920
|
-
for (var group = groups[j],
|
|
921
|
-
if (node = group[
|
|
922
|
-
callback.call(node, node.__data__,
|
|
920
|
+
for (var group = groups[j], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
|
|
921
|
+
if (node = group[i2])
|
|
922
|
+
callback.call(node, node.__data__, i2, group);
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
925
|
return this;
|
|
@@ -1032,16 +1032,16 @@ function ClassList(node) {
|
|
|
1032
1032
|
}
|
|
1033
1033
|
ClassList.prototype = {
|
|
1034
1034
|
add: function(name) {
|
|
1035
|
-
var
|
|
1036
|
-
if (
|
|
1035
|
+
var i2 = this._names.indexOf(name);
|
|
1036
|
+
if (i2 < 0) {
|
|
1037
1037
|
this._names.push(name);
|
|
1038
1038
|
this._node.setAttribute("class", this._names.join(" "));
|
|
1039
1039
|
}
|
|
1040
1040
|
},
|
|
1041
1041
|
remove: function(name) {
|
|
1042
|
-
var
|
|
1043
|
-
if (
|
|
1044
|
-
this._names.splice(
|
|
1042
|
+
var i2 = this._names.indexOf(name);
|
|
1043
|
+
if (i2 >= 0) {
|
|
1044
|
+
this._names.splice(i2, 1);
|
|
1045
1045
|
this._node.setAttribute("class", this._names.join(" "));
|
|
1046
1046
|
}
|
|
1047
1047
|
},
|
|
@@ -1050,14 +1050,14 @@ ClassList.prototype = {
|
|
|
1050
1050
|
}
|
|
1051
1051
|
};
|
|
1052
1052
|
function classedAdd(node, names) {
|
|
1053
|
-
var list = classList(node),
|
|
1054
|
-
while (++
|
|
1055
|
-
list.add(names[
|
|
1053
|
+
var list = classList(node), i2 = -1, n2 = names.length;
|
|
1054
|
+
while (++i2 < n2)
|
|
1055
|
+
list.add(names[i2]);
|
|
1056
1056
|
}
|
|
1057
1057
|
function classedRemove(node, names) {
|
|
1058
|
-
var list = classList(node),
|
|
1059
|
-
while (++
|
|
1060
|
-
list.remove(names[
|
|
1058
|
+
var list = classList(node), i2 = -1, n2 = names.length;
|
|
1059
|
+
while (++i2 < n2)
|
|
1060
|
+
list.remove(names[i2]);
|
|
1061
1061
|
}
|
|
1062
1062
|
function classedTrue(names) {
|
|
1063
1063
|
return function() {
|
|
@@ -1077,9 +1077,9 @@ function classedFunction(names, value) {
|
|
|
1077
1077
|
function selection_classed(name, value) {
|
|
1078
1078
|
var names = classArray(name + "");
|
|
1079
1079
|
if (arguments.length < 2) {
|
|
1080
|
-
var list = classList(this.node()),
|
|
1081
|
-
while (++
|
|
1082
|
-
if (!list.contains(names[
|
|
1080
|
+
var list = classList(this.node()), i2 = -1, n2 = names.length;
|
|
1081
|
+
while (++i2 < n2)
|
|
1082
|
+
if (!list.contains(names[i2]))
|
|
1083
1083
|
return false;
|
|
1084
1084
|
return true;
|
|
1085
1085
|
}
|
|
@@ -1143,9 +1143,9 @@ function constantNull() {
|
|
|
1143
1143
|
return null;
|
|
1144
1144
|
}
|
|
1145
1145
|
function selection_insert(name, before) {
|
|
1146
|
-
var create = typeof name === "function" ? name : creator(name),
|
|
1146
|
+
var create = typeof name === "function" ? name : creator(name), select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
|
|
1147
1147
|
return this.select(function() {
|
|
1148
|
-
return this.insertBefore(create.apply(this, arguments),
|
|
1148
|
+
return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
|
|
1149
1149
|
});
|
|
1150
1150
|
}
|
|
1151
1151
|
function remove() {
|
|
@@ -1177,9 +1177,9 @@ function contextListener(listener) {
|
|
|
1177
1177
|
}
|
|
1178
1178
|
function parseTypenames(typenames) {
|
|
1179
1179
|
return typenames.trim().split(/^|\s+/).map(function(t2) {
|
|
1180
|
-
var name = "",
|
|
1181
|
-
if (
|
|
1182
|
-
name = t2.slice(
|
|
1180
|
+
var name = "", i2 = t2.indexOf(".");
|
|
1181
|
+
if (i2 >= 0)
|
|
1182
|
+
name = t2.slice(i2 + 1), t2 = t2.slice(0, i2);
|
|
1183
1183
|
return { type: t2, name };
|
|
1184
1184
|
});
|
|
1185
1185
|
}
|
|
@@ -1188,15 +1188,15 @@ function onRemove(typename) {
|
|
|
1188
1188
|
var on = this.__on;
|
|
1189
1189
|
if (!on)
|
|
1190
1190
|
return;
|
|
1191
|
-
for (var j = 0,
|
|
1191
|
+
for (var j = 0, i2 = -1, m = on.length, o; j < m; ++j) {
|
|
1192
1192
|
if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
|
|
1193
1193
|
this.removeEventListener(o.type, o.listener, o.options);
|
|
1194
1194
|
} else {
|
|
1195
|
-
on[++
|
|
1195
|
+
on[++i2] = o;
|
|
1196
1196
|
}
|
|
1197
1197
|
}
|
|
1198
|
-
if (++
|
|
1199
|
-
on.length =
|
|
1198
|
+
if (++i2)
|
|
1199
|
+
on.length = i2;
|
|
1200
1200
|
else
|
|
1201
1201
|
delete this.__on;
|
|
1202
1202
|
};
|
|
@@ -1222,13 +1222,13 @@ function onAdd(typename, value, options2) {
|
|
|
1222
1222
|
};
|
|
1223
1223
|
}
|
|
1224
1224
|
function selection_on(typename, value, options2) {
|
|
1225
|
-
var typenames = parseTypenames(typename + ""),
|
|
1225
|
+
var typenames = parseTypenames(typename + ""), i2, n2 = typenames.length, t2;
|
|
1226
1226
|
if (arguments.length < 2) {
|
|
1227
1227
|
var on = this.node().__on;
|
|
1228
1228
|
if (on)
|
|
1229
1229
|
for (var j = 0, m = on.length, o; j < m; ++j) {
|
|
1230
|
-
for (
|
|
1231
|
-
if ((t2 = typenames[
|
|
1230
|
+
for (i2 = 0, o = on[j]; i2 < n2; ++i2) {
|
|
1231
|
+
if ((t2 = typenames[i2]).type === o.type && t2.name === o.name) {
|
|
1232
1232
|
return o.value;
|
|
1233
1233
|
}
|
|
1234
1234
|
}
|
|
@@ -1236,8 +1236,8 @@ function selection_on(typename, value, options2) {
|
|
|
1236
1236
|
return;
|
|
1237
1237
|
}
|
|
1238
1238
|
on = value ? onAdd : onRemove;
|
|
1239
|
-
for (
|
|
1240
|
-
this.each(on(typenames[
|
|
1239
|
+
for (i2 = 0; i2 < n2; ++i2)
|
|
1240
|
+
this.each(on(typenames[i2], value, options2));
|
|
1241
1241
|
return this;
|
|
1242
1242
|
}
|
|
1243
1243
|
function dispatchEvent(node, type, params) {
|
|
@@ -1268,8 +1268,8 @@ function selection_dispatch(type, params) {
|
|
|
1268
1268
|
}
|
|
1269
1269
|
function* selection_iterator() {
|
|
1270
1270
|
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
|
1271
|
-
for (var group = groups[j],
|
|
1272
|
-
if (node = group[
|
|
1271
|
+
for (var group = groups[j], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
|
|
1272
|
+
if (node = group[i2])
|
|
1273
1273
|
yield node;
|
|
1274
1274
|
}
|
|
1275
1275
|
}
|
|
@@ -1320,107 +1320,100 @@ Selection.prototype = {
|
|
|
1320
1320
|
dispatch: selection_dispatch,
|
|
1321
1321
|
[Symbol.iterator]: selection_iterator
|
|
1322
1322
|
};
|
|
1323
|
-
function
|
|
1323
|
+
function e(selector2) {
|
|
1324
1324
|
return typeof selector2 === "string" ? new Selection([[document.querySelector(selector2)]], [document.documentElement]) : new Selection([[selector2]], root$1);
|
|
1325
1325
|
}
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1326
|
+
const t = { "\u21E7": 16, shift: 16, "\u2303": 17, ctrl: 17, "\u2325": 18, alt: 18, option: 18, "\u2318": 91, meta: 91, cmd: 91, super: 91, win: 91 }, r = { 16: "shiftKey", 17: "ctrlKey", 18: "altKey", 91: "metaKey" }, n = { "\u232B": "Backspace", backspace: "Backspace", "\u21E5": "Tab", "\u21C6": "Tab", tab: "Tab", "\u21A9": "Enter", "\u21B5": "Enter", "\u23CE": "Enter", return: "Enter", enter: "Enter", "\u2305": "Enter", pause: "Pause", "pause-break": "Pause", "\u21EA": "CapsLock", caps: "CapsLock", "caps-lock": "CapsLock", "\u238B": ["Escape", "Esc"], escape: ["Escape", "Esc"], esc: ["Escape", "Esc"], space: [" ", "Spacebar"], "": "PageUp", pgup: "PageUp", "page-up": "PageUp", "": "PageDown", pgdown: "PageDown", "page-down": "PageDown", "\u21DF": "End", end: "End", "\u21DE": "Home", home: "Home", ins: "Insert", insert: "Insert", "\u2326": ["Delete", "Del"], del: ["Delete", "Del"], delete: ["Delete", "Del"], "\u2190": ["ArrowLeft", "Left"], left: ["ArrowLeft", "Left"], "arrow-left": ["ArrowLeft", "Left"], "\u2191": ["ArrowUp", "Up"], up: ["ArrowUp", "Up"], "arrow-up": ["ArrowUp", "Up"], "\u2192": ["ArrowRight", "Right"], right: ["ArrowRight", "Right"], "arrow-right": ["ArrowRight", "Right"], "\u2193": ["ArrowDown", "Down"], down: ["ArrowDown", "Down"], "arrow-down": ["ArrowDown", "Down"], "*": ["*", "Multiply"], star: ["*", "Multiply"], asterisk: ["*", "Multiply"], multiply: ["*", "Multiply"], "+": ["+", "Add"], plus: ["+", "Add"], "-": ["-", "Subtract"], subtract: ["-", "Subtract"], dash: ["-", "Subtract"], semicolon: ";", equals: "=", comma: ",", period: ".", "full-stop": ".", slash: "/", "forward-slash": "/", tick: "`", "back-quote": "`", "open-bracket": "[", "back-slash": "\\", "close-bracket": "]", quote: "'", apostrophe: "'", "num-0": "0", "num-1": "1", "num-2": "2", "num-3": "3", "num-4": "4", "num-5": "5", "num-6": "6", "num-7": "7", "num-8": "8", "num-9": "9", f1: "F1", f2: "F2", f3: "F3", f4: "F4", f5: "F5", f6: "F6", f7: "F7", f8: "F8", f9: "F9", f10: "F10", f11: "F11", f12: "F12", f13: "F13", f14: "F14", f15: "F15", f16: "F16", f17: "F17", f18: "F18", f19: "F19", f20: "F20", f21: "F21", f22: "F22", f23: "F23", f24: "F24", f25: "F25" }, s = { "\u232B": 8, backspace: 8, "\u21E5": 9, "\u21C6": 9, tab: 9, "\u21A9": 13, "\u21B5": 13, "\u23CE": 13, return: 13, enter: 13, "\u2305": 13, pause: 19, "pause-break": 19, "\u21EA": 20, caps: 20, "caps-lock": 20, "\u238B": 27, escape: 27, esc: 27, space: 32, "": 33, pgup: 33, "page-up": 33, "": 34, pgdown: 34, "page-down": 34, "\u21DF": 35, end: 35, "\u21DE": 36, home: 36, ins: 45, insert: 45, "\u2326": 46, del: 46, delete: 46, "\u2190": 37, left: 37, "arrow-left": 37, "\u2191": 38, up: 38, "arrow-up": 38, "\u2192": 39, right: 39, "arrow-right": 39, "\u2193": 40, down: 40, "arrow-down": 40, ffequals: 61, "*": 106, star: 106, asterisk: 106, multiply: 106, "+": 107, plus: 107, "-": 109, subtract: 109, "|": 124, ffplus: 171, ffminus: 173, ";": 186, semicolon: 186, "=": 187, equals: 187, ",": 188, comma: 188, dash: 189, ".": 190, period: 190, "full-stop": 190, "/": 191, slash: 191, "forward-slash": 191, "`": 192, tick: 192, "back-quote": 192, "[": 219, "open-bracket": 219, "\\": 220, "back-slash": 220, "]": 221, "close-bracket": 221, "'": 222, quote: 222, apostrophe: 222 };
|
|
1327
|
+
function a(e2) {
|
|
1328
|
+
return Array.from(new Set(e2));
|
|
1329
|
+
}
|
|
1330
|
+
class i {
|
|
1331
|
+
constructor(t2 = "global", r2 = document, n2 = "keydown") {
|
|
1332
|
+
if ("keydown" !== n2 && "keyup" !== n2)
|
|
1333
|
+
throw new Error(n2, "\u4E8B\u4EF6\u7C7B\u578B\u4EC5\u652F\u6301keydown\u3001keyup");
|
|
1334
|
+
this.eventType = n2, this.namespace = t2, this.selection = e(r2), this.bindedKeys = [], this.bindings = this.bindings.bind(this), this.capture = this.capture.bind(this), this.bubble = this.bubble.bind(this), this.init();
|
|
1335
|
+
}
|
|
1336
|
+
init() {
|
|
1337
|
+
return this.selection.on(`${this.eventType}.capture.${this.namespace}`, this.capture, true), this.selection.on(`${this.eventType}.bubble.${this.namespace}`, this.bubble, false), this;
|
|
1338
|
+
}
|
|
1339
|
+
bindings(e2, t2) {
|
|
1340
|
+
var r2, n2, s2 = false, a2 = Object.keys(this.bindedKeys).map(function(e3) {
|
|
1341
|
+
return this.bindedKeys[e3];
|
|
1342
|
+
}.bind(this));
|
|
1343
|
+
for (r2 = 0; r2 < a2.length; r2++)
|
|
1344
|
+
if ((n2 = a2[r2]).event.modifiers.shiftKey && !!n2.capture === t2 && i2(e2, n2, true)) {
|
|
1345
|
+
n2.callback(e2), s2 = true, e2.preventDefault();
|
|
1338
1346
|
break;
|
|
1339
1347
|
}
|
|
1340
|
-
if (!
|
|
1341
|
-
for (r2 = 0; r2 <
|
|
1342
|
-
if (!(
|
|
1343
|
-
|
|
1348
|
+
if (!s2) {
|
|
1349
|
+
for (r2 = 0; r2 < a2.length; r2++)
|
|
1350
|
+
if (!(n2 = a2[r2]).event.modifiers.shiftKey && !!n2.capture === t2 && i2(e2, n2, false)) {
|
|
1351
|
+
n2.callback(e2), e2.preventDefault();
|
|
1344
1352
|
break;
|
|
1345
1353
|
}
|
|
1346
1354
|
}
|
|
1347
|
-
function
|
|
1348
|
-
var
|
|
1349
|
-
if (void 0 !==
|
|
1350
|
-
return
|
|
1351
|
-
}).indexOf(
|
|
1355
|
+
function i2(e3, t3, r3) {
|
|
1356
|
+
var n3 = e3, s3 = false, a3 = true;
|
|
1357
|
+
if (void 0 !== n3.key && (a3 = n3.key.charCodeAt(0) > 255, s3 = true, void 0 === t3.event.key ? s3 = false : Array.isArray(t3.event.key) ? -1 === t3.event.key.map(function(e4) {
|
|
1358
|
+
return e4.toLowerCase();
|
|
1359
|
+
}).indexOf(n3.key.toLowerCase()) && (s3 = false) : n3.key.toLowerCase() !== t3.event.key.toLowerCase() && (s3 = false)), s3 || !a3 && !t3.event.modifiers.shiftKey || (s3 = n3.keyCode === t3.event.keyCode), !s3)
|
|
1352
1360
|
return false;
|
|
1353
|
-
if (!
|
|
1354
|
-
if (
|
|
1361
|
+
if (!n3.ctrlKey || !n3.altKey) {
|
|
1362
|
+
if (n3.ctrlKey !== t3.event.modifiers.ctrlKey)
|
|
1355
1363
|
return false;
|
|
1356
|
-
if (
|
|
1364
|
+
if (n3.altKey !== t3.event.modifiers.altKey)
|
|
1357
1365
|
return false;
|
|
1358
1366
|
}
|
|
1359
|
-
return
|
|
1367
|
+
return n3.metaKey === t3.event.modifiers.metaKey && (!r3 || n3.shiftKey === t3.event.modifiers.shiftKey);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
capture(e2) {
|
|
1371
|
+
this.bindings(e2, true);
|
|
1372
|
+
}
|
|
1373
|
+
bubble(t2) {
|
|
1374
|
+
var r2 = e(t2.target).node().tagName;
|
|
1375
|
+
"INPUT" !== r2 && "SELECT" !== r2 && "TEXTAREA" !== r2 && "true" !== String(t2.target.getAttribute("contenteditable")) && this.bindings(t2, false);
|
|
1376
|
+
}
|
|
1377
|
+
on(e2, i2, o2) {
|
|
1378
|
+
if ("function" != typeof i2)
|
|
1379
|
+
return this.off(e2, o2);
|
|
1380
|
+
for (var c2 = a([].concat(e2)), l = 0; l < c2.length; l++) {
|
|
1381
|
+
var u = c2[l] + (o2 ? "-capture" : "-bubble"), p = { id: u, capture: o2, callback: i2, event: { key: void 0, keyCode: 0, modifiers: { shiftKey: false, ctrlKey: false, altKey: false, metaKey: false } } };
|
|
1382
|
+
this.bindedKeys[u] && console.warn('warning: duplicate keybinding for "' + u + '"'), this.bindedKeys[u] = p;
|
|
1383
|
+
for (var f = c2[l].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g), d = 0; d < f.length; d++)
|
|
1384
|
+
if ("++" === f[d] && (f[d] = "+"), f[d] in t) {
|
|
1385
|
+
var h = r[t[f[d]]];
|
|
1386
|
+
p.event.modifiers[h] = true;
|
|
1387
|
+
} else
|
|
1388
|
+
p.event.key = n[f[d]] || f[d], f[d] in s && (p.event.keyCode = s[f[d]]);
|
|
1360
1389
|
}
|
|
1390
|
+
return this;
|
|
1361
1391
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
1392
|
+
unbind() {
|
|
1393
|
+
return this.selection.on(`${this.eventType}.capture.${this.namespace}`, null), this.selection.on(`${this.eventType}.bubble.${this.namespace}`, null), this;
|
|
1364
1394
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
return c.unbind = function(t2) {
|
|
1379
|
-
return a = [], (t2 = t2 || select(document)).on("keydown.capture." + o, null), t2.on("keydown.bubble." + o, null), c;
|
|
1380
|
-
}, c.clear = function() {
|
|
1381
|
-
return a = {}, c;
|
|
1382
|
-
}, c.off = function(e, r2) {
|
|
1383
|
-
for (var o2 = t([].concat(e)), n2 = 0; n2 < o2.length; n2++) {
|
|
1384
|
-
var f2 = o2[n2] + (r2 ? "-capture" : "-bubble");
|
|
1385
|
-
delete a[f2];
|
|
1386
|
-
}
|
|
1387
|
-
return c;
|
|
1388
|
-
}, c.on = function(e, o2, n2) {
|
|
1389
|
-
if ("function" != typeof o2)
|
|
1390
|
-
return c.off(e, n2);
|
|
1391
|
-
for (var f2 = t([].concat(e)), s2 = 0; s2 < f2.length; s2++) {
|
|
1392
|
-
var i2 = f2[s2] + (n2 ? "-capture" : "-bubble"), u = { id: i2, capture: n2, callback: o2, event: { key: void 0, keyCode: 0, modifiers: { shiftKey: false, ctrlKey: false, altKey: false, metaKey: false } } };
|
|
1393
|
-
a[i2] && console.warn('warning: duplicate keybinding for "' + i2 + '"'), a[i2] = u;
|
|
1394
|
-
for (var l = f2[s2].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g), p = 0; p < l.length; p++)
|
|
1395
|
-
if ("++" === l[p] && (l[p] = "+"), l[p] in r.modifierCodes) {
|
|
1396
|
-
var d = r.modifierProperties[r.modifierCodes[l[p]]];
|
|
1397
|
-
u.event.modifiers[d] = true;
|
|
1398
|
-
} else
|
|
1399
|
-
u.event.key = r.keys[l[p]] || l[p], l[p] in r.keyCodes && (u.event.keyCode = r.keyCodes[l[p]]);
|
|
1400
|
-
}
|
|
1401
|
-
return c;
|
|
1402
|
-
}, c;
|
|
1403
|
-
}
|
|
1404
|
-
r.modifierCodes = { "\u21E7": 16, shift: 16, "\u2303": 17, ctrl: 17, "\u2325": 18, alt: 18, option: 18, "\u2318": 91, meta: 91, cmd: 91, super: 91, win: 91 }, r.modifierProperties = { 16: "shiftKey", 17: "ctrlKey", 18: "altKey", 91: "metaKey" }, r.keys = { "\u232B": "Backspace", backspace: "Backspace", "\u21E5": "Tab", "\u21C6": "Tab", tab: "Tab", "\u21A9": "Enter", "\u21B5": "Enter", "\u23CE": "Enter", return: "Enter", enter: "Enter", "\u2305": "Enter", pause: "Pause", "pause-break": "Pause", "\u21EA": "CapsLock", caps: "CapsLock", "caps-lock": "CapsLock", "\u238B": ["Escape", "Esc"], escape: ["Escape", "Esc"], esc: ["Escape", "Esc"], space: [" ", "Spacebar"], "": "PageUp", pgup: "PageUp", "page-up": "PageUp", "": "PageDown", pgdown: "PageDown", "page-down": "PageDown", "\u21DF": "End", end: "End", "\u21DE": "Home", home: "Home", ins: "Insert", insert: "Insert", "\u2326": ["Delete", "Del"], del: ["Delete", "Del"], delete: ["Delete", "Del"], "\u2190": ["ArrowLeft", "Left"], left: ["ArrowLeft", "Left"], "arrow-left": ["ArrowLeft", "Left"], "\u2191": ["ArrowUp", "Up"], up: ["ArrowUp", "Up"], "arrow-up": ["ArrowUp", "Up"], "\u2192": ["ArrowRight", "Right"], right: ["ArrowRight", "Right"], "arrow-right": ["ArrowRight", "Right"], "\u2193": ["ArrowDown", "Down"], down: ["ArrowDown", "Down"], "arrow-down": ["ArrowDown", "Down"], "*": ["*", "Multiply"], star: ["*", "Multiply"], asterisk: ["*", "Multiply"], multiply: ["*", "Multiply"], "+": ["+", "Add"], plus: ["+", "Add"], "-": ["-", "Subtract"], subtract: ["-", "Subtract"], dash: ["-", "Subtract"], semicolon: ";", equals: "=", comma: ",", period: ".", "full-stop": ".", slash: "/", "forward-slash": "/", tick: "`", "back-quote": "`", "open-bracket": "[", "back-slash": "\\", "close-bracket": "]", quote: "'", apostrophe: "'", "num-0": "0", "num-1": "1", "num-2": "2", "num-3": "3", "num-4": "4", "num-5": "5", "num-6": "6", "num-7": "7", "num-8": "8", "num-9": "9", f1: "F1", f2: "F2", f3: "F3", f4: "F4", f5: "F5", f6: "F6", f7: "F7", f8: "F8", f9: "F9", f10: "F10", f11: "F11", f12: "F12", f13: "F13", f14: "F14", f15: "F15", f16: "F16", f17: "F17", f18: "F18", f19: "F19", f20: "F20", f21: "F21", f22: "F22", f23: "F23", f24: "F24", f25: "F25" }, r.keyCodes = { "\u232B": 8, backspace: 8, "\u21E5": 9, "\u21C6": 9, tab: 9, "\u21A9": 13, "\u21B5": 13, "\u23CE": 13, return: 13, enter: 13, "\u2305": 13, pause: 19, "pause-break": 19, "\u21EA": 20, caps: 20, "caps-lock": 20, "\u238B": 27, escape: 27, esc: 27, space: 32, "": 33, pgup: 33, "page-up": 33, "": 34, pgdown: 34, "page-down": 34, "\u21DF": 35, end: 35, "\u21DE": 36, home: 36, ins: 45, insert: 45, "\u2326": 46, del: 46, delete: 46, "\u2190": 37, left: 37, "arrow-left": 37, "\u2191": 38, up: 38, "arrow-up": 38, "\u2192": 39, right: 39, "arrow-right": 39, "\u2193": 40, down: 40, "arrow-down": 40, ffequals: 61, "*": 106, star: 106, asterisk: 106, multiply: 106, "+": 107, plus: 107, "-": 109, subtract: 109, "|": 124, ffplus: 171, ffminus: 173, ";": 186, semicolon: 186, "=": 187, equals: 187, ",": 188, comma: 188, dash: 189, ".": 190, period: 190, "full-stop": 190, "/": 191, slash: 191, "forward-slash": 191, "`": 192, tick: 192, "back-quote": 192, "[": 219, "open-bracket": 219, "\\": 220, "back-slash": 220, "]": 221, "close-bracket": 221, "'": 222, quote: 222, apostrophe: 222 };
|
|
1405
|
-
for (var o = 95, n = 0; ++o < 106; )
|
|
1406
|
-
r.keyCodes["num-" + n] = o, ++n;
|
|
1407
|
-
for (o = 47, n = 0; ++o < 58; )
|
|
1408
|
-
r.keyCodes[n] = o, ++n;
|
|
1409
|
-
for (o = 111, n = 1; ++o < 136; )
|
|
1410
|
-
r.keyCodes["f" + n] = o, ++n;
|
|
1411
|
-
for (o = 64; ++o < 91; )
|
|
1412
|
-
r.keyCodes[String.fromCharCode(o).toLowerCase()] = o;
|
|
1395
|
+
clear() {
|
|
1396
|
+
return this.bindedKeys = {}, this;
|
|
1397
|
+
}
|
|
1398
|
+
off(e2, t2) {
|
|
1399
|
+
for (var r2 = a([].concat(e2)), n2 = 0; n2 < r2.length; n2++) {
|
|
1400
|
+
var s2 = r2[n2] + (true === t2 ? "-capture" : "-bubble");
|
|
1401
|
+
delete this.bindedKeys[s2];
|
|
1402
|
+
}
|
|
1403
|
+
return this;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
new i("global", document, "keydown");
|
|
1407
|
+
new i("global", document, "keyup");
|
|
1413
1408
|
class KeyboardControl extends CommonCtrol {
|
|
1414
1409
|
_onBindKeyboards(actions, namespace2) {
|
|
1415
|
-
this.keybinding =
|
|
1410
|
+
this.keybinding = new i(namespace2);
|
|
1416
1411
|
actions.forEach((o) => {
|
|
1417
1412
|
this.keybinding.on(o.code, o.action);
|
|
1418
1413
|
});
|
|
1419
|
-
select(document).call(this.keybinding);
|
|
1420
1414
|
}
|
|
1421
1415
|
_onUnbindKeyboards() {
|
|
1422
1416
|
this.keybinding.clear();
|
|
1423
|
-
select(document).call(this.keybinding.unbind);
|
|
1424
1417
|
}
|
|
1425
1418
|
}
|
|
1426
1419
|
const options$5 = {
|
|
@@ -1433,13 +1426,13 @@ const WBK_LAYER_POINTS = "WBK_LAYER_POINTS";
|
|
|
1433
1426
|
const WBK_LAYER_LINE = "WBK_LAYER_LINE";
|
|
1434
1427
|
const WBK_LAYER_MOVE = "WBK_LAYER_MOVE";
|
|
1435
1428
|
class MeasureDistanceControl extends KeyboardControl {
|
|
1436
|
-
constructor(
|
|
1429
|
+
constructor(e2) {
|
|
1437
1430
|
super();
|
|
1438
1431
|
this.name = "measureDistance";
|
|
1439
1432
|
this.measureFlag = false;
|
|
1440
1433
|
this.options = {
|
|
1441
1434
|
...options$5,
|
|
1442
|
-
...
|
|
1435
|
+
...e2
|
|
1443
1436
|
};
|
|
1444
1437
|
this.tooltip = null;
|
|
1445
1438
|
this.startEle = null;
|
|
@@ -1552,18 +1545,18 @@ class MeasureDistanceControl extends KeyboardControl {
|
|
|
1552
1545
|
this._resetData();
|
|
1553
1546
|
}
|
|
1554
1547
|
_eventMeasure() {
|
|
1555
|
-
this._map.on("click", (
|
|
1548
|
+
this._map.on("click", (e2) => {
|
|
1556
1549
|
if (!this.flag)
|
|
1557
1550
|
return;
|
|
1558
|
-
const coord = [
|
|
1551
|
+
const coord = [e2.lngLat.lng, e2.lngLat.lat];
|
|
1559
1552
|
this._addMeasurePoint(coord);
|
|
1560
1553
|
this._addPoint(coord);
|
|
1561
1554
|
this.points.push(coord);
|
|
1562
1555
|
});
|
|
1563
|
-
this._map.on("dblclick", (
|
|
1556
|
+
this._map.on("dblclick", (e2) => {
|
|
1564
1557
|
if (!this.flag)
|
|
1565
1558
|
return;
|
|
1566
|
-
var coords = [
|
|
1559
|
+
var coords = [e2.lngLat.lng, e2.lngLat.lat];
|
|
1567
1560
|
this._addPoint(coords);
|
|
1568
1561
|
this.measureFlag = false;
|
|
1569
1562
|
this._map.getCanvas().style.cursor = "";
|
|
@@ -1583,10 +1576,10 @@ class MeasureDistanceControl extends KeyboardControl {
|
|
|
1583
1576
|
self2._close();
|
|
1584
1577
|
}.bind(this);
|
|
1585
1578
|
});
|
|
1586
|
-
this._map.on("mousemove", (
|
|
1579
|
+
this._map.on("mousemove", (e2) => {
|
|
1587
1580
|
if (!this.flag)
|
|
1588
1581
|
return;
|
|
1589
|
-
const coords = [
|
|
1582
|
+
const coords = [e2.lngLat.lng, e2.lngLat.lat];
|
|
1590
1583
|
if (this.jsonPoint.features.length > 0) {
|
|
1591
1584
|
var prev = this.jsonPoint.features[this.jsonPoint.features.length - 1];
|
|
1592
1585
|
var json = {
|
|
@@ -1711,13 +1704,13 @@ const WBK_AREA_LAYER_POINTS = "WBK_AREA_LAYER_POINTS";
|
|
|
1711
1704
|
const WBK_AREA_LAYER_FILL = "WBK_AREA_LAYER_FILL";
|
|
1712
1705
|
const WBK_AREA_LAYER_STROKE = "WBK_AREA_LAYER_STROKE";
|
|
1713
1706
|
class MeasureAreaControl extends KeyboardControl {
|
|
1714
|
-
constructor(
|
|
1707
|
+
constructor(e2) {
|
|
1715
1708
|
super();
|
|
1716
1709
|
this.name = "measureArea";
|
|
1717
1710
|
this.measureFlag = false;
|
|
1718
1711
|
this.options = {
|
|
1719
1712
|
...options$4,
|
|
1720
|
-
...
|
|
1713
|
+
...e2
|
|
1721
1714
|
};
|
|
1722
1715
|
this.tooltip = null;
|
|
1723
1716
|
this.startEle = null;
|
|
@@ -1826,17 +1819,17 @@ class MeasureAreaControl extends KeyboardControl {
|
|
|
1826
1819
|
this._resetData();
|
|
1827
1820
|
}
|
|
1828
1821
|
_eventMeasure() {
|
|
1829
|
-
this._map.on("click", (
|
|
1822
|
+
this._map.on("click", (e2) => {
|
|
1830
1823
|
if (!this.flag)
|
|
1831
1824
|
return;
|
|
1832
|
-
const coord = [
|
|
1825
|
+
const coord = [e2.lngLat.lng, e2.lngLat.lat];
|
|
1833
1826
|
this.points.push(coord);
|
|
1834
1827
|
this._addPoint(coord);
|
|
1835
1828
|
});
|
|
1836
|
-
this._map.on("dblclick", (
|
|
1829
|
+
this._map.on("dblclick", (e2) => {
|
|
1837
1830
|
if (!this.flag)
|
|
1838
1831
|
return;
|
|
1839
|
-
const coords = [
|
|
1832
|
+
const coords = [e2.lngLat.lng, e2.lngLat.lat];
|
|
1840
1833
|
this.points.push(coords);
|
|
1841
1834
|
this.measureFlag = false;
|
|
1842
1835
|
this._map.getCanvas().style.cursor = "";
|
|
@@ -1857,10 +1850,10 @@ class MeasureAreaControl extends KeyboardControl {
|
|
|
1857
1850
|
self2._close();
|
|
1858
1851
|
}.bind(this);
|
|
1859
1852
|
});
|
|
1860
|
-
this._map.on("mousemove", (
|
|
1853
|
+
this._map.on("mousemove", (e2) => {
|
|
1861
1854
|
if (!this.flag)
|
|
1862
1855
|
return;
|
|
1863
|
-
const coords = [
|
|
1856
|
+
const coords = [e2.lngLat.lng, e2.lngLat.lat];
|
|
1864
1857
|
const len = this.jsonPoint.features.length;
|
|
1865
1858
|
if (len === 0) {
|
|
1866
1859
|
this.startEle.innerHTML = "\u70B9\u51FB\u5730\u56FE\u5F00\u59CB\u6D4B\u91CF";
|
|
@@ -1967,13 +1960,13 @@ const options$3 = {
|
|
|
1967
1960
|
}
|
|
1968
1961
|
};
|
|
1969
1962
|
class PickCoordControl extends KeyboardControl {
|
|
1970
|
-
constructor(
|
|
1963
|
+
constructor(e2) {
|
|
1971
1964
|
super();
|
|
1972
1965
|
this.name = "pick";
|
|
1973
1966
|
this.flagValue = false;
|
|
1974
1967
|
this.options = {
|
|
1975
1968
|
...options$3,
|
|
1976
|
-
...
|
|
1969
|
+
...e2
|
|
1977
1970
|
};
|
|
1978
1971
|
this.text = "\u70B9\u51FB\u67E5\u770B\u7ECF\u7EAC\u5EA6";
|
|
1979
1972
|
}
|
|
@@ -2011,8 +2004,8 @@ class PickCoordControl extends KeyboardControl {
|
|
|
2011
2004
|
this._onUnbindKeyboards();
|
|
2012
2005
|
}
|
|
2013
2006
|
_eventMeasure() {
|
|
2014
|
-
this._map.on("click", (
|
|
2015
|
-
const lngLat =
|
|
2007
|
+
this._map.on("click", (e2) => {
|
|
2008
|
+
const lngLat = e2.lngLat;
|
|
2016
2009
|
this.text = `${lngLat.lng},${lngLat.lat}`;
|
|
2017
2010
|
this._container.querySelector(`.${this.mainClass}-main`).innerHTML = this.text;
|
|
2018
2011
|
});
|
|
@@ -2077,14 +2070,14 @@ const options$2 = {
|
|
|
2077
2070
|
}
|
|
2078
2071
|
};
|
|
2079
2072
|
class MouseRectControl extends KeyboardControl {
|
|
2080
|
-
constructor(
|
|
2073
|
+
constructor(e2) {
|
|
2081
2074
|
super();
|
|
2082
2075
|
this.name = "mouseRect";
|
|
2083
2076
|
this.flagValue = false;
|
|
2084
2077
|
this.moving = false;
|
|
2085
2078
|
this.options = {
|
|
2086
2079
|
...options$2,
|
|
2087
|
-
...
|
|
2080
|
+
...e2
|
|
2088
2081
|
};
|
|
2089
2082
|
this.startLoc = [];
|
|
2090
2083
|
this.endLoc = [];
|
|
@@ -2122,10 +2115,10 @@ class MouseRectControl extends KeyboardControl {
|
|
|
2122
2115
|
this._onUnbindKeyboards();
|
|
2123
2116
|
}
|
|
2124
2117
|
_eventMeasure() {
|
|
2125
|
-
this._map.on("click", (
|
|
2118
|
+
this._map.on("click", (e2) => {
|
|
2126
2119
|
if (!this.flag || !this.moving)
|
|
2127
2120
|
return;
|
|
2128
|
-
const lngLat =
|
|
2121
|
+
const lngLat = e2.lngLat;
|
|
2129
2122
|
const newLoc = [lngLat.lng, lngLat.lat];
|
|
2130
2123
|
let isStart = false;
|
|
2131
2124
|
if (this.startLoc.length === 0) {
|
|
@@ -2141,12 +2134,12 @@ class MouseRectControl extends KeyboardControl {
|
|
|
2141
2134
|
this.options.onEnd && this.options.onEnd({ minX, minY, maxX, maxY });
|
|
2142
2135
|
}
|
|
2143
2136
|
});
|
|
2144
|
-
this._map.on("mousemove", (
|
|
2137
|
+
this._map.on("mousemove", (e2) => {
|
|
2145
2138
|
if (!this.flag || !this.moving)
|
|
2146
2139
|
return;
|
|
2147
2140
|
if (!this.startLoc || this.startLoc.length === 0)
|
|
2148
2141
|
return;
|
|
2149
|
-
const lngLat =
|
|
2142
|
+
const lngLat = e2.lngLat;
|
|
2150
2143
|
const newLoc = [lngLat.lng, lngLat.lat];
|
|
2151
2144
|
this.endLoc = newLoc;
|
|
2152
2145
|
const minX = Math.min(this.startLoc[0], this.endLoc[0]);
|
|
@@ -2168,7 +2161,7 @@ class MouseRectControl extends KeyboardControl {
|
|
|
2168
2161
|
]
|
|
2169
2162
|
}
|
|
2170
2163
|
});
|
|
2171
|
-
this.options.onMousemove && this.options.onMousemove(
|
|
2164
|
+
this.options.onMousemove && this.options.onMousemove(e2);
|
|
2172
2165
|
});
|
|
2173
2166
|
}
|
|
2174
2167
|
_open() {
|
|
@@ -2280,20 +2273,20 @@ const options$1 = {
|
|
|
2280
2273
|
}
|
|
2281
2274
|
};
|
|
2282
2275
|
class PositionControl extends KeyboardControl {
|
|
2283
|
-
constructor(
|
|
2276
|
+
constructor(e2 = {}) {
|
|
2284
2277
|
super();
|
|
2285
2278
|
this.name = "positionControl";
|
|
2286
2279
|
this.flagValue = false;
|
|
2287
2280
|
this.options = {
|
|
2288
2281
|
...options$1,
|
|
2289
|
-
...
|
|
2282
|
+
...e2,
|
|
2290
2283
|
layout: {
|
|
2291
2284
|
...options$1.layout,
|
|
2292
|
-
...
|
|
2285
|
+
...e2.layout
|
|
2293
2286
|
},
|
|
2294
2287
|
paint: {
|
|
2295
2288
|
...options$1.paint,
|
|
2296
|
-
...
|
|
2289
|
+
...e2.paint
|
|
2297
2290
|
}
|
|
2298
2291
|
};
|
|
2299
2292
|
this.value = "";
|
|
@@ -2498,20 +2491,20 @@ class PositionControl extends KeyboardControl {
|
|
|
2498
2491
|
}
|
|
2499
2492
|
const ul = this._container.querySelector("ul");
|
|
2500
2493
|
ul.innerHTML = "";
|
|
2501
|
-
for (let
|
|
2494
|
+
for (let i2 = 0; i2 < newLocs.length; i2++) {
|
|
2502
2495
|
const li = document.createElement("li");
|
|
2503
2496
|
li.className = "f-s-c h-35 c-p w-per-100 white-1";
|
|
2504
|
-
li.setAttribute("data-index",
|
|
2505
|
-
li.setAttribute("title", newLocs[
|
|
2497
|
+
li.setAttribute("data-index", i2);
|
|
2498
|
+
li.setAttribute("title", newLocs[i2].toString());
|
|
2506
2499
|
const tag = document.createElement("span");
|
|
2507
|
-
tag.innerText = `\u70B9${
|
|
2500
|
+
tag.innerText = `\u70B9${i2 + 1}`;
|
|
2508
2501
|
tag.className = "wbiokr-position-tag f-s-0 m-r-10 ease-400 p-e-none f-c";
|
|
2509
|
-
tag.setAttribute("data-index",
|
|
2502
|
+
tag.setAttribute("data-index", i2);
|
|
2510
2503
|
li.append(tag);
|
|
2511
2504
|
const span = document.createElement("span");
|
|
2512
|
-
span.innerText = newLocs[
|
|
2505
|
+
span.innerText = newLocs[i2].toString();
|
|
2513
2506
|
span.className = "wbiokr-position-loc f-1 f-s-c white-1 c-hover-app ease-300 p-e-none";
|
|
2514
|
-
span.setAttribute("data-index",
|
|
2507
|
+
span.setAttribute("data-index", i2);
|
|
2515
2508
|
li.append(span);
|
|
2516
2509
|
ul.append(li);
|
|
2517
2510
|
}
|
|
@@ -2519,7 +2512,7 @@ class PositionControl extends KeyboardControl {
|
|
|
2519
2512
|
}
|
|
2520
2513
|
_coords() {
|
|
2521
2514
|
const locs = coordListByStr(this.getterValue);
|
|
2522
|
-
const newLocs = [...new Set(locs.map((
|
|
2515
|
+
const newLocs = [...new Set(locs.map((a2) => a2.join(",")))].map((s2) => s2.split(","));
|
|
2523
2516
|
if (newLocs.length < locs.length)
|
|
2524
2517
|
this.options.onMini && this.options.onMini();
|
|
2525
2518
|
return newLocs;
|
|
@@ -2543,8 +2536,8 @@ class PositionControl extends KeyboardControl {
|
|
|
2543
2536
|
posBtn.innerText = "\u5B9A\u4F4D";
|
|
2544
2537
|
posBtn.className = "c-app o-hover-70 ease-300";
|
|
2545
2538
|
const _self = this;
|
|
2546
|
-
posBtn.onclick = function(
|
|
2547
|
-
|
|
2539
|
+
posBtn.onclick = function(e2) {
|
|
2540
|
+
e2.preventDefault();
|
|
2548
2541
|
_self._navigate();
|
|
2549
2542
|
};
|
|
2550
2543
|
div.append(posBtn);
|
|
@@ -2567,8 +2560,8 @@ class PositionControl extends KeyboardControl {
|
|
|
2567
2560
|
textarea.className = "w-per-100 h-per-100 p-10 ease-300";
|
|
2568
2561
|
textarea.placeholder = "\u591A\u4E2A\u5750\u6807\u8BF7\u4F7F\u7528\u6362\u884C\u6216\u5206\u53F7(\u82F1\u6587)\u9694\u5F00, \u652F\u6301\u5EA6\u5750\u6807\u4E0E\u79D2\u5750\u6807";
|
|
2569
2562
|
const self2 = this;
|
|
2570
|
-
textarea.onchange = function(
|
|
2571
|
-
self2.getterValue =
|
|
2563
|
+
textarea.onchange = function(e2) {
|
|
2564
|
+
self2.getterValue = e2.target.value;
|
|
2572
2565
|
};
|
|
2573
2566
|
section.append(textarea);
|
|
2574
2567
|
return section;
|
|
@@ -2577,8 +2570,8 @@ class PositionControl extends KeyboardControl {
|
|
|
2577
2570
|
const ul = document.createElement("ul");
|
|
2578
2571
|
ul.className = "d-b p-10 o-a h-max-200 ease-300";
|
|
2579
2572
|
const self2 = this;
|
|
2580
|
-
ul.onclick = function(
|
|
2581
|
-
const idx =
|
|
2573
|
+
ul.onclick = function(e2) {
|
|
2574
|
+
const idx = e2.target.getAttribute("data-index");
|
|
2582
2575
|
self2.current = idx;
|
|
2583
2576
|
};
|
|
2584
2577
|
return ul;
|
|
@@ -2822,13 +2815,13 @@ const options = {
|
|
|
2822
2815
|
}
|
|
2823
2816
|
};
|
|
2824
2817
|
class LayerTreeControl extends KeyboardControl {
|
|
2825
|
-
constructor(
|
|
2818
|
+
constructor(e2) {
|
|
2826
2819
|
super();
|
|
2827
2820
|
this.name = "layersTree";
|
|
2828
2821
|
this.flagValue = false;
|
|
2829
2822
|
this.options = {
|
|
2830
2823
|
...options,
|
|
2831
|
-
...
|
|
2824
|
+
...e2
|
|
2832
2825
|
};
|
|
2833
2826
|
this.layerData = [];
|
|
2834
2827
|
this._getterLayer = this._getterLayer.bind(this);
|
|
@@ -2840,7 +2833,7 @@ class LayerTreeControl extends KeyboardControl {
|
|
|
2840
2833
|
get allLayers() {
|
|
2841
2834
|
let layers = [];
|
|
2842
2835
|
this.layerData.forEach((o) => layers = [...layers, ...o.children]);
|
|
2843
|
-
layers.sort((
|
|
2836
|
+
layers.sort((a2, b) => a2.zIndex - b.zIndex);
|
|
2844
2837
|
return layers;
|
|
2845
2838
|
}
|
|
2846
2839
|
get flag() {
|
|
@@ -2971,7 +2964,7 @@ class LayerTreeControl extends KeyboardControl {
|
|
|
2971
2964
|
} else {
|
|
2972
2965
|
if (((_a = layer.sourceConfig.tiles) == null ? void 0 : _a.length) > 0 && !this._map.getSource(sourceId)) {
|
|
2973
2966
|
const tiles = layer.sourceConfig.tiles.map(
|
|
2974
|
-
(
|
|
2967
|
+
(s2) => s2.replace(/bbox={bbox}|BBOX={bbox}|BBOX={BBOX}|bbox={BBOX}/, "bbox={bbox-epsg-3857}")
|
|
2975
2968
|
);
|
|
2976
2969
|
const beforeId = ["raster", "background"].includes(layer.sourceConfig.type) ? this._firstFactorId() : void 0;
|
|
2977
2970
|
this._map.addSource(
|
|
@@ -3029,8 +3022,8 @@ class LayerTreeControl extends KeyboardControl {
|
|
|
3029
3022
|
const children2 = layer.children || [];
|
|
3030
3023
|
let flagCheck = false;
|
|
3031
3024
|
let flagNoCheck = false;
|
|
3032
|
-
for (let
|
|
3033
|
-
const flag = children2[
|
|
3025
|
+
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
3026
|
+
const flag = children2[i2].checked;
|
|
3034
3027
|
if (flag) {
|
|
3035
3028
|
flagCheck = true;
|
|
3036
3029
|
} else {
|
|
@@ -3043,8 +3036,8 @@ class LayerTreeControl extends KeyboardControl {
|
|
|
3043
3036
|
const children2 = layer.children || [];
|
|
3044
3037
|
if (children2.length === 0)
|
|
3045
3038
|
return layer.checked;
|
|
3046
|
-
for (let
|
|
3047
|
-
if (!children2[
|
|
3039
|
+
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
3040
|
+
if (!children2[i2].checked)
|
|
3048
3041
|
return false;
|
|
3049
3042
|
}
|
|
3050
3043
|
return true;
|
|
@@ -3129,7 +3122,7 @@ class LayerTreeControl extends KeyboardControl {
|
|
|
3129
3122
|
tag.className = "f-s-12 ";
|
|
3130
3123
|
tag.innerText = c.title;
|
|
3131
3124
|
li.append(tag);
|
|
3132
|
-
li.onclick = (
|
|
3125
|
+
li.onclick = (e2) => {
|
|
3133
3126
|
c.checked = !c.checked;
|
|
3134
3127
|
if (c.radio && c.checked) {
|
|
3135
3128
|
o.children.forEach((d, index2) => {
|
|
@@ -3169,10 +3162,4 @@ class LayerTreeControl extends KeyboardControl {
|
|
|
3169
3162
|
});
|
|
3170
3163
|
}
|
|
3171
3164
|
}
|
|
3172
|
-
|
|
3173
|
-
components.forEach((component) => app.component(component.__name, component));
|
|
3174
|
-
};
|
|
3175
|
-
const Ui = {
|
|
3176
|
-
install
|
|
3177
|
-
};
|
|
3178
|
-
export { Checkbox, LayerTreeControl, MeasureAreaControl, MeasureDistanceControl, MouseRectControl, PickCoordControl, PositionControl, copyContent, createUuid, Ui as default, mercatorToLnglat, transformRequest4326 };
|
|
3165
|
+
export { Checkbox, LayerTreeControl, MeasureAreaControl, MeasureDistanceControl, MouseRectControl, PickCoordControl, PositionControl, copyContent, createUuid, mercatorToLnglat, transformRequest4326 };
|