@fleet-frontend/mower-maps 0.2.0-beta.15 → 0.2.0-beta.17
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/config/constants.d.ts +4 -0
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/context/mapEdit.d.ts +3 -1
- package/dist/context/mapEdit.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +873 -355
- package/dist/index.js +874 -356
- package/dist/processor/unified/BaseData.d.ts.map +1 -1
- package/dist/processor/unified/UnifiedMapDataProcessor.d.ts.map +1 -1
- package/dist/render/MowerMapOverlay.d.ts.map +1 -1
- package/dist/render/MowerMapRenderer.d.ts.map +1 -1
- package/dist/render/SvgMapView.d.ts.map +1 -1
- package/dist/render/drag/drag.d.ts.map +1 -1
- package/dist/render/drag/index.d.ts.map +1 -1
- package/dist/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/index.d.ts.map +1 -1
- package/dist/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/index.d.ts.map +1 -1
- package/dist/render/svgEditMap/components/HandleElementInfo/components/HeightModal/index.d.ts.map +1 -1
- package/dist/render/svgEditMap/components/HandleElementInfo/doodle.d.ts.map +1 -1
- package/dist/render/svgEditMap/components/HandleElementInfo/index.d.ts.map +1 -1
- package/dist/render/svgEditMap/components/HandleElementInfo/obstacle.d.ts.map +1 -1
- package/dist/render/svgEditMap/components/HandleElementInfo/visionOff.d.ts.map +1 -1
- package/dist/render/svgEditMap/hooks/useCheckElement.d.ts +7 -5
- package/dist/render/svgEditMap/hooks/useCheckElement.d.ts.map +1 -1
- package/dist/render/svgEditMap/hooks/useCreateVisionOffElement.d.ts.map +1 -1
- package/dist/render/svgEditMap/hooks/useHistoryHandle.d.ts.map +1 -1
- package/dist/render/svgEditMap/hooks/usePolygonDrawing.d.ts.map +1 -1
- package/dist/render/svgEditMap/index.d.ts +3 -1
- package/dist/render/svgEditMap/index.d.ts.map +1 -1
- package/dist/render/svgElement/BoundaryElement/index.d.ts.map +1 -1
- package/dist/render/svgElement/Mobile/CreateObstacleElement/coordinateUtils.d.ts.map +1 -1
- package/dist/render/svgElement/Mobile/CreateObstacleElement/index.d.ts +2 -0
- package/dist/render/svgElement/Mobile/CreateObstacleElement/index.d.ts.map +1 -1
- package/dist/render/svgElement/ObstacleElement/index.d.ts.map +1 -1
- package/dist/render/svgElement/PolygonELement/components/DistanceLabels.d.ts +2 -0
- package/dist/render/svgElement/PolygonELement/components/DistanceLabels.d.ts.map +1 -1
- package/dist/render/svgElement/PolygonELement/components/DragDistanceIndicator.d.ts +2 -0
- package/dist/render/svgElement/PolygonELement/components/DragDistanceIndicator.d.ts.map +1 -1
- package/dist/render/svgElement/PolygonELement/index.d.ts.map +1 -1
- package/dist/render/svgElement/PolygonELement/vertex/index.d.ts.map +1 -1
- package/dist/render/svgElement/TransformWrapper/DoodleTransformWrapper/DoodleTransformWrapper.d.ts.map +1 -1
- package/dist/render/svgElement/TransformWrapper/DoodleTransformWrapper/useDoodleTransform.d.ts.map +1 -1
- package/dist/render/svgElement/TransformWrapper/VisionOffTransformWrapper/VisionOffTransformWrapper.d.ts.map +1 -1
- package/dist/render/svgElement/TransformWrapper/VisionOffTransformWrapper/useVisionOffTransform.d.ts +1 -1
- package/dist/render/svgElement/TransformWrapper/VisionOffTransformWrapper/useVisionOffTransform.d.ts.map +1 -1
- package/dist/render/svgMap/index.d.ts.map +1 -1
- package/dist/render/svgMap/useSvgMapView.d.ts.map +1 -1
- package/dist/types/renderer.d.ts +20 -0
- package/dist/types/renderer.d.ts.map +1 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/mapBounds.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/render/svgElement/TransformWrapper/HandleIcon/index.d.ts +0 -7
- package/dist/render/svgElement/TransformWrapper/HandleIcon/index.d.ts.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { memo, useMemo, useEffect, useState, useRef, useCallback, createContext, useContext, forwardRef, useImperativeHandle, useLayoutEffect } from 'react';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
|
-
import { message } from 'antd';
|
|
5
|
+
import { message, Modal, Popover } from 'antd';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 常量和枚举类型定义
|
|
@@ -48,6 +48,11 @@ var REAL_TIME_DATA_TYPE;
|
|
|
48
48
|
/**
|
|
49
49
|
* 地图渲染相关常量配置
|
|
50
50
|
*/
|
|
51
|
+
// 默认坐标
|
|
52
|
+
const DEFAULT_COORDINATES = {
|
|
53
|
+
sw: [116.35497283935547, 40.0374755859375],
|
|
54
|
+
ne: [116.35584259033203, 40.038658142089844],
|
|
55
|
+
};
|
|
51
56
|
/**
|
|
52
57
|
* 缩放因子 - 将米转换为像素
|
|
53
58
|
*/
|
|
@@ -157,7 +162,6 @@ class BaseData {
|
|
|
157
162
|
*/
|
|
158
163
|
class BoundaryData extends BaseData {
|
|
159
164
|
constructor(originalData, level, channels, style) {
|
|
160
|
-
console.log('originBoundary', originalData);
|
|
161
165
|
const convertedPoints = convertPointsFormat(originalData?.points) || [];
|
|
162
166
|
super(originalData?.id, DataType.BOUNDARY, level, RenderType.POLYGON, convertedPoints, originalData);
|
|
163
167
|
const { isFlowGlobal, cuttingHeight } = convertHeightsetToParams(originalData?.height_set || 0);
|
|
@@ -720,6 +724,7 @@ class UnifiedMapDataProcessor {
|
|
|
720
724
|
for (const element of elements) {
|
|
721
725
|
try {
|
|
722
726
|
// 如果有SVG数据,创建涂鸦数据
|
|
727
|
+
// 如果有过期时间,且过期时间大于当前时间(秒级别),才需要渲染
|
|
723
728
|
if ('svg' in element &&
|
|
724
729
|
element.svg &&
|
|
725
730
|
'center' in element &&
|
|
@@ -727,7 +732,9 @@ class UnifiedMapDataProcessor {
|
|
|
727
732
|
'scale' in element &&
|
|
728
733
|
element.scale !== undefined &&
|
|
729
734
|
'direction' in element &&
|
|
730
|
-
element.direction !== undefined
|
|
735
|
+
element.direction !== undefined &&
|
|
736
|
+
(element.expiration_ts === undefined ||
|
|
737
|
+
element.expiration_ts > Math.floor(Date.now() / 1000))) {
|
|
731
738
|
const convertedPoints = convertPoint(element.center);
|
|
732
739
|
if (!convertedPoints) {
|
|
733
740
|
continue;
|
|
@@ -740,7 +747,9 @@ class UnifiedMapDataProcessor {
|
|
|
740
747
|
else if ('points' in element &&
|
|
741
748
|
element.points &&
|
|
742
749
|
Array.isArray(element.points) &&
|
|
743
|
-
element.points.length >= 3
|
|
750
|
+
element.points.length >= 3 &&
|
|
751
|
+
(element.expiration_ts === undefined ||
|
|
752
|
+
element.expiration_ts > Math.floor(Date.now() / 1000))) {
|
|
744
753
|
const convertedPoints = convertPointsFormat(element.points);
|
|
745
754
|
if (!convertedPoints || convertedPoints.length < 3) {
|
|
746
755
|
continue;
|
|
@@ -1461,51 +1470,46 @@ function estimateGpsFromMapBounds(mapData) {
|
|
|
1461
1470
|
if (!bounds || bounds.minX === Infinity) {
|
|
1462
1471
|
return {
|
|
1463
1472
|
sw: [0, 0],
|
|
1464
|
-
ne: [0, 0]
|
|
1473
|
+
ne: [0, 0],
|
|
1465
1474
|
};
|
|
1466
1475
|
}
|
|
1467
1476
|
// 将边界数据转换为物理单位(米)
|
|
1468
|
-
const minXMeters = bounds.minX / SCALE_FACTOR
|
|
1469
|
-
const minYMeters = bounds.minY / SCALE_FACTOR
|
|
1470
|
-
const maxXMeters = bounds.maxX / SCALE_FACTOR
|
|
1471
|
-
const maxYMeters = bounds.maxY / SCALE_FACTOR
|
|
1477
|
+
const minXMeters = bounds.minX / SCALE_FACTOR; // 西边界
|
|
1478
|
+
const minYMeters = bounds.minY / SCALE_FACTOR; // 南边界
|
|
1479
|
+
const maxXMeters = bounds.maxX / SCALE_FACTOR; // 东边界
|
|
1480
|
+
const maxYMeters = bounds.maxY / SCALE_FACTOR; // 北边界
|
|
1472
1481
|
const mapWidthMeters = maxXMeters - minXMeters;
|
|
1473
1482
|
const mapHeightMeters = maxYMeters - minYMeters;
|
|
1474
|
-
//
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
baseLat = 39.9042; // 北京天安门
|
|
1480
|
-
baseLng = 116.4074;
|
|
1481
|
-
}
|
|
1482
|
-
else if (mapWidthMeters < 10000 && mapHeightMeters < 10000) {
|
|
1483
|
-
// 中型区域 - 使用城市级别的基准点
|
|
1484
|
-
baseLat = 39.9000;
|
|
1485
|
-
baseLng = 116.4000;
|
|
1486
|
-
}
|
|
1487
|
-
else {
|
|
1488
|
-
// 大型区域 - 使用更大范围的基准点
|
|
1489
|
-
baseLat = 40.0000;
|
|
1490
|
-
baseLng = 116.0000;
|
|
1491
|
-
}
|
|
1483
|
+
// 凤凰岭的GPS坐标作为地图中心点
|
|
1484
|
+
const centerLat = 40.103;
|
|
1485
|
+
const centerLng = 116.072222;
|
|
1486
|
+
// const centerLat = 40.03806686401367;
|
|
1487
|
+
// const centerLng = 116.35540771484375;
|
|
1492
1488
|
// 精确的坐标转换常数
|
|
1493
1489
|
// 1度纬度 = 约111,320米(在地球上任何地方都基本相同)
|
|
1494
1490
|
// 1度经度 = 约111,320 * cos(纬度) 米(随纬度变化)
|
|
1495
1491
|
const METERS_PER_DEGREE_LAT = 111320;
|
|
1496
|
-
const METERS_PER_DEGREE_LNG = 111320 * Math.cos(
|
|
1492
|
+
const METERS_PER_DEGREE_LNG = 111320 * Math.cos((centerLat * Math.PI) / 180);
|
|
1497
1493
|
// 计算SW(西南角)GPS坐标
|
|
1498
|
-
|
|
1499
|
-
const
|
|
1494
|
+
// 从中心点减去半个地图的宽度和高度
|
|
1495
|
+
const swLat = centerLat - mapHeightMeters / 2 / METERS_PER_DEGREE_LAT;
|
|
1496
|
+
const swLng = centerLng - mapWidthMeters / 2 / METERS_PER_DEGREE_LNG;
|
|
1500
1497
|
// 计算NE(东北角)GPS坐标
|
|
1501
|
-
|
|
1502
|
-
const
|
|
1498
|
+
// 从中心点加上半个地图的宽度和高度
|
|
1499
|
+
const neLat = centerLat + mapHeightMeters / 2 / METERS_PER_DEGREE_LAT;
|
|
1500
|
+
const neLng = centerLng + mapWidthMeters / 2 / METERS_PER_DEGREE_LNG;
|
|
1503
1501
|
// 验证估算的坐标是否在合理范围内
|
|
1504
|
-
if (swLat < -90 ||
|
|
1505
|
-
|
|
1502
|
+
if (swLat < -90 ||
|
|
1503
|
+
swLat > 90 ||
|
|
1504
|
+
swLng < -180 ||
|
|
1505
|
+
swLng > 180 ||
|
|
1506
|
+
neLat < -90 ||
|
|
1507
|
+
neLat > 90 ||
|
|
1508
|
+
neLng < -180 ||
|
|
1509
|
+
neLng > 180) {
|
|
1506
1510
|
console.warn('估算的GPS坐标超出有效范围:', {
|
|
1507
1511
|
sw: [swLng, swLat],
|
|
1508
|
-
ne: [neLng, neLat]
|
|
1512
|
+
ne: [neLng, neLat],
|
|
1509
1513
|
});
|
|
1510
1514
|
return null;
|
|
1511
1515
|
}
|
|
@@ -1513,13 +1517,13 @@ function estimateGpsFromMapBounds(mapData) {
|
|
|
1513
1517
|
if (swLat >= neLat || swLng >= neLng) {
|
|
1514
1518
|
console.warn('GPS边界坐标逻辑错误:', {
|
|
1515
1519
|
sw: [swLng, swLat],
|
|
1516
|
-
ne: [neLng, neLat]
|
|
1520
|
+
ne: [neLng, neLat],
|
|
1517
1521
|
});
|
|
1518
1522
|
return null;
|
|
1519
1523
|
}
|
|
1520
1524
|
return {
|
|
1521
1525
|
sw: [swLng, swLat], // [经度, 纬度]
|
|
1522
|
-
ne: [neLng, neLat] // [经度, 纬度]
|
|
1526
|
+
ne: [neLng, neLat], // [经度, 纬度]
|
|
1523
1527
|
};
|
|
1524
1528
|
}
|
|
1525
1529
|
catch (error) {
|
|
@@ -7985,6 +7989,42 @@ var PlatformType;
|
|
|
7985
7989
|
PlatformType["WEB"] = "web";
|
|
7986
7990
|
PlatformType["H5"] = "h5";
|
|
7987
7991
|
})(PlatformType || (PlatformType = {}));
|
|
7992
|
+
// 禁区的点进行检查的时候的提示
|
|
7993
|
+
var CheckObstaclePointErrorType;
|
|
7994
|
+
(function (CheckObstaclePointErrorType) {
|
|
7995
|
+
// 禁区相交
|
|
7996
|
+
CheckObstaclePointErrorType["OBSTACLE_INTERSECT"] = "obstacle_intersect";
|
|
7997
|
+
// 禁区与doodle相交
|
|
7998
|
+
CheckObstaclePointErrorType["DOODLE_INTERSECT"] = "doodle_intersect";
|
|
7999
|
+
// 禁区与doodle距离过近
|
|
8000
|
+
CheckObstaclePointErrorType["DOODLE_DISTANCE_TOO_CLOSE"] = "doodle_distance_too_close";
|
|
8001
|
+
// 禁区不在边界内
|
|
8002
|
+
CheckObstaclePointErrorType["BOUNDARY_NOT_IN_BOUNDARY"] = "boundary_not_in_boundary";
|
|
8003
|
+
// 点在禁区内
|
|
8004
|
+
CheckObstaclePointErrorType["POINT_IN_OBSTACLE"] = "point_in_obstacle";
|
|
8005
|
+
// 地图不存在
|
|
8006
|
+
CheckObstaclePointErrorType["MAP_NOT_EXIST"] = "map_not_exist";
|
|
8007
|
+
// 获取点失败
|
|
8008
|
+
CheckObstaclePointErrorType["GET_POINT_FAILED"] = "get_point_failed";
|
|
8009
|
+
// 通用错误
|
|
8010
|
+
CheckObstaclePointErrorType["COMMON_ERROR"] = "common_error";
|
|
8011
|
+
})(CheckObstaclePointErrorType || (CheckObstaclePointErrorType = {}));
|
|
8012
|
+
// doodle进行检查的提示
|
|
8013
|
+
var CheckDoodleErrorType;
|
|
8014
|
+
(function (CheckDoodleErrorType) {
|
|
8015
|
+
// 没有选中doodle
|
|
8016
|
+
CheckDoodleErrorType["NO_DOODLE_SELECTED"] = "no_doodle_selected";
|
|
8017
|
+
// doodle没有可移动的点
|
|
8018
|
+
CheckDoodleErrorType["NO_MOVABLE_POINTS"] = "no_movable_points";
|
|
8019
|
+
// doodle不在边界内
|
|
8020
|
+
CheckDoodleErrorType["DOODLE_NOT_IN_BOUNDARY"] = "doodle_not_in_boundary";
|
|
8021
|
+
// doodle距离边界太近
|
|
8022
|
+
CheckDoodleErrorType["DOODLE_DISTANCE_TOO_CLOSE"] = "doodle_distance_too_close";
|
|
8023
|
+
// doodle与其他元素相交
|
|
8024
|
+
CheckDoodleErrorType["DOODLE_INTERSECT"] = "doodle_intersect";
|
|
8025
|
+
// doodle与其他元素距离过近
|
|
8026
|
+
CheckDoodleErrorType["DOODLE_DISTANCE_TOO_CLOSE_TO_OTHER_ELEMENT"] = "doodle_distance_too_close_to_other_element";
|
|
8027
|
+
})(CheckDoodleErrorType || (CheckDoodleErrorType = {}));
|
|
7988
8028
|
|
|
7989
8029
|
/**
|
|
7990
8030
|
* 触摸事件工具函数
|
|
@@ -8525,23 +8565,6 @@ const useDrag = ({ dragCallbacks, onBoundaryLabelsCollapse, onTransformChange, }
|
|
|
8525
8565
|
|
|
8526
8566
|
// 编辑模式相关常量配置
|
|
8527
8567
|
// 默认的旋转图标
|
|
8528
|
-
const DEFAULT_ROTATE_ICON = `
|
|
8529
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8530
|
-
<g clip-path="url(#clip0_8198_30743)">
|
|
8531
|
-
<path d="M20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10Z" fill="url(#paint0_linear_8198_30743)"/>
|
|
8532
|
-
<path d="M11.4894 14.7176C10.4257 14.9506 9.31616 14.8595 8.30481 14.4558C7.29342 14.0521 6.4264 13.3535 5.81555 12.4519C5.24299 11.6068 4.92013 10.6187 4.88196 9.60134L4.87805 9.39724C4.87805 8.94523 5.24441 8.57892 5.69641 8.57888C6.12014 8.57888 6.46888 8.90061 6.51087 9.31325L6.51477 9.39724L6.52551 9.68142C6.57513 10.3429 6.79716 10.9821 7.17102 11.534C7.54479 12.0855 8.05583 12.528 8.65149 12.8191L8.91223 12.9343C9.61943 13.2166 10.395 13.2809 11.1388 13.1179L11.4142 13.0467C11.6075 12.9889 11.795 12.9149 11.9757 12.8279L10.8282 12.3865C10.4074 12.2245 10.1977 11.7518 10.3595 11.3308C10.5215 10.9099 10.9941 10.7003 11.4152 10.8621L13.9562 11.8386C14.3773 12.0005 14.5878 12.4732 14.4259 12.8943C14.3891 12.9901 14.3364 13.0752 14.2716 13.1472L14.2726 13.1482C13.5227 13.9377 12.5531 14.4845 11.4894 14.7176Z" fill="white"/>
|
|
8533
|
-
<path d="M8.51062 4.54807C9.57433 4.31505 10.6838 4.40612 11.6952 4.80979C12.7066 5.21356 13.5736 5.91214 14.1844 6.8137C14.757 7.65884 15.0799 8.64688 15.118 9.66429L15.1219 9.86839C15.1219 10.3204 14.7556 10.6867 14.3036 10.6867C13.8799 10.6867 13.5311 10.365 13.4891 9.95237L13.4852 9.86839L13.4745 9.58421C13.4249 8.92272 13.2028 8.28348 12.829 7.73167C12.4552 7.18008 11.9442 6.73767 11.3485 6.44651L11.0878 6.33128C10.3806 6.04903 9.60501 5.98477 8.8612 6.14768L8.58581 6.21897C8.39252 6.27673 8.20502 6.35068 8.02429 6.43772L9.17175 6.87913C9.59256 7.04116 9.8023 7.51383 9.6405 7.93479C9.47855 8.35574 9.00587 8.56537 8.58484 8.40354L6.04382 7.42698C5.6227 7.26512 5.41224 6.79244 5.57409 6.37132C5.61094 6.27552 5.66365 6.19044 5.72839 6.11839L5.72742 6.11741C6.47734 5.32789 7.44693 4.78114 8.51062 4.54807Z" fill="white"/>
|
|
8534
|
-
</g>
|
|
8535
|
-
<defs>
|
|
8536
|
-
<linearGradient id="paint0_linear_8198_30743" x1="17.7273" y1="16.3636" x2="-1.21533" y2="2.08814e-07" gradientUnits="userSpaceOnUse">
|
|
8537
|
-
<stop stop-color="#F16629"/>
|
|
8538
|
-
<stop offset="1" stop-color="#F1A129"/>
|
|
8539
|
-
</linearGradient>
|
|
8540
|
-
<clipPath id="clip0_8198_30743">
|
|
8541
|
-
<rect width="20" height="20" fill="white" transform="matrix(-1 0 0 1 20 0)"/>
|
|
8542
|
-
</clipPath>
|
|
8543
|
-
</defs>
|
|
8544
|
-
</svg>`;
|
|
8545
8568
|
// 默认的拖拽图标
|
|
8546
8569
|
const DEFAULT_DRAG_ICON = `
|
|
8547
8570
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -8555,41 +8578,6 @@ const DEFAULT_DRAG_ICON = `
|
|
|
8555
8578
|
</defs>
|
|
8556
8579
|
</svg>`;
|
|
8557
8580
|
|
|
8558
|
-
function styleInject(css, ref) {
|
|
8559
|
-
if ( ref === void 0 ) ref = {};
|
|
8560
|
-
var insertAt = ref.insertAt;
|
|
8561
|
-
|
|
8562
|
-
if (!css || typeof document === 'undefined') { return; }
|
|
8563
|
-
|
|
8564
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
8565
|
-
var style = document.createElement('style');
|
|
8566
|
-
style.type = 'text/css';
|
|
8567
|
-
|
|
8568
|
-
if (insertAt === 'top') {
|
|
8569
|
-
if (head.firstChild) {
|
|
8570
|
-
head.insertBefore(style, head.firstChild);
|
|
8571
|
-
} else {
|
|
8572
|
-
head.appendChild(style);
|
|
8573
|
-
}
|
|
8574
|
-
} else {
|
|
8575
|
-
head.appendChild(style);
|
|
8576
|
-
}
|
|
8577
|
-
|
|
8578
|
-
if (style.styleSheet) {
|
|
8579
|
-
style.styleSheet.cssText = css;
|
|
8580
|
-
} else {
|
|
8581
|
-
style.appendChild(document.createTextNode(css));
|
|
8582
|
-
}
|
|
8583
|
-
}
|
|
8584
|
-
|
|
8585
|
-
var css_248z$6 = ".index-module_edit__-5VvX {\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n pointer-events: auto;\n z-index: 1000;\n cursor: move;\n touch-action: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n.index-module_edit__-5VvX .index-module_border__JdNLM {\n position: absolute;\n inset: -10px;\n border: 2px dashed rgb(241, 102, 41);\n border-radius: 2px;\n pointer-events: none;\n}\n.index-module_edit__-5VvX .index-module_drag__uvdPG {\n position: absolute;\n inset: -10px;\n border-radius: 2px;\n}\n.index-module_edit__-5VvX .index-module_rotate__H-KIZ {\n position: absolute;\n top: -20px;\n right: -20px;\n width: 20px;\n height: 20px;\n cursor: grab;\n z-index: 1001;\n pointer-events: auto;\n}\n.index-module_edit__-5VvX .index-module_move__mZF8s {\n position: absolute;\n bottom: -20px;\n left: -20px;\n width: 20px;\n height: 20px;\n cursor: move;\n z-index: 1001;\n pointer-events: auto;\n}";
|
|
8586
|
-
var styles$6 = {"edit":"index-module_edit__-5VvX","border":"index-module_border__JdNLM","drag":"index-module_drag__uvdPG","rotate":"index-module_rotate__H-KIZ","move":"index-module_move__mZF8s"};
|
|
8587
|
-
styleInject(css_248z$6);
|
|
8588
|
-
|
|
8589
|
-
const RotateHandle = ({ onRotateStart, isRotating }) => {
|
|
8590
|
-
return (jsx("div", { className: styles$6.rotate, onMouseDown: (e) => onRotateStart(e), onTouchStart: (e) => onRotateStart(e), style: { cursor: isRotating ? 'grabbing' : 'grab' }, dangerouslySetInnerHTML: { __html: DEFAULT_ROTATE_ICON } }));
|
|
8591
|
-
};
|
|
8592
|
-
|
|
8593
8581
|
/**
|
|
8594
8582
|
* 高级节流函数
|
|
8595
8583
|
* @param func 要节流的函数
|
|
@@ -8641,29 +8629,63 @@ function isMobileDevice() {
|
|
|
8641
8629
|
// 检查用户代理字符串
|
|
8642
8630
|
const userAgent = navigator.userAgent.toLowerCase();
|
|
8643
8631
|
const mobileKeywords = [
|
|
8644
|
-
'android',
|
|
8645
|
-
'
|
|
8632
|
+
'android',
|
|
8633
|
+
'webos',
|
|
8634
|
+
'iphone',
|
|
8635
|
+
'ipad',
|
|
8636
|
+
'ipod',
|
|
8637
|
+
'blackberry',
|
|
8638
|
+
'windows phone',
|
|
8639
|
+
'mobile',
|
|
8646
8640
|
];
|
|
8647
|
-
const isMobileUserAgent = mobileKeywords.some(keyword => userAgent.includes(keyword));
|
|
8641
|
+
const isMobileUserAgent = mobileKeywords.some((keyword) => userAgent.includes(keyword));
|
|
8648
8642
|
// 检查触摸屏支持
|
|
8649
|
-
const hasTouchScreen = 'ontouchstart' in window ||
|
|
8650
|
-
(navigator.maxTouchPoints && navigator.maxTouchPoints > 0);
|
|
8643
|
+
const hasTouchScreen = 'ontouchstart' in window || (navigator.maxTouchPoints && navigator.maxTouchPoints > 0);
|
|
8651
8644
|
// 检查屏幕尺寸(移动设备通常屏幕较小)
|
|
8652
8645
|
const isSmallScreen = window.innerWidth <= 768;
|
|
8653
8646
|
// 综合判断:用户代理包含移动设备关键词,或者有触摸屏且屏幕较小
|
|
8654
8647
|
return isMobileUserAgent || (hasTouchScreen && isSmallScreen);
|
|
8655
8648
|
}
|
|
8656
8649
|
|
|
8650
|
+
function styleInject(css, ref) {
|
|
8651
|
+
if ( ref === void 0 ) ref = {};
|
|
8652
|
+
var insertAt = ref.insertAt;
|
|
8653
|
+
|
|
8654
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
8655
|
+
|
|
8656
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
8657
|
+
var style = document.createElement('style');
|
|
8658
|
+
style.type = 'text/css';
|
|
8659
|
+
|
|
8660
|
+
if (insertAt === 'top') {
|
|
8661
|
+
if (head.firstChild) {
|
|
8662
|
+
head.insertBefore(style, head.firstChild);
|
|
8663
|
+
} else {
|
|
8664
|
+
head.appendChild(style);
|
|
8665
|
+
}
|
|
8666
|
+
} else {
|
|
8667
|
+
head.appendChild(style);
|
|
8668
|
+
}
|
|
8669
|
+
|
|
8670
|
+
if (style.styleSheet) {
|
|
8671
|
+
style.styleSheet.cssText = css;
|
|
8672
|
+
} else {
|
|
8673
|
+
style.appendChild(document.createTextNode(css));
|
|
8674
|
+
}
|
|
8675
|
+
}
|
|
8676
|
+
|
|
8677
|
+
var css_248z$9 = ".index-module_edit__-5VvX {\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n pointer-events: auto;\n z-index: 1000;\n cursor: move;\n touch-action: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n.index-module_edit__-5VvX .index-module_border__JdNLM {\n position: absolute;\n inset: -10px;\n border: 2px dashed rgb(241, 102, 41);\n border-radius: 2px;\n pointer-events: none;\n}\n.index-module_edit__-5VvX .index-module_drag__uvdPG {\n position: absolute;\n inset: -10px;\n border-radius: 2px;\n}\n.index-module_edit__-5VvX .index-module_rotate__H-KIZ {\n position: absolute;\n top: -20px;\n right: -20px;\n width: 20px;\n height: 20px;\n cursor: grab;\n z-index: 1001;\n pointer-events: auto;\n}\n.index-module_edit__-5VvX .index-module_move__mZF8s {\n position: absolute;\n bottom: -20px;\n left: -20px;\n width: 20px;\n height: 20px;\n cursor: move;\n z-index: 1001;\n pointer-events: auto;\n}";
|
|
8678
|
+
var styles$9 = {"edit":"index-module_edit__-5VvX","border":"index-module_border__JdNLM","drag":"index-module_drag__uvdPG","move":"index-module_move__mZF8s"};
|
|
8679
|
+
styleInject(css_248z$9);
|
|
8680
|
+
|
|
8657
8681
|
const DragHandle = ({ onDragStart, isDragging }) => {
|
|
8658
8682
|
// 在PC设备上隐藏拖拽手柄
|
|
8659
8683
|
if (!isMobileDevice()) {
|
|
8660
8684
|
return null;
|
|
8661
8685
|
}
|
|
8662
|
-
return (jsx("div", { className: styles$
|
|
8663
|
-
console.log('down');
|
|
8686
|
+
return (jsx("div", { className: styles$9.move, onMouseDown: (e) => {
|
|
8664
8687
|
onDragStart(e);
|
|
8665
8688
|
}, onTouchStart: (e) => onDragStart(e), onMouseUp: (e) => {
|
|
8666
|
-
console.log('drag up');
|
|
8667
8689
|
// onDragEnd(e);
|
|
8668
8690
|
},
|
|
8669
8691
|
// onTouchEnd={(e) => onDragEnd(e)}
|
|
@@ -8671,7 +8693,7 @@ const DragHandle = ({ onDragStart, isDragging }) => {
|
|
|
8671
8693
|
};
|
|
8672
8694
|
|
|
8673
8695
|
const MapDrag = ({ map: _map, dragCallbacks, onBoundaryLabelsCollapse, onTransformChange, isDragMap = false, }) => {
|
|
8674
|
-
const { isDragging,
|
|
8696
|
+
const { isDragging, handleDragStart, addGlobalListeners } = useDrag({
|
|
8675
8697
|
dragCallbacks,
|
|
8676
8698
|
onBoundaryLabelsCollapse,
|
|
8677
8699
|
onTransformChange,
|
|
@@ -8682,10 +8704,6 @@ const MapDrag = ({ map: _map, dragCallbacks, onBoundaryLabelsCollapse, onTransfo
|
|
|
8682
8704
|
const cleanup = addGlobalListeners();
|
|
8683
8705
|
return cleanup;
|
|
8684
8706
|
}, [addGlobalListeners]);
|
|
8685
|
-
// 处理旋转开始
|
|
8686
|
-
const handleRotateStart = (e) => {
|
|
8687
|
-
handleDragStart(e, 'rotate', containerRef?.current);
|
|
8688
|
-
};
|
|
8689
8707
|
// 处理拖拽开始
|
|
8690
8708
|
const handleDragStartEvent = (e) => {
|
|
8691
8709
|
handleDragStart(e, 'drag', containerRef?.current);
|
|
@@ -8693,7 +8711,7 @@ const MapDrag = ({ map: _map, dragCallbacks, onBoundaryLabelsCollapse, onTransfo
|
|
|
8693
8711
|
if (!isDragMap) {
|
|
8694
8712
|
return null;
|
|
8695
8713
|
}
|
|
8696
|
-
return (jsxs("div", { ref: containerRef, className: styles$
|
|
8714
|
+
return (jsxs("div", { ref: containerRef, className: styles$9.edit, style: { cursor: isDragging ? 'grabbing' : 'move' }, children: [jsx("div", { className: styles$9.border }), jsx("div", { className: styles$9.drag, onMouseDown: handleDragStartEvent, onTouchStart: handleDragStartEvent }), jsx(DragHandle, { onDragStart: handleDragStartEvent, isDragging: isDragging })] }));
|
|
8697
8715
|
};
|
|
8698
8716
|
|
|
8699
8717
|
/**
|
|
@@ -8744,6 +8762,7 @@ class SvgMapView {
|
|
|
8744
8762
|
svg.style.width = '100%';
|
|
8745
8763
|
svg.style.height = '100%';
|
|
8746
8764
|
svg.style.background = 'transparent';
|
|
8765
|
+
svg.style.overflow = 'visible';
|
|
8747
8766
|
return svg;
|
|
8748
8767
|
}
|
|
8749
8768
|
/**
|
|
@@ -8835,7 +8854,7 @@ class SvgMapView {
|
|
|
8835
8854
|
* 设置自适应视图变换 - 让SVG刚好包裹住图形
|
|
8836
8855
|
*/
|
|
8837
8856
|
fitToView(bounds) {
|
|
8838
|
-
const padding =
|
|
8857
|
+
const padding = 0;
|
|
8839
8858
|
const boundWidth = bounds.maxX - bounds.minX + padding * 2;
|
|
8840
8859
|
const boundHeight = bounds.maxY - bounds.minY + padding * 2;
|
|
8841
8860
|
// 防止宽高为0的情况
|
|
@@ -8844,7 +8863,16 @@ class SvgMapView {
|
|
|
8844
8863
|
return;
|
|
8845
8864
|
}
|
|
8846
8865
|
// 获取容器的实际尺寸进行验证
|
|
8847
|
-
this.container.getBoundingClientRect();
|
|
8866
|
+
const containerRect = this.container.getBoundingClientRect();
|
|
8867
|
+
const containerWidth = containerRect.width;
|
|
8868
|
+
const containerHeight = containerRect.height;
|
|
8869
|
+
if (containerWidth <= 0 || containerHeight <= 0) {
|
|
8870
|
+
console.warn('Invalid container size:', containerWidth, containerHeight);
|
|
8871
|
+
return;
|
|
8872
|
+
}
|
|
8873
|
+
// // 计算内容和容器的宽高比
|
|
8874
|
+
// const contentAspectRatio = boundWidth / boundHeight;
|
|
8875
|
+
// const containerAspectRatio = containerWidth / containerHeight;
|
|
8848
8876
|
// 设置viewBox以包含所有内容
|
|
8849
8877
|
this.viewBox = {
|
|
8850
8878
|
x: bounds.minX - padding,
|
|
@@ -14106,6 +14134,7 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
|
|
|
14106
14134
|
// 调用回调
|
|
14107
14135
|
const elementCount = elements.length;
|
|
14108
14136
|
onMapLoad?.(elementCount);
|
|
14137
|
+
x;
|
|
14109
14138
|
}
|
|
14110
14139
|
catch (error) {
|
|
14111
14140
|
console.error('加载地图数据时出错:', error);
|
|
@@ -14159,9 +14188,7 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
|
|
|
14159
14188
|
}, [mapConfig, onPathLoad]);
|
|
14160
14189
|
// 初始化 SVG 地图视图
|
|
14161
14190
|
const initializeSvgMapView = useCallback((container) => {
|
|
14162
|
-
console.log('initializeSvgMapView called, container:', container, svgMapViewRef.current);
|
|
14163
14191
|
if (!container || svgMapViewRef.current) {
|
|
14164
|
-
console.log('Skipping initialization - container missing or already initialized');
|
|
14165
14192
|
return;
|
|
14166
14193
|
}
|
|
14167
14194
|
containerRef.current = container;
|
|
@@ -14175,12 +14202,10 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
|
|
|
14175
14202
|
offscreenContainerRef.current = offscreenContainer;
|
|
14176
14203
|
// 创建 SvgMapView 实例
|
|
14177
14204
|
svgMapViewRef.current = new SvgMapView(sn, offscreenContainer, 800, 600);
|
|
14178
|
-
console.log('SvgMapView created:', svgMapViewRef.current);
|
|
14179
14205
|
// 加载地图数据
|
|
14180
14206
|
loadMapData();
|
|
14181
14207
|
// 加载路径数据
|
|
14182
14208
|
if (pathData && svgMapViewRef.current) {
|
|
14183
|
-
console.log('Loading path data:', pathData);
|
|
14184
14209
|
loadPathData(pathData, mowPartitionData);
|
|
14185
14210
|
}
|
|
14186
14211
|
else {
|
|
@@ -14196,7 +14221,6 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
|
|
|
14196
14221
|
if (svgElement) {
|
|
14197
14222
|
svgElementRef.current = svgElement;
|
|
14198
14223
|
container.appendChild(svgElement);
|
|
14199
|
-
console.log('SVG element added to container');
|
|
14200
14224
|
}
|
|
14201
14225
|
else {
|
|
14202
14226
|
console.warn('Failed to get SVG element from SvgMapView');
|
|
@@ -14238,8 +14262,6 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
|
|
|
14238
14262
|
const setTransform = useCallback((transform) => {
|
|
14239
14263
|
if (!svgMapViewRef.current)
|
|
14240
14264
|
return;
|
|
14241
|
-
console.log('SvgMapView setTransform called with:', transform);
|
|
14242
|
-
// 使用SvgMapView的transform API
|
|
14243
14265
|
svgMapViewRef.current.setTransform(transform);
|
|
14244
14266
|
}, []);
|
|
14245
14267
|
// 重置到默认变换
|
|
@@ -14310,7 +14332,6 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
|
|
|
14310
14332
|
// 监听pathData变化,确保路径数据能够被加载
|
|
14311
14333
|
useEffect(() => {
|
|
14312
14334
|
if (svgMapViewRef.current && pathData) {
|
|
14313
|
-
console.log('PathData changed, reloading...', pathData);
|
|
14314
14335
|
loadPathData(pathData, mowPartitionData);
|
|
14315
14336
|
svgMapViewRef.current.refresh();
|
|
14316
14337
|
}
|
|
@@ -14318,7 +14339,6 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
|
|
|
14318
14339
|
useEffect(() => {
|
|
14319
14340
|
if (svgMapViewRef.current && mapData) {
|
|
14320
14341
|
loadMapData();
|
|
14321
|
-
console.log('mapData changed, reloading...', mapData);
|
|
14322
14342
|
svgMapViewRef.current.refresh();
|
|
14323
14343
|
}
|
|
14324
14344
|
}, [mapData, loadMapData]);
|
|
@@ -14402,7 +14422,6 @@ const SvgMapComponent = forwardRef(({ editMap, rotate, mapData, pathData, modelT
|
|
|
14402
14422
|
// 初始化 SVG 地图
|
|
14403
14423
|
useEffect(() => {
|
|
14404
14424
|
if (containerRef.current && mapData && !svgMapView) {
|
|
14405
|
-
console.log('Initializing SVG map view, containerRef->', containerRef.current);
|
|
14406
14425
|
initializeSvgMapView(containerRef.current);
|
|
14407
14426
|
}
|
|
14408
14427
|
}, [mapData, svgMapView, initializeSvgMapView, pathData]);
|
|
@@ -14416,9 +14435,9 @@ const SvgMapComponent = forwardRef(({ editMap, rotate, mapData, pathData, modelT
|
|
|
14416
14435
|
// 设置显示名称以便调试
|
|
14417
14436
|
SvgMapComponent.displayName = 'SvgMapComponent';
|
|
14418
14437
|
|
|
14419
|
-
var css_248z$
|
|
14420
|
-
var styles$
|
|
14421
|
-
styleInject(css_248z$
|
|
14438
|
+
var css_248z$8 = ".index-module_mowerPosition__yLpIU {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n width: 100%;\n height: 100%;\n}";
|
|
14439
|
+
var styles$8 = {"mowerPosition":"index-module_mowerPosition__yLpIU"};
|
|
14440
|
+
styleInject(css_248z$8);
|
|
14422
14441
|
|
|
14423
14442
|
const usePosition = ({ mowerPositionData, viewBox, modelType, hasEdger, mapData, realTimeData, onMowingPositionChange, }) => {
|
|
14424
14443
|
// DOM 元素引用,用于直接操作
|
|
@@ -14644,7 +14663,7 @@ const MowerPosition = React__default.memo(({ editMap, mowerPositionData, viewBox
|
|
|
14644
14663
|
pointerEvents: 'none',
|
|
14645
14664
|
zIndex: 1000,
|
|
14646
14665
|
}), []);
|
|
14647
|
-
return (jsx("div", { className: styles$
|
|
14666
|
+
return (jsx("div", { className: styles$8.mowerPosition, style: containerStyle, children: jsx("div", { ref: elementRef, className: "mower-position", style: {
|
|
14648
14667
|
position: 'absolute',
|
|
14649
14668
|
width: 30,
|
|
14650
14669
|
height: 30,
|
|
@@ -14713,9 +14732,9 @@ const CharginPile = React__default.memo(({ mapData, mapConfig = {}, viewBox, rot
|
|
|
14713
14732
|
}, children: jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }, `pile-${idx}`))) }));
|
|
14714
14733
|
});
|
|
14715
14734
|
|
|
14716
|
-
var css_248z$
|
|
14717
|
-
var styles$
|
|
14718
|
-
styleInject(css_248z$
|
|
14735
|
+
var css_248z$7 = ".index-module_container__7IatW {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\n.index-module_boundaryLabel__GDHFn {\n position: absolute;\n background-color: rgba(30, 30, 31, 0.6);\n color: rgb(255, 255, 255);\n padding: 6px;\n border-radius: 12px;\n font-size: 12px;\n font-weight: bold;\n max-width: 220px;\n pointer-events: auto;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n}\n\n.index-module_base__qy2SG {\n font-size: 14px;\n}\n\n.index-module_extended__0TMAt {\n margin-top: 6px;\n font-size: 11px;\n opacity: 0.9;\n border-top: 1px solid rgba(255, 255, 255, 0.2);\n padding-top: 6px;\n}";
|
|
14736
|
+
var styles$7 = {"container":"index-module_container__7IatW","boundaryLabel":"index-module_boundaryLabel__GDHFn","base":"index-module_base__qy2SG","extended":"index-module_extended__0TMAt"};
|
|
14737
|
+
styleInject(css_248z$7);
|
|
14719
14738
|
|
|
14720
14739
|
const useBoundaryLabels = ({ mapData, pathData, unitType, viewBox, mowPartitionData, realTimeData = [], }) => {
|
|
14721
14740
|
const [processStateIsMowing, updateProcessStateIsMowing] = useState(false);
|
|
@@ -14869,7 +14888,7 @@ const BoundaryLabels = React__default.memo(({ editMap, mapData, pathData, unitTy
|
|
|
14869
14888
|
zIndex: expandedId != null ? 9999 : containerZIndex,
|
|
14870
14889
|
display: editMap ? 'none' : 'block',
|
|
14871
14890
|
}), [containerZIndex, expandedId, editMap]);
|
|
14872
|
-
return (jsx("div", { className: styles$
|
|
14891
|
+
return (jsx("div", { className: styles$7.container, style: containerStyle, children: items.map((item) => (jsxs("div", { className: `${styles$7.boundaryLabel} boundary-label`, "data-boundary-id": item.id, style: {
|
|
14873
14892
|
transform: `translate(-50%, -50%) rotate(${-rotation}deg)`,
|
|
14874
14893
|
left: `${item.leftPct}%`,
|
|
14875
14894
|
top: `${item.topPct}%`,
|
|
@@ -14879,12 +14898,12 @@ const BoundaryLabels = React__default.memo(({ editMap, mapData, pathData, unitTy
|
|
|
14879
14898
|
if (onlyRead)
|
|
14880
14899
|
return;
|
|
14881
14900
|
handleClick(item.id);
|
|
14882
|
-
}, children: [jsx("div", { className: styles$
|
|
14901
|
+
}, children: [jsx("div", { className: styles$7.base, children: item.baseText }), jsxs("div", { className: styles$7.extended, style: { display: expandedId === item.id ? 'block' : 'none' }, children: [jsx("div", { style: { marginBottom: 3, fontWeight: 'bold' }, children: item.coverageText }), jsx("div", { children: item.dateText })] })] }, item.id))) }));
|
|
14883
14902
|
});
|
|
14884
14903
|
|
|
14885
|
-
var css_248z$
|
|
14886
|
-
var styles$
|
|
14887
|
-
styleInject(css_248z$
|
|
14904
|
+
var css_248z$6 = ".index-module_container__gB52e {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\n.index-module_item__zHoZP {\n position: absolute;\n pointer-events: auto;\n}\n\n.index-module_icon__CS56A {\n position: relative;\n width: 24px;\n height: 24px;\n cursor: pointer;\n transition: transform 0.2s ease;\n}\n\n.index-module_tooltip__NMCmR {\n position: absolute;\n bottom: 40px;\n left: 0;\n background-color: rgb(247, 251, 255);\n color: rgb(65, 93, 116);\n padding: 10px;\n border-radius: 16px;\n font-size: 14px;\n text-align: left;\n}";
|
|
14905
|
+
var styles$6 = {"container":"index-module_container__gB52e","item":"index-module_item__zHoZP","icon":"index-module_icon__CS56A","tooltip":"index-module_tooltip__NMCmR"};
|
|
14906
|
+
styleInject(css_248z$6);
|
|
14888
14907
|
|
|
14889
14908
|
const useAntennaInfo = (data = [], options = {}) => {
|
|
14890
14909
|
const { viewBox } = options;
|
|
@@ -14993,13 +15012,13 @@ const Antennas = React__default.memo(({ editMap, antennaConfig = [], viewBox, ro
|
|
|
14993
15012
|
document.addEventListener('pointerdown', handleOutside);
|
|
14994
15013
|
return () => document.removeEventListener('pointerdown', handleOutside);
|
|
14995
15014
|
}, []);
|
|
14996
|
-
return (jsx("div", { className: styles$
|
|
15015
|
+
return (jsx("div", { className: styles$6.container, style: containerStyle, children: items.map((item) => (jsxs("div", { className: `antenna-container-item ${styles$6.item}`, style: {
|
|
14997
15016
|
left: `${item.leftPct}%`,
|
|
14998
15017
|
top: `${item.topPct}%`,
|
|
14999
15018
|
transform: `translate(calc(-50% + ${item.offsetX || 0}px), calc(-50% + ${item.offsetY || 0}px)) rotate(${-rotation}deg)`,
|
|
15000
15019
|
zIndex: openType === item.type ? 10000 : containerZIndex,
|
|
15001
15020
|
pointerEvents: onlyRead ? 'none' : 'auto',
|
|
15002
|
-
}, children: [jsx("div", { className: `antenna vector-antenna antenna-${item.type} ${item.isOnline ? 'antenna-online' : 'antenna-offline'} ${styles$
|
|
15021
|
+
}, children: [jsx("div", { className: `antenna vector-antenna antenna-${item.type} ${item.isOnline ? 'antenna-online' : 'antenna-offline'} ${styles$6.icon}`, style: {}, onClick: (e) => {
|
|
15003
15022
|
e.stopPropagation();
|
|
15004
15023
|
if (onlyRead)
|
|
15005
15024
|
return;
|
|
@@ -15014,7 +15033,7 @@ const Antennas = React__default.memo(({ editMap, antennaConfig = [], viewBox, ro
|
|
|
15014
15033
|
return;
|
|
15015
15034
|
e.currentTarget.style.transform =
|
|
15016
15035
|
'scale(1)';
|
|
15017
|
-
}, children: jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }), jsxs("div", { className: styles$
|
|
15036
|
+
}, children: jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }), jsxs("div", { className: styles$6.tooltip, style: {
|
|
15018
15037
|
display: openType === item.type ? 'block' : 'none',
|
|
15019
15038
|
minWidth: item.tooltip.minWidth,
|
|
15020
15039
|
}, children: [jsx("div", { style: { marginBottom: 4, fontWeight: 600 }, children: item.tooltip.title }), jsxs("div", { style: { color: 'rgba(65, 93, 116, 1)', fontWeight: 400 }, children: [item.tooltip.statusText, item.tooltip.syncText || ''] })] })] }, `antenna-${item.type}`))) }));
|
|
@@ -15073,30 +15092,30 @@ const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className, }) =>
|
|
|
15073
15092
|
};
|
|
15074
15093
|
|
|
15075
15094
|
const VertexElement = React__default.memo(({ r, stroke, fill, ...props }) => {
|
|
15076
|
-
const { overlayScale
|
|
15095
|
+
const { overlayScale } = useCommonContext();
|
|
15077
15096
|
const radius = typeof r === 'number' ? r : 12;
|
|
15078
|
-
return (jsx("circle", { r:
|
|
15097
|
+
return (jsx("circle", { r: radius * overlayScale, stroke: stroke || '#fff', fill: fill || '#fff', strokeWidth: 2 * overlayScale, ...props }));
|
|
15079
15098
|
});
|
|
15080
15099
|
|
|
15081
|
-
var _path$
|
|
15082
|
-
function _extends$
|
|
15100
|
+
var _path$4;
|
|
15101
|
+
function _extends$a() { return _extends$a = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$a.apply(null, arguments); }
|
|
15083
15102
|
var SvgDelete = function SvgDelete(props) {
|
|
15084
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
15103
|
+
return /*#__PURE__*/React.createElement("svg", _extends$a({
|
|
15085
15104
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15086
15105
|
width: 16,
|
|
15087
15106
|
height: 16,
|
|
15088
15107
|
fill: "none"
|
|
15089
|
-
}, props), _path$
|
|
15108
|
+
}, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
|
|
15090
15109
|
fill: "#FD494D",
|
|
15091
15110
|
d: "M6.667 12a.667.667 0 0 0 .666-.667v-4a.667.667 0 1 0-1.333 0v4a.667.667 0 0 0 .667.667m6.666-8h-2.666v-.667a2 2 0 0 0-2-2H7.333a2 2 0 0 0-2 2V4H2.667a.667.667 0 0 0 0 1.333h.666v7.334a2 2 0 0 0 2 2h5.334a2 2 0 0 0 2-2V5.333h.666a.667.667 0 1 0 0-1.333m-6.666-.667a.667.667 0 0 1 .666-.666h1.334a.667.667 0 0 1 .666.666V4H6.667zm4.666 9.334a.667.667 0 0 1-.666.666H5.333a.667.667 0 0 1-.666-.666V5.333h6.666zm-2-.667a.667.667 0 0 0 .667-.667v-4a.667.667 0 0 0-1.333 0v4a.667.667 0 0 0 .666.667"
|
|
15092
15111
|
})));
|
|
15093
15112
|
};
|
|
15094
15113
|
|
|
15095
|
-
const DragDistanceIndicator = ({ fontSize, dragState, strokeColor, editMode = false, createMode = false, completed = false, }) => {
|
|
15114
|
+
const DragDistanceIndicator = ({ fontSize, dragState, strokeColor, editMode = false, createMode = false, completed = false, unitType = UnitsType.Metric, }) => {
|
|
15096
15115
|
// 计算两点间的距离(使用通用工具函数)
|
|
15097
15116
|
const calculateDistance$1 = React__default.useCallback((point1, point2) => {
|
|
15098
15117
|
const distance = calculateDistance(point1, point2);
|
|
15099
|
-
const result = convertDistanceByUnits(distance / 50);
|
|
15118
|
+
const result = convertDistanceByUnits(distance / 50, unitType);
|
|
15100
15119
|
return result.value;
|
|
15101
15120
|
}, []);
|
|
15102
15121
|
// 计算点到线段的垂足坐标(使用通用工具函数)
|
|
@@ -15197,12 +15216,13 @@ const TextElement = ({ x, y, fontSize = 30, fill = '#fff', text, background = 'r
|
|
|
15197
15216
|
* @param point2 第二个点 [x, y]
|
|
15198
15217
|
* @returns 距离(mi单位)
|
|
15199
15218
|
*/
|
|
15200
|
-
const calculatePhysicalDistance$1 = (point1, point2) => {
|
|
15219
|
+
const calculatePhysicalDistance$1 = (point1, point2, unit) => {
|
|
15201
15220
|
const dx = point2[0] - point1[0];
|
|
15202
15221
|
const dy = point2[1] - point1[1];
|
|
15203
15222
|
const svgDistance = Math.sqrt(dx * dx + dy * dy);
|
|
15204
15223
|
const physicalDistance = svgDistance / 50; // SVG坐标是物理单位的50倍
|
|
15205
|
-
return physicalDistance.toFixed(2) + ' m';
|
|
15224
|
+
// return physicalDistance.toFixed(2) + ' m';
|
|
15225
|
+
return convertDistanceByUnits(physicalDistance, unit).value;
|
|
15206
15226
|
};
|
|
15207
15227
|
/**
|
|
15208
15228
|
* 计算两点间的中点坐标
|
|
@@ -15213,7 +15233,8 @@ const calculatePhysicalDistance$1 = (point1, point2) => {
|
|
|
15213
15233
|
const calculateMidpoint$1 = (point1, point2) => {
|
|
15214
15234
|
return [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
|
|
15215
15235
|
};
|
|
15216
|
-
const DistanceLabels = ({ coordinates, createMode = false, editMode = false, completed = false, showPoints = false, mousePos: _mousePos = null, ghostLastDistance = null, ghostLastMidpoint = null, ghostFirstDistance = null, ghostFirstMidpoint = null, fontSize = 30, showFirstDistance = true, }) => {
|
|
15236
|
+
const DistanceLabels = ({ coordinates, createMode = false, editMode = false, completed = false, showPoints = false, mousePos: _mousePos = null, ghostLastDistance = null, ghostLastMidpoint = null, ghostFirstDistance = null, ghostFirstMidpoint = null, fontSize = 30, showFirstDistance = true, unit = UnitsType.Metric, }) => {
|
|
15237
|
+
const { drag } = useCommonContext();
|
|
15217
15238
|
// 只在显示可操作顶点时显示距离
|
|
15218
15239
|
if (!((createMode && showPoints) || editMode || (createMode && completed)) ||
|
|
15219
15240
|
coordinates.length < (showFirstDistance ? 1 : 2)) {
|
|
@@ -15227,7 +15248,7 @@ const DistanceLabels = ({ coordinates, createMode = false, editMode = false, com
|
|
|
15227
15248
|
return null;
|
|
15228
15249
|
}
|
|
15229
15250
|
const midpoint = calculateMidpoint$1(coord, nextCoord);
|
|
15230
|
-
const distance = calculatePhysicalDistance$1(coord, nextCoord);
|
|
15251
|
+
const distance = calculatePhysicalDistance$1(coord, nextCoord, unit);
|
|
15231
15252
|
// 如果当前点和下一个点坐标一致则不现实,处理头尾点一样的问题
|
|
15232
15253
|
if (coord[0] === nextCoord[0] && coord[1] === nextCoord[1]) {
|
|
15233
15254
|
return null;
|
|
@@ -15239,23 +15260,32 @@ const DistanceLabels = ({ coordinates, createMode = false, editMode = false, com
|
|
|
15239
15260
|
WebkitUserSelect: 'none',
|
|
15240
15261
|
WebkitTouchCallout: 'none',
|
|
15241
15262
|
touchAction: 'none',
|
|
15263
|
+
transformBox: 'fill-box',
|
|
15264
|
+
transformOrigin: 'center',
|
|
15265
|
+
transform: `rotate(-${drag.rotation}deg)`,
|
|
15242
15266
|
}, text: distance }, `distance-${idx}`));
|
|
15243
15267
|
}), ghostLastDistance && ghostLastMidpoint && (jsx(TextElement, { fontSize: fontSize, x: ghostLastMidpoint[0], y: ghostLastMidpoint[1], text: ghostLastDistance, style: {
|
|
15244
15268
|
userSelect: 'none',
|
|
15245
15269
|
WebkitUserSelect: 'none',
|
|
15246
15270
|
WebkitTouchCallout: 'none',
|
|
15247
15271
|
touchAction: 'none',
|
|
15272
|
+
transformBox: 'fill-box',
|
|
15273
|
+
transformOrigin: 'center',
|
|
15274
|
+
transform: `rotate(-${drag.rotation}deg)`,
|
|
15248
15275
|
} })), ghostFirstDistance && ghostFirstMidpoint && (jsx(TextElement, { fontSize: fontSize, x: ghostFirstMidpoint[0], y: ghostFirstMidpoint[1], text: ghostFirstDistance, style: {
|
|
15249
15276
|
userSelect: 'none',
|
|
15250
15277
|
WebkitUserSelect: 'none',
|
|
15251
15278
|
WebkitTouchCallout: 'none',
|
|
15252
15279
|
touchAction: 'none',
|
|
15280
|
+
transformBox: 'fill-box',
|
|
15281
|
+
transformOrigin: 'center',
|
|
15282
|
+
transform: `rotate(-${drag.rotation}deg)`,
|
|
15253
15283
|
} }))] }));
|
|
15254
15284
|
};
|
|
15255
15285
|
|
|
15256
|
-
var css_248z$
|
|
15257
|
-
var styles$
|
|
15258
|
-
styleInject(css_248z$
|
|
15286
|
+
var css_248z$5 = ".index-module_polygonPathG__S-Bpl {\n cursor: pointer;\n}\n\n.index-module_vertex__-Qb1u {\n cursor: pointer;\n}\n\n.index-module_dragging__xSFdO {\n cursor: grabbing;\n}\n\n.index-module_createVertex__ldz2E {\n cursor: crosshair;\n}\n\n.index-module_addVertex__hrF71 {\n cursor: pointer;\n}\n\n.index-module_polygonPath__PynOn {\n pointer-events: stroke;\n cursor: pointer;\n}\n\n.index-module_notCreate__bFnkV {\n cursor: no-drop;\n}";
|
|
15287
|
+
var styles$5 = {"polygonPathG":"index-module_polygonPathG__S-Bpl","vertex":"index-module_vertex__-Qb1u","dragging":"index-module_dragging__xSFdO","addVertex":"index-module_addVertex__hrF71","polygonPath":"index-module_polygonPath__PynOn","notCreate":"index-module_notCreate__bFnkV"};
|
|
15288
|
+
styleInject(css_248z$5);
|
|
15259
15289
|
|
|
15260
15290
|
var CreateStatus;
|
|
15261
15291
|
(function (CreateStatus) {
|
|
@@ -15283,6 +15313,10 @@ var ClickEventType;
|
|
|
15283
15313
|
(function (ClickEventType) {
|
|
15284
15314
|
// 点击doodle的active time的时候触发
|
|
15285
15315
|
ClickEventType["DOODLE_ACTIVE_TIME"] = "doodleActiveTime";
|
|
15316
|
+
// 移动禁区点之后报错
|
|
15317
|
+
ClickEventType["MOVE_OBSTACLE_POINT_ERROR"] = "moveObstaclePointError";
|
|
15318
|
+
// 拖拽地图
|
|
15319
|
+
ClickEventType["DRAG_MAP"] = "dragMap";
|
|
15286
15320
|
})(ClickEventType || (ClickEventType = {}));
|
|
15287
15321
|
const INIT_EDIT_MAP_INFO = {
|
|
15288
15322
|
editMap: false,
|
|
@@ -15546,17 +15580,23 @@ function coordinatesToPoints$1(coordinates) {
|
|
|
15546
15580
|
|
|
15547
15581
|
const useCheckElement = () => {
|
|
15548
15582
|
const { editMapInfo, minDistance } = useMapEditContext();
|
|
15549
|
-
const { platform } = useCommonContext();
|
|
15550
15583
|
const { svgElementDatas } = useSvgEditContext();
|
|
15551
15584
|
const checkDoodle = useCallback(() => {
|
|
15552
|
-
console.log('checkdoodle', editMapInfo, svgElementDatas);
|
|
15553
15585
|
if (!editMapInfo.selectElement || editMapInfo.selectElement.type !== DataType.DOODLE) {
|
|
15554
|
-
return {
|
|
15586
|
+
return {
|
|
15587
|
+
isValid: false,
|
|
15588
|
+
reason: 'No doodle element selected',
|
|
15589
|
+
code: CheckDoodleErrorType.NO_DOODLE_SELECTED,
|
|
15590
|
+
};
|
|
15555
15591
|
}
|
|
15556
15592
|
const doodleElement = editMapInfo.selectElement;
|
|
15557
15593
|
const doodlePoints = transformSvgElements(doodleElement).flat();
|
|
15558
15594
|
if (doodlePoints.length === 0) {
|
|
15559
|
-
return {
|
|
15595
|
+
return {
|
|
15596
|
+
isValid: false,
|
|
15597
|
+
reason: 'Doodle has no transformed points',
|
|
15598
|
+
code: CheckDoodleErrorType.NO_MOVABLE_POINTS,
|
|
15599
|
+
};
|
|
15560
15600
|
}
|
|
15561
15601
|
const boundary = svgElementDatas?.[DataType.BOUNDARY] || [];
|
|
15562
15602
|
const obstacle = svgElementDatas?.[DataType.OBSTACLE] || [];
|
|
@@ -15565,18 +15605,12 @@ const useCheckElement = () => {
|
|
|
15565
15605
|
// 1. 首先判断 doodle 是否在一个 boundary 内
|
|
15566
15606
|
let isInBoundary = false;
|
|
15567
15607
|
let containingBoundary = null;
|
|
15568
|
-
console.log('doodlePoints--->', doodleElement, doodlePoints);
|
|
15569
15608
|
for (const boundaryData of boundary) {
|
|
15570
15609
|
const boundaryPoints = coordinatesToPoints$1(boundaryData.points);
|
|
15571
15610
|
const allPointsInside = doodlePoints.every((point) => {
|
|
15572
15611
|
const isIn = isPointInPolygon(point, boundaryPoints);
|
|
15573
|
-
// console.log('isIn--->', isIn, point, boundaryPoints);
|
|
15574
|
-
if (!isIn) {
|
|
15575
|
-
console.log('isIn--->', isIn, point, boundaryPoints);
|
|
15576
|
-
}
|
|
15577
15612
|
return isIn;
|
|
15578
15613
|
});
|
|
15579
|
-
console.log('allPointsInside--->', allPointsInside, boundaryPoints, boundaryData);
|
|
15580
15614
|
if (allPointsInside) {
|
|
15581
15615
|
isInBoundary = true;
|
|
15582
15616
|
containingBoundary = boundaryData;
|
|
@@ -15584,7 +15618,11 @@ const useCheckElement = () => {
|
|
|
15584
15618
|
}
|
|
15585
15619
|
}
|
|
15586
15620
|
if (!isInBoundary) {
|
|
15587
|
-
return {
|
|
15621
|
+
return {
|
|
15622
|
+
isValid: false,
|
|
15623
|
+
reason: 'Doodle 不在任何边界内',
|
|
15624
|
+
code: CheckDoodleErrorType.DOODLE_NOT_IN_BOUNDARY,
|
|
15625
|
+
};
|
|
15588
15626
|
}
|
|
15589
15627
|
// 2. 检查 doodle 所有点距离 boundary 边界至少 2m
|
|
15590
15628
|
const boundaryPoints = coordinatesToPoints$1(containingBoundary.points);
|
|
@@ -15594,6 +15632,7 @@ const useCheckElement = () => {
|
|
|
15594
15632
|
return {
|
|
15595
15633
|
isValid: false,
|
|
15596
15634
|
reason: `Doodle 距离边界过近 (${distanceToBoundary.toFixed(2) / SCALE_FACTOR}m < ${minDistance / SCALE_FACTOR}m)`,
|
|
15635
|
+
code: CheckDoodleErrorType.DOODLE_DISTANCE_TOO_CLOSE,
|
|
15597
15636
|
};
|
|
15598
15637
|
}
|
|
15599
15638
|
}
|
|
@@ -15624,11 +15663,11 @@ const useCheckElement = () => {
|
|
|
15624
15663
|
return {
|
|
15625
15664
|
isValid: false,
|
|
15626
15665
|
reason: `Doodle 与${elementTypeName}相交或重叠`,
|
|
15666
|
+
code: CheckDoodleErrorType.DOODLE_INTERSECT,
|
|
15627
15667
|
};
|
|
15628
15668
|
}
|
|
15629
15669
|
// 检查距离是否大于 2m
|
|
15630
15670
|
const distance = polygonToPolygonDistance(doodlePoints, elementPoints);
|
|
15631
|
-
console.log('distance--->', distance, minDistance, doodlePoints, elementPoints);
|
|
15632
15671
|
if (distance < minDistance) {
|
|
15633
15672
|
const elementTypeName = {
|
|
15634
15673
|
[DataType.OBSTACLE]: '障碍物',
|
|
@@ -15639,17 +15678,16 @@ const useCheckElement = () => {
|
|
|
15639
15678
|
return {
|
|
15640
15679
|
isValid: false,
|
|
15641
15680
|
reason: `Doodle 与${elementTypeName}距离过近 (${distance.toFixed(2) / SCALE_FACTOR}m < ${minDistance / SCALE_FACTOR}m)`,
|
|
15681
|
+
code: CheckDoodleErrorType.DOODLE_DISTANCE_TOO_CLOSE_TO_OTHER_ELEMENT,
|
|
15642
15682
|
};
|
|
15643
15683
|
}
|
|
15644
15684
|
}
|
|
15645
|
-
// 所有检查通过
|
|
15646
|
-
console.log('Doodle 位置检查通过');
|
|
15647
15685
|
return { isValid: true };
|
|
15648
15686
|
}, [editMapInfo, svgElementDatas, minDistance]);
|
|
15649
15687
|
const checkCanNotCreateAtPosition = useCallback((checkPoint, checkPoints) => {
|
|
15650
15688
|
// console.log('editMapInfo.elementType--->', editMapInfo);
|
|
15651
15689
|
if (!editMapInfo.elementType)
|
|
15652
|
-
return false;
|
|
15690
|
+
return { result: false };
|
|
15653
15691
|
const currentPoints = editMapInfo?.selectElement?.points;
|
|
15654
15692
|
const points = checkPoints || currentPoints;
|
|
15655
15693
|
const firstPoint = coordinatesToPoints$1(points)?.[0] || checkPoint;
|
|
@@ -15664,14 +15702,21 @@ const useCheckElement = () => {
|
|
|
15664
15702
|
break;
|
|
15665
15703
|
}
|
|
15666
15704
|
}
|
|
15667
|
-
console.log('currentBoundary--->', currentBoundary, points);
|
|
15668
15705
|
if (!currentBoundary)
|
|
15669
|
-
return
|
|
15706
|
+
return {
|
|
15707
|
+
result: true,
|
|
15708
|
+
code: CheckObstaclePointErrorType.BOUNDARY_NOT_IN_BOUNDARY,
|
|
15709
|
+
};
|
|
15670
15710
|
if (!isPointInPolygon(checkPoint, coordinatesToPoints$1(currentBoundary.points)))
|
|
15671
|
-
return
|
|
15711
|
+
return {
|
|
15712
|
+
result: true,
|
|
15713
|
+
code: CheckObstaclePointErrorType.POINT_IN_OBSTACLE,
|
|
15714
|
+
};
|
|
15672
15715
|
// 如果不是创建 obstacle,则不需要进一步检查
|
|
15673
15716
|
if (editMapInfo.elementType !== DataType.OBSTACLE)
|
|
15674
|
-
return
|
|
15717
|
+
return {
|
|
15718
|
+
result: false,
|
|
15719
|
+
};
|
|
15675
15720
|
// 获取当前正在创建的 obstacle 的点
|
|
15676
15721
|
const currentObstaclePoints = coordinatesToPoints$1(points) || [];
|
|
15677
15722
|
// 构建当前 obstacle 的多边形(包括检查点位置)
|
|
@@ -15691,8 +15736,10 @@ const useCheckElement = () => {
|
|
|
15691
15736
|
for (const obstacle of obstaclesInBoundary) {
|
|
15692
15737
|
const obstaclePoints = coordinatesToPoints$1(obstacle.points);
|
|
15693
15738
|
if (doPolygonsIntersect(currentObstaclePolygon, obstaclePoints)) {
|
|
15694
|
-
|
|
15695
|
-
|
|
15739
|
+
return {
|
|
15740
|
+
result: true,
|
|
15741
|
+
code: CheckObstaclePointErrorType.OBSTACLE_INTERSECT,
|
|
15742
|
+
};
|
|
15696
15743
|
}
|
|
15697
15744
|
}
|
|
15698
15745
|
// 3. 找到在 currentBoundary 内的 doodle 元素
|
|
@@ -15707,18 +15754,23 @@ const useCheckElement = () => {
|
|
|
15707
15754
|
const doodleTransformedPoints = transformSvgElements(doodle).flat();
|
|
15708
15755
|
// 检查相交
|
|
15709
15756
|
if (doPolygonsIntersect(currentObstaclePolygon, doodleTransformedPoints)) {
|
|
15710
|
-
|
|
15711
|
-
|
|
15757
|
+
return {
|
|
15758
|
+
result: true,
|
|
15759
|
+
code: CheckObstaclePointErrorType.DOODLE_INTERSECT,
|
|
15760
|
+
};
|
|
15712
15761
|
}
|
|
15713
15762
|
// 检查距离
|
|
15714
15763
|
const distance = polygonToPolygonDistance(currentObstaclePolygon, doodleTransformedPoints);
|
|
15715
|
-
console.log('Obstacle-Doodle distance too close:', distance, 'required:', minDistance);
|
|
15716
15764
|
if (distance < minDistance) {
|
|
15717
|
-
|
|
15718
|
-
|
|
15765
|
+
return {
|
|
15766
|
+
result: true,
|
|
15767
|
+
code: CheckObstaclePointErrorType.DOODLE_DISTANCE_TOO_CLOSE,
|
|
15768
|
+
};
|
|
15719
15769
|
}
|
|
15720
15770
|
}
|
|
15721
|
-
return
|
|
15771
|
+
return {
|
|
15772
|
+
result: false,
|
|
15773
|
+
};
|
|
15722
15774
|
}, [editMapInfo.selectElement, editMapInfo.elementType, svgElementDatas, minDistance]);
|
|
15723
15775
|
return {
|
|
15724
15776
|
checkDoodle,
|
|
@@ -15740,12 +15792,13 @@ const coordinatesToPoints = (coordinates) => {
|
|
|
15740
15792
|
* @param point2 第二个点 [x, y]
|
|
15741
15793
|
* @returns 距离(mi单位)
|
|
15742
15794
|
*/
|
|
15743
|
-
const calculatePhysicalDistance = (point1, point2) => {
|
|
15795
|
+
const calculatePhysicalDistance = (point1, point2, unit) => {
|
|
15744
15796
|
const dx = point2[0] - point1[0];
|
|
15745
15797
|
const dy = point2[1] - point1[1];
|
|
15746
15798
|
const svgDistance = Math.sqrt(dx * dx + dy * dy);
|
|
15747
15799
|
const physicalDistance = svgDistance / 50; // SVG坐标是物理单位的50倍
|
|
15748
|
-
return physicalDistance.toFixed(2) + ' m';
|
|
15800
|
+
// return physicalDistance.toFixed(2) + ' m';
|
|
15801
|
+
return convertDistanceByUnits(physicalDistance, unit).value;
|
|
15749
15802
|
};
|
|
15750
15803
|
/**
|
|
15751
15804
|
* 计算两点间的中点坐标
|
|
@@ -15816,7 +15869,8 @@ const createPathData = (points) => {
|
|
|
15816
15869
|
};
|
|
15817
15870
|
const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity = 1, strokeColor = '#000', strokeWidth = 2, strokeOpacity = 1, createMode = false, showPoints = false, onPointClick, completed = false, mousePos = null, editMode = false, onCoordinatesChange, onPathClick, onPolygonClick, onVertexDelete, draggable = true, // 新增参数,如果未指定则根据createMode和editMode自动判断
|
|
15818
15871
|
}) => {
|
|
15819
|
-
const { overlayScale } = useCommonContext();
|
|
15872
|
+
const { overlayScale, unitType } = useCommonContext();
|
|
15873
|
+
const { onHandleEvent } = useMapEditContext();
|
|
15820
15874
|
const { svgRef } = useSvgEditContext();
|
|
15821
15875
|
const [dragState, setDragState] = useState({
|
|
15822
15876
|
isDragging: false,
|
|
@@ -16076,19 +16130,19 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
16076
16130
|
return (checkCanNotCreateAtPosition?.({
|
|
16077
16131
|
x: dragState.currentPosition[0],
|
|
16078
16132
|
y: dragState.currentPosition[1],
|
|
16079
|
-
}) === true);
|
|
16133
|
+
}).result === true);
|
|
16080
16134
|
const prePoints = coordinates.slice(0, dragState.dragIndex);
|
|
16081
16135
|
const afterPoints = coordinates.slice(dragState.dragIndex + 1);
|
|
16082
16136
|
const checkPoints = [...prePoints, dragState.currentPosition, ...afterPoints];
|
|
16083
16137
|
return (checkCanNotCreateAtPosition?.({
|
|
16084
16138
|
x: dragState.currentPosition[0],
|
|
16085
16139
|
y: dragState.currentPosition[1],
|
|
16086
|
-
}, checkPoints) === true);
|
|
16140
|
+
}, checkPoints).result === true);
|
|
16087
16141
|
}, [dragState.currentPosition, checkCanNotCreateAtPosition, coordinates]);
|
|
16088
16142
|
const generateVertexClassName = useMemo(() => {
|
|
16089
16143
|
if (!dragState.isDragging)
|
|
16090
|
-
return styles$
|
|
16091
|
-
return showNotCreateCursor ? styles$
|
|
16144
|
+
return styles$5.vertex;
|
|
16145
|
+
return showNotCreateCursor ? styles$5.notCreate : styles$5.dragging;
|
|
16092
16146
|
}, [dragState.isDragging, showNotCreateCursor]);
|
|
16093
16147
|
// 使用 useRef 来存储 requestAnimationFrame ID
|
|
16094
16148
|
const rafIdRef = useRef(null);
|
|
@@ -16210,7 +16264,15 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
16210
16264
|
? newCoordinates
|
|
16211
16265
|
: newCoordinates.reverse();
|
|
16212
16266
|
if (showNotCreateCursor) {
|
|
16213
|
-
|
|
16267
|
+
if (platform === PlatformType.H5) {
|
|
16268
|
+
onHandleEvent?.(ClickEventType.MOVE_OBSTACLE_POINT_ERROR, {
|
|
16269
|
+
result: true,
|
|
16270
|
+
code: CheckObstaclePointErrorType.COMMON_ERROR,
|
|
16271
|
+
});
|
|
16272
|
+
}
|
|
16273
|
+
else {
|
|
16274
|
+
message.error('Unable to place here, please select a valid spot');
|
|
16275
|
+
}
|
|
16214
16276
|
}
|
|
16215
16277
|
else {
|
|
16216
16278
|
onCoordinatesChange?.(result);
|
|
@@ -16282,7 +16344,12 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
16282
16344
|
]);
|
|
16283
16345
|
// 获取当前渲染用的坐标
|
|
16284
16346
|
const renderCoordinates = getRenderCoordinates();
|
|
16285
|
-
const polygonPoints =
|
|
16347
|
+
const polygonPoints = useMemo(() => {
|
|
16348
|
+
const points = editMapInfo?.createMode === CreateStatus.CREATING
|
|
16349
|
+
? [...renderCoordinates, mousePos ? [mousePos.x, mousePos.y] : []]
|
|
16350
|
+
: renderCoordinates;
|
|
16351
|
+
return coordinatesToPoints(points);
|
|
16352
|
+
}, [editMapInfo?.createMode, renderCoordinates, mousePos]);
|
|
16286
16353
|
// 按type分组坐标点 - 创建模式下不自动闭合
|
|
16287
16354
|
const pathSegments = groupCoordinatesByType(renderCoordinates, !createMode || completed);
|
|
16288
16355
|
const dashPaths = pathSegments.filter((segment) => segment.type === 1);
|
|
@@ -16295,13 +16362,10 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
16295
16362
|
: null;
|
|
16296
16363
|
// 虚拟连线的距离计算
|
|
16297
16364
|
const ghostLastDistance = createMode && mousePos && renderCoordinates.length > 0 && !completed
|
|
16298
|
-
? calculatePhysicalDistance(renderCoordinates[renderCoordinates.length - 1], [
|
|
16299
|
-
mousePos.x,
|
|
16300
|
-
mousePos.y,
|
|
16301
|
-
])
|
|
16365
|
+
? calculatePhysicalDistance(renderCoordinates[renderCoordinates.length - 1], [mousePos.x, mousePos.y], unitType)
|
|
16302
16366
|
: null;
|
|
16303
16367
|
const ghostFirstDistance = createMode && mousePos && !completed && renderCoordinates.length >= 1
|
|
16304
|
-
? calculatePhysicalDistance(renderCoordinates[0], [mousePos.x, mousePos.y])
|
|
16368
|
+
? calculatePhysicalDistance(renderCoordinates[0], [mousePos.x, mousePos.y], unitType)
|
|
16305
16369
|
: null;
|
|
16306
16370
|
// 虚拟连线的中点坐标
|
|
16307
16371
|
const ghostLastMidpoint = createMode && mousePos && renderCoordinates.length > 0 && !completed
|
|
@@ -16352,30 +16416,50 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
16352
16416
|
return (jsxs(Fragment, { children: [(editMode || (createMode && completed)) &&
|
|
16353
16417
|
dragState.isDragging &&
|
|
16354
16418
|
dragState.dragType !== 'new' &&
|
|
16355
|
-
dragState.originalPosition && (jsxs(Fragment, { children: [jsx(VertexElement, { cx: dragState.originalPosition[0], cy: dragState.originalPosition[1], stroke: strokeColor, strokeOpacity: 0.2, pointerEvents: "none"
|
|
16419
|
+
dragState.originalPosition && (jsxs(Fragment, { children: [jsx(VertexElement, { cx: dragState.originalPosition[0], cy: dragState.originalPosition[1], stroke: strokeColor, strokeOpacity: 0.2, pointerEvents: "none", style: {
|
|
16420
|
+
userSelect: 'none',
|
|
16421
|
+
WebkitUserSelect: 'none',
|
|
16422
|
+
WebkitTouchCallout: 'none',
|
|
16423
|
+
touchAction: 'none',
|
|
16424
|
+
} }, "ghost-vertex"), (() => {
|
|
16356
16425
|
// 获取前一个点和后一个点的索引
|
|
16357
16426
|
const prevIndex = (dragState.dragIndex - 1 + coordinates.length) % coordinates.length;
|
|
16358
16427
|
const nextIndex = (dragState.dragIndex + 1) % coordinates.length;
|
|
16359
|
-
return (jsxs(Fragment, { children: [jsx("line", { x1: coordinates[prevIndex][0], y1: coordinates[prevIndex][1], x2: dragState.originalPosition[0], y2: dragState.originalPosition[1], stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: 0.5, strokeDasharray: "5,5", pointerEvents: "none"
|
|
16360
|
-
|
|
16361
|
-
|
|
16428
|
+
return (jsxs(Fragment, { children: [jsx("line", { x1: coordinates[prevIndex][0], y1: coordinates[prevIndex][1], x2: dragState.originalPosition[0], y2: dragState.originalPosition[1], stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: 0.5, strokeDasharray: "5,5", pointerEvents: "none", style: {
|
|
16429
|
+
userSelect: 'none',
|
|
16430
|
+
WebkitUserSelect: 'none',
|
|
16431
|
+
WebkitTouchCallout: 'none',
|
|
16432
|
+
touchAction: 'none',
|
|
16433
|
+
} }), jsx("line", { x1: dragState.originalPosition[0], y1: dragState.originalPosition[1], x2: coordinates[nextIndex][0], y2: coordinates[nextIndex][1], stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: 0.5, strokeDasharray: "5,5", pointerEvents: "none", style: {
|
|
16434
|
+
userSelect: 'none',
|
|
16435
|
+
WebkitUserSelect: 'none',
|
|
16436
|
+
WebkitTouchCallout: 'none',
|
|
16437
|
+
touchAction: 'none',
|
|
16438
|
+
} })] }));
|
|
16439
|
+
})()] })), renderCoordinates.length >= 3 && (jsx("polygon", { className: editMapInfo?.createMode === CreateStatus.CREATING ? '' : styles$5.polygonPathG, points: polygonPoints, fill: fillColor, fillOpacity: fillOpacity, stroke: "none" // 边框透明
|
|
16440
|
+
, onClick: onPolygonClick })), jsxs("g", { className: styles$5.polygonPathG, children: [renderCoordinates.length >= 2 &&
|
|
16362
16441
|
pathSegments.map((segment, index) => {
|
|
16363
16442
|
if (segment.points.length < 2)
|
|
16364
16443
|
return null;
|
|
16365
16444
|
const pathData = createPathData(segment.points);
|
|
16366
16445
|
const isDash = segment.type === 1;
|
|
16367
|
-
return (jsx("path", { d: pathData, fill: "none", stroke: isDash ? 'none' : strokeColor, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", className: styles$
|
|
16446
|
+
return (jsx("path", { d: pathData, fill: "none", stroke: isDash ? 'none' : strokeColor, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", className: styles$5.polygonPath, vectorEffect: "non-scaling-stroke", onClick: onPathClick, style: {
|
|
16447
|
+
userSelect: 'none',
|
|
16448
|
+
WebkitUserSelect: 'none',
|
|
16449
|
+
WebkitTouchCallout: 'none',
|
|
16450
|
+
touchAction: 'none',
|
|
16451
|
+
} }, index));
|
|
16368
16452
|
}), renderCoordinates.length >= 2 &&
|
|
16369
16453
|
dashPaths.map((segment, index) => {
|
|
16370
16454
|
if (segment.points.length < 2)
|
|
16371
16455
|
return null;
|
|
16372
|
-
return (jsx(DashPath, { className: styles$
|
|
16456
|
+
return (jsx(DashPath, { className: styles$5.polygonPath, points: segment.points, stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity }, index));
|
|
16373
16457
|
})] }), (editMode || (createMode && completed)) &&
|
|
16374
16458
|
renderCoordinates.length >= 2 &&
|
|
16375
16459
|
renderCoordinates.map((coord, index) => {
|
|
16376
16460
|
const nextCoord = renderCoordinates[(index + 1) % renderCoordinates.length];
|
|
16377
16461
|
const isDashPath = coord[2] === 1;
|
|
16378
|
-
return (jsx("line", { x1: coord[0], y1: coord[1], x2: nextCoord[0], y2: nextCoord[1], stroke: isDashPath ? 'transparent' : strokeColor, strokeWidth: platform === PlatformType.H5 ? strokeWidth * 3 : strokeWidth, className: styles$
|
|
16462
|
+
return (jsx("line", { x1: coord[0], y1: coord[1], x2: nextCoord[0], y2: nextCoord[1], stroke: isDashPath ? 'transparent' : strokeColor, strokeWidth: platform === PlatformType.H5 ? strokeWidth * 3 : strokeWidth, className: styles$5.addVertex, style: {
|
|
16379
16463
|
userSelect: 'none',
|
|
16380
16464
|
WebkitUserSelect: 'none',
|
|
16381
16465
|
WebkitTouchCallout: 'none',
|
|
@@ -16407,7 +16491,7 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
16407
16491
|
setHoverVertex(null);
|
|
16408
16492
|
},
|
|
16409
16493
|
}) }, `edge-${index}`));
|
|
16410
|
-
}), ghostLastPath && (jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >= 2 && (jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed, fontSize: platform === PlatformType.H5 ? 12 * overlayScale : 30 * overlayScale }), jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint, fontSize: platform === PlatformType.H5 ? 12 * overlayScale : 30 * overlayScale, showFirstDistance: platform !== PlatformType.H5 }), hoverVertex && !dragState.isDragging && (jsx(VertexElement, { cx: hoverVertex.position.x, cy: hoverVertex.position.y, stroke: strokeColor, strokeOpacity: 0.6, fill: "white", fillOpacity: 0.8, pointerEvents: "none" })), ((createMode && showPoints) || editMode || (createMode && completed)) &&
|
|
16494
|
+
}), ghostLastPath && (jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >= 2 && (jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed, fontSize: platform === PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, unitType: unitType }), jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint, fontSize: platform === PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, showFirstDistance: platform !== PlatformType.H5, unit: unitType }), hoverVertex && !dragState.isDragging && (jsx(VertexElement, { cx: hoverVertex.position.x, cy: hoverVertex.position.y, stroke: strokeColor, strokeOpacity: 0.6, fill: "white", fillOpacity: 0.8, pointerEvents: "none" })), ((createMode && showPoints) || editMode || (createMode && completed)) &&
|
|
16411
16495
|
renderCoordinates.map((coord, idx) => {
|
|
16412
16496
|
// 判断当前顶点的状态
|
|
16413
16497
|
const isLastPoint = idx === renderCoordinates.length - 1;
|
|
@@ -16416,7 +16500,8 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
16416
16500
|
const isInEditMode = editMode;
|
|
16417
16501
|
// H5模式下选中的顶点显示蓝色,并且放大1.5倍
|
|
16418
16502
|
const isSelected = platform === PlatformType.H5 && selectedVertexIndex === idx;
|
|
16419
|
-
const
|
|
16503
|
+
const commonRadius = canComplete ? 16 : 12;
|
|
16504
|
+
const vertexRadius = isSelected ? commonRadius * 1.2 : commonRadius;
|
|
16420
16505
|
const vertexFill = isSelected ? '#FFAB7E' : 'white';
|
|
16421
16506
|
return (jsxs("g", { children: [jsx(VertexElement, { className: generateVertexClassName, style: {
|
|
16422
16507
|
userSelect: 'none',
|
|
@@ -16594,7 +16679,6 @@ const BoundaryElement = ({ data }) => {
|
|
|
16594
16679
|
return (jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: onPathClick, onPolygonClick: () => {
|
|
16595
16680
|
onPathClick();
|
|
16596
16681
|
}, onCoordinatesChange: (coordinates) => {
|
|
16597
|
-
console.log('onCoordinatesChange', coordinates);
|
|
16598
16682
|
setEditMapInfo((prev) => ({
|
|
16599
16683
|
...prev,
|
|
16600
16684
|
selectElement: {
|
|
@@ -16647,7 +16731,6 @@ const useHistoryHandle = (props) => {
|
|
|
16647
16731
|
// undo
|
|
16648
16732
|
const undo = () => {
|
|
16649
16733
|
setEditMapInfo((prev) => {
|
|
16650
|
-
console.log('undo->', prev);
|
|
16651
16734
|
if (prev?.historyList?.length > 0 && prev?.currentHistoryIndex > 0) {
|
|
16652
16735
|
return {
|
|
16653
16736
|
...prev,
|
|
@@ -16715,10 +16798,8 @@ const ObstacleElement = ({ data }) => {
|
|
|
16715
16798
|
const { addHistory } = useHistoryHandle();
|
|
16716
16799
|
// 处理删除顶点
|
|
16717
16800
|
const handleCreateVertexDelete = useCallback((vertexIndex) => {
|
|
16718
|
-
console.log('ObstacleElement删除顶点', vertexIndex);
|
|
16719
16801
|
if (editMapInfo?.selectElement?.points && editMapInfo?.selectElement?.points?.length > 0) {
|
|
16720
16802
|
const newPoints = editMapInfo?.selectElement?.points?.filter((_, index) => index !== vertexIndex);
|
|
16721
|
-
console.log('newPoints', newPoints);
|
|
16722
16803
|
setEditMapInfo((prev) => ({
|
|
16723
16804
|
...prev,
|
|
16724
16805
|
selectElement: {
|
|
@@ -16749,7 +16830,8 @@ const ObstacleElement = ({ data }) => {
|
|
|
16749
16830
|
if (platform === PlatformType.H5 &&
|
|
16750
16831
|
editMapInfo?.selectElement?.id === data.id &&
|
|
16751
16832
|
editMapInfo.mobileMode === MobileEditMode.START) {
|
|
16752
|
-
return dp2px((style.lineWidth ||
|
|
16833
|
+
return dp2px((style.lineWidth || 1) * 2);
|
|
16834
|
+
// return dp2px(((style.lineWidth as number) || 3) * 3);
|
|
16753
16835
|
}
|
|
16754
16836
|
return dp2px(style.lineWidth || 3);
|
|
16755
16837
|
}, [platform, style, editMapInfo]);
|
|
@@ -16889,11 +16971,11 @@ const useVisionOffTransform = (data, scaleConstraints
|
|
|
16889
16971
|
return newPoints;
|
|
16890
16972
|
}, []);
|
|
16891
16973
|
// 计算选择框的四个角点(每条边与内部元素对应边平行)
|
|
16892
|
-
const calculateSelectionBoxPoints = useCallback((points) => {
|
|
16974
|
+
const calculateSelectionBoxPoints = useCallback((points, scale = 1) => {
|
|
16893
16975
|
if (points.length < 4)
|
|
16894
16976
|
return points;
|
|
16895
16977
|
// 设置偏移距离(可以根据需要调整)
|
|
16896
|
-
const offset =
|
|
16978
|
+
const offset = 20 * scale; // 偏移距离
|
|
16897
16979
|
// 使用更简单的方法:计算矩形的边界框,然后向外扩展
|
|
16898
16980
|
// 计算矩形的两条相邻边向量(从左上角出发)
|
|
16899
16981
|
const edge1 = { x: points[1].x - points[0].x, y: points[1].y - points[0].y }; // 左上到左下
|
|
@@ -17209,15 +17291,15 @@ const useVisionOffTransform = (data, scaleConstraints
|
|
|
17209
17291
|
};
|
|
17210
17292
|
};
|
|
17211
17293
|
|
|
17212
|
-
var _g$
|
|
17213
|
-
function _extends$
|
|
17294
|
+
var _g$5, _defs$5;
|
|
17295
|
+
function _extends$9() { return _extends$9 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$9.apply(null, arguments); }
|
|
17214
17296
|
var SvgTransformDelete = function SvgTransformDelete(props) {
|
|
17215
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17297
|
+
return /*#__PURE__*/React.createElement("svg", _extends$9({
|
|
17216
17298
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17217
17299
|
width: 20,
|
|
17218
17300
|
height: 20,
|
|
17219
17301
|
fill: "none"
|
|
17220
|
-
}, props), _g$
|
|
17302
|
+
}, props), _g$5 || (_g$5 = /*#__PURE__*/React.createElement("g", {
|
|
17221
17303
|
clipPath: "url(#transform-delete_svg__a)"
|
|
17222
17304
|
}, /*#__PURE__*/React.createElement("circle", {
|
|
17223
17305
|
cx: 10,
|
|
@@ -17240,7 +17322,7 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
|
|
|
17240
17322
|
fill: "#fff",
|
|
17241
17323
|
rx: 0.8,
|
|
17242
17324
|
transform: "rotate(45 6.323 5.191)"
|
|
17243
|
-
}))), _defs$
|
|
17325
|
+
}))), _defs$5 || (_defs$5 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
17244
17326
|
id: "transform-delete_svg__b",
|
|
17245
17327
|
x1: 17.727,
|
|
17246
17328
|
x2: -1.215,
|
|
@@ -17260,15 +17342,15 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
|
|
|
17260
17342
|
})))));
|
|
17261
17343
|
};
|
|
17262
17344
|
|
|
17263
|
-
var _g$
|
|
17264
|
-
function _extends$
|
|
17345
|
+
var _g$4, _defs$4;
|
|
17346
|
+
function _extends$8() { return _extends$8 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$8.apply(null, arguments); }
|
|
17265
17347
|
var SvgTransformRotate = function SvgTransformRotate(props) {
|
|
17266
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17348
|
+
return /*#__PURE__*/React.createElement("svg", _extends$8({
|
|
17267
17349
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17268
17350
|
width: 21,
|
|
17269
17351
|
height: 20,
|
|
17270
17352
|
fill: "none"
|
|
17271
|
-
}, props), _g$
|
|
17353
|
+
}, props), _g$4 || (_g$4 = /*#__PURE__*/React.createElement("g", {
|
|
17272
17354
|
clipPath: "url(#transform-rotate_svg__a)"
|
|
17273
17355
|
}, /*#__PURE__*/React.createElement("path", {
|
|
17274
17356
|
fill: "url(#transform-rotate_svg__b)",
|
|
@@ -17276,7 +17358,7 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
|
|
|
17276
17358
|
}), /*#__PURE__*/React.createElement("path", {
|
|
17277
17359
|
fill: "#fff",
|
|
17278
17360
|
d: "M11.602 14.719a5.447 5.447 0 0 1-6.608-5.116l-.004-.205a.818.818 0 0 1 1.633-.084l.004.084.01.285a3.81 3.81 0 0 0 2.127 3.137l.26.115a3.8 3.8 0 0 0 2.227.184l.276-.071q.29-.088.561-.219l-1.147-.441a.817.817 0 0 1 .587-1.525l2.54.977a.817.817 0 0 1 .316 1.308l.001.001a5.45 5.45 0 0 1-2.783 1.57M8.623 4.548a5.447 5.447 0 0 1 6.608 5.116l.004.204a.818.818 0 0 1-1.633.084l-.004-.084-.01-.284a3.81 3.81 0 0 0-2.127-3.138l-.26-.115a3.8 3.8 0 0 0-2.227-.184l-.276.072q-.29.087-.561.218l1.147.442a.817.817 0 0 1-.586 1.524l-2.542-.976a.817.817 0 0 1-.315-1.309 5.45 5.45 0 0 1 2.782-1.57"
|
|
17279
|
-
}))), _defs$
|
|
17361
|
+
}))), _defs$4 || (_defs$4 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
17280
17362
|
id: "transform-rotate_svg__b",
|
|
17281
17363
|
x1: 17.84,
|
|
17282
17364
|
x2: -1.103,
|
|
@@ -17296,15 +17378,15 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
|
|
|
17296
17378
|
})))));
|
|
17297
17379
|
};
|
|
17298
17380
|
|
|
17299
|
-
var _g$
|
|
17300
|
-
function _extends$
|
|
17381
|
+
var _g$3, _defs$3;
|
|
17382
|
+
function _extends$7() { return _extends$7 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$7.apply(null, arguments); }
|
|
17301
17383
|
var SvgTransformScale = function SvgTransformScale(props) {
|
|
17302
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17384
|
+
return /*#__PURE__*/React.createElement("svg", _extends$7({
|
|
17303
17385
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17304
17386
|
width: 21,
|
|
17305
17387
|
height: 20,
|
|
17306
17388
|
fill: "none"
|
|
17307
|
-
}, props), _g$
|
|
17389
|
+
}, props), _g$3 || (_g$3 = /*#__PURE__*/React.createElement("g", {
|
|
17308
17390
|
clipPath: "url(#transform-scale_svg__a)"
|
|
17309
17391
|
}, /*#__PURE__*/React.createElement("path", {
|
|
17310
17392
|
fill: "url(#transform-scale_svg__b)",
|
|
@@ -17312,7 +17394,7 @@ var SvgTransformScale = function SvgTransformScale(props) {
|
|
|
17312
17394
|
}), /*#__PURE__*/React.createElement("path", {
|
|
17313
17395
|
fill: "#fff",
|
|
17314
17396
|
d: "M5.078 8.265a.8.8 0 0 0 1.6.001v-.544l5.69 5.69h-.494a.8.8 0 0 0 0 1.6l2.474-.002a.8.8 0 0 0 .311-.062.8.8 0 0 0 .49-.738v-2.474a.8.8 0 1 0-1.6 0v.594L7.81 6.59h.544a.8.8 0 0 0 0-1.6H5.879a.8.8 0 0 0-.8.8z"
|
|
17315
|
-
}))), _defs$
|
|
17397
|
+
}))), _defs$3 || (_defs$3 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
17316
17398
|
id: "transform-scale_svg__b",
|
|
17317
17399
|
x1: 17.84,
|
|
17318
17400
|
x2: -1.103,
|
|
@@ -17332,15 +17414,15 @@ var SvgTransformScale = function SvgTransformScale(props) {
|
|
|
17332
17414
|
})))));
|
|
17333
17415
|
};
|
|
17334
17416
|
|
|
17335
|
-
var _g, _defs;
|
|
17336
|
-
function _extends$
|
|
17417
|
+
var _g$2, _defs$2;
|
|
17418
|
+
function _extends$6() { return _extends$6 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$6.apply(null, arguments); }
|
|
17337
17419
|
var SvgTransformTranslate = function SvgTransformTranslate(props) {
|
|
17338
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17420
|
+
return /*#__PURE__*/React.createElement("svg", _extends$6({
|
|
17339
17421
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17340
17422
|
width: 20,
|
|
17341
17423
|
height: 20,
|
|
17342
17424
|
fill: "none"
|
|
17343
|
-
}, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
|
17425
|
+
}, props), _g$2 || (_g$2 = /*#__PURE__*/React.createElement("g", {
|
|
17344
17426
|
clipPath: "url(#transform-translate_svg__a)"
|
|
17345
17427
|
}, /*#__PURE__*/React.createElement("circle", {
|
|
17346
17428
|
cx: 10,
|
|
@@ -17350,7 +17432,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
|
|
|
17350
17432
|
}), /*#__PURE__*/React.createElement("path", {
|
|
17351
17433
|
fill: "#fff",
|
|
17352
17434
|
d: "M16.18 10.758a.8.8 0 0 0-.105-1.218l-1.66-1.66a.801.801 0 0 0-1.132 1.132l.383.381h-2.96V6.418l.385.386a.8.8 0 1 0 1.131-1.13l-1.75-1.75a.8.8 0 0 0-1.222.11L7.594 5.689a.8.8 0 0 0 1.131 1.13l.381-.38v2.954H6.137l.381-.38a.8.8 0 1 0-1.13-1.132l-1.752 1.75a.8.8 0 0 0 .106 1.22l1.66 1.66a.801.801 0 0 0 1.132-1.133l-.386-.385h2.958v2.972l-.38-.38a.8.8 0 0 0-1.132 1.131l1.751 1.75a.8.8 0 0 0 1.223-.11l1.654-1.655a.8.8 0 1 0-1.13-1.131l-.386.386v-2.963h2.978l-.385.384a.8.8 0 1 0 1.131 1.131z"
|
|
17353
|
-
}))), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
17435
|
+
}))), _defs$2 || (_defs$2 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
17354
17436
|
id: "transform-translate_svg__b",
|
|
17355
17437
|
x1: 17.727,
|
|
17356
17438
|
x2: -1.215,
|
|
@@ -17372,7 +17454,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
|
|
|
17372
17454
|
|
|
17373
17455
|
const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCancel, onDragEnd, onDragMove, disabled = false, className = '', scaleConstraints = { minEdgeLength: 0.5, maxEdgeLength: 10000 }, showInfo = true, }) => {
|
|
17374
17456
|
const { overlayScale } = useCommonContext();
|
|
17375
|
-
const { platform } = useCommonContext();
|
|
17457
|
+
const { platform, unitType } = useCommonContext();
|
|
17376
17458
|
const { editMapInfo } = useMapEditContext();
|
|
17377
17459
|
const dataPoints = useMemo(() => {
|
|
17378
17460
|
return {
|
|
@@ -17396,10 +17478,10 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
17396
17478
|
if (platform === PlatformType.H5) {
|
|
17397
17479
|
if (editMapInfo?.mobileMode === MobileEditMode.START &&
|
|
17398
17480
|
editMapInfo?.selectElement?.id === data.id) {
|
|
17399
|
-
return dp2px((style.lineWidth ||
|
|
17481
|
+
return dp2px((style.lineWidth || 1) * 2);
|
|
17400
17482
|
}
|
|
17401
17483
|
}
|
|
17402
|
-
return dp2px(style.lineWidth ||
|
|
17484
|
+
return dp2px(style.lineWidth || 1);
|
|
17403
17485
|
}, [style, platform, editMapInfo, data]);
|
|
17404
17486
|
// 初始化 - 无论是否选中都要初始化点坐标
|
|
17405
17487
|
useEffect(() => {
|
|
@@ -17502,7 +17584,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
17502
17584
|
}) })), isSelected &&
|
|
17503
17585
|
currentPoints.length === 4 &&
|
|
17504
17586
|
(() => {
|
|
17505
|
-
const selectionBoxPoints = calculateSelectionBoxPoints(currentPoints);
|
|
17587
|
+
const selectionBoxPoints = calculateSelectionBoxPoints(currentPoints, overlayScale);
|
|
17506
17588
|
// 计算选择框的边界
|
|
17507
17589
|
const minX = Math.min(...selectionBoxPoints.map((p) => p.x));
|
|
17508
17590
|
const maxX = Math.max(...selectionBoxPoints.map((p) => p.x));
|
|
@@ -17510,13 +17592,23 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
17510
17592
|
// 计算选择框的中心
|
|
17511
17593
|
const centerX = (minX + maxX) / 2;
|
|
17512
17594
|
// 计算尺寸显示框的位置(选择框下方)
|
|
17513
|
-
const infoBoxY = maxY + 20; // 选择框下方20像素
|
|
17514
|
-
const infoBoxWidth =
|
|
17515
|
-
const infoBoxHeight =
|
|
17595
|
+
const infoBoxY = maxY + 20 + 40 * overlayScale; // 选择框下方20像素
|
|
17596
|
+
const infoBoxWidth = 300 * overlayScale; // 信息框宽度
|
|
17597
|
+
const infoBoxHeight = 50 * overlayScale; // 信息框高度
|
|
17516
17598
|
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
17517
|
-
const scale =
|
|
17599
|
+
const scale = 2 * overlayScale;
|
|
17518
17600
|
const offsetLeft = 10 * scale;
|
|
17519
|
-
return (jsxs(Fragment, { children: [jsx("
|
|
17601
|
+
return (jsxs(Fragment, { children: [showInfo && (jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, children: jsxs("div", { style: {
|
|
17602
|
+
padding: `5px ${10 * overlayScale}px`,
|
|
17603
|
+
background: 'linear-gradient(266.64deg, #F26A2A 4.1%, #F2942A 86.42%)',
|
|
17604
|
+
borderRadius: `${30 * overlayScale}px`,
|
|
17605
|
+
display: 'inline-flex',
|
|
17606
|
+
alignItems: 'center',
|
|
17607
|
+
justifyContent: 'center',
|
|
17608
|
+
fontSize: `${26 * overlayScale}px`,
|
|
17609
|
+
color: 'white',
|
|
17610
|
+
fontWeight: '400',
|
|
17611
|
+
}, children: [convertDistanceByUnits(dimensions.height, unitType).value, " \u00D7", ' ', convertDistanceByUnits(dimensions.width, unitType).value] }) })), jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#9EA6BA", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
|
|
17520
17612
|
? {
|
|
17521
17613
|
onTouchStart: createReactEventHandler((e) => {
|
|
17522
17614
|
handleMouseDownWithDisabled(e);
|
|
@@ -17556,18 +17648,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
17556
17648
|
}
|
|
17557
17649
|
: {
|
|
17558
17650
|
onMouseDown: handleScaleStartWithDisabled,
|
|
17559
|
-
}), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsx(SvgTransformScale, {}) }) })
|
|
17560
|
-
padding: '5px 6px',
|
|
17561
|
-
background: 'linear-gradient(266.64deg, #F26A2A 4.1%, #F2942A 86.42%)',
|
|
17562
|
-
borderRadius: '20px',
|
|
17563
|
-
display: 'inline-flex',
|
|
17564
|
-
alignItems: 'center',
|
|
17565
|
-
justifyContent: 'center',
|
|
17566
|
-
fontSize: '12px',
|
|
17567
|
-
color: 'white',
|
|
17568
|
-
fontWeight: '400',
|
|
17569
|
-
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
17570
|
-
}, children: [dimensions.height, " m \u00D7 ", dimensions.width, " m"] }) }))] }));
|
|
17651
|
+
}), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsx(SvgTransformScale, {}) }) })] }));
|
|
17571
17652
|
})()] }));
|
|
17572
17653
|
};
|
|
17573
17654
|
|
|
@@ -17797,11 +17878,6 @@ const useDoodleTransform = (data, onTransformChange, options) => {
|
|
|
17797
17878
|
}, [currentCenter, currentScale, currentDirection, getSvgDimensions]);
|
|
17798
17879
|
// 初始化变换状态
|
|
17799
17880
|
const initializeTransform = useCallback(() => {
|
|
17800
|
-
console.log('useDoodleTransform: 初始化变换状态', {
|
|
17801
|
-
center: data.center,
|
|
17802
|
-
scale: data.scale,
|
|
17803
|
-
direction: data.direction,
|
|
17804
|
-
});
|
|
17805
17881
|
const convertedCenter = convertPoint(data.center);
|
|
17806
17882
|
setCurrentCenter({ x: convertedCenter[0], y: convertedCenter[1] });
|
|
17807
17883
|
setCurrentScale(data.scale);
|
|
@@ -18028,21 +18104,6 @@ const useDoodleTransform = (data, onTransformChange, options) => {
|
|
|
18028
18104
|
};
|
|
18029
18105
|
};
|
|
18030
18106
|
|
|
18031
|
-
var _path$1;
|
|
18032
|
-
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
18033
|
-
var SvgTransformArrow = function SvgTransformArrow(props) {
|
|
18034
|
-
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
18035
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
18036
|
-
width: 7,
|
|
18037
|
-
height: 11,
|
|
18038
|
-
fill: "none"
|
|
18039
|
-
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
18040
|
-
fill: "#fff",
|
|
18041
|
-
d: "M2.156 1.032a.777.777 0 0 0-1.061 0 .69.69 0 0 0-.062.943l.062.068 3.97 3.78-3.97 3.78a.69.69 0 0 0-.062.944l.062.067c.27.257.696.277.99.06l.07-.06 4.5-4.286a.69.69 0 0 0 .063-.943l-.062-.067z",
|
|
18042
|
-
opacity: 0.5
|
|
18043
|
-
})));
|
|
18044
|
-
};
|
|
18045
|
-
|
|
18046
18107
|
const DoodleTransform = ({ data, isSelected: _isSelected, onSelect }) => {
|
|
18047
18108
|
const { editMapInfo } = useMapEditContext();
|
|
18048
18109
|
const { platform } = useCommonContext();
|
|
@@ -18098,7 +18159,7 @@ const DoodleTransform = ({ data, isSelected: _isSelected, onSelect }) => {
|
|
|
18098
18159
|
};
|
|
18099
18160
|
|
|
18100
18161
|
const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOperation = false, onSelect, onCancel, onTransformChange, disabled = false, className = '', minScale, onMinScaleReached, onDragMove, onDragEnd, showInfo = true, onClickInfo, }) => {
|
|
18101
|
-
const { platform, overlayScale } = useCommonContext();
|
|
18162
|
+
const { platform, overlayScale, unitType } = useCommonContext();
|
|
18102
18163
|
// 使用自定义hook管理所有变换逻辑
|
|
18103
18164
|
const { currentCenter, currentScale, currentDirection, isDragging, isRotating, isScaling, initializeTransform, calculateSelectionBoxPoints, handleMouseDown, handleRotateStart, handleScaleStart, handleMouseMove, handleMouseUp, containerRef, dimensions, } = useDoodleTransform(data, onTransformChange, {
|
|
18104
18165
|
minScale,
|
|
@@ -18220,10 +18281,9 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
18220
18281
|
const maxY = Math.max(...selectionBoxPoints.map((p) => p.y));
|
|
18221
18282
|
// 计算选择框的中心
|
|
18222
18283
|
const centerX = (minX + maxX) / 2;
|
|
18223
|
-
//
|
|
18224
|
-
const
|
|
18225
|
-
const
|
|
18226
|
-
const infoBoxHeight = 100 * overlayScale; // 信息框高度
|
|
18284
|
+
const infoBoxY = maxY + 20 + 30 * overlayScale; // 选择框下方20像素
|
|
18285
|
+
const infoBoxWidth = 300 * overlayScale; // 信息框宽度
|
|
18286
|
+
const infoBoxHeight = 40 * overlayScale; // 信息框高度
|
|
18227
18287
|
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
18228
18288
|
return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#B2B4B9", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
|
|
18229
18289
|
? {
|
|
@@ -18236,14 +18296,14 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
18236
18296
|
}) }), jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[3].x, cy: selectionBoxPoints[3].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[1].x, cy: selectionBoxPoints[1].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[2].x, cy: selectionBoxPoints[2].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), platform === PlatformType.H5 && (jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
|
|
18237
18297
|
onClickInfo?.();
|
|
18238
18298
|
}, children: jsx("div", { style: {
|
|
18239
|
-
padding:
|
|
18299
|
+
padding: `5px ${10 * overlayScale}px`,
|
|
18240
18300
|
background: 'rgba(201, 209, 218, 1)',
|
|
18241
|
-
borderRadius:
|
|
18301
|
+
borderRadius: `${10 * overlayScale}px`,
|
|
18242
18302
|
display: 'inline-flex',
|
|
18243
18303
|
flexDirection: 'column',
|
|
18244
18304
|
alignItems: 'flex-start',
|
|
18245
18305
|
justifyContent: 'center',
|
|
18246
|
-
fontSize:
|
|
18306
|
+
fontSize: `${26 * overlayScale}px`,
|
|
18247
18307
|
color: 'white',
|
|
18248
18308
|
fontWeight: '400',
|
|
18249
18309
|
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
@@ -18301,14 +18361,32 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
18301
18361
|
const maxY = Math.max(...selectionBoxPoints.map((p) => p.y));
|
|
18302
18362
|
// 计算选择框的中心
|
|
18303
18363
|
const centerX = (minX + maxX) / 2;
|
|
18304
|
-
//
|
|
18305
|
-
const
|
|
18306
|
-
const infoBoxWidth = 140 * overlayScale; // 信息框宽度
|
|
18364
|
+
const infoBoxY = maxY + 20 + 40 * overlayScale; // 选择框下方20像素
|
|
18365
|
+
const infoBoxWidth = 300 * overlayScale; // 信息框宽度
|
|
18307
18366
|
const infoBoxHeight = 100 * overlayScale; // 信息框高度
|
|
18308
18367
|
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
18309
|
-
const scale =
|
|
18368
|
+
const scale = 2 * overlayScale;
|
|
18310
18369
|
const offsetLeft = 10 * scale;
|
|
18311
|
-
return (jsxs(Fragment, { children: [jsx("
|
|
18370
|
+
return (jsxs(Fragment, { children: [showInfo && (jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
|
|
18371
|
+
onClickInfo?.();
|
|
18372
|
+
}, children: jsxs("div", { style: {
|
|
18373
|
+
padding: `${10 * overlayScale}px`,
|
|
18374
|
+
background: 'linear-gradient(266.64deg, #F26A2A 4.1%, #F2942A 86.42%)',
|
|
18375
|
+
borderRadius: `${20 * overlayScale}px`,
|
|
18376
|
+
display: 'inline-flex',
|
|
18377
|
+
flexDirection: 'column',
|
|
18378
|
+
alignItems: 'flex-start',
|
|
18379
|
+
justifyContent: 'center',
|
|
18380
|
+
fontSize: `${26 * overlayScale}px`,
|
|
18381
|
+
color: 'white',
|
|
18382
|
+
fontWeight: '400',
|
|
18383
|
+
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
18384
|
+
}, children: [jsxs("div", { children: [convertDistanceByUnits(dimensions.width, unitType).value, " \u00D7", ' ', convertDistanceByUnits(dimensions.height, unitType).value] }), jsx("div", { style: {
|
|
18385
|
+
display: 'flex',
|
|
18386
|
+
alignItems: 'center',
|
|
18387
|
+
justifyContent: 'center',
|
|
18388
|
+
gap: `${10 * overlayScale}px`,
|
|
18389
|
+
}, children: jsxs("div", { children: ["Active Time: ", activeTime, " >"] }) })] }) })), jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#9EA6BA", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
|
|
18312
18390
|
? {
|
|
18313
18391
|
onTouchStart: createReactEventHandler((e) => {
|
|
18314
18392
|
handleMouseDownWithDisabled(e);
|
|
@@ -18348,26 +18426,7 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
18348
18426
|
}
|
|
18349
18427
|
: {
|
|
18350
18428
|
onMouseDown: handleScaleStartWithDisabled,
|
|
18351
|
-
}), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsx(SvgTransformScale, {}) }) })
|
|
18352
|
-
onClickInfo?.();
|
|
18353
|
-
}, children: jsxs("div", { style: {
|
|
18354
|
-
padding: '5px 6px',
|
|
18355
|
-
background: 'linear-gradient(266.64deg, #F26A2A 4.1%, #F2942A 86.42%)',
|
|
18356
|
-
borderRadius: '10px',
|
|
18357
|
-
display: 'inline-flex',
|
|
18358
|
-
flexDirection: 'column',
|
|
18359
|
-
alignItems: 'flex-start',
|
|
18360
|
-
justifyContent: 'center',
|
|
18361
|
-
fontSize: '12px',
|
|
18362
|
-
color: 'white',
|
|
18363
|
-
fontWeight: '400',
|
|
18364
|
-
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
18365
|
-
}, children: [jsxs("div", { children: [dimensions.width, " m \u00D7 ", dimensions.height, " m"] }), jsxs("div", { style: {
|
|
18366
|
-
display: 'flex',
|
|
18367
|
-
alignItems: 'center',
|
|
18368
|
-
justifyContent: 'center',
|
|
18369
|
-
gap: '10px',
|
|
18370
|
-
}, children: [jsxs("div", { children: ["Active Time: ", activeTime] }), jsx(SvgTransformArrow, {})] })] }) }))] }));
|
|
18429
|
+
}), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsx(SvgTransformScale, {}) }) })] }));
|
|
18371
18430
|
})()] }));
|
|
18372
18431
|
};
|
|
18373
18432
|
|
|
@@ -18555,9 +18614,9 @@ const GElement = ({ type, children }) => {
|
|
|
18555
18614
|
return jsx("g", { id: `layer-${type}`, children: children }, type);
|
|
18556
18615
|
};
|
|
18557
18616
|
|
|
18558
|
-
var css_248z$
|
|
18559
|
-
var styles$
|
|
18560
|
-
styleInject(css_248z$
|
|
18617
|
+
var css_248z$4 = ".index-module_mapEdit__XC5Gw {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n width: 100%;\n height: 100%;\n cursor: default;\n}\n.index-module_mapEdit__XC5Gw.index-module_createMode__14EPH {\n cursor: crosshair;\n}\n.index-module_mapEdit__XC5Gw.index-module_notCreateCursor__1-OjF {\n cursor: no-drop;\n}";
|
|
18618
|
+
var styles$4 = {"mapEdit":"index-module_mapEdit__XC5Gw","createMode":"index-module_createMode__14EPH","notCreateCursor":"index-module_notCreateCursor__1-OjF"};
|
|
18619
|
+
styleInject(css_248z$4);
|
|
18561
18620
|
|
|
18562
18621
|
var classnames = {exports: {}};
|
|
18563
18622
|
|
|
@@ -19580,7 +19639,7 @@ function usePolygonDrawing(options = {}) {
|
|
|
19580
19639
|
const p = getSvgPoint(svgEl, e.clientX, e.clientY);
|
|
19581
19640
|
if (!p)
|
|
19582
19641
|
return;
|
|
19583
|
-
if (checkCanNotCreateAtPosition(p)) {
|
|
19642
|
+
if (checkCanNotCreateAtPosition(p)?.result) {
|
|
19584
19643
|
message.error('Unable to place here, please select a valid spot');
|
|
19585
19644
|
return;
|
|
19586
19645
|
}
|
|
@@ -19593,7 +19652,6 @@ function usePolygonDrawing(options = {}) {
|
|
|
19593
19652
|
},
|
|
19594
19653
|
};
|
|
19595
19654
|
});
|
|
19596
|
-
console.log('onSvgClick');
|
|
19597
19655
|
addHistory({
|
|
19598
19656
|
selectElement: {
|
|
19599
19657
|
...editMapInfo.selectElement,
|
|
@@ -19635,7 +19693,6 @@ function usePolygonDrawing(options = {}) {
|
|
|
19635
19693
|
},
|
|
19636
19694
|
};
|
|
19637
19695
|
});
|
|
19638
|
-
console.log('updatePoints');
|
|
19639
19696
|
addHistory({
|
|
19640
19697
|
selectElement: {
|
|
19641
19698
|
...editMapInfo.selectElement,
|
|
@@ -19683,11 +19740,6 @@ const isPointInSvgBounds = (point, svgElement) => {
|
|
|
19683
19740
|
const maxY = minY + height;
|
|
19684
19741
|
// 检查点是否在viewBox范围内
|
|
19685
19742
|
const isInBounds = point.x >= minX && point.x <= maxX && point.y >= minY && point.y <= maxY;
|
|
19686
|
-
console.log('点边界检查:', {
|
|
19687
|
-
point: { x: point.x, y: point.y },
|
|
19688
|
-
viewBox: { minX, minY, maxX, maxY },
|
|
19689
|
-
isInBounds,
|
|
19690
|
-
});
|
|
19691
19743
|
return isInBounds;
|
|
19692
19744
|
}
|
|
19693
19745
|
catch (error) {
|
|
@@ -19714,8 +19766,6 @@ const getScreenCenterSvgPoint = (svgElement, mapInstance) => {
|
|
|
19714
19766
|
// 计算Google Maps容器的中心点
|
|
19715
19767
|
const centerX = mapRect.left + mapRect.width / 2;
|
|
19716
19768
|
const centerY = mapRect.top + mapRect.height / 2;
|
|
19717
|
-
console.log('Google Maps容器中心位置:', { centerX, centerY });
|
|
19718
|
-
console.log('Google Maps容器尺寸:', { width: mapRect.width, height: mapRect.height });
|
|
19719
19769
|
// 直接使用SVG的CTM进行坐标转换
|
|
19720
19770
|
const pt = svgElement.createSVGPoint();
|
|
19721
19771
|
pt.x = centerX;
|
|
@@ -19727,7 +19777,6 @@ const getScreenCenterSvgPoint = (svgElement, mapInstance) => {
|
|
|
19727
19777
|
}
|
|
19728
19778
|
const inv = ctm.inverse();
|
|
19729
19779
|
const svgPoint = pt.matrixTransform(inv);
|
|
19730
|
-
console.log('转换后的SVG坐标:', { x: svgPoint.x, y: svgPoint.y });
|
|
19731
19780
|
// 检查点是否在SVG可见区域内
|
|
19732
19781
|
const point = { x: svgPoint.x, y: svgPoint.y };
|
|
19733
19782
|
if (!isPointInSvgBounds(point, svgElement)) {
|
|
@@ -19754,24 +19803,38 @@ const CreateObstacleElement = forwardRef(({ enabled = false, svgElement, onPoint
|
|
|
19754
19803
|
const addPoint = useCallback(() => {
|
|
19755
19804
|
if (!enabled || !svgElement) {
|
|
19756
19805
|
console.warn('未启用创建模式或SVG元素不存在');
|
|
19757
|
-
return {
|
|
19806
|
+
return {
|
|
19807
|
+
isValid: false,
|
|
19808
|
+
reason: '未启用创建模式或SVG元素不存在',
|
|
19809
|
+
code: CheckObstaclePointErrorType.COMMON_ERROR,
|
|
19810
|
+
};
|
|
19758
19811
|
}
|
|
19759
19812
|
if (!mapRef) {
|
|
19760
19813
|
console.warn('地图实例不存在');
|
|
19761
|
-
return {
|
|
19814
|
+
return {
|
|
19815
|
+
isValid: false,
|
|
19816
|
+
reason: '地图实例不存在',
|
|
19817
|
+
code: CheckObstaclePointErrorType.MAP_NOT_EXIST,
|
|
19818
|
+
};
|
|
19762
19819
|
}
|
|
19763
19820
|
const centerPoint = getScreenCenterSvgPoint(svgElement, mapRef);
|
|
19764
19821
|
if (!centerPoint) {
|
|
19765
19822
|
console.warn('无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内');
|
|
19766
|
-
return {
|
|
19823
|
+
return {
|
|
19824
|
+
isValid: false,
|
|
19825
|
+
reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内',
|
|
19826
|
+
code: CheckObstaclePointErrorType.GET_POINT_FAILED,
|
|
19827
|
+
};
|
|
19767
19828
|
}
|
|
19768
19829
|
console.error('centerPoint--->', centerPoint);
|
|
19769
|
-
console.error('checkCanNotCreateAtPosition--->', checkCanNotCreateAtPosition(centerPoint));
|
|
19830
|
+
console.error('checkCanNotCreateAtPosition--->', checkCanNotCreateAtPosition(centerPoint).result);
|
|
19770
19831
|
// 校验是否能打点
|
|
19771
|
-
|
|
19832
|
+
const checkResult = checkCanNotCreateAtPosition(centerPoint);
|
|
19833
|
+
if (checkResult.result) {
|
|
19772
19834
|
return {
|
|
19773
19835
|
isValid: false,
|
|
19774
|
-
reason: '
|
|
19836
|
+
reason: '',
|
|
19837
|
+
code: checkResult.code || CheckObstaclePointErrorType.COMMON_ERROR,
|
|
19775
19838
|
};
|
|
19776
19839
|
}
|
|
19777
19840
|
const newPoints = [...points, centerPoint];
|
|
@@ -19812,37 +19875,33 @@ const CreateObstacleElement = forwardRef(({ enabled = false, svgElement, onPoint
|
|
|
19812
19875
|
if (!enabled || points.length === 0) {
|
|
19813
19876
|
return null;
|
|
19814
19877
|
}
|
|
19815
|
-
return (jsx(PolygonElement, { points: points.map((p) => [p.x, p.y, 2]), fillColor: styles.fillColor, fillOpacity: 0.3, strokeColor: styles.strokeColor, strokeWidth:
|
|
19878
|
+
return (jsx(PolygonElement, { points: points.map((p) => [p.x, p.y, 2]), fillColor: styles.fillColor, fillOpacity: 0.3, strokeColor: styles.strokeColor, strokeWidth: 1, strokeOpacity: 1, createMode: true, showPoints: true, editMode: false, completed: true, draggable: false }));
|
|
19816
19879
|
});
|
|
19817
19880
|
CreateObstacleElement.displayName = 'CreateObstacleElement';
|
|
19818
19881
|
|
|
19819
19882
|
const MIN_ELEMENT_WIDTH = 50;
|
|
19820
19883
|
const useCreateVisionOffElement = () => {
|
|
19821
|
-
const { svgRef } = useSvgEditContext();
|
|
19822
19884
|
const { editMapInfo } = useMapEditContext();
|
|
19885
|
+
const { svgViewBox } = useCommonContext();
|
|
19823
19886
|
const centerPoint = useMemo(() => {
|
|
19824
|
-
if (!
|
|
19887
|
+
if (!svgViewBox)
|
|
19825
19888
|
return null;
|
|
19826
|
-
const
|
|
19827
|
-
const center = [
|
|
19828
|
-
baseVal?.x + (baseVal?.width || 0) / 2,
|
|
19829
|
-
baseVal?.y + (baseVal?.height || 0) / 2,
|
|
19830
|
-
];
|
|
19889
|
+
const center = [svgViewBox.x + svgViewBox.width / 2, -svgViewBox.y - svgViewBox.height / 2];
|
|
19831
19890
|
return center;
|
|
19832
|
-
}, [
|
|
19891
|
+
}, [svgViewBox]);
|
|
19833
19892
|
const elementWidth = useMemo(() => {
|
|
19834
|
-
if (!
|
|
19893
|
+
if (!svgViewBox)
|
|
19835
19894
|
return MIN_ELEMENT_WIDTH;
|
|
19836
|
-
const baseVal =
|
|
19837
|
-
if (baseVal && baseVal /
|
|
19838
|
-
return baseVal /
|
|
19895
|
+
const baseVal = Math.min(svgViewBox.width, svgViewBox.height);
|
|
19896
|
+
if (baseVal && baseVal / 4 > MIN_ELEMENT_WIDTH) {
|
|
19897
|
+
return baseVal / 4;
|
|
19839
19898
|
}
|
|
19840
19899
|
return MIN_ELEMENT_WIDTH;
|
|
19841
|
-
}, [
|
|
19900
|
+
}, [svgViewBox]);
|
|
19842
19901
|
const getVisionOffPoints = useCallback(() => {
|
|
19843
|
-
if (!
|
|
19902
|
+
if (!svgViewBox)
|
|
19844
19903
|
return null;
|
|
19845
|
-
const offset = ((
|
|
19904
|
+
const offset = (Math.random() - 0.5) * elementWidth;
|
|
19846
19905
|
const [minX, minY, maxX, maxY] = [
|
|
19847
19906
|
centerPoint[0] - elementWidth / 2 + offset,
|
|
19848
19907
|
centerPoint[1] - elementWidth / 2 + offset,
|
|
@@ -19903,7 +19962,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
|
|
|
19903
19962
|
}, [centerPoint]);
|
|
19904
19963
|
// 调整SVG大小的函数
|
|
19905
19964
|
const adjustSvgSize = (layoutData) => {
|
|
19906
|
-
const padding =
|
|
19965
|
+
const padding = 0; // 添加一些边距以避免内容贴边
|
|
19907
19966
|
const boundWidth = bounds.maxX - bounds.minX + padding * 2;
|
|
19908
19967
|
const boundHeight = bounds.maxY - bounds.minY + padding * 2;
|
|
19909
19968
|
// 防止宽高为0的情况
|
|
@@ -20107,11 +20166,11 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
|
|
|
20107
20166
|
const showNotCreateCursor = useMemo(() => {
|
|
20108
20167
|
if (!mousePos)
|
|
20109
20168
|
return false;
|
|
20110
|
-
return checkCanNotCreateAtPosition(mousePos);
|
|
20169
|
+
return checkCanNotCreateAtPosition(mousePos)?.result ?? false;
|
|
20111
20170
|
}, [mousePos, checkCanNotCreateAtPosition]);
|
|
20112
|
-
return (jsx("div", { ref: containerRef, className: classNames(styles$
|
|
20113
|
-
[styles$
|
|
20114
|
-
[styles$
|
|
20171
|
+
return (jsx("div", { ref: containerRef, className: classNames(styles$4.mapEdit, {
|
|
20172
|
+
[styles$4.createMode]: isCreating,
|
|
20173
|
+
[styles$4.notCreateCursor]: showNotCreateCursor,
|
|
20115
20174
|
}), style: {
|
|
20116
20175
|
display: editMap ? 'block' : 'none',
|
|
20117
20176
|
}, children: jsxs("svg", { style: {
|
|
@@ -20119,6 +20178,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
|
|
|
20119
20178
|
left: '50%',
|
|
20120
20179
|
top: '50%',
|
|
20121
20180
|
transform: 'translate(-50%, -50%)',
|
|
20181
|
+
overflow: 'visible',
|
|
20122
20182
|
// cursor: createMode ? 'crosshair' : editMode ? 'default' : 'move',
|
|
20123
20183
|
// pointerEvents: 'auto', // 关键:允许接收鼠标事件
|
|
20124
20184
|
}, xmlns: "http://www.w3.org/2000/svg", "shape-rendering": "geometricPrecision", "text-rendering": "geometricPrecision", "image-rendering": "optimizeQuality", ref: svgRef, onClick: editMapInfo.createMode && platform !== PlatformType.H5 ? onSvgClick : undefined, onMouseMove: editMapInfo.createMode && platform !== PlatformType.H5 ? onSvgMouseMove : undefined, children: [jsxs("defs", { children: [jsx("filter", { id: "vertex-tooltip-shadow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: jsx("feDropShadow", { dx: "2", dy: "2", stdDeviation: "2", floodColor: "#000", floodOpacity: "0.12" }) }), jsxs("filter", { id: `path-hover-${DataType.BOUNDARY}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: BOUNDARY_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxs("filter", { id: `path-hover-${DataType.VISION_OFF}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: VISION_OFF_AREA_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxs("filter", { id: `path-hover-${DataType.OBSTACLE}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: OBSTACLE_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] })] }), Object.keys(svgElementDatas)
|
|
@@ -20209,15 +20269,15 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
|
|
|
20209
20269
|
});
|
|
20210
20270
|
SvgEditMap.displayName = 'SvgEditMap';
|
|
20211
20271
|
|
|
20212
|
-
var _path;
|
|
20213
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20272
|
+
var _path$3;
|
|
20273
|
+
function _extends$5() { return _extends$5 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$5.apply(null, arguments); }
|
|
20214
20274
|
var SvgMobileAddPoint = function SvgMobileAddPoint(props) {
|
|
20215
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
20275
|
+
return /*#__PURE__*/React.createElement("svg", _extends$5({
|
|
20216
20276
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20217
20277
|
width: 36,
|
|
20218
20278
|
height: 36,
|
|
20219
20279
|
fill: "none"
|
|
20220
|
-
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
20280
|
+
}, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
|
|
20221
20281
|
stroke: "#fff",
|
|
20222
20282
|
strokeLinecap: "round",
|
|
20223
20283
|
strokeLinejoin: "round",
|
|
@@ -20226,9 +20286,9 @@ var SvgMobileAddPoint = function SvgMobileAddPoint(props) {
|
|
|
20226
20286
|
})));
|
|
20227
20287
|
};
|
|
20228
20288
|
|
|
20229
|
-
var css_248z = ".index-module_crosshair__etey6 {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 40px;\n height: 40px;\n pointer-events: none;\n z-index: 99999;\n display: flex;\n justify-content: center;\n align-items: center;\n}";
|
|
20230
|
-
var styles = {"crosshair":"index-module_crosshair__etey6"};
|
|
20231
|
-
styleInject(css_248z);
|
|
20289
|
+
var css_248z$3 = ".index-module_crosshair__etey6 {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 40px;\n height: 40px;\n pointer-events: none;\n z-index: 99999;\n display: flex;\n justify-content: center;\n align-items: center;\n}";
|
|
20290
|
+
var styles$3 = {"crosshair":"index-module_crosshair__etey6"};
|
|
20291
|
+
styleInject(css_248z$3);
|
|
20232
20292
|
|
|
20233
20293
|
/**
|
|
20234
20294
|
* 十字准心组件
|
|
@@ -20245,7 +20305,460 @@ const Crosshair = () => {
|
|
|
20245
20305
|
}
|
|
20246
20306
|
return false;
|
|
20247
20307
|
}, [platform, editMapInfo]);
|
|
20248
|
-
return isVisible ? (jsx("div", { className: styles.crosshair, children: jsx(SvgMobileAddPoint, {}) })) : null;
|
|
20308
|
+
return isVisible ? (jsx("div", { className: styles$3.crosshair, children: jsx(SvgMobileAddPoint, {}) })) : null;
|
|
20309
|
+
};
|
|
20310
|
+
|
|
20311
|
+
var css_248z$2 = ".index-module_addEntry__QsQHD {\n position: absolute;\n right: 8px;\n top: 8px;\n cursor: pointer;\n z-index: 10;\n}\n.index-module_addEntry__QsQHD .index-module_icon__qIgA4 {\n padding: 6px;\n border-radius: 8px;\n background: #fff;\n box-shadow: 2px 2px 12px 0px rgba(0, 0, 0, 0.2);\n}\n\n.index-module_addItem__mglwZ {\n display: flex;\n align-items: center;\n padding: 4px;\n justify-content: flex-start;\n cursor: pointer;\n}\n.index-module_addItem__mglwZ:hover {\n box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.25);\n border-radius: 4px;\n}\n.index-module_addItem__mglwZ:not(:last-child) {\n margin-bottom: 6px;\n}\n.index-module_addItem__mglwZ .index-module_icon__qIgA4 {\n width: 16px;\n height: 16px;\n}\n.index-module_addItem__mglwZ .index-module_label__QqZ-9 {\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n color: rgb(158, 158, 158);\n margin-left: 4px;\n}";
|
|
20312
|
+
var styles$2 = {"addEntry":"index-module_addEntry__QsQHD","icon":"index-module_icon__qIgA4","addItem":"index-module_addItem__mglwZ","label":"index-module_label__QqZ-9"};
|
|
20313
|
+
styleInject(css_248z$2);
|
|
20314
|
+
|
|
20315
|
+
var _rect$2, _path$2, _defs$1;
|
|
20316
|
+
function _extends$4() { return _extends$4 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$4.apply(null, arguments); }
|
|
20317
|
+
var SvgAddEntry = function SvgAddEntry(props) {
|
|
20318
|
+
return /*#__PURE__*/React.createElement("svg", _extends$4({
|
|
20319
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20320
|
+
width: 24,
|
|
20321
|
+
height: 24,
|
|
20322
|
+
fill: "none"
|
|
20323
|
+
}, props), _rect$2 || (_rect$2 = /*#__PURE__*/React.createElement("rect", {
|
|
20324
|
+
width: 10.95,
|
|
20325
|
+
height: 10.95,
|
|
20326
|
+
x: 10.613,
|
|
20327
|
+
y: 3.15,
|
|
20328
|
+
fill: "#1F1F1F",
|
|
20329
|
+
stroke: "url(#add-entry_svg__a)",
|
|
20330
|
+
strokeWidth: 0.3,
|
|
20331
|
+
opacity: 0.795,
|
|
20332
|
+
rx: 1.05
|
|
20333
|
+
})), /*#__PURE__*/React.createElement("foreignObject", {
|
|
20334
|
+
width: 23.468,
|
|
20335
|
+
height: 20.501,
|
|
20336
|
+
x: -1.543,
|
|
20337
|
+
y: 3.499
|
|
20338
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
20339
|
+
xmlns: "http://www.w3.org/1999/xhtml",
|
|
20340
|
+
style: {
|
|
20341
|
+
backdropFilter: "blur(1.63px)",
|
|
20342
|
+
clipPath: "url(#add-entry_svg__b)",
|
|
20343
|
+
height: "100%",
|
|
20344
|
+
width: "100%"
|
|
20345
|
+
}
|
|
20346
|
+
})), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
|
|
20347
|
+
fill: "#1F1F1F",
|
|
20348
|
+
stroke: "url(#add-entry_svg__c)",
|
|
20349
|
+
strokeWidth: 0.3,
|
|
20350
|
+
d: "M9.302 7.402a1.05 1.05 0 0 1 1.778 0l7.27 11.578a1.05 1.05 0 0 1-.89 1.608H2.92a1.05 1.05 0 0 1-.889-1.608z",
|
|
20351
|
+
"data-figma-bg-blur-radius": 3.262
|
|
20352
|
+
})), _defs$1 || (_defs$1 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
20353
|
+
id: "add-entry_svg__a",
|
|
20354
|
+
x1: 16.851,
|
|
20355
|
+
x2: 20.384,
|
|
20356
|
+
y1: 10.392,
|
|
20357
|
+
y2: 4.767,
|
|
20358
|
+
gradientUnits: "userSpaceOnUse"
|
|
20359
|
+
}, /*#__PURE__*/React.createElement("stop", {
|
|
20360
|
+
stopColor: "#fff",
|
|
20361
|
+
stopOpacity: 0.01
|
|
20362
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
20363
|
+
offset: 1,
|
|
20364
|
+
stopColor: "#fff"
|
|
20365
|
+
})), /*#__PURE__*/React.createElement("linearGradient", {
|
|
20366
|
+
id: "add-entry_svg__c",
|
|
20367
|
+
x1: 21.47,
|
|
20368
|
+
x2: 12.314,
|
|
20369
|
+
y1: 15.036,
|
|
20370
|
+
y2: 5.769,
|
|
20371
|
+
gradientUnits: "userSpaceOnUse"
|
|
20372
|
+
}, /*#__PURE__*/React.createElement("stop", {
|
|
20373
|
+
stopColor: "#fff",
|
|
20374
|
+
stopOpacity: 0.01
|
|
20375
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
20376
|
+
offset: 1,
|
|
20377
|
+
stopColor: "#fff"
|
|
20378
|
+
})), /*#__PURE__*/React.createElement("clipPath", {
|
|
20379
|
+
id: "add-entry_svg__b",
|
|
20380
|
+
transform: "translate(1.543 -3.499)"
|
|
20381
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
20382
|
+
d: "M9.302 7.402a1.05 1.05 0 0 1 1.778 0l7.27 11.578a1.05 1.05 0 0 1-.89 1.608H2.92a1.05 1.05 0 0 1-.889-1.608z"
|
|
20383
|
+
})))));
|
|
20384
|
+
};
|
|
20385
|
+
|
|
20386
|
+
var _path$1, _path2$1, _path3;
|
|
20387
|
+
function _extends$3() { return _extends$3 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$3.apply(null, arguments); }
|
|
20388
|
+
var SvgBoundary = function SvgBoundary(props) {
|
|
20389
|
+
return /*#__PURE__*/React.createElement("svg", _extends$3({
|
|
20390
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20391
|
+
width: 16,
|
|
20392
|
+
height: 16,
|
|
20393
|
+
fill: "none"
|
|
20394
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
20395
|
+
fill: "#1DBEAC",
|
|
20396
|
+
fillRule: "evenodd",
|
|
20397
|
+
d: "M3.385 2h9.23C13.38 2 14 2.62 14 3.385v9.23C14 13.38 13.38 14 12.615 14h-9.23C2.62 14 2 13.38 2 12.615v-9.23C2 2.62 2.62 2 3.385 2m9.692 1.385a.46.46 0 0 0-.462-.462h-9.23a.46.46 0 0 0-.462.462v9.23c0 .255.207.462.462.462h9.23a.46.46 0 0 0 .462-.462z",
|
|
20398
|
+
clipRule: "evenodd",
|
|
20399
|
+
opacity: 0.602
|
|
20400
|
+
})), _path2$1 || (_path2$1 = /*#__PURE__*/React.createElement("path", {
|
|
20401
|
+
fill: "#1DBEAC",
|
|
20402
|
+
d: "M12.615 2.923c.255 0 .462.207.462.462v9.23a.46.46 0 0 1-.462.462h-9.23a.46.46 0 0 1-.462-.462v-9.23c0-.255.207-.462.462-.462z",
|
|
20403
|
+
opacity: 0.152
|
|
20404
|
+
})), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", {
|
|
20405
|
+
fill: "#1DBEAC",
|
|
20406
|
+
fillRule: "evenodd",
|
|
20407
|
+
d: "M2.833 2a.833.833 0 1 0 0 1.667.833.833 0 0 0 0-1.667m0 10.333a.833.833 0 1 0 0 1.667.833.833 0 0 0 0-1.667m9.5-9.5a.833.833 0 1 1 1.667 0 .833.833 0 0 1-1.667 0m.834 9.5a.833.833 0 1 0 0 1.667.833.833 0 0 0 0-1.667M6.49 10.333s.335-4.388 3.451-5.666c-1.725 2.439-1.725 5.666-1.725 5.666zm2.305 0s.548-4.108 2.872-4.816c-1.071 1.7-1.071 4.816-1.071 4.816zM6.87 5.517c-2.384 1.42-2.537 4.816-2.537 4.816h1.582s-.21-2.698.955-4.816",
|
|
20408
|
+
clipRule: "evenodd"
|
|
20409
|
+
})));
|
|
20410
|
+
};
|
|
20411
|
+
|
|
20412
|
+
var _path, _path2, _rect$1, _rect2$1;
|
|
20413
|
+
function _extends$2() { return _extends$2 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$2.apply(null, arguments); }
|
|
20414
|
+
var SvgLimitIsland = function SvgLimitIsland(props) {
|
|
20415
|
+
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
20416
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20417
|
+
width: 16,
|
|
20418
|
+
height: 16,
|
|
20419
|
+
fill: "none"
|
|
20420
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
20421
|
+
fill: "#FFA077",
|
|
20422
|
+
d: "M11.725 6.714c-1.019-.137-2.516-1.488-1.9-2.14.588-.621 1.91.344 1.9 2.14"
|
|
20423
|
+
})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
|
|
20424
|
+
fill: "#FF5D17",
|
|
20425
|
+
d: "M11.195 3.637c-.863.109-.623 2.341.354 3.024 1.603.79 2.575-.099 2.517-.459-.072-.445-.983-1.014-2.029-.274.455-.92-.08-2.387-.842-2.291M10.004 9.084l.308.87c1.202.178 2.002.494 2.002.856 0 .556-1.887 1.007-4.215 1.007-2.329 0-4.216-.451-4.217-1.007 0-.334.683-.63 1.733-.812l.593-1.679zm-.777-2.197.518 1.463-3.312-.667.443-1.253zM7.467 4.76a.535.535 0 0 1 1.01 0l.493 1.398L7.1 5.794z"
|
|
20426
|
+
})), _rect$1 || (_rect$1 = /*#__PURE__*/React.createElement("rect", {
|
|
20427
|
+
width: 14.237,
|
|
20428
|
+
height: 10.667,
|
|
20429
|
+
x: 0.882,
|
|
20430
|
+
y: 2.667,
|
|
20431
|
+
fill: "#F50",
|
|
20432
|
+
opacity: 0.15,
|
|
20433
|
+
rx: 2
|
|
20434
|
+
})), _rect2$1 || (_rect2$1 = /*#__PURE__*/React.createElement("rect", {
|
|
20435
|
+
width: 14.237,
|
|
20436
|
+
height: 10.667,
|
|
20437
|
+
x: 0.882,
|
|
20438
|
+
y: 2.667,
|
|
20439
|
+
stroke: "#FF5D17",
|
|
20440
|
+
strokeWidth: 0.867,
|
|
20441
|
+
rx: 2
|
|
20442
|
+
})));
|
|
20443
|
+
};
|
|
20444
|
+
|
|
20445
|
+
var _rect, _rect2, _rect3, _rect4, _g$1;
|
|
20446
|
+
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
20447
|
+
var SvgVisionFence = function SvgVisionFence(props) {
|
|
20448
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
20449
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20450
|
+
width: 16,
|
|
20451
|
+
height: 16,
|
|
20452
|
+
fill: "none"
|
|
20453
|
+
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
|
|
20454
|
+
width: 14.333,
|
|
20455
|
+
height: 10.667,
|
|
20456
|
+
x: 0.833,
|
|
20457
|
+
y: 2.667,
|
|
20458
|
+
fill: "#B1D9FF",
|
|
20459
|
+
rx: 2.667
|
|
20460
|
+
})), _rect2 || (_rect2 = /*#__PURE__*/React.createElement("rect", {
|
|
20461
|
+
width: 13.333,
|
|
20462
|
+
height: 9.667,
|
|
20463
|
+
x: 1.333,
|
|
20464
|
+
y: 3.167,
|
|
20465
|
+
stroke: "#5C9DFF",
|
|
20466
|
+
strokeDasharray: "6.33 6.33",
|
|
20467
|
+
rx: 1.333
|
|
20468
|
+
})), _rect3 || (_rect3 = /*#__PURE__*/React.createElement("rect", {
|
|
20469
|
+
width: 6,
|
|
20470
|
+
height: 6,
|
|
20471
|
+
x: 5,
|
|
20472
|
+
y: 4.833,
|
|
20473
|
+
fill: "#B1D9FF",
|
|
20474
|
+
rx: 3
|
|
20475
|
+
})), /*#__PURE__*/React.createElement("mask", {
|
|
20476
|
+
id: "visionFence_svg__a",
|
|
20477
|
+
width: 6,
|
|
20478
|
+
height: 6,
|
|
20479
|
+
x: 5,
|
|
20480
|
+
y: 5,
|
|
20481
|
+
maskUnits: "userSpaceOnUse",
|
|
20482
|
+
style: {
|
|
20483
|
+
maskType: "alpha"
|
|
20484
|
+
}
|
|
20485
|
+
}, _rect4 || (_rect4 = /*#__PURE__*/React.createElement("rect", {
|
|
20486
|
+
width: 5.333,
|
|
20487
|
+
height: 5.333,
|
|
20488
|
+
x: 5.333,
|
|
20489
|
+
y: 5.5,
|
|
20490
|
+
fill: "#B1D9FF",
|
|
20491
|
+
rx: 2.667
|
|
20492
|
+
}))), _g$1 || (_g$1 = /*#__PURE__*/React.createElement("g", {
|
|
20493
|
+
fill: "#5C9DFF",
|
|
20494
|
+
mask: "url(#visionFence_svg__a)"
|
|
20495
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
20496
|
+
d: "m8.838 3.395.636.636-5.42 5.421-.637-.636zM9.896 4.452l.637.637-5.422 5.42-.636-.635zM10.954 5.51l.636.637-5.421 5.421-.636-.636zM12.172 6.547l.636.637-5.421 5.42-.636-.635z"
|
|
20497
|
+
}))));
|
|
20498
|
+
};
|
|
20499
|
+
|
|
20500
|
+
var _g, _defs;
|
|
20501
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20502
|
+
var SvgDoodle = function SvgDoodle(props) {
|
|
20503
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
20504
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20505
|
+
width: 16,
|
|
20506
|
+
height: 16,
|
|
20507
|
+
fill: "none"
|
|
20508
|
+
}, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
|
20509
|
+
clipPath: "url(#doodle_svg__a)"
|
|
20510
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
20511
|
+
clipPath: "url(#doodle_svg__b)"
|
|
20512
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
20513
|
+
width: 14.237,
|
|
20514
|
+
height: 10.667,
|
|
20515
|
+
x: 0.333,
|
|
20516
|
+
y: 4.332,
|
|
20517
|
+
fill: "#CBFCF7",
|
|
20518
|
+
stroke: "#9AEEE5",
|
|
20519
|
+
strokeWidth: 0.867,
|
|
20520
|
+
rx: 2
|
|
20521
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
20522
|
+
fill: "#F2FFFD",
|
|
20523
|
+
d: "M1.374 9.88a4 4 0 0 0 4 4h.546l.514-1.524c.073-.216-.087-.443-.312-.48-1.415-.229-3.6-1.485-4.399-4.639a.35.35 0 0 0-.135-.197c-.138.405-.214.84-.214 1.293z"
|
|
20524
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
20525
|
+
fill: "#50D0C2",
|
|
20526
|
+
d: "M15.814 2.13c-.352 2.267-6.501 9.305-8.003 9.43a.282.282 0 0 1-.238-.455L15.565.828c.398.332.293 1.015.249 1.303"
|
|
20527
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
20528
|
+
fill: "#50D0C2",
|
|
20529
|
+
d: "M14.208.95c-2.147.946-7.434 8.618-7.15 10.058a.2.2 0 0 0 .017.047.295.295 0 0 0 .498.051L15.565.826c-.437-.28-1.084.003-1.357.123"
|
|
20530
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
20531
|
+
fill: "#9CE7DE",
|
|
20532
|
+
d: "M7.76 11.558a.282.282 0 0 1-.187-.453.295.295 0 0 1-.498-.05.2.2 0 0 1-.016-.048c-.108-.55.598-2.01 1.63-3.658l2.297 1.689c-1.348 1.415-2.6 2.473-3.174 2.522a.2.2 0 0 1-.053-.002"
|
|
20533
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
20534
|
+
fill: "#50D0C2",
|
|
20535
|
+
d: "M5.602 11.02c.658-.873 1.769-1.145 2.482-.607.714.537.759 1.68.1 2.553-.657.873-2.733.94-2.733.94s-.507-2.013.15-2.886"
|
|
20536
|
+
})))), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
20537
|
+
id: "doodle_svg__a"
|
|
20538
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
20539
|
+
fill: "#fff",
|
|
20540
|
+
d: "M0 0h16v16H0z"
|
|
20541
|
+
})), /*#__PURE__*/React.createElement("clipPath", {
|
|
20542
|
+
id: "doodle_svg__b"
|
|
20543
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
20544
|
+
fill: "#fff",
|
|
20545
|
+
d: "M0 0h16v16H0z"
|
|
20546
|
+
})))));
|
|
20547
|
+
};
|
|
20548
|
+
|
|
20549
|
+
var HandleElementMapType;
|
|
20550
|
+
(function (HandleElementMapType) {
|
|
20551
|
+
HandleElementMapType["name"] = "name";
|
|
20552
|
+
HandleElementMapType["focus"] = "focus";
|
|
20553
|
+
HandleElementMapType["delete"] = "delete";
|
|
20554
|
+
HandleElementMapType["timePeriod"] = "timePeriod";
|
|
20555
|
+
HandleElementMapType["area"] = "area";
|
|
20556
|
+
HandleElementMapType["dooleExist"] = "dooleExist";
|
|
20557
|
+
})(HandleElementMapType || (HandleElementMapType = {}));
|
|
20558
|
+
const DATE_TYPE_MAP = [
|
|
20559
|
+
{ type: DataType.BOUNDARY, label: 'Boundary', icon: jsx(SvgBoundary, {}) },
|
|
20560
|
+
{
|
|
20561
|
+
type: DataType.OBSTACLE,
|
|
20562
|
+
paramType: RecordTypeEnum.OBSTACLE,
|
|
20563
|
+
label: 'Off-limit island',
|
|
20564
|
+
icon: jsx(SvgLimitIsland, {}),
|
|
20565
|
+
},
|
|
20566
|
+
// { type: DataType.CHANNEL, label: 'Channel', icon: <ChannelIcon /> },
|
|
20567
|
+
{
|
|
20568
|
+
type: DataType.VISION_OFF,
|
|
20569
|
+
paramType: RecordTypeEnum.VISI_OFF,
|
|
20570
|
+
label: 'VisionFence-off zone',
|
|
20571
|
+
icon: jsx(SvgVisionFence, {}),
|
|
20572
|
+
},
|
|
20573
|
+
{
|
|
20574
|
+
type: DataType.DOODLE,
|
|
20575
|
+
paramType: RecordTypeEnum.DOODLE,
|
|
20576
|
+
label: 'Doodle',
|
|
20577
|
+
icon: jsx(SvgDoodle, {}),
|
|
20578
|
+
},
|
|
20579
|
+
];
|
|
20580
|
+
({
|
|
20581
|
+
[DataType.BOUNDARY]: {
|
|
20582
|
+
},
|
|
20583
|
+
[DataType.OBSTACLE]: {
|
|
20584
|
+
},
|
|
20585
|
+
[DataType.CHANNEL]: {
|
|
20586
|
+
},
|
|
20587
|
+
[DataType.VISION_OFF]: {
|
|
20588
|
+
},
|
|
20589
|
+
[DataType.DOODLE]: {
|
|
20590
|
+
},
|
|
20591
|
+
[DataType.PATH]: undefined,
|
|
20592
|
+
[DataType.ANTENNA]: undefined,
|
|
20593
|
+
[DataType.CHARGING_PILE]: undefined,
|
|
20594
|
+
});
|
|
20595
|
+
|
|
20596
|
+
var css_248z$1 = ".ant-modal .ant-modal-body .ant-modal-confirm-title {\n text-align: center;\n}\n.ant-modal .ant-modal-body .ant-modal-confirm-btns {\n margin-top: 24px;\n}\n.ant-modal .ant-modal-body .ant-modal-confirm-btns .ant-btn + .ant-btn {\n margin-left: 24px;\n}\n\n.index-module_modal__fkxhn.index-module_center__d461v .ant-modal-title {\n text-align: center;\n padding: 10px 20px 0;\n font-size: 18px;\n}\n.index-module_modal__fkxhn.index-module_center__d461v .ant-modal-header {\n margin-bottom: 24px;\n}\n.index-module_modal__fkxhn.index-module_center__d461v .ant-modal .ant-modal-footer {\n margin-top: 24px;\n}\n.index-module_modal__fkxhn.index-module_center__d461v .ant-modal .ant-modal-footer .ant-btn + .ant-btn {\n margin-left: 24px;\n}";
|
|
20597
|
+
var styles$1 = {"modal":"index-module_modal__fkxhn","center":"index-module_center__d461v"};
|
|
20598
|
+
styleInject(css_248z$1);
|
|
20599
|
+
|
|
20600
|
+
const CustomModal = ({ children, titleCenter, hasMinHeight, height, ...props }) => {
|
|
20601
|
+
return (jsx(Modal, { centered: true, styles: {
|
|
20602
|
+
body: {
|
|
20603
|
+
maxHeight: height ? `${height}px` : 'calc(100vh - 200px)',
|
|
20604
|
+
minHeight: hasMinHeight ? '520px' : undefined,
|
|
20605
|
+
overflow: 'auto',
|
|
20606
|
+
},
|
|
20607
|
+
}, wrapClassName: classNames(styles$1.modal, {
|
|
20608
|
+
[styles$1.center]: titleCenter,
|
|
20609
|
+
}), cancelButtonProps: { color: 'primary', variant: 'outlined' }, cancelText: 'Cancel', ...props, children: children }));
|
|
20610
|
+
};
|
|
20611
|
+
|
|
20612
|
+
var css_248z = ".index-module_doodleModal__EGNPW .index-module_title__ViZuB {\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: rgb(29, 29, 29);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n max-height: 230px;\n overflow-y: auto;\n width: 470px;\n margin: 20px auto 0;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 {\n width: 70px;\n height: 70px;\n padding: 10px;\n border-radius: 8px;\n cursor: pointer;\n border: 2px solid transparent;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ease;\n position: relative;\n background: rgb(233, 242, 241);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7.index-module_active__1OHfd {\n border: 2px solid #ff5a00;\n background-color: rgba(110, 220, 207, 0.1);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7.index-module_active__1OHfd .index-module_selectIcon__EFQF- {\n display: block;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_svgImage__2OT8- {\n width: 100%;\n height: 100%;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_svgImage__2OT8- svg {\n width: 100%;\n height: 100%;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_selectIcon__EFQF- {\n position: absolute;\n bottom: 4px;\n right: 4px;\n display: none;\n}";
|
|
20613
|
+
var styles = {"doodleModal":"index-module_doodleModal__EGNPW","title":"index-module_title__ViZuB","content":"index-module_content__h-60T","item":"index-module_item__dvoq7","active":"index-module_active__1OHfd","svgImage":"index-module_svgImage__2OT8-"};
|
|
20614
|
+
styleInject(css_248z);
|
|
20615
|
+
|
|
20616
|
+
const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
|
|
20617
|
+
const { editMapInfo, setEditMapInfo, onHandleEnterRecord } = useMapEditContext();
|
|
20618
|
+
const [selectedDoodle, setSelectedDoodle] = useState(null);
|
|
20619
|
+
const noNeed = useMemo(() => {
|
|
20620
|
+
return '1234567890QWERTYUIOPASDFGHJKLZXCVBNM';
|
|
20621
|
+
}, []);
|
|
20622
|
+
// 选择 Doodle
|
|
20623
|
+
const handleSelectDoodle = useCallback((item) => {
|
|
20624
|
+
setSelectedDoodle(item);
|
|
20625
|
+
}, []);
|
|
20626
|
+
// 确认选择
|
|
20627
|
+
const handleConfirm = useCallback(() => {
|
|
20628
|
+
if (selectedDoodle) {
|
|
20629
|
+
const newDoodle = initDoodle();
|
|
20630
|
+
const svg = selectedDoodle?.svgStr;
|
|
20631
|
+
const minLength = selectedDoodle.minLength;
|
|
20632
|
+
const parseSvg = SvgParserNative.parseSvg(svg);
|
|
20633
|
+
const svgMinLength = parseSvg.height / SCALE_FACTOR;
|
|
20634
|
+
// 使用获取到的 SVG 内容,如果没有获取到则使用 URL
|
|
20635
|
+
newDoodle.svg = svg;
|
|
20636
|
+
newDoodle.scale = minLength / svgMinLength;
|
|
20637
|
+
newDoodle.direction = 0;
|
|
20638
|
+
newDoodle.center = restorePoint(centerPoint);
|
|
20639
|
+
onHandleEnterRecord?.({
|
|
20640
|
+
type: 1,
|
|
20641
|
+
function: 0,
|
|
20642
|
+
})?.then(() => {
|
|
20643
|
+
setEditMapInfo({
|
|
20644
|
+
...editMapInfo,
|
|
20645
|
+
historyList: [
|
|
20646
|
+
{
|
|
20647
|
+
selectElement: newDoodle,
|
|
20648
|
+
},
|
|
20649
|
+
],
|
|
20650
|
+
currentHistoryIndex: 0,
|
|
20651
|
+
createMode: CreateStatus.COMPLETED,
|
|
20652
|
+
elementType: DataType.DOODLE,
|
|
20653
|
+
selectElement: newDoodle,
|
|
20654
|
+
isShowDrag: true,
|
|
20655
|
+
});
|
|
20656
|
+
setOpen(false);
|
|
20657
|
+
onSelect?.(svg);
|
|
20658
|
+
}, (error) => {
|
|
20659
|
+
message.error('Save failed, please try again');
|
|
20660
|
+
});
|
|
20661
|
+
}
|
|
20662
|
+
}, [selectedDoodle, setEditMapInfo, editMapInfo, setOpen, onSelect, centerPoint]);
|
|
20663
|
+
return (jsx(CustomModal, { width: 560, title: "Create doodle", titleCenter: true, open: open, onOk: handleConfirm, onCancel: () => setOpen(false), okButtonProps: { disabled: !selectedDoodle }, afterClose: () => setSelectedDoodle(null), okText: "Create", cancelText: "Cancel", children: jsxs("div", { className: styles.doodleModal, children: [jsx("div", { className: styles.title, children: "Select the doodle that you want to create" }), jsx("div", { className: styles.content, children: doodleList
|
|
20664
|
+
?.filter((item) => !noNeed.includes(item.name))
|
|
20665
|
+
.map((item) => {
|
|
20666
|
+
return (jsx("div", { className: classNames(styles.item, {
|
|
20667
|
+
[styles.active]: selectedDoodle?.svg === item.svg,
|
|
20668
|
+
}), onClick: () => handleSelectDoodle(item), children: jsx("div", { className: styles.svgImage, dangerouslySetInnerHTML: { __html: item?.svgStr } }) }, item.id));
|
|
20669
|
+
}) })] }) }));
|
|
20670
|
+
};
|
|
20671
|
+
|
|
20672
|
+
const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
|
|
20673
|
+
const { svgRef } = useSvgEditContext();
|
|
20674
|
+
const { editMapInfo, setEditMapInfo, onHandleEnterRecord } = useMapEditContext();
|
|
20675
|
+
const divRef = useRef(null);
|
|
20676
|
+
const [open, setOpen] = useState(false);
|
|
20677
|
+
const [doodleOpen, setDoodleOpen] = useState(false);
|
|
20678
|
+
const centerPoint = useMemo(() => {
|
|
20679
|
+
if (!svgRef)
|
|
20680
|
+
return null;
|
|
20681
|
+
const baseVal = svgRef?.viewBox.baseVal;
|
|
20682
|
+
const center = [
|
|
20683
|
+
baseVal?.x + (baseVal?.width || 0) / 2,
|
|
20684
|
+
baseVal?.y + (baseVal?.height || 0) / 2,
|
|
20685
|
+
];
|
|
20686
|
+
return center;
|
|
20687
|
+
}, [svgRef?.viewBox?.baseVal?.x]);
|
|
20688
|
+
const centerBounds = useMemo(() => {
|
|
20689
|
+
if (!svgRef)
|
|
20690
|
+
return null;
|
|
20691
|
+
const elementWidth = 50 * 10;
|
|
20692
|
+
const [minX, minY, maxX, maxY] = [
|
|
20693
|
+
centerPoint[0] - elementWidth / 2,
|
|
20694
|
+
centerPoint[1] - elementWidth / 2,
|
|
20695
|
+
centerPoint[0] + elementWidth / 2,
|
|
20696
|
+
centerPoint[1] + elementWidth / 2,
|
|
20697
|
+
];
|
|
20698
|
+
const elementPoints = [
|
|
20699
|
+
[minX, minY],
|
|
20700
|
+
[minX, maxY],
|
|
20701
|
+
[maxX, maxY],
|
|
20702
|
+
[maxX, minY],
|
|
20703
|
+
];
|
|
20704
|
+
return elementPoints;
|
|
20705
|
+
}, [centerPoint]);
|
|
20706
|
+
const addNewElement = useCallback((type, item) => {
|
|
20707
|
+
setOpen(false);
|
|
20708
|
+
let newElement = null;
|
|
20709
|
+
if (type === DataType.BOUNDARY) {
|
|
20710
|
+
newElement = initBoundary();
|
|
20711
|
+
}
|
|
20712
|
+
else if (type === DataType.OBSTACLE) {
|
|
20713
|
+
newElement = initObstacle();
|
|
20714
|
+
}
|
|
20715
|
+
else if (type === DataType.CHANNEL) {
|
|
20716
|
+
newElement = initChannel();
|
|
20717
|
+
}
|
|
20718
|
+
else if (type === DataType.VISION_OFF) {
|
|
20719
|
+
newElement = initVisionOff();
|
|
20720
|
+
newElement.points = centerBounds;
|
|
20721
|
+
}
|
|
20722
|
+
else if (type === DataType.DOODLE) {
|
|
20723
|
+
return setDoodleOpen(true);
|
|
20724
|
+
}
|
|
20725
|
+
onHandleEnterRecord?.({
|
|
20726
|
+
type: item?.paramType,
|
|
20727
|
+
function: item?.type === DataType.OBSTACLE ? 0 : undefined,
|
|
20728
|
+
})?.then(() => {
|
|
20729
|
+
setEditMapInfo({
|
|
20730
|
+
...editMapInfo,
|
|
20731
|
+
historyList: [
|
|
20732
|
+
{
|
|
20733
|
+
selectElement: newElement,
|
|
20734
|
+
},
|
|
20735
|
+
],
|
|
20736
|
+
currentHistoryIndex: 0,
|
|
20737
|
+
createMode: type === DataType.VISION_OFF ? CreateStatus.COMPLETED : CreateStatus.CREATING,
|
|
20738
|
+
elementType: type,
|
|
20739
|
+
selectElement: newElement,
|
|
20740
|
+
});
|
|
20741
|
+
}, (errorText) => {
|
|
20742
|
+
message.error('Save failed, please try again');
|
|
20743
|
+
});
|
|
20744
|
+
}, [centerBounds]);
|
|
20745
|
+
const addItems = useMemo(() => {
|
|
20746
|
+
return DATE_TYPE_MAP?.filter((item) => {
|
|
20747
|
+
if (item.type === DataType.OBSTACLE) {
|
|
20748
|
+
return !disabledObstacles;
|
|
20749
|
+
}
|
|
20750
|
+
return item.type !== DataType.BOUNDARY;
|
|
20751
|
+
});
|
|
20752
|
+
}, [disabledObstacles]);
|
|
20753
|
+
// console.log('addEntry->', editMapInfo, editMap);
|
|
20754
|
+
if (editMapInfo.createMode || editMapInfo.editMap || !editMap) {
|
|
20755
|
+
return null;
|
|
20756
|
+
}
|
|
20757
|
+
return (jsxs("div", { ref: divRef, className: styles$2.addEntry, children: [jsx(Popover, { open: open, onOpenChange: setOpen, arrow: false, placement: "leftTop", content: addItems?.map((item) => {
|
|
20758
|
+
return (jsxs("div", { className: styles$2.addItem, onClick: () => {
|
|
20759
|
+
addNewElement(item.type, item);
|
|
20760
|
+
}, children: [jsx("div", { className: styles$2.icon, children: item?.icon }), jsx("div", { className: styles$2.label, children: item?.label })] }, item.label));
|
|
20761
|
+
}), children: jsx("div", { className: styles$2.icon, children: jsx(SvgAddEntry, {}) }) }), jsx(DoodleModal, { centerPoint: centerPoint, doodleList: doodleList, open: doodleOpen, onOk: () => setDoodleOpen(false), setOpen: setDoodleOpen })] }));
|
|
20249
20762
|
};
|
|
20250
20763
|
|
|
20251
20764
|
// 验证GPS坐标是否有效
|
|
@@ -20299,10 +20812,7 @@ const getValidGpsBounds = (mapData, rotation = 0) => {
|
|
|
20299
20812
|
else {
|
|
20300
20813
|
// 最后的fallback:使用默认坐标
|
|
20301
20814
|
console.warn('无法获取有效的GPS边界,使用默认坐标');
|
|
20302
|
-
bounds =
|
|
20303
|
-
sw: [-9.1562, -37.7503],
|
|
20304
|
-
ne: [31.247, 5.797],
|
|
20305
|
-
};
|
|
20815
|
+
bounds = DEFAULT_COORDINATES;
|
|
20306
20816
|
}
|
|
20307
20817
|
}
|
|
20308
20818
|
// 如果有旋转角度,计算旋转后的边界
|
|
@@ -20455,7 +20965,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
20455
20965
|
overlayScale,
|
|
20456
20966
|
doodleList,
|
|
20457
20967
|
]);
|
|
20458
|
-
// console.log('svgElementDatas->', svgElementDatas, unStructMapData, commonValue);
|
|
20459
20968
|
// 处理地图分区边界
|
|
20460
20969
|
// const partitionBoundary = useMemo(() => {
|
|
20461
20970
|
// const allBoundaryElements = [];
|
|
@@ -20684,6 +21193,14 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
20684
21193
|
useEffect(() => {
|
|
20685
21194
|
setDrag(defaultTransform ?? { x: 0, y: 0, rotation: 0 });
|
|
20686
21195
|
}, [defaultTransform]);
|
|
21196
|
+
useEffect(() => {
|
|
21197
|
+
// 监听drag变化,比较drag和defaultTransform
|
|
21198
|
+
onHandleEvent?.(ClickEventType.DRAG_MAP, {
|
|
21199
|
+
isDragMap: drag.x !== defaultTransform.x ||
|
|
21200
|
+
drag.y !== defaultTransform.y ||
|
|
21201
|
+
drag.rotation !== defaultTransform.rotation,
|
|
21202
|
+
});
|
|
21203
|
+
}, [drag, defaultTransform, onHandleEvent]);
|
|
20687
21204
|
// 监听地图zoom变化,计算缩放比例
|
|
20688
21205
|
useEffect(() => {
|
|
20689
21206
|
if (!mapRef)
|
|
@@ -20695,8 +21212,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
20695
21212
|
// 基于固定的参考zoom级别计算overlayScale
|
|
20696
21213
|
const zoomDiff = currentZoom - REFERENCE_ZOOM;
|
|
20697
21214
|
const scale = Math.pow(2, -zoomDiff); // 负数实现反向缩放
|
|
20698
|
-
|
|
20699
|
-
setOverlayScale(scale < 1 ? 1 : scale);
|
|
21215
|
+
setOverlayScale(scale < 1 ? 1 : platform === PlatformType.H5 ? 1.5 * scale : scale);
|
|
20700
21216
|
};
|
|
20701
21217
|
// 使用lodash throttle进行节流处理: 100ms内只执行一次
|
|
20702
21218
|
const handleZoomChanged = throttle$2(updateScale, 50);
|
|
@@ -20778,7 +21294,9 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
20778
21294
|
// 添加视觉失效区
|
|
20779
21295
|
addVisionOffPoint: () => svgEditMapRef.current?.addVisionOffPoint(),
|
|
20780
21296
|
// h5进入视觉失效区编辑模式
|
|
20781
|
-
enterVisionOffEditMode: (mode) =>
|
|
21297
|
+
enterVisionOffEditMode: (mode) => {
|
|
21298
|
+
svgEditMapRef.current?.enterVisionOffEditMode(mode);
|
|
21299
|
+
},
|
|
20782
21300
|
// 重做
|
|
20783
21301
|
redo: () => svgEditMapRef.current?.redo(),
|
|
20784
21302
|
// 撤销
|
|
@@ -20809,7 +21327,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
20809
21327
|
}
|
|
20810
21328
|
// console.log('mowerrender------->', svgViewBox);
|
|
20811
21329
|
// 使用goole maps自定义叠加层,返回debug信息(如果启用)
|
|
20812
|
-
return (jsx(CommonContextProvider, { value: commonValue, children: jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxs(MapEditContextProvider, { value: mapEditValue, children: [platform !== PlatformType.H5 && (jsx(Fragment, {})), platform === PlatformType.H5 && jsx(Crosshair, {}), jsxs(OverlayViewF, { onLoad: (lay) => {
|
|
21330
|
+
return (jsx(CommonContextProvider, { value: commonValue, children: jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxs(MapEditContextProvider, { value: mapEditValue, children: [platform !== PlatformType.H5 && (jsx(Fragment, { children: jsx(AddEntry, { disabledObstacles: disabledObstacles, doodleList: doodleList, editMap: editMap }) })), platform === PlatformType.H5 && jsx(Crosshair, {}), jsxs(OverlayViewF, { onLoad: (lay) => {
|
|
20813
21331
|
setOverlay(lay);
|
|
20814
21332
|
}, onDraw: (style) => {
|
|
20815
21333
|
const layout = Object.keys(style).reduce((pre, cur) => {
|
|
@@ -20889,4 +21407,4 @@ const BoundarySvgRender = React__default.memo(({ mapJson, id, maxWidth = 300 })
|
|
|
20889
21407
|
}) }), jsx(CharginPile, { mapData: mapJson, mapConfig: DEFAULT_STYLES, viewBox: boundaryViewBox || null, rotation: 0 })] }));
|
|
20890
21408
|
});
|
|
20891
21409
|
|
|
20892
|
-
export { ALL_DIRECTION_SELECTED, AntennaData, AntennaDataBuilder, BaseData, BoundaryData, BoundarySvgRender, ChannelData, ChargingPileData, CreateStatus, DataType, DoodleData, MAX_DIRECTION_ANGLE, MIN_DIRECTION_ANGLE, MapDataProcessor, MobileEditMode, MowerMapRenderer, ObstacleData, PathData, PathDataProcessor, PlatformType, RecordFunctionEnum, RecordTypeEnum, RenderType, SCALE_FACTOR, SvgParserNative, UnifiedMapDataProcessor, VisionOffData, calculateMapGpsCenter, estimateGpsFromMapBounds, initBoundary, initChannel, initDoodle, initObstacle, initVisionOff, restorePointsFormat };
|
|
21410
|
+
export { ALL_DIRECTION_SELECTED, AntennaData, AntennaDataBuilder, BaseData, BoundaryData, BoundarySvgRender, ChannelData, ChargingPileData, CheckDoodleErrorType, CheckObstaclePointErrorType, ClickEventType, CreateStatus, DataType, DoodleData, MAX_DIRECTION_ANGLE, MIN_DIRECTION_ANGLE, MapDataProcessor, MobileEditMode, MowerMapRenderer, ObstacleData, PathData, PathDataProcessor, PlatformType, RecordFunctionEnum, RecordTypeEnum, RenderType, SCALE_FACTOR, SvgParserNative, UnifiedMapDataProcessor, VisionOffData, calculateMapGpsCenter, estimateGpsFromMapBounds, initBoundary, initChannel, initDoodle, initObstacle, initVisionOff, restorePointsFormat };
|