@heycar/heycars-map 0.9.8-fix2 → 0.9.8-memory
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/index.cjs +417 -44
- package/dist/index.js +417 -44
- package/dist/src/Demo/DemoBusinessTaxiService.d.ts +805 -560
- package/dist/src/business-components/FitView/FitView.d.ts +4 -1
- package/dist/src/business-components/PassengerCircle/PassengerCircle.d.ts +825 -825
- package/dist/src/business-components/StartEndPoint/StartEndPoint.d.ts +825 -825
- package/dist/src/business-components/TaxiCar/TaxiCar.d.ts +825 -825
- package/dist/src/components/Amap/Amap.d.ts +8 -7
- package/dist/src/components/Amap/SafeAmap.d.ts +103 -0
- package/dist/src/components/MapProvider/MapProvider.d.ts +2 -1
- package/dist/src/hooks/useHeycarMap.d.ts +5 -1585
- package/dist/src/hooks/useMap.d.ts +4 -794
- package/dist/src/hooks/useMapAngle.d.ts +3 -3
- package/dist/src/hooks/useMapDrag.d.ts +3 -3
- package/dist/src/hooks/useMapFitView.d.ts +108 -108
- package/dist/src/hooks/useMapLngLatToVw.d.ts +3 -3
- package/dist/src/hooks/useMapWheelZoomCenter.d.ts +3 -2
- package/dist/src/hooks/useMapZoom.d.ts +3 -2
- package/dist/src/hooks-business/useBusinessQuotingMap.d.ts +806 -561
- package/dist/src/hooks-business/useBusinessTaxiServiceMap.d.ts +806 -561
- package/dist/src/types/interface.d.ts +4 -2
- package/dist/src/utils/referenceCount.d.ts +8 -0
- package/package.json +1 -1
- package/todo.md +11 -0
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7
7
|
import Vue, { defineComponent, h, computed, inject, provide, watch, onMounted, onUnmounted, watchPostEffect, shallowRef, ref, watchEffect, reactive, toRefs, toRef } from "vue";
|
|
8
8
|
const style_css_ts_vanilla = "";
|
|
9
9
|
const name = "@heycar/heycars-map";
|
|
10
|
-
const version = "0.9.8-
|
|
10
|
+
const version = "0.9.8-memory";
|
|
11
11
|
const type = "module";
|
|
12
12
|
const bin = {
|
|
13
13
|
checkVersion: "./bin/checkVersion.js"
|
|
@@ -1216,7 +1216,7 @@ const pipeDefer = (fn) => (...args) => {
|
|
|
1216
1216
|
setTimeout(() => {
|
|
1217
1217
|
const result = fn == null ? void 0 : fn(...args);
|
|
1218
1218
|
resolve(result);
|
|
1219
|
-
},
|
|
1219
|
+
}, 50);
|
|
1220
1220
|
});
|
|
1221
1221
|
};
|
|
1222
1222
|
const pipeOnlyLastEffect = (fn) => {
|
|
@@ -1385,14 +1385,13 @@ function watchPostEffectForMapProperty(targetRef, props, nameOptions, watchOptio
|
|
|
1385
1385
|
watch(
|
|
1386
1386
|
deps,
|
|
1387
1387
|
(values, prevValues) => {
|
|
1388
|
-
|
|
1389
|
-
if (!target)
|
|
1388
|
+
if (!targetRef.value)
|
|
1390
1389
|
return;
|
|
1391
1390
|
for (const [idx, value] of values.entries()) {
|
|
1392
1391
|
const { name: name2, defaultValue } = nameOptions[idx];
|
|
1393
1392
|
const prev = prevValues[idx];
|
|
1394
1393
|
if (!deepCompareEqualsForMaps(value, prev)) {
|
|
1395
|
-
|
|
1394
|
+
targetRef.value[name2setterName(name2)](value != null ? value : defaultValue);
|
|
1396
1395
|
}
|
|
1397
1396
|
}
|
|
1398
1397
|
},
|
|
@@ -1411,16 +1410,18 @@ function watchNoneImmediatePostEffectForMapProperty(targetRef, props, nameOption
|
|
|
1411
1410
|
}
|
|
1412
1411
|
function watchPostEffectForAMapEvent(targetRef, props, emit, propertyNames) {
|
|
1413
1412
|
watchPostEffect((onCleanup) => {
|
|
1414
|
-
|
|
1415
|
-
if (!target)
|
|
1413
|
+
if (!(targetRef == null ? void 0 : targetRef.value))
|
|
1416
1414
|
return;
|
|
1417
1415
|
const cleanList = [];
|
|
1418
1416
|
for (const name2 of propertyNames) {
|
|
1419
1417
|
const emitEventName = property2emitEventName(name2);
|
|
1420
1418
|
const eventName = property2mapEventName(name2);
|
|
1421
1419
|
const handler = (e) => emit(emitEventName, e);
|
|
1422
|
-
|
|
1423
|
-
cleanList.push(() =>
|
|
1420
|
+
targetRef == null ? void 0 : targetRef.value.on(eventName, handler);
|
|
1421
|
+
cleanList.push(() => {
|
|
1422
|
+
var _a;
|
|
1423
|
+
return (_a = targetRef == null ? void 0 : targetRef.value) == null ? void 0 : _a.off(eventName, handler);
|
|
1424
|
+
});
|
|
1424
1425
|
}
|
|
1425
1426
|
onCleanup(() => {
|
|
1426
1427
|
for (const clean of cleanList)
|
|
@@ -1450,24 +1451,49 @@ function watchPostEffectForGMapEvent(targetRef, props, emit, propertyNames) {
|
|
|
1450
1451
|
const watchPostEffectOnce = (callback) => {
|
|
1451
1452
|
watch(() => 0, callback, { immediate: true, flush: "post" });
|
|
1452
1453
|
};
|
|
1454
|
+
class ReferenceCount {
|
|
1455
|
+
constructor() {
|
|
1456
|
+
__publicField(this, "count", 0);
|
|
1457
|
+
}
|
|
1458
|
+
log() {
|
|
1459
|
+
console.log(`ReferenceCount count = ${this.count}`);
|
|
1460
|
+
}
|
|
1461
|
+
add() {
|
|
1462
|
+
this.count += 1;
|
|
1463
|
+
this.log();
|
|
1464
|
+
}
|
|
1465
|
+
remove() {
|
|
1466
|
+
this.count -= 1;
|
|
1467
|
+
this.log();
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
const referenceCount = new ReferenceCount();
|
|
1453
1471
|
const AmapMarker = defineSetup(function AmapMarker2(props, { emit }) {
|
|
1454
1472
|
const { registerOverlay } = props;
|
|
1455
1473
|
const markerRef = shallowRef();
|
|
1456
1474
|
const mapRef = useAmap();
|
|
1457
1475
|
onMounted(() => {
|
|
1476
|
+
referenceCount.add();
|
|
1458
1477
|
markerRef.value = new AMap.Marker({ ...props });
|
|
1459
1478
|
});
|
|
1460
1479
|
onUnmounted(() => {
|
|
1461
|
-
var _a;
|
|
1480
|
+
var _a, _b;
|
|
1481
|
+
referenceCount.remove();
|
|
1462
1482
|
(_a = markerRef.value) == null ? void 0 : _a.setMap(null);
|
|
1483
|
+
(_b = markerRef.value) == null ? void 0 : _b.destroy();
|
|
1484
|
+
markerRef.value = void 0;
|
|
1463
1485
|
});
|
|
1464
1486
|
useMapOverlay({ registerOverlay, overlayRef: markerRef });
|
|
1465
|
-
watchPostEffect(() => {
|
|
1487
|
+
watchPostEffect((onCleanup) => {
|
|
1466
1488
|
var _a;
|
|
1467
1489
|
const map = mapRef == null ? void 0 : mapRef.value;
|
|
1468
|
-
if (!map)
|
|
1490
|
+
if (!(map == null ? void 0 : map.amap))
|
|
1469
1491
|
return;
|
|
1470
|
-
(_a = markerRef.value) == null ? void 0 : _a.setMap(map);
|
|
1492
|
+
(_a = markerRef.value) == null ? void 0 : _a.setMap(map.amap);
|
|
1493
|
+
onCleanup(() => {
|
|
1494
|
+
var _a2;
|
|
1495
|
+
return (_a2 = markerRef.value) == null ? void 0 : _a2.setMap(null);
|
|
1496
|
+
});
|
|
1471
1497
|
});
|
|
1472
1498
|
watchNoneImmediatePostEffectForMapProperty(markerRef, props, [
|
|
1473
1499
|
{ name: "anchor", defaultValue: "" },
|
|
@@ -2315,6 +2341,8 @@ function detectWebGL() {
|
|
|
2315
2341
|
const useAmapLngLatToVw = (props) => {
|
|
2316
2342
|
const apiMapLngLatToVw = (point) => {
|
|
2317
2343
|
const amap2 = props.mapRef.value;
|
|
2344
|
+
if (!(amap2 == null ? void 0 : amap2.amap))
|
|
2345
|
+
return [0, 0];
|
|
2318
2346
|
const sw = innerWidth;
|
|
2319
2347
|
const [x, y] = amap2 == null ? void 0 : amap2.lngLatToContainer(point).toArray();
|
|
2320
2348
|
return [100 * x / sw, 100 * y / sw];
|
|
@@ -2379,6 +2407,316 @@ const useAmapWheelZoomCenter = (props) => {
|
|
|
2379
2407
|
};
|
|
2380
2408
|
const Amap_css_ts_vanilla = "";
|
|
2381
2409
|
var amap = "_1d8ur7t0";
|
|
2410
|
+
class SafeAmap {
|
|
2411
|
+
constructor(elm, options) {
|
|
2412
|
+
__publicField(this, "containerElm");
|
|
2413
|
+
__publicField(this, "amap");
|
|
2414
|
+
this.containerElm = document.createElement("div");
|
|
2415
|
+
this.containerElm.style.position = "absolute";
|
|
2416
|
+
this.containerElm.style.top = "0";
|
|
2417
|
+
this.containerElm.style.left = "0";
|
|
2418
|
+
this.containerElm.style.right = "0";
|
|
2419
|
+
this.containerElm.style.bottom = "0";
|
|
2420
|
+
elm.appendChild(this.containerElm);
|
|
2421
|
+
this.amap = new AMap.Map(this.containerElm, options);
|
|
2422
|
+
}
|
|
2423
|
+
destroy() {
|
|
2424
|
+
var _a, _b, _c;
|
|
2425
|
+
(_b = (_a = this.containerElm) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(this.containerElm);
|
|
2426
|
+
(_c = this.amap) == null ? void 0 : _c.destroy();
|
|
2427
|
+
this.containerElm = void 0;
|
|
2428
|
+
this.amap = void 0;
|
|
2429
|
+
}
|
|
2430
|
+
getContainer() {
|
|
2431
|
+
var _a;
|
|
2432
|
+
return (_a = this.containerElm) == null ? void 0 : _a.parentElement;
|
|
2433
|
+
}
|
|
2434
|
+
setCenter(center, immediately, duration) {
|
|
2435
|
+
var _a;
|
|
2436
|
+
return (_a = this.amap) == null ? void 0 : _a.setCenter(center, immediately, duration);
|
|
2437
|
+
}
|
|
2438
|
+
getStyleByUserId(id, zoom) {
|
|
2439
|
+
var _a;
|
|
2440
|
+
return (_a = this.amap) == null ? void 0 : _a.getStyleByUserId(id, zoom);
|
|
2441
|
+
}
|
|
2442
|
+
getCustomTypeByContainerPos(lnglat) {
|
|
2443
|
+
var _a;
|
|
2444
|
+
return (_a = this.amap) == null ? void 0 : _a.getCustomTypeByContainerPos(lnglat);
|
|
2445
|
+
}
|
|
2446
|
+
getScreenShot(width, height) {
|
|
2447
|
+
var _a;
|
|
2448
|
+
return (_a = this.amap) == null ? void 0 : _a.getScreenShot(width, height);
|
|
2449
|
+
}
|
|
2450
|
+
setZoomAndCenter(zoom, center, immediately, duration) {
|
|
2451
|
+
var _a;
|
|
2452
|
+
(_a = this.amap) == null ? void 0 : _a.setZoomAndCenter(zoom, center, immediately, duration);
|
|
2453
|
+
}
|
|
2454
|
+
getBounds() {
|
|
2455
|
+
var _a;
|
|
2456
|
+
return (_a = this.amap) == null ? void 0 : _a.getBounds();
|
|
2457
|
+
}
|
|
2458
|
+
getCenter() {
|
|
2459
|
+
var _a;
|
|
2460
|
+
return (_a = this.amap) == null ? void 0 : _a.getCenter();
|
|
2461
|
+
}
|
|
2462
|
+
getGraphicInfo() {
|
|
2463
|
+
var _a;
|
|
2464
|
+
return (_a = this.amap) == null ? void 0 : _a.getGraphicInfo();
|
|
2465
|
+
}
|
|
2466
|
+
setZoom(zoom, immediately, duration) {
|
|
2467
|
+
var _a;
|
|
2468
|
+
(_a = this.amap) == null ? void 0 : _a.setZoom(zoom, immediately, duration);
|
|
2469
|
+
}
|
|
2470
|
+
getZoom(digits) {
|
|
2471
|
+
var _a;
|
|
2472
|
+
return (_a = this.amap) == null ? void 0 : _a.getZoom(digits);
|
|
2473
|
+
}
|
|
2474
|
+
zoomIn() {
|
|
2475
|
+
var _a;
|
|
2476
|
+
(_a = this.amap) == null ? void 0 : _a.zoomIn();
|
|
2477
|
+
}
|
|
2478
|
+
zoomOut() {
|
|
2479
|
+
var _a;
|
|
2480
|
+
(_a = this.amap) == null ? void 0 : _a.zoomOut();
|
|
2481
|
+
}
|
|
2482
|
+
getPitch() {
|
|
2483
|
+
var _a;
|
|
2484
|
+
return (_a = this.amap) == null ? void 0 : _a.getPitch();
|
|
2485
|
+
}
|
|
2486
|
+
setPitch(pitch, immediately, duration) {
|
|
2487
|
+
var _a;
|
|
2488
|
+
(_a = this.amap) == null ? void 0 : _a.setPitch(pitch, immediately, duration);
|
|
2489
|
+
}
|
|
2490
|
+
getRotation() {
|
|
2491
|
+
var _a;
|
|
2492
|
+
return (_a = this.amap) == null ? void 0 : _a.getRotation();
|
|
2493
|
+
}
|
|
2494
|
+
setRotation(rotation, immediately, duration) {
|
|
2495
|
+
var _a;
|
|
2496
|
+
(_a = this.amap) == null ? void 0 : _a.setRotation(rotation, immediately, duration);
|
|
2497
|
+
}
|
|
2498
|
+
setBounds(bounds, immediately, avoid) {
|
|
2499
|
+
var _a;
|
|
2500
|
+
(_a = this.amap) == null ? void 0 : _a.setBounds(bounds, immediately, avoid);
|
|
2501
|
+
}
|
|
2502
|
+
panTo(lnglat, duration) {
|
|
2503
|
+
var _a;
|
|
2504
|
+
(_a = this.amap) == null ? void 0 : _a.panTo(lnglat, duration);
|
|
2505
|
+
}
|
|
2506
|
+
panBy(x, y, duration) {
|
|
2507
|
+
var _a;
|
|
2508
|
+
(_a = this.amap) == null ? void 0 : _a.panBy(x, y, duration);
|
|
2509
|
+
}
|
|
2510
|
+
add(features) {
|
|
2511
|
+
var _a;
|
|
2512
|
+
(_a = this.amap) == null ? void 0 : _a.add(features);
|
|
2513
|
+
}
|
|
2514
|
+
remove(features) {
|
|
2515
|
+
var _a;
|
|
2516
|
+
(_a = this.amap) == null ? void 0 : _a.remove(features);
|
|
2517
|
+
}
|
|
2518
|
+
lngLatToCoords(lnglat) {
|
|
2519
|
+
var _a;
|
|
2520
|
+
return (_a = this.amap) == null ? void 0 : _a.lngLatToCoords(lnglat);
|
|
2521
|
+
}
|
|
2522
|
+
coordsToLngLat(coords) {
|
|
2523
|
+
var _a;
|
|
2524
|
+
return (_a = this.amap) == null ? void 0 : _a.coordsToLngLat(coords);
|
|
2525
|
+
}
|
|
2526
|
+
lngLatToContainer(lnglat) {
|
|
2527
|
+
var _a;
|
|
2528
|
+
return (_a = this.amap) == null ? void 0 : _a.lngLatToContainer(lnglat);
|
|
2529
|
+
}
|
|
2530
|
+
containerToLngLat(pixel) {
|
|
2531
|
+
var _a;
|
|
2532
|
+
return (_a = this.amap) == null ? void 0 : _a.containerToLngLat(pixel);
|
|
2533
|
+
}
|
|
2534
|
+
coordToContainer(coord) {
|
|
2535
|
+
var _a;
|
|
2536
|
+
return (_a = this.amap) == null ? void 0 : _a.coordToContainer(coord);
|
|
2537
|
+
}
|
|
2538
|
+
containerToCoord(pixel) {
|
|
2539
|
+
var _a;
|
|
2540
|
+
return (_a = this.amap) == null ? void 0 : _a.containerToCoord(pixel);
|
|
2541
|
+
}
|
|
2542
|
+
pixelToLngLat(pixel, z) {
|
|
2543
|
+
var _a;
|
|
2544
|
+
return (_a = this.amap) == null ? void 0 : _a.pixelToLngLat(pixel, z);
|
|
2545
|
+
}
|
|
2546
|
+
lngLatToPixel(lnglat, z) {
|
|
2547
|
+
var _a;
|
|
2548
|
+
return (_a = this.amap) == null ? void 0 : _a.lngLatToPixel(lnglat, z);
|
|
2549
|
+
}
|
|
2550
|
+
getResolution(point) {
|
|
2551
|
+
var _a;
|
|
2552
|
+
return (_a = this.amap) == null ? void 0 : _a.getResolution(point);
|
|
2553
|
+
}
|
|
2554
|
+
getScale(dpi) {
|
|
2555
|
+
var _a;
|
|
2556
|
+
return (_a = this.amap) == null ? void 0 : _a.getScale(dpi);
|
|
2557
|
+
}
|
|
2558
|
+
getCity(cbk, lnglat) {
|
|
2559
|
+
var _a;
|
|
2560
|
+
(_a = this.amap) == null ? void 0 : _a.getCity(cbk, lnglat);
|
|
2561
|
+
}
|
|
2562
|
+
setCity(cityName, cbk) {
|
|
2563
|
+
var _a;
|
|
2564
|
+
(_a = this.amap) == null ? void 0 : _a.setCity(cityName, cbk);
|
|
2565
|
+
}
|
|
2566
|
+
setFitView(overlays, immediately, avoid, maxZoom) {
|
|
2567
|
+
var _a;
|
|
2568
|
+
return (_a = this.amap) == null ? void 0 : _a.setFitView(overlays, immediately, avoid, maxZoom);
|
|
2569
|
+
}
|
|
2570
|
+
getFitZoomAndCenterByOverlays(overlayList, avoid, maxZoom) {
|
|
2571
|
+
var _a;
|
|
2572
|
+
return (_a = this.amap) == null ? void 0 : _a.getFitZoomAndCenterByOverlays(overlayList, avoid, maxZoom);
|
|
2573
|
+
}
|
|
2574
|
+
getFitZoomAndCenterByBounds(bounds, avoid, maxZoom) {
|
|
2575
|
+
var _a;
|
|
2576
|
+
return (_a = this.amap) == null ? void 0 : _a.getFitZoomAndCenterByBounds(bounds, avoid, maxZoom);
|
|
2577
|
+
}
|
|
2578
|
+
addControl(control) {
|
|
2579
|
+
var _a;
|
|
2580
|
+
(_a = this.amap) == null ? void 0 : _a.addControl(control);
|
|
2581
|
+
}
|
|
2582
|
+
removeControl(control) {
|
|
2583
|
+
var _a;
|
|
2584
|
+
(_a = this.amap) == null ? void 0 : _a.removeControl(control);
|
|
2585
|
+
}
|
|
2586
|
+
setMapStyle(value) {
|
|
2587
|
+
var _a;
|
|
2588
|
+
(_a = this.amap) == null ? void 0 : _a.setMapStyle(value);
|
|
2589
|
+
}
|
|
2590
|
+
getMapStyle() {
|
|
2591
|
+
var _a;
|
|
2592
|
+
return (_a = this.amap) == null ? void 0 : _a.getMapStyle();
|
|
2593
|
+
}
|
|
2594
|
+
getAllOverlays(type2) {
|
|
2595
|
+
var _a;
|
|
2596
|
+
return (_a = this.amap) == null ? void 0 : _a.getAllOverlays(type2);
|
|
2597
|
+
}
|
|
2598
|
+
clearMap() {
|
|
2599
|
+
var _a;
|
|
2600
|
+
(_a = this.amap) == null ? void 0 : _a.clearMap();
|
|
2601
|
+
}
|
|
2602
|
+
clearInfoWindow() {
|
|
2603
|
+
var _a;
|
|
2604
|
+
(_a = this.amap) == null ? void 0 : _a.clearInfoWindow();
|
|
2605
|
+
}
|
|
2606
|
+
getFeatures() {
|
|
2607
|
+
var _a;
|
|
2608
|
+
return (_a = this.amap) == null ? void 0 : _a.getFeatures();
|
|
2609
|
+
}
|
|
2610
|
+
setFeatures(features) {
|
|
2611
|
+
var _a;
|
|
2612
|
+
(_a = this.amap) == null ? void 0 : _a.setFeatures(features);
|
|
2613
|
+
}
|
|
2614
|
+
getMapApprovalNumber() {
|
|
2615
|
+
var _a;
|
|
2616
|
+
return (_a = this.amap) == null ? void 0 : _a.getMapApprovalNumber();
|
|
2617
|
+
}
|
|
2618
|
+
setMask(maskPath) {
|
|
2619
|
+
var _a;
|
|
2620
|
+
(_a = this.amap) == null ? void 0 : _a.setMask(maskPath);
|
|
2621
|
+
}
|
|
2622
|
+
setLabelRejectMask(reject) {
|
|
2623
|
+
var _a;
|
|
2624
|
+
(_a = this.amap) == null ? void 0 : _a.setLabelRejectMask(reject);
|
|
2625
|
+
}
|
|
2626
|
+
/**
|
|
2627
|
+
* AMap.coreMap
|
|
2628
|
+
*/
|
|
2629
|
+
getSize() {
|
|
2630
|
+
var _a;
|
|
2631
|
+
return (_a = this.amap) == null ? void 0 : _a.getSize();
|
|
2632
|
+
}
|
|
2633
|
+
addLayer(layer) {
|
|
2634
|
+
var _a;
|
|
2635
|
+
(_a = this.amap) == null ? void 0 : _a.addLayer(layer);
|
|
2636
|
+
}
|
|
2637
|
+
removeLayer(layer) {
|
|
2638
|
+
var _a;
|
|
2639
|
+
(_a = this.amap) == null ? void 0 : _a.removeLayer(layer);
|
|
2640
|
+
}
|
|
2641
|
+
setLayers(layers) {
|
|
2642
|
+
var _a;
|
|
2643
|
+
(_a = this.amap) == null ? void 0 : _a.setLayers(layers);
|
|
2644
|
+
}
|
|
2645
|
+
getLayers() {
|
|
2646
|
+
var _a;
|
|
2647
|
+
return (_a = this.amap) == null ? void 0 : _a.getLayers();
|
|
2648
|
+
}
|
|
2649
|
+
getLayersDangerous() {
|
|
2650
|
+
var _a;
|
|
2651
|
+
return (_a = this.amap) == null ? void 0 : _a.getLayersDangerous();
|
|
2652
|
+
}
|
|
2653
|
+
getStatus() {
|
|
2654
|
+
var _a;
|
|
2655
|
+
return (_a = this.amap) == null ? void 0 : _a.getStatus();
|
|
2656
|
+
}
|
|
2657
|
+
setStatus(status) {
|
|
2658
|
+
var _a;
|
|
2659
|
+
(_a = this.amap) == null ? void 0 : _a.setStatus(status);
|
|
2660
|
+
}
|
|
2661
|
+
getDefaultCursor() {
|
|
2662
|
+
var _a;
|
|
2663
|
+
return (_a = this.amap) == null ? void 0 : _a.getDefaultCursor();
|
|
2664
|
+
}
|
|
2665
|
+
setDefaultCursor(cursor) {
|
|
2666
|
+
var _a;
|
|
2667
|
+
(_a = this.amap) == null ? void 0 : _a.setDefaultCursor(cursor);
|
|
2668
|
+
}
|
|
2669
|
+
getLimitBounds() {
|
|
2670
|
+
var _a;
|
|
2671
|
+
return (_a = this.amap) == null ? void 0 : _a.getLimitBounds();
|
|
2672
|
+
}
|
|
2673
|
+
setLimitBounds(bounds) {
|
|
2674
|
+
var _a;
|
|
2675
|
+
(_a = this.amap) == null ? void 0 : _a.setLimitBounds(bounds);
|
|
2676
|
+
}
|
|
2677
|
+
clearLimitBounds() {
|
|
2678
|
+
var _a;
|
|
2679
|
+
(_a = this.amap) == null ? void 0 : _a.clearLimitBounds();
|
|
2680
|
+
}
|
|
2681
|
+
getZooms() {
|
|
2682
|
+
var _a;
|
|
2683
|
+
return (_a = this.amap) == null ? void 0 : _a.getZooms();
|
|
2684
|
+
}
|
|
2685
|
+
setZooms(zooms) {
|
|
2686
|
+
var _a;
|
|
2687
|
+
(_a = this.amap) == null ? void 0 : _a.setZooms(zooms);
|
|
2688
|
+
}
|
|
2689
|
+
/**
|
|
2690
|
+
* AMap.Event
|
|
2691
|
+
*/
|
|
2692
|
+
on(type2, fn, context2, once) {
|
|
2693
|
+
var _a;
|
|
2694
|
+
(_a = this.amap) == null ? void 0 : _a.on(type2, fn, context2, once);
|
|
2695
|
+
return this;
|
|
2696
|
+
}
|
|
2697
|
+
off(type2, fn, context2) {
|
|
2698
|
+
var _a;
|
|
2699
|
+
(_a = this.amap) == null ? void 0 : _a.off(type2, fn, context2);
|
|
2700
|
+
return this;
|
|
2701
|
+
}
|
|
2702
|
+
hasEvents(type2, fn, context2) {
|
|
2703
|
+
var _a;
|
|
2704
|
+
return !!((_a = this.amap) == null ? void 0 : _a.hasEvents(type2, fn, context2));
|
|
2705
|
+
}
|
|
2706
|
+
clearEvents(type2) {
|
|
2707
|
+
var _a;
|
|
2708
|
+
(_a = this.amap) == null ? void 0 : _a.clearEvents(type2);
|
|
2709
|
+
return this;
|
|
2710
|
+
}
|
|
2711
|
+
emit(type2, data) {
|
|
2712
|
+
var _a;
|
|
2713
|
+
(_a = this.amap) == null ? void 0 : _a.emit(type2, data);
|
|
2714
|
+
return this;
|
|
2715
|
+
}
|
|
2716
|
+
getEvents() {
|
|
2717
|
+
return this.amap.getEvents();
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2382
2720
|
const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
2383
2721
|
const {
|
|
2384
2722
|
onDragStart,
|
|
@@ -2422,10 +2760,11 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
2422
2760
|
provideAmap(mapRef);
|
|
2423
2761
|
const { apiMapDistanceVwOfPoints } = useMapLngLatToVw({ mapRef });
|
|
2424
2762
|
useAmapWheelZoomCenter({ mapRef, enableRef: computed(() => !!props.touchZoomCenter) });
|
|
2425
|
-
watchPostEffect(() => {
|
|
2763
|
+
watchPostEffect((onCleanup) => {
|
|
2426
2764
|
if (mapRef.value || !elementRef.value)
|
|
2427
2765
|
return;
|
|
2428
|
-
|
|
2766
|
+
referenceCount.add();
|
|
2767
|
+
const map = new SafeAmap(elementRef.value, {
|
|
2429
2768
|
...defaultOptions,
|
|
2430
2769
|
scrollWheel: defaultOptions.touchZoomCenter ? false : defaultOptions.scrollWheel,
|
|
2431
2770
|
vectorMapForeign
|
|
@@ -2433,6 +2772,13 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
2433
2772
|
window.GlobalAmap = map;
|
|
2434
2773
|
mapRef.value = map;
|
|
2435
2774
|
setMap == null ? void 0 : setMap(map);
|
|
2775
|
+
onCleanup(() => {
|
|
2776
|
+
window.GlobalAmap = void 0;
|
|
2777
|
+
mapRef.value = void 0;
|
|
2778
|
+
setMap == null ? void 0 : setMap(void 0);
|
|
2779
|
+
map == null ? void 0 : map.destroy();
|
|
2780
|
+
referenceCount.remove();
|
|
2781
|
+
});
|
|
2436
2782
|
});
|
|
2437
2783
|
watchNoneImmediatePostEffectForDeepOption(
|
|
2438
2784
|
() => statusOptions.value,
|
|
@@ -2736,18 +3082,26 @@ const AmapPolyline = defineSetup(function AmapPolyline2(props) {
|
|
|
2736
3082
|
const polylineRef = shallowRef();
|
|
2737
3083
|
const mapRef = useAmap();
|
|
2738
3084
|
onMounted(() => {
|
|
3085
|
+
referenceCount.add();
|
|
2739
3086
|
polylineRef.value = new AMap.Polyline({ ...props });
|
|
2740
3087
|
});
|
|
2741
3088
|
onUnmounted(() => {
|
|
2742
|
-
var _a;
|
|
3089
|
+
var _a, _b;
|
|
3090
|
+
referenceCount.remove();
|
|
2743
3091
|
(_a = polylineRef.value) == null ? void 0 : _a.setMap(null);
|
|
3092
|
+
(_b = polylineRef.value) == null ? void 0 : _b.destroy();
|
|
3093
|
+
polylineRef.value = void 0;
|
|
2744
3094
|
});
|
|
2745
|
-
watchPostEffect(() => {
|
|
3095
|
+
watchPostEffect((onCleanup) => {
|
|
2746
3096
|
var _a;
|
|
2747
3097
|
const map = mapRef == null ? void 0 : mapRef.value;
|
|
2748
|
-
if (!map)
|
|
3098
|
+
if (!(map == null ? void 0 : map.amap))
|
|
2749
3099
|
return;
|
|
2750
|
-
(_a = polylineRef.value) == null ? void 0 : _a.setMap(map);
|
|
3100
|
+
(_a = polylineRef.value) == null ? void 0 : _a.setMap(map.amap);
|
|
3101
|
+
onCleanup(() => {
|
|
3102
|
+
var _a2;
|
|
3103
|
+
return (_a2 = polylineRef.value) == null ? void 0 : _a2.setMap(null);
|
|
3104
|
+
});
|
|
2751
3105
|
});
|
|
2752
3106
|
watchNoneImmediatePostEffectForMapProperty(polylineRef, props, [
|
|
2753
3107
|
{ name: "path", defaultValue: [[0, 0]] },
|
|
@@ -3027,7 +3381,7 @@ const useDrivingRoute = (props) => {
|
|
|
3027
3381
|
return supplier === "gmap" ? useGDrivingRoute(props) : useADrivingRoute(props);
|
|
3028
3382
|
};
|
|
3029
3383
|
const amapComputeHeading = (from, to, map) => {
|
|
3030
|
-
if (!map)
|
|
3384
|
+
if (!(map == null ? void 0 : map.amap))
|
|
3031
3385
|
return 0;
|
|
3032
3386
|
const { x: xFrom, y: yFrom } = map.lngLatToContainer(from);
|
|
3033
3387
|
const { x: xTo, y: yTo } = map.lngLatToContainer(to);
|
|
@@ -3119,15 +3473,15 @@ const useAmapFitView = (props) => {
|
|
|
3119
3473
|
const { mapRef, autoFitTimeout } = props;
|
|
3120
3474
|
const overlayGroup = /* @__PURE__ */ new Set();
|
|
3121
3475
|
let timer = void 0;
|
|
3122
|
-
const setFitView = () => {
|
|
3476
|
+
const setFitView = (immediate = false) => {
|
|
3123
3477
|
var _a, _b;
|
|
3124
3478
|
const map = mapRef.value;
|
|
3125
|
-
if (!map)
|
|
3479
|
+
if (!(map == null ? void 0 : map.amap))
|
|
3126
3480
|
return;
|
|
3127
3481
|
const vw = window.innerWidth / 100;
|
|
3128
3482
|
const [top, right, bottom, left] = (_a = props.padding) != null ? _a : [0, 0, 0, 0];
|
|
3129
3483
|
spaceLog("setFitView", "overlayGroup = ", overlayGroup);
|
|
3130
|
-
map.setFitView([...overlayGroup],
|
|
3484
|
+
map.setFitView([...overlayGroup], immediate, [top * vw, bottom * vw, left * vw, right * vw]);
|
|
3131
3485
|
if (overlayGroup.size === 1) {
|
|
3132
3486
|
const [overlay] = [...overlayGroup];
|
|
3133
3487
|
const position = (_b = overlay.getPosition) == null ? void 0 : _b.call(overlay);
|
|
@@ -3307,7 +3661,7 @@ const FitViewOnce = defineSetup(function FitViewOnce2(props, {
|
|
|
3307
3661
|
} = registerOverlay;
|
|
3308
3662
|
onMounted(async () => {
|
|
3309
3663
|
await mapMountedPromise;
|
|
3310
|
-
setFitView();
|
|
3664
|
+
setFitView(!!props.immediate);
|
|
3311
3665
|
});
|
|
3312
3666
|
return () => {
|
|
3313
3667
|
var _a;
|
|
@@ -3389,7 +3743,7 @@ const InterruptableIntervalFitView = defineSetup(function InterruptableIntervalF
|
|
|
3389
3743
|
} = pausableSleep(props.interval));
|
|
3390
3744
|
await sleepPromise;
|
|
3391
3745
|
console.log("InterruptableIntervalFitView setFitView");
|
|
3392
|
-
registerOverlay.setFitView();
|
|
3746
|
+
registerOverlay.setFitView(!!props.immediate);
|
|
3393
3747
|
}
|
|
3394
3748
|
}, {
|
|
3395
3749
|
immediate: true,
|
|
@@ -3576,7 +3930,7 @@ const BusinessQuotingMap = defineLagecySetup(function BusinessQuotingMap2(props,
|
|
|
3576
3930
|
language
|
|
3577
3931
|
} = useMapSupplier();
|
|
3578
3932
|
const fittableRegistryOverlay = createFittableRegisterOverlay(registerOverlay);
|
|
3579
|
-
const deferedSetFitView = pipeDefer(registerOverlay.setFitView);
|
|
3933
|
+
const deferedSetFitView = pipeDefer(() => registerOverlay.setFitView(true));
|
|
3580
3934
|
return () => {
|
|
3581
3935
|
const {
|
|
3582
3936
|
from: inputFromPlace,
|
|
@@ -4090,11 +4444,11 @@ const useHeycarAmap = () => {
|
|
|
4090
4444
|
const { apiMapDistanceVwOfPoints } = useMapLngLatToVw({ mapRef: amapRef });
|
|
4091
4445
|
const setMap = (map) => {
|
|
4092
4446
|
amapRef.value = map;
|
|
4093
|
-
amapElementRef.value = map.getContainer();
|
|
4447
|
+
amapElementRef.value = map == null ? void 0 : map.getContainer();
|
|
4094
4448
|
};
|
|
4095
4449
|
const panTo = async (value) => {
|
|
4096
4450
|
const amap2 = amapRef.value;
|
|
4097
|
-
if (!amap2)
|
|
4451
|
+
if (!(amap2 == null ? void 0 : amap2.amap))
|
|
4098
4452
|
return;
|
|
4099
4453
|
const { lng, lat } = amap2.getCenter();
|
|
4100
4454
|
const distanceVw = apiMapDistanceVwOfPoints(value, [lng, lat]);
|
|
@@ -4114,7 +4468,7 @@ const useHeycarGamp = () => {
|
|
|
4114
4468
|
const gmapElementRef = shallowRef();
|
|
4115
4469
|
const setMap = (map) => {
|
|
4116
4470
|
gmapRef.value = map;
|
|
4117
|
-
gmapElementRef.value = map.getDiv();
|
|
4471
|
+
gmapElementRef.value = map == null ? void 0 : map.getDiv();
|
|
4118
4472
|
};
|
|
4119
4473
|
const panTo = (value) => {
|
|
4120
4474
|
var _a;
|
|
@@ -6057,7 +6411,7 @@ const useAmapZoom = (props) => {
|
|
|
6057
6411
|
watch(
|
|
6058
6412
|
() => mapRef.value,
|
|
6059
6413
|
(map) => {
|
|
6060
|
-
if (!map)
|
|
6414
|
+
if (!(map == null ? void 0 : map.amap))
|
|
6061
6415
|
return;
|
|
6062
6416
|
zoomRef.value = map.getZoom();
|
|
6063
6417
|
}
|
|
@@ -6105,20 +6459,28 @@ const AmapPolygon = defineSetup(function AmapPolygon2(props) {
|
|
|
6105
6459
|
const polygonRef = shallowRef();
|
|
6106
6460
|
const mapRef = useAmap();
|
|
6107
6461
|
onMounted(() => {
|
|
6462
|
+
referenceCount.add();
|
|
6108
6463
|
polygonRef.value = new AMap.Polygon();
|
|
6109
6464
|
polygonRef.value.setOptions(props);
|
|
6110
6465
|
});
|
|
6111
6466
|
onUnmounted(() => {
|
|
6112
|
-
var _a;
|
|
6467
|
+
var _a, _b;
|
|
6468
|
+
referenceCount.remove();
|
|
6113
6469
|
(_a = polygonRef.value) == null ? void 0 : _a.setMap(null);
|
|
6470
|
+
(_b = polygonRef.value) == null ? void 0 : _b.destroy();
|
|
6471
|
+
polygonRef.value = void 0;
|
|
6114
6472
|
});
|
|
6115
6473
|
useAmapFixBugPolygonDrag(polygonRef);
|
|
6116
|
-
watchPostEffect(() => {
|
|
6474
|
+
watchPostEffect((onCleanup) => {
|
|
6117
6475
|
var _a;
|
|
6118
6476
|
const map = mapRef == null ? void 0 : mapRef.value;
|
|
6119
|
-
if (!map)
|
|
6477
|
+
if (!(map == null ? void 0 : map.amap))
|
|
6120
6478
|
return;
|
|
6121
|
-
(_a = polygonRef.value) == null ? void 0 : _a.setMap(map);
|
|
6479
|
+
(_a = polygonRef.value) == null ? void 0 : _a.setMap(map.amap);
|
|
6480
|
+
onCleanup(() => {
|
|
6481
|
+
var _a2;
|
|
6482
|
+
return (_a2 = polygonRef.value) == null ? void 0 : _a2.setMap(null);
|
|
6483
|
+
});
|
|
6122
6484
|
});
|
|
6123
6485
|
watchNoneImmediatePostEffectForMapProperty(polygonRef, props, [
|
|
6124
6486
|
{ name: "path", defaultValue: [[0, 0]] },
|
|
@@ -7596,10 +7958,12 @@ const SectionDispatching = defineSetup(function SectionDispatching2(props) {
|
|
|
7596
7958
|
}
|
|
7597
7959
|
}), h(FitViewOnce, {
|
|
7598
7960
|
"attrs": {
|
|
7599
|
-
"registerOverlay": registerOverlay
|
|
7961
|
+
"registerOverlay": registerOverlay,
|
|
7962
|
+
"immediate": true
|
|
7600
7963
|
}
|
|
7601
7964
|
}), h(InterruptableIntervalFitView, {
|
|
7602
7965
|
"attrs": {
|
|
7966
|
+
"immediate": true,
|
|
7603
7967
|
"interval": AUTO_FIT_VIEW_INTERVAL,
|
|
7604
7968
|
"registerOverlay": registerOverlay
|
|
7605
7969
|
}
|
|
@@ -7671,7 +8035,8 @@ const SectionConfirmed = defineSetup(function SectionConfirmed2(props) {
|
|
|
7671
8035
|
}
|
|
7672
8036
|
}), h(FitViewOnce, {
|
|
7673
8037
|
"attrs": {
|
|
7674
|
-
"registerOverlay": registerOverlay
|
|
8038
|
+
"registerOverlay": registerOverlay,
|
|
8039
|
+
"immediate": true
|
|
7675
8040
|
}
|
|
7676
8041
|
}), h(InterruptableIntervalFitView, {
|
|
7677
8042
|
"attrs": {
|
|
@@ -7777,7 +8142,8 @@ const SectionDriverStartService = defineSetup(function SectionDriverStartService
|
|
|
7777
8142
|
}
|
|
7778
8143
|
}), h(FitViewOnce, {
|
|
7779
8144
|
"attrs": {
|
|
7780
|
-
"registerOverlay": registerOverlay
|
|
8145
|
+
"registerOverlay": registerOverlay,
|
|
8146
|
+
"immediate": true
|
|
7781
8147
|
}
|
|
7782
8148
|
}), h(InterruptableIntervalFitView, {
|
|
7783
8149
|
"attrs": {
|
|
@@ -7864,7 +8230,8 @@ const SectionBookDispatched = defineSetup(function SectionBookDispatched2(props)
|
|
|
7864
8230
|
}
|
|
7865
8231
|
}), h(FitViewOnce, {
|
|
7866
8232
|
"attrs": {
|
|
7867
|
-
"registerOverlay": registerOverlay
|
|
8233
|
+
"registerOverlay": registerOverlay,
|
|
8234
|
+
"immediate": true
|
|
7868
8235
|
}
|
|
7869
8236
|
}), h(InterruptableIntervalFitView, {
|
|
7870
8237
|
"attrs": {
|
|
@@ -7937,7 +8304,8 @@ const SectionDriverArrived = defineSetup(function SectionDriverArrived2(props) {
|
|
|
7937
8304
|
}
|
|
7938
8305
|
}), h(FitViewOnce, {
|
|
7939
8306
|
"attrs": {
|
|
7940
|
-
"registerOverlay": registerOverlay
|
|
8307
|
+
"registerOverlay": registerOverlay,
|
|
8308
|
+
"immediate": true
|
|
7941
8309
|
}
|
|
7942
8310
|
}), h(InterruptableIntervalFitView, {
|
|
7943
8311
|
"attrs": {
|
|
@@ -8021,7 +8389,8 @@ const SectionInService = defineSetup(function SectionInService2(props) {
|
|
|
8021
8389
|
}
|
|
8022
8390
|
}), h(FitViewOnce, {
|
|
8023
8391
|
"attrs": {
|
|
8024
|
-
"registerOverlay": registerOverlay
|
|
8392
|
+
"registerOverlay": registerOverlay,
|
|
8393
|
+
"immediate": true
|
|
8025
8394
|
}
|
|
8026
8395
|
}), h(InterruptableIntervalFitView, {
|
|
8027
8396
|
"attrs": {
|
|
@@ -8071,10 +8440,12 @@ const SectionCanceled = defineSetup(function SectionCanceled2(props) {
|
|
|
8071
8440
|
}
|
|
8072
8441
|
}), h(FitViewOnce, {
|
|
8073
8442
|
"attrs": {
|
|
8074
|
-
"registerOverlay": registerOverlay
|
|
8443
|
+
"registerOverlay": registerOverlay,
|
|
8444
|
+
"immediate": true
|
|
8075
8445
|
}
|
|
8076
8446
|
}), h(InterruptableIntervalFitView, {
|
|
8077
8447
|
"attrs": {
|
|
8448
|
+
"immediate": true,
|
|
8078
8449
|
"interval": AUTO_FIT_VIEW_INTERVAL,
|
|
8079
8450
|
"registerOverlay": registerOverlay
|
|
8080
8451
|
}
|
|
@@ -8134,11 +8505,13 @@ const SectionEndService = defineSetup(function SectionEndService2(props) {
|
|
|
8134
8505
|
}
|
|
8135
8506
|
}), h(FitViewOnce, {
|
|
8136
8507
|
"attrs": {
|
|
8137
|
-
"registerOverlay": registerOverlay
|
|
8508
|
+
"registerOverlay": registerOverlay,
|
|
8509
|
+
"immediate": true
|
|
8138
8510
|
}
|
|
8139
8511
|
}), h(InterruptableIntervalFitView, {
|
|
8140
8512
|
"attrs": {
|
|
8141
8513
|
"interval": AUTO_FIT_VIEW_INTERVAL,
|
|
8514
|
+
"immediate": true,
|
|
8142
8515
|
"registerOverlay": registerOverlay
|
|
8143
8516
|
}
|
|
8144
8517
|
})]);
|
|
@@ -8156,7 +8529,7 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
|
|
|
8156
8529
|
autoFitTimeout: 5e3,
|
|
8157
8530
|
padding: [19, 36, 19, 26]
|
|
8158
8531
|
});
|
|
8159
|
-
const deferedSetFitView = pipeDefer(registerFitVeiw.setFitView);
|
|
8532
|
+
const deferedSetFitView = pipeDefer(() => registerFitVeiw.setFitView(true));
|
|
8160
8533
|
return () => {
|
|
8161
8534
|
const {
|
|
8162
8535
|
from: inputFrom,
|
|
@@ -8195,7 +8568,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
8195
8568
|
renderStartSerivceTitle,
|
|
8196
8569
|
renderInServiceTitle
|
|
8197
8570
|
} = props;
|
|
8198
|
-
const deferedSetFitView = pipeDefer(registerOverlay.setFitView);
|
|
8571
|
+
const deferedSetFitView = pipeDefer(() => registerOverlay.setFitView(true));
|
|
8199
8572
|
const {
|
|
8200
8573
|
setMap,
|
|
8201
8574
|
mapElementRef
|