@heycar/heycars-map 0.7.2 → 0.7.4-zone1

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.js CHANGED
@@ -2056,8 +2056,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
2056
2056
  const map = new AMap.Map(elementRef.value, {
2057
2057
  ...defaultOptions,
2058
2058
  scrollWheel: defaultOptions.touchZoomCenter ? false : defaultOptions.scrollWheel,
2059
- vectorMapForeign,
2060
- mapStyle: "amap://styles/95498a904992a4c0b866a3e4d7729682"
2059
+ vectorMapForeign
2061
2060
  });
2062
2061
  window.GlobalAmap = map;
2063
2062
  mapRef.value = map;
@@ -2408,6 +2407,14 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
2408
2407
  }
2409
2408
  };
2410
2409
  }).props(["center", "fallback", "loading", "mapRef", "zoom", "touchEnable", "touchZoomCenter"]);
2410
+ const BEIJIN_POINT = [116.2317, 39.5427];
2411
+ const ZINDEX_BUBBLE_LAYER = 50;
2412
+ const ZINDEX_START_END_LOGO_LAYER = 40;
2413
+ const ZINDEX_PLACE_LAYER = 30;
2414
+ const ZINDEX_CAR_LAYER = 21;
2415
+ const ZINDEX_PASSENGER_LAYER = 20;
2416
+ const ZINDEX_LINE_LAYER = 12;
2417
+ const ZINDEX_GREEN_ZONE = 10;
2411
2418
  const AmapPolyline = defineSetup(function AmapPolyline2(props) {
2412
2419
  const polylineRef = shallowRef();
2413
2420
  const mapRef = useAmap();
@@ -2486,7 +2493,8 @@ const ADrivingLine = defineSetup(function ADrivingLine2(props) {
2486
2493
  "strokeOpacity": 1,
2487
2494
  "strokeColor": strokeColorOuter,
2488
2495
  "lineJoin": "round",
2489
- "lineCap": "round"
2496
+ "lineCap": "round",
2497
+ "zIndex": ZINDEX_LINE_LAYER
2490
2498
  }
2491
2499
  }), h(AmapPolyline, {
2492
2500
  "attrs": {
@@ -2497,7 +2505,8 @@ const ADrivingLine = defineSetup(function ADrivingLine2(props) {
2497
2505
  "lineJoin": "round",
2498
2506
  "lineCap": "round",
2499
2507
  "strokeStyle": "dashed",
2500
- "strokeDasharray": [dashLength, dashLength * 0.5]
2508
+ "strokeDasharray": [dashLength, dashLength * 0.5],
2509
+ "zIndex": ZINDEX_LINE_LAYER
2501
2510
  }
2502
2511
  }), h(AmapPolyline, {
2503
2512
  "attrs": {
@@ -2506,7 +2515,8 @@ const ADrivingLine = defineSetup(function ADrivingLine2(props) {
2506
2515
  "strokeOpacity": 1,
2507
2516
  "strokeColor": strokeColorInner,
2508
2517
  "lineJoin": "round",
2509
- "lineCap": "round"
2518
+ "lineCap": "round",
2519
+ "zIndex": ZINDEX_LINE_LAYER
2510
2520
  }
2511
2521
  }), h(AmapPolyline, {
2512
2522
  "attrs": {
@@ -2516,7 +2526,8 @@ const ADrivingLine = defineSetup(function ADrivingLine2(props) {
2516
2526
  "strokeOpacity": 1,
2517
2527
  "strokeColor": "transparent",
2518
2528
  "lineJoin": "round",
2519
- "lineCap": "round"
2529
+ "lineCap": "round",
2530
+ "zIndex": ZINDEX_LINE_LAYER
2520
2531
  }
2521
2532
  })]);
2522
2533
  };
@@ -2538,7 +2549,8 @@ const GDrivingLine = defineSetup(function GDrivingLine2(props) {
2538
2549
  "path": pathRef.value,
2539
2550
  "strokeWeight": strokeWidth + 2 * borderWidth + 2 * outlineWidth,
2540
2551
  "strokeOpacity": 1,
2541
- "strokeColor": strokeColorOuter
2552
+ "strokeColor": strokeColorOuter,
2553
+ "zIndex": ZINDEX_LINE_LAYER
2542
2554
  }
2543
2555
  }), h(GmapPolyline, {
2544
2556
  "attrs": {
@@ -2553,7 +2565,8 @@ const GDrivingLine = defineSetup(function GDrivingLine2(props) {
2553
2565
  },
2554
2566
  repeat: `${strokeWidth}px`,
2555
2567
  offset: `${strokeWidth / 2}px`
2556
- }]
2568
+ }],
2569
+ "zIndex": ZINDEX_LINE_LAYER
2557
2570
  }
2558
2571
  }), h(GmapPolyline, {
2559
2572
  "attrs": {
@@ -2569,7 +2582,8 @@ const GDrivingLine = defineSetup(function GDrivingLine2(props) {
2569
2582
  scale: 0.7
2570
2583
  },
2571
2584
  repeat: `${repeat}px`
2572
- }]
2585
+ }],
2586
+ "zIndex": ZINDEX_LINE_LAYER
2573
2587
  }
2574
2588
  })]);
2575
2589
  };
@@ -3006,12 +3020,6 @@ const KeyedFitView = defineSetup(function KeyedFitView2(props, {
3006
3020
  return h("div", [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
3007
3021
  };
3008
3022
  });
3009
- const BEIJIN_POINT = [116.2317, 39.5427];
3010
- const ZINDEX_BUBBLE_LAYER = 50;
3011
- const ZINDEX_START_END_LOGO_LAYER = 40;
3012
- const ZINDEX_PLACE_LAYER = 30;
3013
- const ZINDEX_CAR_LAYER = 21;
3014
- const ZINDEX_PASSENGER_LAYER = 20;
3015
3023
  const imgEndPoint = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSI3Mi4zMzklIiB5MT0iNTAlIiB4Mj0iMCUiIHkyPSI1MCUiIGlkPSJwcmVmaXhfX2EiPjxzdG9wIHN0b3AtY29sb3I9IiNGRjg0NDciIG9mZnNldD0iMCUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkY4QjRBIiBvZmZzZXQ9IjUwLjU5NiUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkZBOTVBIiBvZmZzZXQ9IjEwMCUiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0xMiAzMC4yMTVjMi4xMzQgMCAzLjg2My0uODkzIDMuODYzLTEuOTk1IDAtMS4xLTEuNzMtMS45OTQtMy44NjMtMS45OTQtMi4xMzQgMC0zLjg2My44OT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VudD48L2RlZnM+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTIgMzAuMjE1YzEuOTUgMCAzLjUzMi0uODE2IDMuNTMyLTEuODIzIDAtMS4wMDctMS41ODEtMS44MjMtMy41MzItMS44MjMtMS45NSAwLTMuNTMyLjgxNi0zLjUzMiAxLjgyMyAwIDEuMDA3IDEuNTgxIDEuODIzIDMuNTMyIDEuODIzeiIgZmlsbC1vcGFjaXR5PSIuNSIgZmlsbD0iIzQzNDg1QSIvPjxwYXRoIGQ9Ik0xMSAyN2MyLjEyOCAwLS45LTMuNzQyIDUuNjIxLTYuNjQxIDMuMjIxLTEuOTEgNS4zNzktNS40MSA1LjM3OS05LjQxMkMyMiA0LjkwMSAxNy4wNzUgMCAxMSAwUzAgNC45MDEgMCAxMC45NDdjMCAzLjkxOCAyLjA2OCA3LjM1NSA1LjE3NyA5LjI5QzExLjc1IDIzLjI3NyA5LjA2IDI3IDExIDI3eiIgc3Ryb2tlPSIjRkZGIiBmaWxsPSJ1cmwoI3ByZWZpeF9fYSkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMS4yMTUpIi8+PHRleHQgZm9udC1mYW1pbHk9IlBpbmdGYW5nU0MtU2VtaWJvbGQsIFBpbmdGYW5nIFNDIiBmb250LXNpemU9IjEyIiBmb250LXdlaWdodD0iNTAwIiBmaWxsPSIjRkZGIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxIDEuMjE1KSI+PHRzcGFuIHg9IjUiIHk9IjE1LjYyNCI+6LW3PC90c3Bhbj48L3RleHQ+PC9nPjwvc3ZnPg==";
3017
3025
  const StartEndPoint_css_ts_vanilla = "";
@@ -5269,7 +5277,8 @@ const useAmapRecomendPlace = (props) => {
5269
5277
  const { pointRef, getRecomendPlace, getLimit, context: context2, emptyPlaceName, onChange, onChangePlace } = props;
5270
5278
  const availableRef = ref(true);
5271
5279
  const placeCandidatesRef = ref([]);
5272
- const { idx: recomendPlaceKey, update: updateRecomandPlace } = useUpdate();
5280
+ const zoneRef = ref();
5281
+ const { idx: recomendPlaceKey, update: updateRecommendPlaceKey } = useUpdate();
5273
5282
  const { readyPromise } = useMapSupplier();
5274
5283
  const { place, updatePlace, setPlace } = useAmapPlace({
5275
5284
  emptyPlaceName,
@@ -5284,49 +5293,72 @@ const useAmapRecomendPlace = (props) => {
5284
5293
  );
5285
5294
  });
5286
5295
  const updatePlaceCandidates = async (place2) => {
5287
- const inputPlaceCandidates = await getRecomendPlace({ ...place2 }, context2);
5296
+ var _a;
5297
+ const {
5298
+ places: inputPlaceCandidates,
5299
+ zone,
5300
+ available
5301
+ } = (_a = await getRecomendPlace({ ...place2 }, context2)) != null ? _a : {};
5288
5302
  const placeCandidates = inputPlaceCandidates == null ? void 0 : inputPlaceCandidates.map(toPlaceType);
5289
- availableRef.value = placeCandidates !== void 0;
5303
+ availableRef.value = !!available;
5304
+ zoneRef.value = zone;
5290
5305
  placeCandidatesRef.value = placeCandidates != null ? placeCandidates : [];
5291
5306
  };
5307
+ const updateRecommendPlace = (place2) => {
5308
+ setPlace(place2);
5309
+ updateRecommendPlaceKey();
5310
+ };
5311
+ const setPlaceCandidatesAndZone = ({ zone, places }) => {
5312
+ placeCandidatesRef.value = places != null ? places : [];
5313
+ zoneRef.value = zone ? zone : void 0;
5314
+ };
5292
5315
  watch(
5293
5316
  () => recomendPlaceKey.value,
5294
5317
  async () => {
5318
+ var _a;
5295
5319
  await readyPromise;
5296
- const inputPlaceCandidates = await getRecomendPlace({ ...place }, context2);
5320
+ const {
5321
+ places: inputPlaceCandidates,
5322
+ zone,
5323
+ available
5324
+ } = (_a = await getRecomendPlace({ ...place }, context2)) != null ? _a : {};
5297
5325
  const placeCandidates = inputPlaceCandidates == null ? void 0 : inputPlaceCandidates.map(toPlaceType);
5298
- if (placeCandidates === void 0) {
5299
- availableRef.value = false;
5326
+ if (!available || !placeCandidates) {
5327
+ availableRef.value = !!available;
5328
+ zoneRef.value = zone;
5300
5329
  placeCandidatesRef.value = [];
5301
5330
  Object.assign(recomendPlace, { ...place });
5302
- onChange == null ? void 0 : onChange({ ...place });
5331
+ onChange == null ? void 0 : onChange({ place: { ...place }, inputPlace: { ...place }, isInZone: !!zone });
5303
5332
  return;
5304
5333
  }
5305
5334
  const { shortestPlace, shortestDistance } = findAmapNearestPlace(place, placeCandidates);
5306
5335
  const limit = getLimit(context2);
5307
5336
  const resultPlace = shortestDistance > limit ? place : shortestPlace;
5308
- availableRef.value = true;
5337
+ availableRef.value = !!available;
5338
+ zoneRef.value = zone;
5309
5339
  placeCandidatesRef.value = placeCandidates;
5310
5340
  Object.assign(recomendPlace, { ...resultPlace });
5311
- onChange == null ? void 0 : onChange({ ...resultPlace });
5341
+ onChange == null ? void 0 : onChange({ place: { ...resultPlace }, inputPlace: { ...place }, isInZone: !!zone });
5312
5342
  }
5313
5343
  );
5314
5344
  return {
5345
+ zoneRef,
5315
5346
  recomendPlace,
5316
5347
  placeCandidates: placeCandidatesRef,
5317
5348
  availableRef,
5318
5349
  isElectedRef,
5319
- updateRecomandPlace,
5350
+ updateRecommendPlace,
5320
5351
  updatePlaceCandidates,
5321
5352
  updatePlace,
5322
- setPlace
5353
+ setPlaceCandidatesAndZone
5323
5354
  };
5324
5355
  };
5325
5356
  const useGmapRecomendPlace = (props) => {
5326
5357
  const { pointRef, getRecomendPlace, getLimit, context: context2, emptyPlaceName, onChange, onChangePlace } = props;
5327
5358
  const availableRef = ref(true);
5328
5359
  const placeCandidatesRef = ref([]);
5329
- const { idx: recomendPlaceKey, update: updateRecomandPlace } = useUpdate();
5360
+ const zoneRef = ref();
5361
+ const { idx: recomendPlaceKey, update: updateRecommendPlaceKey } = useUpdate();
5330
5362
  const { readyPromise } = useMapSupplier();
5331
5363
  const { place, updatePlace, setPlace } = useGmapPlace({
5332
5364
  emptyPlaceName,
@@ -5341,40 +5373,64 @@ const useGmapRecomendPlace = (props) => {
5341
5373
  );
5342
5374
  });
5343
5375
  const updatePlaceCandidates = async (place2) => {
5344
- const placeCandidates = await getRecomendPlace({ ...place2 }, context2);
5345
- availableRef.value = placeCandidates !== void 0;
5376
+ var _a;
5377
+ const {
5378
+ places: inputPlaceCandidates,
5379
+ zone,
5380
+ available
5381
+ } = (_a = await getRecomendPlace({ ...place2 }, context2)) != null ? _a : {};
5382
+ const placeCandidates = inputPlaceCandidates == null ? void 0 : inputPlaceCandidates.map(toPlaceType);
5383
+ availableRef.value = !!available;
5384
+ zoneRef.value = zone;
5346
5385
  placeCandidatesRef.value = placeCandidates != null ? placeCandidates : [];
5347
5386
  };
5387
+ const updateRecommendPlace = (place2) => {
5388
+ setPlace(place2);
5389
+ updateRecommendPlaceKey();
5390
+ };
5391
+ const setPlaceCandidatesAndZone = ({ zone, places }) => {
5392
+ placeCandidatesRef.value = places != null ? places : [];
5393
+ zoneRef.value = zone ? zone : void 0;
5394
+ };
5348
5395
  watch(
5349
5396
  () => recomendPlaceKey.value,
5350
5397
  async () => {
5398
+ var _a;
5351
5399
  await readyPromise;
5352
- const placeCandidates = await getRecomendPlace({ ...place }, context2);
5353
- if (placeCandidates === void 0) {
5354
- availableRef.value = false;
5400
+ const {
5401
+ places: inputPlaceCandidates,
5402
+ zone,
5403
+ available
5404
+ } = (_a = await getRecomendPlace({ ...place }, context2)) != null ? _a : {};
5405
+ const placeCandidates = inputPlaceCandidates == null ? void 0 : inputPlaceCandidates.map(toPlaceType);
5406
+ if (!available || !placeCandidates) {
5407
+ availableRef.value = !!available;
5408
+ zoneRef.value = zone;
5355
5409
  placeCandidatesRef.value = [];
5356
5410
  Object.assign(recomendPlace, { ...place });
5357
- onChange == null ? void 0 : onChange({ ...place });
5411
+ onChange == null ? void 0 : onChange({ place: { ...place }, inputPlace: { ...place }, isInZone: !!zone });
5358
5412
  return;
5359
5413
  }
5360
5414
  const { shortestPlace, shortestDistance } = findGmapNearestPlace(place, placeCandidates);
5361
5415
  const limit = getLimit(context2);
5362
5416
  const resultPlace = shortestDistance > limit ? place : shortestPlace;
5363
- availableRef.value = true;
5417
+ availableRef.value = !!available;
5418
+ zoneRef.value = zone;
5364
5419
  placeCandidatesRef.value = placeCandidates;
5365
5420
  Object.assign(recomendPlace, { ...resultPlace });
5366
- onChange == null ? void 0 : onChange({ ...resultPlace });
5421
+ onChange == null ? void 0 : onChange({ place: { ...resultPlace }, inputPlace: { ...place }, isInZone: !!zone });
5367
5422
  }
5368
5423
  );
5369
5424
  return {
5425
+ zoneRef,
5370
5426
  recomendPlace,
5371
5427
  placeCandidates: placeCandidatesRef,
5372
5428
  availableRef,
5373
5429
  isElectedRef,
5374
- updateRecomandPlace,
5430
+ updateRecommendPlace,
5375
5431
  updatePlaceCandidates,
5376
5432
  updatePlace,
5377
- setPlace
5433
+ setPlaceCandidatesAndZone
5378
5434
  };
5379
5435
  };
5380
5436
  const useMapRecomendPlace = (props) => {
@@ -5428,6 +5484,131 @@ const useMapZoom = (props) => {
5428
5484
  const { supplier } = useMapSupplier();
5429
5485
  return supplier === "gmap" ? useGmapZoom(props) : useAmapZoom(props);
5430
5486
  };
5487
+ const AmapPolygon = defineSetup(function AmapPolygon2(props) {
5488
+ const polygonRef = shallowRef();
5489
+ const mapRef = useAmap();
5490
+ onMounted(() => {
5491
+ polygonRef.value = new AMap.Polygon();
5492
+ polygonRef.value.setOptions(props);
5493
+ });
5494
+ onUnmounted(() => {
5495
+ var _a;
5496
+ (_a = polygonRef.value) == null ? void 0 : _a.setMap(null);
5497
+ });
5498
+ watchPostEffect(() => {
5499
+ var _a;
5500
+ const map = mapRef == null ? void 0 : mapRef.value;
5501
+ if (!map)
5502
+ return;
5503
+ (_a = polygonRef.value) == null ? void 0 : _a.setMap(map);
5504
+ });
5505
+ watchNoneImmediatePostEffectForMapProperty(polygonRef, props, [
5506
+ { name: "path", defaultValue: [[0, 0]] },
5507
+ { name: "extData", defaultValue: void 0 },
5508
+ { name: "draggable", defaultValue: false }
5509
+ ]);
5510
+ watchNoneImmediatePostEffectForDeepOption(
5511
+ () => {
5512
+ const { path, extData, draggable, ...otherOptions } = props;
5513
+ return otherOptions;
5514
+ },
5515
+ (otherOptions) => {
5516
+ var _a;
5517
+ (_a = polygonRef.value) == null ? void 0 : _a.setOptions({ ...otherOptions });
5518
+ }
5519
+ );
5520
+ return () => null;
5521
+ });
5522
+ const GmapPolygon = defineSetup(function GmapPolygon2(props) {
5523
+ const polygonRef = shallowRef();
5524
+ const mapRef = useGmap();
5525
+ onMounted(() => {
5526
+ polygonRef.value = new google.maps.Polygon({ ...props });
5527
+ });
5528
+ onUnmounted(() => {
5529
+ var _a;
5530
+ (_a = polygonRef.value) == null ? void 0 : _a.setMap(null);
5531
+ });
5532
+ watchPostEffect(() => {
5533
+ var _a;
5534
+ const map = mapRef == null ? void 0 : mapRef.value;
5535
+ if (!map)
5536
+ return;
5537
+ (_a = polygonRef.value) == null ? void 0 : _a.setMap(map);
5538
+ });
5539
+ watchNoneImmediatePostEffectForDeepOption(
5540
+ () => ({ ...props }),
5541
+ (props2) => {
5542
+ var _a;
5543
+ (_a = polygonRef.value) == null ? void 0 : _a.setOptions({ ...props2 });
5544
+ }
5545
+ );
5546
+ return () => null;
5547
+ });
5548
+ const GREEN_ZONE_FILL_COLOR = "#C7E5FB";
5549
+ const GREEN_ZONE_FILL_OPACITY = 0.5;
5550
+ const GREEN_ZONE_STROKE_COLOR = "#4BA7FF";
5551
+ const GREEN_ZONE_STROKE_WEIGHT_VW = 1;
5552
+ const AGreenZone = defineSetup(function AGreenZone2(props) {
5553
+ const strokeWeight = GREEN_ZONE_STROKE_WEIGHT_VW * globalThis.innerWidth / 100;
5554
+ return () => {
5555
+ return h(AmapPolygon, {
5556
+ "attrs": {
5557
+ "path": props.path,
5558
+ "strokeColor": GREEN_ZONE_STROKE_COLOR,
5559
+ "strokeStyle": "dashed",
5560
+ "strokeWeight": strokeWeight,
5561
+ "fillColor": GREEN_ZONE_FILL_COLOR,
5562
+ "fillOpacity": GREEN_ZONE_FILL_OPACITY,
5563
+ "zIndex": ZINDEX_GREEN_ZONE
5564
+ }
5565
+ });
5566
+ };
5567
+ });
5568
+ const GGreenZone = defineSetup(function GGreenZone2(props) {
5569
+ const pathRef = computed(() => props.path.map(vec2lnglat));
5570
+ const strokeWeight = GREEN_ZONE_STROKE_WEIGHT_VW * globalThis.innerWidth / 100;
5571
+ const lineSymbol = {
5572
+ path: "M 0,-1 0,1",
5573
+ strokeOpacity: 1,
5574
+ scale: 4
5575
+ };
5576
+ return () => {
5577
+ const path = pathRef.value;
5578
+ return h("div", [h(GmapPolygon, {
5579
+ "attrs": {
5580
+ "paths": path,
5581
+ "strokeColor": GREEN_ZONE_STROKE_COLOR,
5582
+ "strokeOpacity": 0,
5583
+ "strokeWeight": strokeWeight,
5584
+ "fillColor": GREEN_ZONE_FILL_COLOR,
5585
+ "fillOpacity": GREEN_ZONE_FILL_OPACITY,
5586
+ "zIndex": ZINDEX_GREEN_ZONE
5587
+ }
5588
+ }), h(GmapPolyline, {
5589
+ "attrs": {
5590
+ "path": path,
5591
+ "strokeColor": GREEN_ZONE_STROKE_COLOR,
5592
+ "strokeWeight": GREEN_ZONE_STROKE_WEIGHT_VW,
5593
+ "icons": [{
5594
+ icon: lineSymbol,
5595
+ offset: "0",
5596
+ repeat: "20px"
5597
+ }]
5598
+ }
5599
+ })]);
5600
+ };
5601
+ });
5602
+ const GreenZone = defineSetup(function GreenZone2(props) {
5603
+ const payload = useMapSupplier();
5604
+ return () => {
5605
+ if (!props.path.length)
5606
+ return null;
5607
+ return createElement(payload.supplier === "gmap" ? GGreenZone : AGreenZone, {
5608
+ attrs: props
5609
+ });
5610
+ };
5611
+ });
5431
5612
  const imgPassengerCircleArrow = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIge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JpeCB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMjQgMCIgaW49InNoYWRvd0JsdXJPdXRlcjEiLz48L2ZpbHRlcj48Y2lyY2xlIGlkPSJwcmVmaXhfX2IiIGN4PSIxMC41IiBjeT0iMTkuNSIgcj0iMTAuNSIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGZpbGw9IiM0NDcxRkYiIGQ9Ik0xNC40ODEgMGw2LjYwMyAxMy4xODFINy44Nzl6Ii8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNCkiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI3ByZWZpeF9fYSkiIHhsaW5rOmhyZWY9IiNwcmVmaXhfX2IiLz48Y2lyY2xlIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIyLjQiIHN0cm9rZS1saW5lam9pbj0ic3F1YXJlIiBmaWxsPSIjNDg3MUYxIiBjeD0iMTAuNSIgY3k9IjE5LjUiIHI9IjkuMyIvPjwvZz48L2c+PC9zdmc+";
@@ -5818,7 +5999,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5818
5999
  const centerSource = {
5819
6000
  source: "geo"
5820
6001
  };
5821
- const setCenterPlaceByRecomand = (point) => {
6002
+ const updateCenterPlaceByPoint = (point) => {
5822
6003
  centerSource.source = "api";
5823
6004
  updatePlace(point);
5824
6005
  };
@@ -5832,15 +6013,40 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5832
6013
  emit("changePlace", {
5833
6014
  ...place
5834
6015
  });
5835
- updatePlaceCandidates(place);
6016
+ updateRecommendPlace(place);
5836
6017
  await pipeDefer(setZoom)(READY_ZOOM);
5837
6018
  };
6019
+ const setCenterPlaceByUserSpecifiedInZone = ({
6020
+ place,
6021
+ recommends
6022
+ }) => {
6023
+ centerPlace.lng = place.lng;
6024
+ centerPlace.lat = place.lat;
6025
+ centerPlace.name = place.name;
6026
+ centerPlace.displayName = place.displayName;
6027
+ setPlaceCandidatesAndZone(recommends);
6028
+ emit("changePlace", {
6029
+ ...place
6030
+ });
6031
+ };
5838
6032
  const setCenterByPlace = (place) => {
5839
6033
  centerSource.source = "api";
5840
6034
  centerPlace.lng = place.lng;
5841
6035
  centerPlace.lat = place.lat;
5842
6036
  centerPlace.name = place.name;
5843
6037
  centerPlace.displayName = place.displayName;
6038
+ emit("changePlace", {
6039
+ ...place
6040
+ });
6041
+ emit("changeRecomandPlace", {
6042
+ place: {
6043
+ ...place
6044
+ },
6045
+ inputPlace: {
6046
+ ...place
6047
+ },
6048
+ isInZone: !!zoneRef.value
6049
+ });
5844
6050
  };
5845
6051
  const defaultCenterPlacePromise = new Promise((resolve) => {
5846
6052
  getDefaultCenterPlace().then(resolve).catch(() => resolve(void 0));
@@ -5881,10 +6087,11 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5881
6087
  }
5882
6088
  });
5883
6089
  mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
6090
+ mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
5884
6091
  mapContext.panToGeoPositionByRecomend = () => {
5885
6092
  if (geoError.value)
5886
6093
  return false;
5887
- setCenterPlaceByRecomand(geoPosition.value);
6094
+ updateCenterPlaceByPoint(geoPosition.value);
5888
6095
  return true;
5889
6096
  };
5890
6097
  const {
@@ -5899,9 +6106,10 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5899
6106
  });
5900
6107
  const {
5901
6108
  updatePlace,
5902
- updateRecomandPlace,
5903
- updatePlaceCandidates,
6109
+ updateRecommendPlace,
6110
+ setPlaceCandidatesAndZone,
5904
6111
  placeCandidates,
6112
+ zoneRef,
5905
6113
  availableRef,
5906
6114
  isElectedRef
5907
6115
  } = useMapRecomendPlace({
@@ -5924,17 +6132,25 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5924
6132
  },
5925
6133
  onChangePlace: (place) => {
5926
6134
  if (centerSource.source !== "recomend") {
5927
- updateRecomandPlace();
6135
+ updateRecommendPlace(place);
5928
6136
  }
5929
6137
  emit("changePlace", place);
5930
6138
  },
5931
- onChange: async (place) => {
6139
+ onChange: async ({
6140
+ place,
6141
+ inputPlace,
6142
+ isInZone
6143
+ }) => {
5932
6144
  centerSource.source = "recomend";
5933
6145
  Object.assign(centerPlace, {
5934
6146
  ...place
5935
6147
  });
5936
6148
  panTo(place2point(place));
5937
- emit("changeRecomandPlace", place);
6149
+ emit("changeRecomandPlace", {
6150
+ place,
6151
+ inputPlace,
6152
+ isInZone
6153
+ });
5938
6154
  if (isFirstWorkflowRecomendLoadingRef.value)
5939
6155
  await pipeDefer(setZoom)(READY_ZOOM);
5940
6156
  completeFirstWorkflowRecomend();
@@ -5949,6 +6165,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5949
6165
  mapContext.onChangeRecomendPlaces([...placeCandidates.value]);
5950
6166
  });
5951
6167
  return () => {
6168
+ var _a2, _b2;
5952
6169
  const {
5953
6170
  geoLoadingTitle,
5954
6171
  recomendDescription,
@@ -5965,7 +6182,11 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5965
6182
  "fallback": slots.fallback,
5966
6183
  "loading": slots.loading
5967
6184
  }
5968
- }, [!geoLoading.value && !geoError.value && h(PassengerCircle, {
6185
+ }, [((_a2 = zoneRef.value) == null ? void 0 : _a2.path.length) && h(GreenZone, {
6186
+ "attrs": {
6187
+ "path": (_b2 = zoneRef.value) == null ? void 0 : _b2.path
6188
+ }
6189
+ }), !geoLoading.value && !geoError.value && h(PassengerCircle, {
5969
6190
  "attrs": {
5970
6191
  "position": geoPosition.value,
5971
6192
  "angle": orientation.cssRotationVariableName
@@ -6148,7 +6369,8 @@ const AWalkingLine = defineSetup(function AWalkingLine2(props) {
6148
6369
  "strokeStyle": "dashed",
6149
6370
  "strokeDasharray": [strokeWidth, strokeWidth * 1.5],
6150
6371
  "lineJoin": "round",
6151
- "lineCap": "round"
6372
+ "lineCap": "round",
6373
+ "zIndex": ZINDEX_LINE_LAYER
6152
6374
  }
6153
6375
  });
6154
6376
  };
@@ -6184,7 +6406,8 @@ const GWalkingLine = defineSetup(function GWalkingLine2(props) {
6184
6406
  scale: 1
6185
6407
  },
6186
6408
  repeat: `${strokeWidth * 2}px`
6187
- }]
6409
+ }],
6410
+ "zIndex": ZINDEX_LINE_LAYER
6188
6411
  }
6189
6412
  });
6190
6413
  };
@@ -7100,6 +7323,7 @@ const useBusinessRecomendPlaceMap = () => {
7100
7323
  const { inChina } = useMapInChina();
7101
7324
  const panToGeoPositionByRecomend = (value) => mapContext.panToGeoPositionByRecomend(value);
7102
7325
  const setCenterPlaceByUserSpecified = (value) => mapContext.setCenterPlaceByUserSpecified(value);
7326
+ const setCenterPlaceByUserSpecifiedInZone = (value) => mapContext.setCenterPlaceByUserSpecifiedInZone(value);
7103
7327
  const mapContext = {
7104
7328
  panToGeoPositionByRecomend: () => {
7105
7329
  throw new Error("MyError: panToGeoPositionByRecomend used before assigned");
@@ -7107,6 +7331,9 @@ const useBusinessRecomendPlaceMap = () => {
7107
7331
  setCenterPlaceByUserSpecified: () => {
7108
7332
  throw new Error("MyError: setCenterPlaceByRecomand used before assigned");
7109
7333
  },
7334
+ setCenterPlaceByUserSpecifiedInZone: () => {
7335
+ throw new Error("MyError: setCenterPlaceByUserSpecifiedInZone used before assigned");
7336
+ },
7110
7337
  onChangeCenterPlace: (place) => {
7111
7338
  Object.assign(centerPlace, { ...place });
7112
7339
  },
@@ -7120,6 +7347,7 @@ const useBusinessRecomendPlaceMap = () => {
7120
7347
  placeCandidates,
7121
7348
  panToGeoPositionByRecomend,
7122
7349
  setCenterPlaceByUserSpecified,
7350
+ setCenterPlaceByUserSpecifiedInZone,
7123
7351
  apiMapDistance,
7124
7352
  apiMapInChina: inChina
7125
7353
  };
@@ -8,6 +8,15 @@ export type Place = {
8
8
  name: string;
9
9
  displayName: string;
10
10
  };
11
+ export interface Zone {
12
+ name: string;
13
+ path: Point[];
14
+ }
15
+ export interface RecommendZonePlaces {
16
+ available?: boolean;
17
+ zone?: Zone;
18
+ places?: Place[];
19
+ }
11
20
  export interface RegisterOverlay<T> {
12
21
  add: (overlay: T) => void;
13
22
  remove: (overlay: T) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.7.2",
3
+ "version": "0.7.4-zone1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",