@heycar/heycars-map 0.8.5 → 0.8.7

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 CHANGED
@@ -9,7 +9,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
9
  const Vue = require("vue");
10
10
  const style = "";
11
11
  const name = "@heycar/heycars-map";
12
- const version = "0.8.5";
12
+ const version = "0.8.7";
13
13
  const type = "module";
14
14
  const scripts = {
15
15
  dev: "vite -c vite.config.dev.ts",
@@ -2224,7 +2224,6 @@ const useAmapLngLatToVw = (props) => {
2224
2224
  const [x1, y1] = apiMapLngLatToVw(point1);
2225
2225
  const [x2, y2] = apiMapLngLatToVw(point2);
2226
2226
  const result = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
2227
- console.log("distance = ", result);
2228
2227
  return result;
2229
2228
  };
2230
2229
  return { apiMapLngLatToVw, apiMapDistanceVwOfPoints };
@@ -6085,7 +6084,6 @@ const useMapZoom = (props) => {
6085
6084
  const { supplier } = useMapSupplier();
6086
6085
  return supplier === "gmap" ? useGmapZoom(props) : useAmapZoom(props);
6087
6086
  };
6088
- const reverse = (direction) => direction === "left" ? "right" : "left";
6089
6087
  const usePointsLabelDirection = (props) => {
6090
6088
  const { widthLimit, heightLimit } = props;
6091
6089
  const mapRef = useMap();
@@ -6115,7 +6113,7 @@ const usePointsLabelDirection = (props) => {
6115
6113
  distanceFn: diffVw
6116
6114
  });
6117
6115
  const directions = createLabelDirections({
6118
- sortedPoints: sortedPlaces.map(place2point),
6116
+ sortedPoints: noOverlapPlaces.map(place2point),
6119
6117
  widthLimit,
6120
6118
  heightLimit,
6121
6119
  distanceFn: diffVw
@@ -6132,7 +6130,7 @@ function createLabelDirections(props) {
6132
6130
  const result = [];
6133
6131
  const calcDirection = (isLimited2, isDoubleLimited2, prevDx2, prevDirection2) => {
6134
6132
  if (isLimited2)
6135
- return reverse(prevDirection2);
6133
+ return prevDx2 > 0 ? "right" : "left";
6136
6134
  if (isDoubleLimited2 && prevDx2 < 0 && prevDirection2 === "left")
6137
6135
  return "left";
6138
6136
  return "right";
@@ -6142,6 +6140,7 @@ function createLabelDirections(props) {
6142
6140
  let isDoubleLimited = false;
6143
6141
  let prevDx = Infinity;
6144
6142
  for (let idx = 0; idx < len; idx++) {
6143
+ debugger;
6145
6144
  if (idx === len - 1) {
6146
6145
  const direction2 = calcDirection(isLimited, isDoubleLimited, prevDx, prevDirection);
6147
6146
  result.push(direction2);
@@ -6195,7 +6194,7 @@ function filterNoOverlapPlaces(props) {
6195
6194
  }
6196
6195
  return nextPlaces;
6197
6196
  }
6198
- const findRelation = (places, measureRelate) => {
6197
+ const findSequenceRelation = (places, measureRelate) => {
6199
6198
  let isPrevRelated = false;
6200
6199
  let isNextRelated = false;
6201
6200
  let isFound = false;
@@ -6237,6 +6236,14 @@ const findMax = (list, measure) => {
6237
6236
  }
6238
6237
  return list[index];
6239
6238
  };
6239
+ const find3ItemFullRelation = (places, measureRelate) => {
6240
+ const [p1, p2, p3] = places;
6241
+ const count = Number(measureRelate(p1, p2)) + Number(measureRelate(p1, p3)) + Number(measureRelate(p2, p3));
6242
+ return count >= 2 ? places : [];
6243
+ };
6244
+ const findRelation = (places, measureRelate) => {
6245
+ return places.length === 3 ? find3ItemFullRelation(places, measureRelate) : findSequenceRelation(places, measureRelate);
6246
+ };
6240
6247
  var AnchorType = /* @__PURE__ */ ((AnchorType2) => {
6241
6248
  AnchorType2["topLeft"] = "top-left";
6242
6249
  AnchorType2["topCenter"] = "top-center";
@@ -6425,8 +6432,8 @@ const PickupPoints = defineSetup(function PickupPoints2(props, {
6425
6432
  });
6426
6433
  const RECOMMEND_PLACE_DRAG_LIMIT = 10;
6427
6434
  const RECOMMEND_PLACE_LARGE_LIMIT = 100;
6428
- const RECOMMEND_PLACE_ICON_ZOOM_MIN = 15.75;
6429
- const RECOMMEND_PLACE_TEXT_ZOOM_MIN = 16.75;
6435
+ const RECOMMEND_PLACE_ICON_ZOOM_MIN = 16.25;
6436
+ const RECOMMEND_PLACE_TEXT_ZOOM_MIN = 16.25;
6430
6437
  const DEFAULT_PLACE_NAME = "当前位置";
6431
6438
  const DEFAULT_ZOOM = 17;
6432
6439
  const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlaceMap2(props, {
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 = "";
9
9
  const name = "@heycar/heycars-map";
10
- const version = "0.8.5";
10
+ const version = "0.8.7";
11
11
  const type = "module";
12
12
  const scripts = {
13
13
  dev: "vite -c vite.config.dev.ts",
@@ -2222,7 +2222,6 @@ const useAmapLngLatToVw = (props) => {
2222
2222
  const [x1, y1] = apiMapLngLatToVw(point1);
2223
2223
  const [x2, y2] = apiMapLngLatToVw(point2);
2224
2224
  const result = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
2225
- console.log("distance = ", result);
2226
2225
  return result;
2227
2226
  };
2228
2227
  return { apiMapLngLatToVw, apiMapDistanceVwOfPoints };
@@ -6083,7 +6082,6 @@ const useMapZoom = (props) => {
6083
6082
  const { supplier } = useMapSupplier();
6084
6083
  return supplier === "gmap" ? useGmapZoom(props) : useAmapZoom(props);
6085
6084
  };
6086
- const reverse = (direction) => direction === "left" ? "right" : "left";
6087
6085
  const usePointsLabelDirection = (props) => {
6088
6086
  const { widthLimit, heightLimit } = props;
6089
6087
  const mapRef = useMap();
@@ -6113,7 +6111,7 @@ const usePointsLabelDirection = (props) => {
6113
6111
  distanceFn: diffVw
6114
6112
  });
6115
6113
  const directions = createLabelDirections({
6116
- sortedPoints: sortedPlaces.map(place2point),
6114
+ sortedPoints: noOverlapPlaces.map(place2point),
6117
6115
  widthLimit,
6118
6116
  heightLimit,
6119
6117
  distanceFn: diffVw
@@ -6130,7 +6128,7 @@ function createLabelDirections(props) {
6130
6128
  const result = [];
6131
6129
  const calcDirection = (isLimited2, isDoubleLimited2, prevDx2, prevDirection2) => {
6132
6130
  if (isLimited2)
6133
- return reverse(prevDirection2);
6131
+ return prevDx2 > 0 ? "right" : "left";
6134
6132
  if (isDoubleLimited2 && prevDx2 < 0 && prevDirection2 === "left")
6135
6133
  return "left";
6136
6134
  return "right";
@@ -6140,6 +6138,7 @@ function createLabelDirections(props) {
6140
6138
  let isDoubleLimited = false;
6141
6139
  let prevDx = Infinity;
6142
6140
  for (let idx = 0; idx < len; idx++) {
6141
+ debugger;
6143
6142
  if (idx === len - 1) {
6144
6143
  const direction2 = calcDirection(isLimited, isDoubleLimited, prevDx, prevDirection);
6145
6144
  result.push(direction2);
@@ -6193,7 +6192,7 @@ function filterNoOverlapPlaces(props) {
6193
6192
  }
6194
6193
  return nextPlaces;
6195
6194
  }
6196
- const findRelation = (places, measureRelate) => {
6195
+ const findSequenceRelation = (places, measureRelate) => {
6197
6196
  let isPrevRelated = false;
6198
6197
  let isNextRelated = false;
6199
6198
  let isFound = false;
@@ -6235,6 +6234,14 @@ const findMax = (list, measure) => {
6235
6234
  }
6236
6235
  return list[index];
6237
6236
  };
6237
+ const find3ItemFullRelation = (places, measureRelate) => {
6238
+ const [p1, p2, p3] = places;
6239
+ const count = Number(measureRelate(p1, p2)) + Number(measureRelate(p1, p3)) + Number(measureRelate(p2, p3));
6240
+ return count >= 2 ? places : [];
6241
+ };
6242
+ const findRelation = (places, measureRelate) => {
6243
+ return places.length === 3 ? find3ItemFullRelation(places, measureRelate) : findSequenceRelation(places, measureRelate);
6244
+ };
6238
6245
  var AnchorType = /* @__PURE__ */ ((AnchorType2) => {
6239
6246
  AnchorType2["topLeft"] = "top-left";
6240
6247
  AnchorType2["topCenter"] = "top-center";
@@ -6423,8 +6430,8 @@ const PickupPoints = defineSetup(function PickupPoints2(props, {
6423
6430
  });
6424
6431
  const RECOMMEND_PLACE_DRAG_LIMIT = 10;
6425
6432
  const RECOMMEND_PLACE_LARGE_LIMIT = 100;
6426
- const RECOMMEND_PLACE_ICON_ZOOM_MIN = 15.75;
6427
- const RECOMMEND_PLACE_TEXT_ZOOM_MIN = 16.75;
6433
+ const RECOMMEND_PLACE_ICON_ZOOM_MIN = 16.25;
6434
+ const RECOMMEND_PLACE_TEXT_ZOOM_MIN = 16.25;
6428
6435
  const DEFAULT_PLACE_NAME = "当前位置";
6429
6436
  const DEFAULT_ZOOM = 17;
6430
6437
  const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlaceMap2(props, {
@@ -8,8 +8,8 @@ import type { Place, Point } from "../../types/interface";
8
8
  import { AbsoluteAddressBoxProps } from "../AbsoluteAddressBox";
9
9
  export declare const RECOMMEND_PLACE_DRAG_LIMIT = 10;
10
10
  export declare const RECOMMEND_PLACE_LARGE_LIMIT = 100;
11
- export declare const RECOMMEND_PLACE_ICON_ZOOM_MIN = 15.75;
12
- export declare const RECOMMEND_PLACE_TEXT_ZOOM_MIN = 16.75;
11
+ export declare const RECOMMEND_PLACE_ICON_ZOOM_MIN = 16.25;
12
+ export declare const RECOMMEND_PLACE_TEXT_ZOOM_MIN = 16.25;
13
13
  export declare const DEFAULT_PLACE_NAME = "\u5F53\u524D\u4F4D\u7F6E";
14
14
  export declare const DEFAULT_ZOOM = 17;
15
15
  export interface CenterPlaceSource {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",