@abdellatifui/react 3.1.77 → 3.1.78
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/nextgen.js
CHANGED
|
@@ -14142,18 +14142,26 @@ const NetworkMapComponent = forwardRef((props, ref) => {
|
|
|
14142
14142
|
}
|
|
14143
14143
|
function getFixedOffsetPosition(source, dest, offsetFromEdge = 0.5) {
|
|
14144
14144
|
var _a;
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14145
|
+
try {
|
|
14146
|
+
if (debug) {
|
|
14147
|
+
console.log("source", source);
|
|
14148
|
+
console.log("dest", dest);
|
|
14149
|
+
}
|
|
14150
|
+
const dx = dest.lng - source.lng;
|
|
14151
|
+
const dy = dest.lat - source.lat;
|
|
14152
|
+
const dist2 = Math.sqrt(dx * dx + dy * dy);
|
|
14153
|
+
const dirX = dx / dist2;
|
|
14154
|
+
const dirY = dy / dist2;
|
|
14155
|
+
const offsetLng = source.lng + dirX * offsetFromEdge;
|
|
14156
|
+
const offsetLat = source.lat + dirY * offsetFromEdge;
|
|
14157
|
+
const screenPos = mapApi.current.project([offsetLng, offsetLat]);
|
|
14158
|
+
const mapBearing = (_a = mapApi == null ? void 0 : mapApi.current) == null ? void 0 : _a.getBearing();
|
|
14159
|
+
const mapRotation = getBearing(source, dest) - mapBearing;
|
|
14160
|
+
const adjustedAngle = mapRotation + 90;
|
|
14161
|
+
return [screenPos.x, screenPos.y, adjustedAngle];
|
|
14162
|
+
} catch (e) {
|
|
14163
|
+
return [null, null, null];
|
|
14164
|
+
}
|
|
14157
14165
|
}
|
|
14158
14166
|
useMemo(() => {
|
|
14159
14167
|
var _a, _b, _c;
|
|
@@ -14164,6 +14172,9 @@ const NetworkMapComponent = forwardRef((props, ref) => {
|
|
|
14164
14172
|
var _a2, _b2, _c2;
|
|
14165
14173
|
const [offsetX, offsetY, _rotationAngle] = getFixedOffsetPosition(conn == null ? void 0 : conn.source, conn == null ? void 0 : conn.destination, 0.4);
|
|
14166
14174
|
const [offsetX2, offsetY2, _rotationAngle2] = getFixedOffsetPosition(conn == null ? void 0 : conn.destination, conn == null ? void 0 : conn.source, 0.4);
|
|
14175
|
+
if (!offsetX || !offsetY || !_rotationAngle || !offsetX2 || !offsetY2 || !_rotationAngle2) {
|
|
14176
|
+
return null;
|
|
14177
|
+
}
|
|
14167
14178
|
const rotationAngle = _rotationAngle + 180;
|
|
14168
14179
|
const rotationAngle2 = _rotationAngle2 + 180;
|
|
14169
14180
|
conn._rotationAngle = _rotationAngle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.d.ts","sourceRoot":"","sources":["../../../../src/components/NetworkMap/Map.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwG,MAAM,OAAO,CAAC;AAG7H,OAAO,kCAAkC,CAAC;AAY1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK1C,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;IAWrB,CAAA;
|
|
1
|
+
{"version":3,"file":"Map.d.ts","sourceRoot":"","sources":["../../../../src/components/NetworkMap/Map.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwG,MAAM,OAAO,CAAC;AAG7H,OAAO,kCAAkC,CAAC;AAY1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK1C,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;IAWrB,CAAA;AAqoBD,QAAA,MAAM,UAAU,4GAA4B,CAAC;AAC7C,eAAe,UAAU,CAAC"}
|