@heycar/heycars-map 0.8.8 → 0.8.10

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.8";
12
+ const version = "0.8.10";
13
13
  const type = "module";
14
14
  const scripts = {
15
15
  dev: "vite -c vite.config.dev.ts",
@@ -6127,11 +6127,23 @@ function createLabelDirections(props) {
6127
6127
  const { sortedPoints, widthLimit, heightLimit, distanceFn } = props;
6128
6128
  const len = sortedPoints.length;
6129
6129
  const result = [];
6130
- const calcDirection = (isLimited2, isDoubleLimited2, prevDx2, prevDirection2) => {
6130
+ const calcDirection = (isLimited2, isDoubleLimited2, prevDx2, prevDirection2, isNextLimited, dx) => {
6131
+ spaceLog(
6132
+ "calcDirection",
6133
+ "isLimited, isDoubleLimited, prevDx, prevDirection, isNextLimited, dx = ",
6134
+ isLimited2,
6135
+ isDoubleLimited2,
6136
+ prevDx2,
6137
+ prevDirection2,
6138
+ isNextLimited,
6139
+ dx
6140
+ );
6131
6141
  if (isLimited2)
6132
6142
  return prevDx2 > 0 ? "right" : "left";
6133
6143
  if (isDoubleLimited2 && prevDx2 < 0 && prevDirection2 === "left")
6134
6144
  return "left";
6145
+ if (isNextLimited)
6146
+ return dx > 0 ? "left" : "right";
6135
6147
  return "right";
6136
6148
  };
6137
6149
  let prevDirection = "right";
@@ -6140,7 +6152,15 @@ function createLabelDirections(props) {
6140
6152
  let prevDx = Infinity;
6141
6153
  for (let idx = 0; idx < len; idx++) {
6142
6154
  if (idx === len - 1) {
6143
- const direction2 = calcDirection(isLimited, isDoubleLimited, prevDx, prevDirection);
6155
+ const isNextLimited2 = false;
6156
+ const direction2 = calcDirection(
6157
+ isLimited,
6158
+ isDoubleLimited,
6159
+ prevDx,
6160
+ prevDirection,
6161
+ isNextLimited2,
6162
+ 0
6163
+ );
6144
6164
  result.push(direction2);
6145
6165
  continue;
6146
6166
  }
@@ -6155,11 +6175,19 @@ function createLabelDirections(props) {
6155
6175
  continue;
6156
6176
  }
6157
6177
  const [dx, dy] = distanceFn(sortedPoints[idx], sortedPoints[idx + 1]);
6158
- const direction = calcDirection(isLimited, isDoubleLimited, prevDx, prevDirection);
6178
+ const isNextLimited = dx > -widthLimit && dx < widthLimit && dy > -heightLimit && dy < heightLimit;
6179
+ const direction = calcDirection(
6180
+ isLimited,
6181
+ isDoubleLimited,
6182
+ prevDx,
6183
+ prevDirection,
6184
+ isNextLimited,
6185
+ dx
6186
+ );
6159
6187
  result.push(direction);
6160
6188
  prevDirection = direction;
6161
6189
  prevDx = dx;
6162
- isLimited = dx > -widthLimit && dx < widthLimit && dy > -heightLimit && dy < heightLimit;
6190
+ isLimited = isNextLimited;
6163
6191
  isDoubleLimited = dx > -widthLimit * 2 && dx < widthLimit * 2 && dy > -heightLimit && dy < heightLimit;
6164
6192
  }
6165
6193
  return result;
@@ -6170,7 +6198,7 @@ function filterNoOverlapPlaces(props) {
6170
6198
  const [dx, dy] = distanceFn(place2point(place1), place2point(place2));
6171
6199
  const isOverlap = dx > -widthLimit && dx < widthLimit && dy > -heightLimit && dy < heightLimit;
6172
6200
  spaceLog(
6173
- "usePointsLabelDirection",
6201
+ "filterNoOverlapPlaces",
6174
6202
  "p1, p2, dx, dy, isOverlap = ",
6175
6203
  place1.displayName,
6176
6204
  place2.displayName,
@@ -7418,7 +7446,7 @@ const SectionDriverStartService = defineSetup(function SectionDriverStartService
7418
7446
  distance,
7419
7447
  duration
7420
7448
  }) => {
7421
- var _a;
7449
+ var _a, _b;
7422
7450
  spaceLog("angleDifference", "carPosition, routeAngle, driverAngle = ", carPosition, angle, carAngle);
7423
7451
  return [Vue.h(DrivingLine, {
7424
7452
  "attrs": {
@@ -7437,7 +7465,7 @@ const SectionDriverStartService = defineSetup(function SectionDriverStartService
7437
7465
  }), Vue.h(KeyedFitView, {
7438
7466
  "attrs": {
7439
7467
  "registerOverlay": registerOverlay,
7440
- "fitViewKey": JSON.stringify(carPosition)
7468
+ "fitViewKey": JSON.stringify((_b = path[0]) != null ? _b : carPosition)
7441
7469
  }
7442
7470
  })];
7443
7471
  }
@@ -7643,7 +7671,7 @@ const SectionInService = defineSetup(function SectionInService2(props) {
7643
7671
  distance,
7644
7672
  duration
7645
7673
  }) => {
7646
- var _a;
7674
+ var _a, _b;
7647
7675
  spaceLog("angleDifference", "carPosition, routeAngle, driverAngle = ", carPosition, angle, carAngle);
7648
7676
  return [Vue.h(DrivingLine, {
7649
7677
  "attrs": {
@@ -7662,7 +7690,7 @@ const SectionInService = defineSetup(function SectionInService2(props) {
7662
7690
  }), Vue.h(KeyedFitView, {
7663
7691
  "attrs": {
7664
7692
  "registerOverlay": registerOverlay,
7665
- "fitViewKey": JSON.stringify(carPosition)
7693
+ "fitViewKey": JSON.stringify((_b = path[0]) != null ? _b : carPosition)
7666
7694
  }
7667
7695
  })];
7668
7696
  }
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.8";
10
+ const version = "0.8.10";
11
11
  const type = "module";
12
12
  const scripts = {
13
13
  dev: "vite -c vite.config.dev.ts",
@@ -6125,11 +6125,23 @@ function createLabelDirections(props) {
6125
6125
  const { sortedPoints, widthLimit, heightLimit, distanceFn } = props;
6126
6126
  const len = sortedPoints.length;
6127
6127
  const result = [];
6128
- const calcDirection = (isLimited2, isDoubleLimited2, prevDx2, prevDirection2) => {
6128
+ const calcDirection = (isLimited2, isDoubleLimited2, prevDx2, prevDirection2, isNextLimited, dx) => {
6129
+ spaceLog(
6130
+ "calcDirection",
6131
+ "isLimited, isDoubleLimited, prevDx, prevDirection, isNextLimited, dx = ",
6132
+ isLimited2,
6133
+ isDoubleLimited2,
6134
+ prevDx2,
6135
+ prevDirection2,
6136
+ isNextLimited,
6137
+ dx
6138
+ );
6129
6139
  if (isLimited2)
6130
6140
  return prevDx2 > 0 ? "right" : "left";
6131
6141
  if (isDoubleLimited2 && prevDx2 < 0 && prevDirection2 === "left")
6132
6142
  return "left";
6143
+ if (isNextLimited)
6144
+ return dx > 0 ? "left" : "right";
6133
6145
  return "right";
6134
6146
  };
6135
6147
  let prevDirection = "right";
@@ -6138,7 +6150,15 @@ function createLabelDirections(props) {
6138
6150
  let prevDx = Infinity;
6139
6151
  for (let idx = 0; idx < len; idx++) {
6140
6152
  if (idx === len - 1) {
6141
- const direction2 = calcDirection(isLimited, isDoubleLimited, prevDx, prevDirection);
6153
+ const isNextLimited2 = false;
6154
+ const direction2 = calcDirection(
6155
+ isLimited,
6156
+ isDoubleLimited,
6157
+ prevDx,
6158
+ prevDirection,
6159
+ isNextLimited2,
6160
+ 0
6161
+ );
6142
6162
  result.push(direction2);
6143
6163
  continue;
6144
6164
  }
@@ -6153,11 +6173,19 @@ function createLabelDirections(props) {
6153
6173
  continue;
6154
6174
  }
6155
6175
  const [dx, dy] = distanceFn(sortedPoints[idx], sortedPoints[idx + 1]);
6156
- const direction = calcDirection(isLimited, isDoubleLimited, prevDx, prevDirection);
6176
+ const isNextLimited = dx > -widthLimit && dx < widthLimit && dy > -heightLimit && dy < heightLimit;
6177
+ const direction = calcDirection(
6178
+ isLimited,
6179
+ isDoubleLimited,
6180
+ prevDx,
6181
+ prevDirection,
6182
+ isNextLimited,
6183
+ dx
6184
+ );
6157
6185
  result.push(direction);
6158
6186
  prevDirection = direction;
6159
6187
  prevDx = dx;
6160
- isLimited = dx > -widthLimit && dx < widthLimit && dy > -heightLimit && dy < heightLimit;
6188
+ isLimited = isNextLimited;
6161
6189
  isDoubleLimited = dx > -widthLimit * 2 && dx < widthLimit * 2 && dy > -heightLimit && dy < heightLimit;
6162
6190
  }
6163
6191
  return result;
@@ -6168,7 +6196,7 @@ function filterNoOverlapPlaces(props) {
6168
6196
  const [dx, dy] = distanceFn(place2point(place1), place2point(place2));
6169
6197
  const isOverlap = dx > -widthLimit && dx < widthLimit && dy > -heightLimit && dy < heightLimit;
6170
6198
  spaceLog(
6171
- "usePointsLabelDirection",
6199
+ "filterNoOverlapPlaces",
6172
6200
  "p1, p2, dx, dy, isOverlap = ",
6173
6201
  place1.displayName,
6174
6202
  place2.displayName,
@@ -7416,7 +7444,7 @@ const SectionDriverStartService = defineSetup(function SectionDriverStartService
7416
7444
  distance,
7417
7445
  duration
7418
7446
  }) => {
7419
- var _a;
7447
+ var _a, _b;
7420
7448
  spaceLog("angleDifference", "carPosition, routeAngle, driverAngle = ", carPosition, angle, carAngle);
7421
7449
  return [h(DrivingLine, {
7422
7450
  "attrs": {
@@ -7435,7 +7463,7 @@ const SectionDriverStartService = defineSetup(function SectionDriverStartService
7435
7463
  }), h(KeyedFitView, {
7436
7464
  "attrs": {
7437
7465
  "registerOverlay": registerOverlay,
7438
- "fitViewKey": JSON.stringify(carPosition)
7466
+ "fitViewKey": JSON.stringify((_b = path[0]) != null ? _b : carPosition)
7439
7467
  }
7440
7468
  })];
7441
7469
  }
@@ -7641,7 +7669,7 @@ const SectionInService = defineSetup(function SectionInService2(props) {
7641
7669
  distance,
7642
7670
  duration
7643
7671
  }) => {
7644
- var _a;
7672
+ var _a, _b;
7645
7673
  spaceLog("angleDifference", "carPosition, routeAngle, driverAngle = ", carPosition, angle, carAngle);
7646
7674
  return [h(DrivingLine, {
7647
7675
  "attrs": {
@@ -7660,7 +7688,7 @@ const SectionInService = defineSetup(function SectionInService2(props) {
7660
7688
  }), h(KeyedFitView, {
7661
7689
  "attrs": {
7662
7690
  "registerOverlay": registerOverlay,
7663
- "fitViewKey": JSON.stringify(carPosition)
7691
+ "fitViewKey": JSON.stringify((_b = path[0]) != null ? _b : carPosition)
7664
7692
  }
7665
7693
  })];
7666
7694
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.8.8",
3
+ "version": "0.8.10",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",