hy-dispatch-ui-v3 0.2.83 → 0.2.84
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/es/components/hyMap/js/index.mjs +1 -0
- package/es/utils/map/hook/bigMap.mjs +103 -124
- package/es/utils/map/hook/gaode.mjs +3 -0
- package/es/utils/map/hook/leafletjs.mjs +78 -113
- package/es/utils/map/index.mjs +4 -4
- package/es/utils/map/js/mapProxy.mjs +24 -5
- package/es/version.mjs +1 -1
- package/lib/components/hyMap/js/index.js +1 -0
- package/lib/utils/map/hook/bigMap.js +102 -123
- package/lib/utils/map/hook/gaode.js +3 -0
- package/lib/utils/map/hook/leafletjs.js +77 -112
- package/lib/utils/map/index.js +4 -4
- package/lib/utils/map/js/mapProxy.js +24 -4
- package/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import 'leaflet.motion/dist/leaflet.motion.min';
|
|
|
7
7
|
import 'leaflet.markercluster/dist/leaflet.markercluster-src.js';
|
|
8
8
|
import 'leaflet-polylinedecorator/dist/leaflet.polylineDecorator';
|
|
9
9
|
import { importCoordinate, exportCoordinate } from '../js/webgis.mjs';
|
|
10
|
-
import {
|
|
10
|
+
import { createNativeMapProxy, createWrappedHandlerStore } from '../js/mapProxy.mjs';
|
|
11
11
|
import * as esriNS from 'esri-leaflet';
|
|
12
12
|
import * as cluster from 'esri-leaflet-cluster';
|
|
13
13
|
import related from 'esri-leaflet-related/dist/esri-leaflet-related';
|
|
@@ -63,22 +63,7 @@ const generalMapMethods = {
|
|
|
63
63
|
*/
|
|
64
64
|
getBounds(target) {
|
|
65
65
|
const bounds = target.getBounds();
|
|
66
|
-
|
|
67
|
-
const northEast = bounds.getNorthEast();
|
|
68
|
-
const center = bounds.getCenter();
|
|
69
|
-
bounds.getSouthWest = () => {
|
|
70
|
-
const { lat, lng } = latAndLngCheck(southWest);
|
|
71
|
-
return L.latLng(lat, lng);
|
|
72
|
-
};
|
|
73
|
-
bounds.getNorthEast = () => {
|
|
74
|
-
const { lat, lng } = latAndLngCheck(northEast);
|
|
75
|
-
return L.latLng(lat, lng);
|
|
76
|
-
};
|
|
77
|
-
bounds.getCenter = () => {
|
|
78
|
-
const { lat, lng } = latAndLngCheck(center);
|
|
79
|
-
return L.latLng(lat, lng);
|
|
80
|
-
};
|
|
81
|
-
return bounds;
|
|
66
|
+
return L.latLngBounds(latAndLngCheck(bounds.getSouthWest()), latAndLngCheck(bounds.getNorthEast()));
|
|
82
67
|
},
|
|
83
68
|
/**
|
|
84
69
|
* 包装Map实例
|
|
@@ -86,13 +71,7 @@ const generalMapMethods = {
|
|
|
86
71
|
* @returns {Proxy} 包装后的Map
|
|
87
72
|
*/
|
|
88
73
|
getMap(map) {
|
|
89
|
-
return
|
|
90
|
-
getCenter(target) {
|
|
91
|
-
const center = target.getCenter();
|
|
92
|
-
const { lng, lat } = latAndLngCheck(center);
|
|
93
|
-
return L.latLng(lat, lng);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
74
|
+
return getInitMap(map);
|
|
96
75
|
},
|
|
97
76
|
/**
|
|
98
77
|
* 包装Bounds(导出转换)
|
|
@@ -101,22 +80,7 @@ const generalMapMethods = {
|
|
|
101
80
|
*/
|
|
102
81
|
getBoundsExport(target) {
|
|
103
82
|
const bounds = target.getBounds();
|
|
104
|
-
|
|
105
|
-
const northEast = bounds.getNorthEast();
|
|
106
|
-
const center = bounds.getCenter();
|
|
107
|
-
bounds.getSouthWest = () => {
|
|
108
|
-
const { lat, lng } = latAndLngCheckExport(southWest);
|
|
109
|
-
return L.latLng(lat, lng);
|
|
110
|
-
};
|
|
111
|
-
bounds.getNorthEast = () => {
|
|
112
|
-
const { lat, lng } = latAndLngCheckExport(northEast);
|
|
113
|
-
return L.latLng(lat, lng);
|
|
114
|
-
};
|
|
115
|
-
bounds.getCenter = () => {
|
|
116
|
-
const { lat, lng } = latAndLngCheckExport(center);
|
|
117
|
-
return L.latLng(lat, lng);
|
|
118
|
-
};
|
|
119
|
-
return bounds;
|
|
83
|
+
return L.latLngBounds(latAndLngCheckExport(bounds.getSouthWest()), latAndLngCheckExport(bounds.getNorthEast()));
|
|
120
84
|
}
|
|
121
85
|
};
|
|
122
86
|
function latAndLngCheck(item) {
|
|
@@ -136,6 +100,7 @@ function latAndLngCheckExport(item) {
|
|
|
136
100
|
function latLngListCheck(dataList = []) {
|
|
137
101
|
return dataList.map((item) => {
|
|
138
102
|
const isArray = Array.isArray(item);
|
|
103
|
+
if (isArray && (item.length === 0 || typeof item[0] === "object")) return latLngListCheck(item);
|
|
139
104
|
const { lat, lng } = latAndLngCheck(item);
|
|
140
105
|
return isArray ? [lat, lng] : { ...item, lat, lng };
|
|
141
106
|
});
|
|
@@ -143,6 +108,7 @@ function latLngListCheck(dataList = []) {
|
|
|
143
108
|
function latLngListCheckExport(dataList = []) {
|
|
144
109
|
return dataList.map((item) => {
|
|
145
110
|
const isArray = Array.isArray(item);
|
|
111
|
+
if (isArray && (item.length === 0 || typeof item[0] === "object")) return latLngListCheckExport(item);
|
|
146
112
|
const { lat, lng } = latAndLngCheckExport(item);
|
|
147
113
|
return isArray ? [lat, lng] : { ...item, lat, lng };
|
|
148
114
|
});
|
|
@@ -159,32 +125,15 @@ function circleToPolygonPoints(center, radius, asObject = false) {
|
|
|
159
125
|
return points;
|
|
160
126
|
}
|
|
161
127
|
function wrapDrawLayer(layer) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const item = JSON.parse(JSON.stringify(latLngList[0]));
|
|
172
|
-
return [latLngListCheckExport([...item])];
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
layer.getBounds = () => {
|
|
176
|
-
const southWest = bounds.getSouthWest();
|
|
177
|
-
const northEast = bounds.getNorthEast();
|
|
178
|
-
bounds.getSouthWest = () => {
|
|
179
|
-
const { lat, lng } = latAndLngCheckExport(southWest);
|
|
180
|
-
return L.latLng(lat, lng);
|
|
181
|
-
};
|
|
182
|
-
bounds.getNorthEast = () => {
|
|
183
|
-
const { lat, lng } = latAndLngCheckExport(northEast);
|
|
184
|
-
return L.latLng(lat, lng);
|
|
185
|
-
};
|
|
186
|
-
return bounds;
|
|
187
|
-
};
|
|
128
|
+
return createNativeMapProxy(layer, {
|
|
129
|
+
getLatLngs: function(target) {
|
|
130
|
+
const points = target.getLatLngs ? target.getLatLngs() : [circleToPolygonPoints(target.getLatLng(), target.getRadius() / 1e3, true)];
|
|
131
|
+
return latLngListCheckExport(points);
|
|
132
|
+
},
|
|
133
|
+
getBounds: function(target) {
|
|
134
|
+
return generalMapMethods.getBoundsExport(target);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
188
137
|
}
|
|
189
138
|
function createClickHandler(fn, context, target, withOriginEvent = false) {
|
|
190
139
|
return (e) => {
|
|
@@ -276,14 +225,15 @@ class Leafletjs extends EventEmitter {
|
|
|
276
225
|
return generalMapMethods.getBoundsExport(target);
|
|
277
226
|
},
|
|
278
227
|
getLatLngs: function(target) {
|
|
279
|
-
|
|
280
|
-
const item = JSON.parse(JSON.stringify(latLngList[0]));
|
|
281
|
-
return [latLngListCheckExport([...item])];
|
|
228
|
+
return latLngListCheckExport(target.getLatLngs());
|
|
282
229
|
},
|
|
283
230
|
// 修改位置
|
|
284
231
|
setLatLngs: function(target, lngLatList = []) {
|
|
285
232
|
return target.setLatLngs(latLngListCheck(lngLatList));
|
|
286
233
|
},
|
|
234
|
+
addLatLng: function(target, point) {
|
|
235
|
+
return target.addLatLng(latAndLngCheck(point));
|
|
236
|
+
},
|
|
287
237
|
on: function(target, types, fn, context) {
|
|
288
238
|
if (types === "click") {
|
|
289
239
|
const customClickHandler = createClickHandler(fn, context, target);
|
|
@@ -297,7 +247,7 @@ class Leafletjs extends EventEmitter {
|
|
|
297
247
|
return target.off(types, wrappedFn || fn, context);
|
|
298
248
|
}
|
|
299
249
|
};
|
|
300
|
-
return
|
|
250
|
+
return createNativeMapProxy(polygon, handlers);
|
|
301
251
|
});
|
|
302
252
|
this.initParams = request;
|
|
303
253
|
this.tileLayerList = [];
|
|
@@ -330,16 +280,23 @@ class Leafletjs extends EventEmitter {
|
|
|
330
280
|
wrappedHandlers.clear();
|
|
331
281
|
}
|
|
332
282
|
},
|
|
333
|
-
fitBounds: function(target, params) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
283
|
+
fitBounds: function(target, params, options) {
|
|
284
|
+
const bounds = L.latLngBounds();
|
|
285
|
+
const extendBounds = (item) => {
|
|
286
|
+
if (item?.getBounds) {
|
|
287
|
+
const layer = item.getInitLayer ? item.getInitLayer() : item;
|
|
288
|
+
bounds.extend(layer.getBounds());
|
|
289
|
+
} else if (item?.getSouthWest) {
|
|
290
|
+
bounds.extend(latAndLngCheck(item.getSouthWest()));
|
|
291
|
+
bounds.extend(latAndLngCheck(item.getNorthEast()));
|
|
292
|
+
} else if (Array.isArray(item) && (item.length === 0 || typeof item[0] === "object")) {
|
|
293
|
+
item.forEach(extendBounds);
|
|
294
|
+
} else {
|
|
295
|
+
bounds.extend(latAndLngCheck(item));
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
extendBounds(params);
|
|
299
|
+
return target.fitBounds(bounds, options);
|
|
343
300
|
},
|
|
344
301
|
// 获取中心点
|
|
345
302
|
getCenter: function(target) {
|
|
@@ -353,18 +310,7 @@ class Leafletjs extends EventEmitter {
|
|
|
353
310
|
},
|
|
354
311
|
// 四个角
|
|
355
312
|
getBounds: function(target) {
|
|
356
|
-
|
|
357
|
-
const southWest = bounds.getSouthWest();
|
|
358
|
-
const northEast = bounds.getNorthEast();
|
|
359
|
-
bounds.getSouthWest = () => {
|
|
360
|
-
const { lat: lat2, lng: lng2 } = latAndLngCheckExport(southWest);
|
|
361
|
-
return L.latLng(lat2, lng2);
|
|
362
|
-
};
|
|
363
|
-
bounds.getNorthEast = () => {
|
|
364
|
-
const { lat: lat2, lng: lng2 } = latAndLngCheckExport(northEast);
|
|
365
|
-
return L.latLng(lat2, lng2);
|
|
366
|
-
};
|
|
367
|
-
return bounds;
|
|
313
|
+
return generalMapMethods.getBoundsExport(target);
|
|
368
314
|
},
|
|
369
315
|
// 移动至目标位置
|
|
370
316
|
panTo: function(target, center2, options) {
|
|
@@ -385,7 +331,7 @@ class Leafletjs extends EventEmitter {
|
|
|
385
331
|
} else if (types === "pm:create") {
|
|
386
332
|
const customClickHandler = (e) => {
|
|
387
333
|
const newEvent = { ...e };
|
|
388
|
-
wrapDrawLayer(newEvent.layer);
|
|
334
|
+
newEvent.layer = wrapDrawLayer(newEvent.layer);
|
|
389
335
|
fn.call(context || target, newEvent);
|
|
390
336
|
};
|
|
391
337
|
wrappedHandlers.remember(types, fn, customClickHandler);
|
|
@@ -402,7 +348,7 @@ class Leafletjs extends EventEmitter {
|
|
|
402
348
|
_this.setLayersUrl(target, satelliteMap !== 2);
|
|
403
349
|
}
|
|
404
350
|
};
|
|
405
|
-
const map =
|
|
351
|
+
const map = createNativeMapProxy(newMap, handlers);
|
|
406
352
|
map.id = createUniqueId();
|
|
407
353
|
map.whenReady(() => {
|
|
408
354
|
if (option.completeCallbacks) {
|
|
@@ -549,16 +495,16 @@ class Leafletjs extends EventEmitter {
|
|
|
549
495
|
}
|
|
550
496
|
// 地图图层
|
|
551
497
|
layerGroup(map, markers = []) {
|
|
552
|
-
const layerGroup = L.layerGroup(markers).addTo(getInitMap(map));
|
|
498
|
+
const layerGroup = L.layerGroup(markers.map((item) => item.getInitLayer?.() || item)).addTo(getInitMap(map));
|
|
553
499
|
const handlers = {
|
|
554
500
|
addLayer: function(target, addItem) {
|
|
555
|
-
return target.addLayer(addItem);
|
|
501
|
+
return target.addLayer(addItem.getInitLayer?.() || addItem);
|
|
556
502
|
},
|
|
557
503
|
clearLayers: function(target) {
|
|
558
504
|
return target.clearLayers();
|
|
559
505
|
}
|
|
560
506
|
};
|
|
561
|
-
return
|
|
507
|
+
return createNativeMapProxy(layerGroup, handlers);
|
|
562
508
|
}
|
|
563
509
|
// 获取esri对象
|
|
564
510
|
esriFn() {
|
|
@@ -629,7 +575,7 @@ class Leafletjs extends EventEmitter {
|
|
|
629
575
|
// 更改标记位置。
|
|
630
576
|
setLatLng: function(target, lngAndLat) {
|
|
631
577
|
const { lat, lng } = latAndLngCheck(lngAndLat);
|
|
632
|
-
target.setLatLng([lat, lng]);
|
|
578
|
+
return target.setLatLng([lat, lng]);
|
|
633
579
|
},
|
|
634
580
|
setIcon: function(target, iconParams) {
|
|
635
581
|
target.setIcon(iconParams.divIcon);
|
|
@@ -647,7 +593,7 @@ class Leafletjs extends EventEmitter {
|
|
|
647
593
|
return target.off(types, wrappedFn || fn, context);
|
|
648
594
|
}
|
|
649
595
|
};
|
|
650
|
-
const markerProxy =
|
|
596
|
+
const markerProxy = createNativeMapProxy(marker, handlers);
|
|
651
597
|
marker._proxy = markerProxy;
|
|
652
598
|
return markerProxy;
|
|
653
599
|
}
|
|
@@ -683,6 +629,9 @@ class Leafletjs extends EventEmitter {
|
|
|
683
629
|
addLayers: function(target, markerList2 = []) {
|
|
684
630
|
target.addLayers(toNativeMarkers(markerList2, target));
|
|
685
631
|
},
|
|
632
|
+
clearLayers: function(target) {
|
|
633
|
+
target.clearLayers();
|
|
634
|
+
},
|
|
686
635
|
// 销毁聚合内所有 marker 并清空图层
|
|
687
636
|
destroyAll: function(target) {
|
|
688
637
|
target.getLayers().forEach((layer) => {
|
|
@@ -696,7 +645,7 @@ class Leafletjs extends EventEmitter {
|
|
|
696
645
|
target.clearLayers();
|
|
697
646
|
}
|
|
698
647
|
};
|
|
699
|
-
const newDisplayCluster =
|
|
648
|
+
const newDisplayCluster = createNativeMapProxy(displayCluster, handlers);
|
|
700
649
|
newDisplayCluster.addLayers(markerList);
|
|
701
650
|
return newDisplayCluster;
|
|
702
651
|
}
|
|
@@ -715,6 +664,12 @@ class Leafletjs extends EventEmitter {
|
|
|
715
664
|
latLngList = [lat, lng];
|
|
716
665
|
const circle = L.circle(latLngList, option);
|
|
717
666
|
const handlers = {
|
|
667
|
+
getLatLng: function(target) {
|
|
668
|
+
return L.latLng(latAndLngCheckExport(target.getLatLng()));
|
|
669
|
+
},
|
|
670
|
+
setLatLng: function(target, point) {
|
|
671
|
+
return target.setLatLng(latAndLngCheck(point));
|
|
672
|
+
},
|
|
718
673
|
addTo: function(target, map) {
|
|
719
674
|
return target.addTo(generalMapMethods.getMap(map));
|
|
720
675
|
},
|
|
@@ -728,7 +683,7 @@ class Leafletjs extends EventEmitter {
|
|
|
728
683
|
return [latLngListCheckExport(points)];
|
|
729
684
|
}
|
|
730
685
|
};
|
|
731
|
-
return
|
|
686
|
+
return createNativeMapProxy(circle, handlers);
|
|
732
687
|
}
|
|
733
688
|
// 自定义 popup
|
|
734
689
|
Popup(option) {
|
|
@@ -738,6 +693,10 @@ class Leafletjs extends EventEmitter {
|
|
|
738
693
|
};
|
|
739
694
|
const popup = L.popup(option);
|
|
740
695
|
const handlers = {
|
|
696
|
+
getLatLng: function(target) {
|
|
697
|
+
const point = target.getLatLng();
|
|
698
|
+
return point ? L.latLng(latAndLngCheckExport(point)) : point;
|
|
699
|
+
},
|
|
741
700
|
addTo: function(target, map) {
|
|
742
701
|
return target.addTo(generalMapMethods.getMap(map));
|
|
743
702
|
},
|
|
@@ -762,7 +721,7 @@ class Leafletjs extends EventEmitter {
|
|
|
762
721
|
return target.setLatLng(latLngList);
|
|
763
722
|
}
|
|
764
723
|
};
|
|
765
|
-
return
|
|
724
|
+
return createNativeMapProxy(popup, handlers);
|
|
766
725
|
}
|
|
767
726
|
// 自定义 线条
|
|
768
727
|
Polyline(latLngList = [], option = {}) {
|
|
@@ -772,6 +731,9 @@ class Leafletjs extends EventEmitter {
|
|
|
772
731
|
const polyline = L.polyline(latLngList, option);
|
|
773
732
|
const wrappedHandlers = createWrappedHandlerStore();
|
|
774
733
|
const handlers = {
|
|
734
|
+
getLatLngs: function(target) {
|
|
735
|
+
return latLngListCheckExport(target.getLatLngs());
|
|
736
|
+
},
|
|
775
737
|
addTo: function(target, map) {
|
|
776
738
|
return target.addTo(generalMapMethods.getMap(map));
|
|
777
739
|
},
|
|
@@ -800,22 +762,25 @@ class Leafletjs extends EventEmitter {
|
|
|
800
762
|
return target.off(types, wrappedFn || fn, context);
|
|
801
763
|
}
|
|
802
764
|
};
|
|
803
|
-
return
|
|
765
|
+
return createNativeMapProxy(polyline, handlers);
|
|
804
766
|
}
|
|
805
767
|
MotionPolyline(latLngList = [], option = {}, motionOption = {}, markerOption = {}) {
|
|
806
768
|
if (latLngList && latLngList.length !== 0) {
|
|
807
769
|
latLngList = latLngListCheck(latLngList);
|
|
808
770
|
}
|
|
809
771
|
const polyline = L.motion.polyline(latLngList, option, motionOption, markerOption);
|
|
810
|
-
return
|
|
772
|
+
return createNativeMapProxy(polyline, {
|
|
811
773
|
addTo: function(target, map) {
|
|
812
774
|
return target.addTo(generalMapMethods.getMap(map));
|
|
813
775
|
}
|
|
814
776
|
});
|
|
815
777
|
}
|
|
816
778
|
motionSeq(motion, options) {
|
|
817
|
-
const seq = L.motion.seq(
|
|
818
|
-
|
|
779
|
+
const seq = L.motion.seq(
|
|
780
|
+
motion.map((item) => item.getInitLayer?.() || item),
|
|
781
|
+
options
|
|
782
|
+
);
|
|
783
|
+
return createNativeMapProxy(seq, {
|
|
819
784
|
addTo: function(target, map) {
|
|
820
785
|
return target.addTo(generalMapMethods.getMap(map));
|
|
821
786
|
}
|
|
@@ -898,7 +863,7 @@ class Leafletjs extends EventEmitter {
|
|
|
898
863
|
trackPolyline = null;
|
|
899
864
|
}
|
|
900
865
|
};
|
|
901
|
-
return
|
|
866
|
+
return createNativeMapProxy(marker, handlers);
|
|
902
867
|
}
|
|
903
868
|
// 创建绘画工具 rectangle 正方形 circle 圆形 polygon 多边形
|
|
904
869
|
CreatePm(pmType = "rectangle", options = {}, map) {
|
|
@@ -924,7 +889,7 @@ class Leafletjs extends EventEmitter {
|
|
|
924
889
|
map.on("pm:create", (e) => {
|
|
925
890
|
layer = e.layer;
|
|
926
891
|
if (options.onChange) {
|
|
927
|
-
const pointsList =
|
|
892
|
+
const pointsList = layer.getLatLngs()[0];
|
|
928
893
|
options.onChange(pointsList);
|
|
929
894
|
}
|
|
930
895
|
});
|
|
@@ -942,7 +907,7 @@ class Leafletjs extends EventEmitter {
|
|
|
942
907
|
enableDraw(toolType);
|
|
943
908
|
}
|
|
944
909
|
};
|
|
945
|
-
return
|
|
910
|
+
return createNativeMapProxy({}, handlers);
|
|
946
911
|
}
|
|
947
912
|
// 电子围栏
|
|
948
913
|
CreateFence(pmType = "rectangle", options = {}, map) {
|
|
@@ -970,7 +935,7 @@ class Leafletjs extends EventEmitter {
|
|
|
970
935
|
pm.close();
|
|
971
936
|
};
|
|
972
937
|
const onChange = (pointList) => {
|
|
973
|
-
setPolygon(
|
|
938
|
+
setPolygon(pointList);
|
|
974
939
|
};
|
|
975
940
|
const pm = this.CreatePm(
|
|
976
941
|
pmType,
|
|
@@ -990,7 +955,7 @@ class Leafletjs extends EventEmitter {
|
|
|
990
955
|
setPolygon(circleToPolygonPoints(lnglat, radius / 2e3));
|
|
991
956
|
},
|
|
992
957
|
setPolygon: function(target, pointList) {
|
|
993
|
-
setPolygon(
|
|
958
|
+
setPolygon(pointList);
|
|
994
959
|
},
|
|
995
960
|
startDraw: function(target, toolType = "rectangle") {
|
|
996
961
|
clearPolygon();
|
|
@@ -1011,7 +976,7 @@ class Leafletjs extends EventEmitter {
|
|
|
1011
976
|
target.setMouseTool(toolType);
|
|
1012
977
|
}
|
|
1013
978
|
};
|
|
1014
|
-
return
|
|
979
|
+
return createNativeMapProxy(pm, handlers);
|
|
1015
980
|
}
|
|
1016
981
|
// 测距工具 labelColor labelFillColor lineColor
|
|
1017
982
|
RangingTool(options = {}, map) {
|
|
@@ -1304,7 +1269,7 @@ class Leafletjs extends EventEmitter {
|
|
|
1304
1269
|
rangingPointsEnd = null;
|
|
1305
1270
|
}
|
|
1306
1271
|
};
|
|
1307
|
-
return
|
|
1272
|
+
return createNativeMapProxy({}, handlers);
|
|
1308
1273
|
}
|
|
1309
1274
|
}
|
|
1310
1275
|
|
package/es/utils/map/index.mjs
CHANGED
|
@@ -86,11 +86,11 @@ function setMapServer(mapType, mapConfig = {}) {
|
|
|
86
86
|
return promise;
|
|
87
87
|
}
|
|
88
88
|
function setPoiServer(mapConfig) {
|
|
89
|
-
const data = mapConfig;
|
|
90
|
-
data.mapCoordinate = typeof data.bmCorrect === "number" ? data.bmCorrect :
|
|
89
|
+
const data = { ...mapConfig };
|
|
90
|
+
data.mapCoordinate = data.mapCoordinate ?? (typeof data.bmCorrect === "number" ? data.bmCorrect : void 0);
|
|
91
91
|
data.serverCoordinate = 1;
|
|
92
|
-
data.projectCoordinate = 1;
|
|
93
|
-
data.projectPoiCoordinate =
|
|
92
|
+
data.projectCoordinate = data.projectCoordinate ?? 1;
|
|
93
|
+
data.projectPoiCoordinate = data.projectPoiCoordinate ?? data.projectCoordinate;
|
|
94
94
|
data.poiServer = data.poiServer || {};
|
|
95
95
|
let city = data.poiServer.city || "";
|
|
96
96
|
city = city.split("-");
|
|
@@ -1,17 +1,36 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const nativeTargets = /* @__PURE__ */ new WeakMap();
|
|
2
|
+
const rawGetters = /* @__PURE__ */ new Set(["getInitMap", "getRawMap", "getInitMarker", "getInitLayer"]);
|
|
3
|
+
const unwrapNative = (value) => {
|
|
4
|
+
if (Array.isArray(value)) return value.map(unwrapNative);
|
|
5
|
+
while (value && nativeTargets.has(value)) value = nativeTargets.get(value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
8
|
+
const createMapProxy = (target, handlers = {}, nativeMethods = false) => {
|
|
9
|
+
const proxy = new Proxy(target, {
|
|
3
10
|
get(_target, prop) {
|
|
11
|
+
if (nativeMethods && prop === "getInitLayer") return () => unwrapNative(_target);
|
|
4
12
|
if (handlers[prop]) {
|
|
5
|
-
return (...args) =>
|
|
13
|
+
return (...args) => {
|
|
14
|
+
const result = handlers[prop](_target, ...args);
|
|
15
|
+
return nativeMethods && result === _target && !rawGetters.has(prop) ? proxy : result;
|
|
16
|
+
};
|
|
6
17
|
}
|
|
7
|
-
|
|
18
|
+
const value = _target[prop];
|
|
19
|
+
if (!nativeMethods || typeof value !== "function") return value;
|
|
20
|
+
return (...args) => {
|
|
21
|
+
const result = value.apply(_target, args.map(unwrapNative));
|
|
22
|
+
return result === _target && !rawGetters.has(prop) ? proxy : result;
|
|
23
|
+
};
|
|
8
24
|
},
|
|
9
25
|
set(_target, prop, value) {
|
|
10
26
|
if (prop === "_proxy") return true;
|
|
11
27
|
return Reflect.set(_target, prop, value);
|
|
12
28
|
}
|
|
13
29
|
});
|
|
30
|
+
if (nativeMethods) nativeTargets.set(proxy, target);
|
|
31
|
+
return proxy;
|
|
14
32
|
};
|
|
33
|
+
const createNativeMapProxy = (target, handlers = {}) => createMapProxy(target, handlers, true);
|
|
15
34
|
const createWrappedHandlerStore = () => {
|
|
16
35
|
const wrappedHandlerMap = /* @__PURE__ */ new Map();
|
|
17
36
|
return {
|
|
@@ -35,4 +54,4 @@ const createWrappedHandlerStore = () => {
|
|
|
35
54
|
};
|
|
36
55
|
};
|
|
37
56
|
|
|
38
|
-
export { createMapProxy, createWrappedHandlerStore, createMapProxy as default };
|
|
57
|
+
export { createMapProxy, createNativeMapProxy, createWrappedHandlerStore, createMapProxy as default };
|
package/es/version.mjs
CHANGED
|
@@ -145,6 +145,7 @@ const useAppMapWrapper = (hy) => {
|
|
|
145
145
|
maxZoom: mapConfig.maxZoom || 18,
|
|
146
146
|
center: { lat: userInfo?.lat || 22.553681, lng: userInfo?.lng || 113.931936 },
|
|
147
147
|
zoom: mapConfig.zoom || 14,
|
|
148
|
+
satelliteMap: mapConfig.satelliteMap,
|
|
148
149
|
completeCallbacks: () => {
|
|
149
150
|
vue.nextTick(() => {
|
|
150
151
|
emits("complete", hy.hyMap.value, hy.map.value);
|