@heycar/heycars-map 2.4.2 → 2.4.4

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.
@@ -1,2 +1,2 @@
1
1
  import type { CoordinatePoint } from "../types/interface";
2
- export declare function isCoordinatePointEqual(p1: CoordinatePoint, p2?: CoordinatePoint): boolean;
2
+ export declare function isCoordinatePointEqual(input1: CoordinatePoint, input2?: CoordinatePoint): boolean;
@@ -1,8 +1,11 @@
1
1
  import { e as exported } from "../chunks/gcoord.esm-bundler.3f2f1369.js";
2
+ import { toCoordinatePointType } from "../utils/typeChecking.js";
2
3
  const GCOORD_ACCURCY_RANGE = 1e-6;
3
- function isCoordinatePointEqual(p1, p2) {
4
- if (!p2)
4
+ function isCoordinatePointEqual(input1, input2) {
5
+ if (!input2)
5
6
  return false;
7
+ const p1 = toCoordinatePointType(input1);
8
+ const p2 = toCoordinatePointType(input2);
6
9
  if (p1.type === p2.type)
7
10
  return p1.lng === p2.lng && p1.lat === p2.lat;
8
11
  const { lng: x1, lat: y1 } = p1.type === "gcj02" ? p1 : p2;
@@ -12,6 +12,15 @@ const GREEN_ZONE_FILL_COLOR = "#C7E5FB";
12
12
  const GREEN_ZONE_FILL_OPACITY = 0.5;
13
13
  const GREEN_ZONE_STROKE_COLOR = "#4BA7FF";
14
14
  const GREEN_ZONE_STROKE_WEIGHT_VW = 1;
15
+ const toClosedPath = (path) => {
16
+ const first = path[0];
17
+ if (!first)
18
+ return path;
19
+ const last = path.slice(-1)[0];
20
+ if (first.lng === last.lng && first.lat === last.lat)
21
+ return path;
22
+ return [...path, first];
23
+ };
15
24
  const AGreenZone = defineSetup("AGreenZone", function(props) {
16
25
  const strokeWeight = GREEN_ZONE_STROKE_WEIGHT_VW * globalThis.innerWidth / 100;
17
26
  return () => {
@@ -39,6 +48,7 @@ const GGreenZone = defineSetup("GGreenZone", function(props) {
39
48
  };
40
49
  return () => {
41
50
  const path = pathRef.value;
51
+ const closedPath = toClosedPath(path);
42
52
  return h("div", [h(GmapPolygon, {
43
53
  "attrs": {
44
54
  "registerOverlay": props.registerOverlay,
@@ -52,14 +62,16 @@ const GGreenZone = defineSetup("GGreenZone", function(props) {
52
62
  }
53
63
  }), h(GmapPolyline, {
54
64
  "attrs": {
55
- "path": path,
65
+ "path": closedPath,
56
66
  "strokeColor": GREEN_ZONE_STROKE_COLOR,
57
67
  "strokeWeight": GREEN_ZONE_STROKE_WEIGHT_VW,
68
+ "strokeOpacity": 0,
58
69
  "icons": [{
59
70
  icon: lineSymbol,
60
71
  offset: "0",
61
72
  repeat: "20px"
62
- }]
73
+ }],
74
+ "zIndex": ZINDEX_GREEN_ZONE
63
75
  }
64
76
  })]);
65
77
  };
@@ -1,4 +1,4 @@
1
- import "../../css/Gmap-26ef76ca.css";
1
+ import "../../css/Gmap-90a0d638.css";
2
2
  import { computed, shallowRef, watchPostEffect, watch } from "vue-demi";
3
3
  import { createElement } from "../../demi-polyfill/demi-polyfill.js";
4
4
  import { provideGmap } from "../../hooks/useMap.js";
@@ -24,7 +24,10 @@ const GmapPolygon = defineSetup("GmapPolygon", function(props) {
24
24
  (_a = polygonRef.value) == null ? void 0 : _a.setMap(map);
25
25
  });
26
26
  watchNoneImmediatePostEffectForDeepOption(
27
- () => ({ ...props }),
27
+ () => {
28
+ const { registerOverlay: registerOverlay2, ...restProps } = props;
29
+ return restProps;
30
+ },
28
31
  (props2) => {
29
32
  var _a;
30
33
  (_a = polygonRef.value) == null ? void 0 : _a.setOptions({ ...props2 });
@@ -24,7 +24,10 @@ const GmapPolyline = defineSetup("GmapPolyline", function(props) {
24
24
  (_a = polylineRef.value) == null ? void 0 : _a.setMap(map);
25
25
  });
26
26
  watchNoneImmediatePostEffectForDeepOption(
27
- () => ({ ...props }),
27
+ () => {
28
+ const { registerOverlay: registerOverlay2, ...restProps } = props;
29
+ return restProps;
30
+ },
28
31
  (props2) => {
29
32
  var _a;
30
33
  (_a = polylineRef.value) == null ? void 0 : _a.setOptions({ ...props2 });
@@ -20,4 +20,7 @@ a[title*="Google"]>div>img[alt="Google"], .gmnoprint {
20
20
  }
21
21
  ._7anfuo0 .gm-style iframe + div {
22
22
  border: none !important;
23
+ }
24
+ ._7anfuo0 div[role=alertdialog]:has(a[href="https://developers.google.com/maps/documentation/javascript/error-messages"]) {
25
+ z-index: 2;
23
26
  }
@@ -115,11 +115,18 @@ const useGmapGestureZoomCenter = (props) => {
115
115
  }
116
116
  });
117
117
  };
118
+ const disableDefaultBehavior = (e) => e.preventDefault();
119
+ element.addEventListener("touchstart", disableDefaultBehavior, true);
120
+ element.addEventListener("touchmove", disableDefaultBehavior, true);
121
+ element.addEventListener("touchend", disableDefaultBehavior, true);
118
122
  element.addEventListener("touchstart", handleTouchStart, { passive: true });
119
123
  element.addEventListener("touchmove", handleTouchMove, { passive: true });
120
124
  element.addEventListener("touchend", handleTouchEnd, { passive: true });
121
125
  const unsubscribeDoubleTap = subscribeDoubleTap(element, handleDoubleTap);
122
126
  onCleanup(() => {
127
+ element.removeEventListener("touchstart", disableDefaultBehavior, true);
128
+ element.removeEventListener("touchmove", disableDefaultBehavior, true);
129
+ element.removeEventListener("touchend", disableDefaultBehavior, true);
123
130
  element.removeEventListener("touchstart", handleTouchStart);
124
131
  element.removeEventListener("touchmove", handleTouchMove);
125
132
  element.removeEventListener("touchend", handleTouchEnd);
@@ -691,7 +691,7 @@ const useGmapLoader = (props) => {
691
691
  statusRef.value = "SUCCESS";
692
692
  resolveLoader();
693
693
  onSuccess == null ? void 0 : onSuccess();
694
- setTimeout(onDownloadOptimizeEndOnce, 500);
694
+ onDownloadOptimizeEndOnce(Date.now() - startTime);
695
695
  },
696
696
  () => {
697
697
  if (signal == null ? void 0 : signal.aborted)
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.4.1";
3
+ const pkgVersion = "2.4.4";
4
4
  const isEnableLog = (name) => {
5
5
  const searchParam = new URLSearchParams(location.search);
6
6
  return searchParam.has(`log-${name}`);
@@ -1,2 +1,2 @@
1
1
  import type { CoordinatePoint } from "../types/interface";
2
- export declare function isCoordinatePointEqual(p1: CoordinatePoint, p2?: CoordinatePoint): boolean;
2
+ export declare function isCoordinatePointEqual(input1: CoordinatePoint, input2?: CoordinatePoint): boolean;
@@ -1,8 +1,11 @@
1
1
  import { e as exported } from "../chunks/gcoord.esm-bundler.3f2f1369.js";
2
+ import { toCoordinatePointType } from "../utils/typeChecking.js";
2
3
  const GCOORD_ACCURCY_RANGE = 1e-6;
3
- function isCoordinatePointEqual(p1, p2) {
4
- if (!p2)
4
+ function isCoordinatePointEqual(input1, input2) {
5
+ if (!input2)
5
6
  return false;
7
+ const p1 = toCoordinatePointType(input1);
8
+ const p2 = toCoordinatePointType(input2);
6
9
  if (p1.type === p2.type)
7
10
  return p1.lng === p2.lng && p1.lat === p2.lat;
8
11
  const { lng: x1, lat: y1 } = p1.type === "gcj02" ? p1 : p2;
@@ -12,6 +12,15 @@ const GREEN_ZONE_FILL_COLOR = "#C7E5FB";
12
12
  const GREEN_ZONE_FILL_OPACITY = 0.5;
13
13
  const GREEN_ZONE_STROKE_COLOR = "#4BA7FF";
14
14
  const GREEN_ZONE_STROKE_WEIGHT_VW = 1;
15
+ const toClosedPath = (path) => {
16
+ const first = path[0];
17
+ if (!first)
18
+ return path;
19
+ const last = path.slice(-1)[0];
20
+ if (first.lng === last.lng && first.lat === last.lat)
21
+ return path;
22
+ return [...path, first];
23
+ };
15
24
  const AGreenZone = defineSetup("AGreenZone", function(props) {
16
25
  const strokeWeight = GREEN_ZONE_STROKE_WEIGHT_VW * globalThis.innerWidth / 100;
17
26
  return () => {
@@ -37,6 +46,7 @@ const GGreenZone = defineSetup("GGreenZone", function(props) {
37
46
  };
38
47
  return () => {
39
48
  const path = pathRef.value;
49
+ const closedPath = toClosedPath(path);
40
50
  return createVNode("div", null, [createVNode(GmapPolygon, {
41
51
  "registerOverlay": props.registerOverlay,
42
52
  "paths": path,
@@ -47,14 +57,16 @@ const GGreenZone = defineSetup("GGreenZone", function(props) {
47
57
  "fillOpacity": GREEN_ZONE_FILL_OPACITY,
48
58
  "zIndex": ZINDEX_GREEN_ZONE
49
59
  }, null), createVNode(GmapPolyline, {
50
- "path": path,
60
+ "path": closedPath,
51
61
  "strokeColor": GREEN_ZONE_STROKE_COLOR,
52
62
  "strokeWeight": GREEN_ZONE_STROKE_WEIGHT_VW,
63
+ "strokeOpacity": 0,
53
64
  "icons": [{
54
65
  icon: lineSymbol,
55
66
  offset: "0",
56
67
  repeat: "20px"
57
- }]
68
+ }],
69
+ "zIndex": ZINDEX_GREEN_ZONE
58
70
  }, null)]);
59
71
  };
60
72
  });
@@ -1,4 +1,4 @@
1
- import "../../css/Gmap-26ef76ca.css";
1
+ import "../../css/Gmap-90a0d638.css";
2
2
  import { computed, shallowRef, watchPostEffect, watch } from "vue-demi";
3
3
  import { createElement } from "../../demi-polyfill/demi-polyfill.js";
4
4
  import { provideGmap } from "../../hooks/useMap.js";
@@ -24,7 +24,10 @@ const GmapPolygon = defineSetup("GmapPolygon", function(props) {
24
24
  (_a = polygonRef.value) == null ? void 0 : _a.setMap(map);
25
25
  });
26
26
  watchNoneImmediatePostEffectForDeepOption(
27
- () => ({ ...props }),
27
+ () => {
28
+ const { registerOverlay: registerOverlay2, ...restProps } = props;
29
+ return restProps;
30
+ },
28
31
  (props2) => {
29
32
  var _a;
30
33
  (_a = polygonRef.value) == null ? void 0 : _a.setOptions({ ...props2 });
@@ -24,7 +24,10 @@ const GmapPolyline = defineSetup("GmapPolyline", function(props) {
24
24
  (_a = polylineRef.value) == null ? void 0 : _a.setMap(map);
25
25
  });
26
26
  watchNoneImmediatePostEffectForDeepOption(
27
- () => ({ ...props }),
27
+ () => {
28
+ const { registerOverlay: registerOverlay2, ...restProps } = props;
29
+ return restProps;
30
+ },
28
31
  (props2) => {
29
32
  var _a;
30
33
  (_a = polylineRef.value) == null ? void 0 : _a.setOptions({ ...props2 });
@@ -20,4 +20,7 @@ a[title*="Google"]>div>img[alt="Google"], .gmnoprint {
20
20
  }
21
21
  ._7anfuo0 .gm-style iframe + div {
22
22
  border: none !important;
23
+ }
24
+ ._7anfuo0 div[role=alertdialog]:has(a[href="https://developers.google.com/maps/documentation/javascript/error-messages"]) {
25
+ z-index: 2;
23
26
  }
@@ -115,11 +115,18 @@ const useGmapGestureZoomCenter = (props) => {
115
115
  }
116
116
  });
117
117
  };
118
+ const disableDefaultBehavior = (e) => e.preventDefault();
119
+ element.addEventListener("touchstart", disableDefaultBehavior, true);
120
+ element.addEventListener("touchmove", disableDefaultBehavior, true);
121
+ element.addEventListener("touchend", disableDefaultBehavior, true);
118
122
  element.addEventListener("touchstart", handleTouchStart, { passive: true });
119
123
  element.addEventListener("touchmove", handleTouchMove, { passive: true });
120
124
  element.addEventListener("touchend", handleTouchEnd, { passive: true });
121
125
  const unsubscribeDoubleTap = subscribeDoubleTap(element, handleDoubleTap);
122
126
  onCleanup(() => {
127
+ element.removeEventListener("touchstart", disableDefaultBehavior, true);
128
+ element.removeEventListener("touchmove", disableDefaultBehavior, true);
129
+ element.removeEventListener("touchend", disableDefaultBehavior, true);
123
130
  element.removeEventListener("touchstart", handleTouchStart);
124
131
  element.removeEventListener("touchmove", handleTouchMove);
125
132
  element.removeEventListener("touchend", handleTouchEnd);
@@ -691,7 +691,7 @@ const useGmapLoader = (props) => {
691
691
  statusRef.value = "SUCCESS";
692
692
  resolveLoader();
693
693
  onSuccess == null ? void 0 : onSuccess();
694
- setTimeout(onDownloadOptimizeEndOnce, 500);
694
+ onDownloadOptimizeEndOnce(Date.now() - startTime);
695
695
  },
696
696
  () => {
697
697
  if (signal == null ? void 0 : signal.aborted)
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.4.1";
3
+ const pkgVersion = "2.4.4";
4
4
  const isEnableLog = (name) => {
5
5
  const searchParam = new URLSearchParams(location.search);
6
6
  return searchParam.has(`log-${name}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "2.4.2",
3
+ "version": "2.4.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js",