@heycar/heycars-map 0.8.9 → 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 +34 -6
- package/dist/index.js +34 -6
- package/package.json +1 -1
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.
|
|
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
|
|
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
|
|
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 =
|
|
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
|
-
"
|
|
6201
|
+
"filterNoOverlapPlaces",
|
|
6174
6202
|
"p1, p2, dx, dy, isOverlap = ",
|
|
6175
6203
|
place1.displayName,
|
|
6176
6204
|
place2.displayName,
|
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.
|
|
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
|
|
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
|
|
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 =
|
|
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
|
-
"
|
|
6199
|
+
"filterNoOverlapPlaces",
|
|
6172
6200
|
"p1, p2, dx, dy, isOverlap = ",
|
|
6173
6201
|
place1.displayName,
|
|
6174
6202
|
place2.displayName,
|