@heycar/heycars-map 0.6.10 → 0.6.11

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.
@@ -15,8 +15,9 @@ export interface AmapProps extends Omit<AMap.MapOptions, "vectorMapForeign"> {
15
15
  touchZoomCenter?: 0 | 1;
16
16
  onDragStart?: MapEventHandler<AMap.Map>;
17
17
  onDragEnd?: MapEventHandler<AMap.Map>;
18
+ onZoomStart?: MapEventHandler<AMap.Map>;
18
19
  onZoomEnd?: MapEventHandler<AMap.Map>;
19
20
  onResize?: MapEventHandler<AMap.Map>;
20
21
  onMoveend?: MapEventHandler<AMap.Map>;
21
22
  }
22
- export declare const Amap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<AmapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<AmapProps, Required<AmapProps>>, "resize" | "moveend" | "dragStart" | "dragEnd" | "zoomEnd", AmapProps, {}>;
23
+ export declare const Amap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<AmapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<AmapProps, Required<AmapProps>>, "resize" | "moveend" | "dragStart" | "dragEnd" | "zoomStart" | "zoomEnd", AmapProps, {}>;
package/dist/index.cjs CHANGED
@@ -3415,12 +3415,28 @@ const useAmapDrag = (props) => {
3415
3415
  const centerRef = Vue.ref([0, 0]);
3416
3416
  const isDragging = Vue.ref(false);
3417
3417
  const isDragEndWaitingMovingEndRef = Vue.ref(false);
3418
+ let isZoom = false;
3419
+ let zoomStartCenter = void 0;
3418
3420
  let watchId = void 0;
3419
3421
  const emitDragStart = () => {
3420
3422
  pipeAsync(() => {
3421
3423
  isDragging.value = true;
3422
3424
  })();
3423
3425
  };
3426
+ const handleZoomStart = () => {
3427
+ var _a;
3428
+ isZoom = true;
3429
+ zoomStartCenter = (_a = mapRef.value) == null ? void 0 : _a.getCenter().toJSON();
3430
+ };
3431
+ const handleChange = (value) => {
3432
+ console.log("useAmapDrag value, zoomStartCenter = ", value, zoomStartCenter);
3433
+ if (isZoom) {
3434
+ isZoom = false;
3435
+ if (isPointEqual(value, zoomStartCenter))
3436
+ return;
3437
+ }
3438
+ onChange == null ? void 0 : onChange(value);
3439
+ };
3424
3440
  const handleDragEndWithAnimationEnd = (target) => {
3425
3441
  var _a;
3426
3442
  isDragEndWaitingMovingEndRef.value = false;
@@ -3428,7 +3444,7 @@ const useAmapDrag = (props) => {
3428
3444
  const { lng, lat } = target.getCenter();
3429
3445
  spaceLog("onDragEndWithAnimationEnd", "[lng, lat] = ", [lng, lat]);
3430
3446
  centerRef.value = [lng, lat];
3431
- (_a = pipeAsync(onChange)) == null ? void 0 : _a([lng, lat]);
3447
+ (_a = pipeAsync(handleChange)) == null ? void 0 : _a([lng, lat]);
3432
3448
  };
3433
3449
  const emitDragEnd = (_, { target }) => {
3434
3450
  const { lng: baseLng, lat: baseLat } = target.getCenter();
@@ -3450,6 +3466,9 @@ const useAmapDrag = (props) => {
3450
3466
  return;
3451
3467
  handleDragEndWithAnimationEnd(target);
3452
3468
  };
3469
+ watchPostEffectForAMapEvent(mapRef, {}, handleZoomStart, [
3470
+ "onZoomStart"
3471
+ ]);
3453
3472
  watchPostEffectForAMapEvent(mapRef, {}, emitDragStart, [
3454
3473
  "onDragStart"
3455
3474
  ]);
package/dist/index.js CHANGED
@@ -3413,12 +3413,28 @@ const useAmapDrag = (props) => {
3413
3413
  const centerRef = ref([0, 0]);
3414
3414
  const isDragging = ref(false);
3415
3415
  const isDragEndWaitingMovingEndRef = ref(false);
3416
+ let isZoom = false;
3417
+ let zoomStartCenter = void 0;
3416
3418
  let watchId = void 0;
3417
3419
  const emitDragStart = () => {
3418
3420
  pipeAsync(() => {
3419
3421
  isDragging.value = true;
3420
3422
  })();
3421
3423
  };
3424
+ const handleZoomStart = () => {
3425
+ var _a;
3426
+ isZoom = true;
3427
+ zoomStartCenter = (_a = mapRef.value) == null ? void 0 : _a.getCenter().toJSON();
3428
+ };
3429
+ const handleChange = (value) => {
3430
+ console.log("useAmapDrag value, zoomStartCenter = ", value, zoomStartCenter);
3431
+ if (isZoom) {
3432
+ isZoom = false;
3433
+ if (isPointEqual(value, zoomStartCenter))
3434
+ return;
3435
+ }
3436
+ onChange == null ? void 0 : onChange(value);
3437
+ };
3422
3438
  const handleDragEndWithAnimationEnd = (target) => {
3423
3439
  var _a;
3424
3440
  isDragEndWaitingMovingEndRef.value = false;
@@ -3426,7 +3442,7 @@ const useAmapDrag = (props) => {
3426
3442
  const { lng, lat } = target.getCenter();
3427
3443
  spaceLog("onDragEndWithAnimationEnd", "[lng, lat] = ", [lng, lat]);
3428
3444
  centerRef.value = [lng, lat];
3429
- (_a = pipeAsync(onChange)) == null ? void 0 : _a([lng, lat]);
3445
+ (_a = pipeAsync(handleChange)) == null ? void 0 : _a([lng, lat]);
3430
3446
  };
3431
3447
  const emitDragEnd = (_, { target }) => {
3432
3448
  const { lng: baseLng, lat: baseLat } = target.getCenter();
@@ -3448,6 +3464,9 @@ const useAmapDrag = (props) => {
3448
3464
  return;
3449
3465
  handleDragEndWithAnimationEnd(target);
3450
3466
  };
3467
+ watchPostEffectForAMapEvent(mapRef, {}, handleZoomStart, [
3468
+ "onZoomStart"
3469
+ ]);
3451
3470
  watchPostEffectForAMapEvent(mapRef, {}, emitDragStart, [
3452
3471
  "onDragStart"
3453
3472
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",
package/todo.md CHANGED
@@ -1,131 +1,6 @@
1
1
  https://dawchihliou.github.io/articles/building-custom-google-maps-marker-react-component-like-airbnb-in-nextjs
2
2
 
3
- 2. Google 地址名称太长
4
- 3. 高德地图加载期间出现大量的请求
5
- 4. map 的两个 slot loading 和 error slot 没有生效
6
- 5. 企业微信如果关闭定位,会不停的跳 geoError 事件
7
-
8
- 二期:
9
-
10
- 1. 绿区数据格式约定
11
- 2. map loading 设计稿
12
-
13
- 缩放问题
14
-
15
- - 4867
16
- - 4920
17
-
18
- 章新华
19
-
20
- - 5238
21
-
22
- 不明白的
23
-
24
- - 5294
25
-
26
- 需要复现
27
-
28
- - 5044
29
- - 5113
30
- - 5291
31
- - 5257 我的 safari 没有问题
32
-
33
- 0.4.3
34
-
35
- - 5105
36
-
37
- 0.4.4
38
-
39
- - 5057
40
-
41
- 0.4.5
42
-
43
- - 5215
44
-
45
- 0.4.6
46
-
47
- - 4824
48
- - 4809
49
- - 4836
50
- - 4915
51
- - 5228
52
-
53
- 0.4.8
54
-
55
- - 5014
56
-
57
- 0.4.9
58
-
59
- - 4903
60
- - 5006
61
- - 5017
62
- - 5238
63
-
64
- 0.5.0
65
-
66
- - 5284
67
- - 5314
68
- - 5313
69
- - 5297
70
- - 5277
71
- - 5244
72
- - 5198
73
- - 5173
74
- - 5168
75
-
76
- 0.5.1
77
-
78
- - 5303
79
- - 5329
80
- - 4769
81
- - 5044 (跟章新华说下)
82
- - 5314
83
- - 5347
84
- - 5348
85
- - 5057
86
-
87
- 0.5.3
88
-
89
- - 4867
90
- - 4920
91
- - 5252
92
- - 5366
93
- - 5364
94
- - 5373
95
-
96
- 0.5.4
97
-
98
- - 5375
99
- - 4946
100
-
101
- 0.5.5
102
-
103
- - 4977
104
- - 5381
105
-
106
- 0.5.6
107
-
108
- - 5455
109
-
110
- 0.5.9
111
-
112
- - 5500
113
- - 5524
114
-
115
- 0.6.3
116
-
117
- - 5623
118
- - 5625
119
- - 5550
120
- - 5546
121
- - 5541
122
- - 5540
123
-
124
- 0.6.5
125
-
126
- - 5640
127
- - 5631
128
- - 5614
129
- - 5598
130
- - 5567
131
- - 5560
3
+ 1. Google 地址名称太长
4
+ 2. 企业微信如果关闭定位,会不停的跳 geoError 事件
5
+ 3. regeo 不应该阻塞 getRecommendPlace
6
+ 4. 手机缩放导致 onPlaceChange 触发,并且 getRecommendPlace 也被调用了