@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.
Files changed (54) hide show
  1. package/dist/config/constants.d.ts +4 -0
  2. package/dist/config/constants.d.ts.map +1 -1
  3. package/dist/context/mapEdit.d.ts +3 -1
  4. package/dist/context/mapEdit.d.ts.map +1 -1
  5. package/dist/index.d.ts +2 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.esm.js +873 -355
  8. package/dist/index.js +874 -356
  9. package/dist/processor/unified/BaseData.d.ts.map +1 -1
  10. package/dist/processor/unified/UnifiedMapDataProcessor.d.ts.map +1 -1
  11. package/dist/render/MowerMapOverlay.d.ts.map +1 -1
  12. package/dist/render/MowerMapRenderer.d.ts.map +1 -1
  13. package/dist/render/SvgMapView.d.ts.map +1 -1
  14. package/dist/render/drag/drag.d.ts.map +1 -1
  15. package/dist/render/drag/index.d.ts.map +1 -1
  16. package/dist/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/index.d.ts.map +1 -1
  17. package/dist/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/index.d.ts.map +1 -1
  18. package/dist/render/svgEditMap/components/HandleElementInfo/components/HeightModal/index.d.ts.map +1 -1
  19. package/dist/render/svgEditMap/components/HandleElementInfo/doodle.d.ts.map +1 -1
  20. package/dist/render/svgEditMap/components/HandleElementInfo/index.d.ts.map +1 -1
  21. package/dist/render/svgEditMap/components/HandleElementInfo/obstacle.d.ts.map +1 -1
  22. package/dist/render/svgEditMap/components/HandleElementInfo/visionOff.d.ts.map +1 -1
  23. package/dist/render/svgEditMap/hooks/useCheckElement.d.ts +7 -5
  24. package/dist/render/svgEditMap/hooks/useCheckElement.d.ts.map +1 -1
  25. package/dist/render/svgEditMap/hooks/useCreateVisionOffElement.d.ts.map +1 -1
  26. package/dist/render/svgEditMap/hooks/useHistoryHandle.d.ts.map +1 -1
  27. package/dist/render/svgEditMap/hooks/usePolygonDrawing.d.ts.map +1 -1
  28. package/dist/render/svgEditMap/index.d.ts +3 -1
  29. package/dist/render/svgEditMap/index.d.ts.map +1 -1
  30. package/dist/render/svgElement/BoundaryElement/index.d.ts.map +1 -1
  31. package/dist/render/svgElement/Mobile/CreateObstacleElement/coordinateUtils.d.ts.map +1 -1
  32. package/dist/render/svgElement/Mobile/CreateObstacleElement/index.d.ts +2 -0
  33. package/dist/render/svgElement/Mobile/CreateObstacleElement/index.d.ts.map +1 -1
  34. package/dist/render/svgElement/ObstacleElement/index.d.ts.map +1 -1
  35. package/dist/render/svgElement/PolygonELement/components/DistanceLabels.d.ts +2 -0
  36. package/dist/render/svgElement/PolygonELement/components/DistanceLabels.d.ts.map +1 -1
  37. package/dist/render/svgElement/PolygonELement/components/DragDistanceIndicator.d.ts +2 -0
  38. package/dist/render/svgElement/PolygonELement/components/DragDistanceIndicator.d.ts.map +1 -1
  39. package/dist/render/svgElement/PolygonELement/index.d.ts.map +1 -1
  40. package/dist/render/svgElement/PolygonELement/vertex/index.d.ts.map +1 -1
  41. package/dist/render/svgElement/TransformWrapper/DoodleTransformWrapper/DoodleTransformWrapper.d.ts.map +1 -1
  42. package/dist/render/svgElement/TransformWrapper/DoodleTransformWrapper/useDoodleTransform.d.ts.map +1 -1
  43. package/dist/render/svgElement/TransformWrapper/VisionOffTransformWrapper/VisionOffTransformWrapper.d.ts.map +1 -1
  44. package/dist/render/svgElement/TransformWrapper/VisionOffTransformWrapper/useVisionOffTransform.d.ts +1 -1
  45. package/dist/render/svgElement/TransformWrapper/VisionOffTransformWrapper/useVisionOffTransform.d.ts.map +1 -1
  46. package/dist/render/svgMap/index.d.ts.map +1 -1
  47. package/dist/render/svgMap/useSvgMapView.d.ts.map +1 -1
  48. package/dist/types/renderer.d.ts +20 -0
  49. package/dist/types/renderer.d.ts.map +1 -1
  50. package/dist/utils/common.d.ts.map +1 -1
  51. package/dist/utils/mapBounds.d.ts.map +1 -1
  52. package/package.json +1 -1
  53. package/dist/render/svgElement/TransformWrapper/HandleIcon/index.d.ts +0 -7
  54. package/dist/render/svgElement/TransformWrapper/HandleIcon/index.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -68,6 +68,11 @@ var REAL_TIME_DATA_TYPE;
68
68
  /**
69
69
  * 地图渲染相关常量配置
70
70
  */
71
+ // 默认坐标
72
+ const DEFAULT_COORDINATES = {
73
+ sw: [116.35497283935547, 40.0374755859375],
74
+ ne: [116.35584259033203, 40.038658142089844],
75
+ };
71
76
  /**
72
77
  * 缩放因子 - 将米转换为像素
73
78
  */
@@ -177,7 +182,6 @@ class BaseData {
177
182
  */
178
183
  class BoundaryData extends BaseData {
179
184
  constructor(originalData, level, channels, style) {
180
- console.log('originBoundary', originalData);
181
185
  const convertedPoints = convertPointsFormat(originalData?.points) || [];
182
186
  super(originalData?.id, exports.DataType.BOUNDARY, level, exports.RenderType.POLYGON, convertedPoints, originalData);
183
187
  const { isFlowGlobal, cuttingHeight } = convertHeightsetToParams(originalData?.height_set || 0);
@@ -740,6 +744,7 @@ class UnifiedMapDataProcessor {
740
744
  for (const element of elements) {
741
745
  try {
742
746
  // 如果有SVG数据,创建涂鸦数据
747
+ // 如果有过期时间,且过期时间大于当前时间(秒级别),才需要渲染
743
748
  if ('svg' in element &&
744
749
  element.svg &&
745
750
  'center' in element &&
@@ -747,7 +752,9 @@ class UnifiedMapDataProcessor {
747
752
  'scale' in element &&
748
753
  element.scale !== undefined &&
749
754
  'direction' in element &&
750
- element.direction !== undefined) {
755
+ element.direction !== undefined &&
756
+ (element.expiration_ts === undefined ||
757
+ element.expiration_ts > Math.floor(Date.now() / 1000))) {
751
758
  const convertedPoints = convertPoint(element.center);
752
759
  if (!convertedPoints) {
753
760
  continue;
@@ -760,7 +767,9 @@ class UnifiedMapDataProcessor {
760
767
  else if ('points' in element &&
761
768
  element.points &&
762
769
  Array.isArray(element.points) &&
763
- element.points.length >= 3) {
770
+ element.points.length >= 3 &&
771
+ (element.expiration_ts === undefined ||
772
+ element.expiration_ts > Math.floor(Date.now() / 1000))) {
764
773
  const convertedPoints = convertPointsFormat(element.points);
765
774
  if (!convertedPoints || convertedPoints.length < 3) {
766
775
  continue;
@@ -1481,51 +1490,46 @@ function estimateGpsFromMapBounds(mapData) {
1481
1490
  if (!bounds || bounds.minX === Infinity) {
1482
1491
  return {
1483
1492
  sw: [0, 0],
1484
- ne: [0, 0]
1493
+ ne: [0, 0],
1485
1494
  };
1486
1495
  }
1487
1496
  // 将边界数据转换为物理单位(米)
1488
- const minXMeters = bounds.minX / SCALE_FACTOR * 6; // 西边界
1489
- const minYMeters = bounds.minY / SCALE_FACTOR * 6; // 南边界
1490
- const maxXMeters = bounds.maxX / SCALE_FACTOR * 6; // 东边界
1491
- const maxYMeters = bounds.maxY / SCALE_FACTOR * 6; // 北边界
1497
+ const minXMeters = bounds.minX / SCALE_FACTOR; // 西边界
1498
+ const minYMeters = bounds.minY / SCALE_FACTOR; // 南边界
1499
+ const maxXMeters = bounds.maxX / SCALE_FACTOR; // 东边界
1500
+ const maxYMeters = bounds.maxY / SCALE_FACTOR; // 北边界
1492
1501
  const mapWidthMeters = maxXMeters - minXMeters;
1493
1502
  const mapHeightMeters = maxYMeters - minYMeters;
1494
- // 根据地图大小选择合适的基准GPS坐标
1495
- let baseLat;
1496
- let baseLng;
1497
- if (mapWidthMeters < 1000 && mapHeightMeters < 1000) {
1498
- // 小型区域 - 使用更精确的基准点
1499
- baseLat = 39.9042; // 北京天安门
1500
- baseLng = 116.4074;
1501
- }
1502
- else if (mapWidthMeters < 10000 && mapHeightMeters < 10000) {
1503
- // 中型区域 - 使用城市级别的基准点
1504
- baseLat = 39.9000;
1505
- baseLng = 116.4000;
1506
- }
1507
- else {
1508
- // 大型区域 - 使用更大范围的基准点
1509
- baseLat = 40.0000;
1510
- baseLng = 116.0000;
1511
- }
1503
+ // 凤凰岭的GPS坐标作为地图中心点
1504
+ const centerLat = 40.103;
1505
+ const centerLng = 116.072222;
1506
+ // const centerLat = 40.03806686401367;
1507
+ // const centerLng = 116.35540771484375;
1512
1508
  // 精确的坐标转换常数
1513
1509
  // 1度纬度 = 约111,320米(在地球上任何地方都基本相同)
1514
1510
  // 1度经度 = 约111,320 * cos(纬度) 米(随纬度变化)
1515
1511
  const METERS_PER_DEGREE_LAT = 111320;
1516
- const METERS_PER_DEGREE_LNG = 111320 * Math.cos(baseLat * Math.PI / 180);
1512
+ const METERS_PER_DEGREE_LNG = 111320 * Math.cos((centerLat * Math.PI) / 180);
1517
1513
  // 计算SW(西南角)GPS坐标
1518
- const swLat = baseLat + minYMeters / METERS_PER_DEGREE_LAT; // 南边界纬度
1519
- const swLng = baseLng + minXMeters / METERS_PER_DEGREE_LNG; // 西边界经度
1514
+ // 从中心点减去半个地图的宽度和高度
1515
+ const swLat = centerLat - mapHeightMeters / 2 / METERS_PER_DEGREE_LAT;
1516
+ const swLng = centerLng - mapWidthMeters / 2 / METERS_PER_DEGREE_LNG;
1520
1517
  // 计算NE(东北角)GPS坐标
1521
- const neLat = baseLat + maxYMeters / METERS_PER_DEGREE_LAT; // 北边界纬度
1522
- const neLng = baseLng + maxXMeters / METERS_PER_DEGREE_LNG; // 东边界经度
1518
+ // 从中心点加上半个地图的宽度和高度
1519
+ const neLat = centerLat + mapHeightMeters / 2 / METERS_PER_DEGREE_LAT;
1520
+ const neLng = centerLng + mapWidthMeters / 2 / METERS_PER_DEGREE_LNG;
1523
1521
  // 验证估算的坐标是否在合理范围内
1524
- if (swLat < -90 || swLat > 90 || swLng < -180 || swLng > 180 ||
1525
- neLat < -90 || neLat > 90 || neLng < -180 || neLng > 180) {
1522
+ if (swLat < -90 ||
1523
+ swLat > 90 ||
1524
+ swLng < -180 ||
1525
+ swLng > 180 ||
1526
+ neLat < -90 ||
1527
+ neLat > 90 ||
1528
+ neLng < -180 ||
1529
+ neLng > 180) {
1526
1530
  console.warn('估算的GPS坐标超出有效范围:', {
1527
1531
  sw: [swLng, swLat],
1528
- ne: [neLng, neLat]
1532
+ ne: [neLng, neLat],
1529
1533
  });
1530
1534
  return null;
1531
1535
  }
@@ -1533,13 +1537,13 @@ function estimateGpsFromMapBounds(mapData) {
1533
1537
  if (swLat >= neLat || swLng >= neLng) {
1534
1538
  console.warn('GPS边界坐标逻辑错误:', {
1535
1539
  sw: [swLng, swLat],
1536
- ne: [neLng, neLat]
1540
+ ne: [neLng, neLat],
1537
1541
  });
1538
1542
  return null;
1539
1543
  }
1540
1544
  return {
1541
1545
  sw: [swLng, swLat], // [经度, 纬度]
1542
- ne: [neLng, neLat] // [经度, 纬度]
1546
+ ne: [neLng, neLat], // [经度, 纬度]
1543
1547
  };
1544
1548
  }
1545
1549
  catch (error) {
@@ -8005,6 +8009,42 @@ exports.PlatformType = void 0;
8005
8009
  PlatformType["WEB"] = "web";
8006
8010
  PlatformType["H5"] = "h5";
8007
8011
  })(exports.PlatformType || (exports.PlatformType = {}));
8012
+ // 禁区的点进行检查的时候的提示
8013
+ exports.CheckObstaclePointErrorType = void 0;
8014
+ (function (CheckObstaclePointErrorType) {
8015
+ // 禁区相交
8016
+ CheckObstaclePointErrorType["OBSTACLE_INTERSECT"] = "obstacle_intersect";
8017
+ // 禁区与doodle相交
8018
+ CheckObstaclePointErrorType["DOODLE_INTERSECT"] = "doodle_intersect";
8019
+ // 禁区与doodle距离过近
8020
+ CheckObstaclePointErrorType["DOODLE_DISTANCE_TOO_CLOSE"] = "doodle_distance_too_close";
8021
+ // 禁区不在边界内
8022
+ CheckObstaclePointErrorType["BOUNDARY_NOT_IN_BOUNDARY"] = "boundary_not_in_boundary";
8023
+ // 点在禁区内
8024
+ CheckObstaclePointErrorType["POINT_IN_OBSTACLE"] = "point_in_obstacle";
8025
+ // 地图不存在
8026
+ CheckObstaclePointErrorType["MAP_NOT_EXIST"] = "map_not_exist";
8027
+ // 获取点失败
8028
+ CheckObstaclePointErrorType["GET_POINT_FAILED"] = "get_point_failed";
8029
+ // 通用错误
8030
+ CheckObstaclePointErrorType["COMMON_ERROR"] = "common_error";
8031
+ })(exports.CheckObstaclePointErrorType || (exports.CheckObstaclePointErrorType = {}));
8032
+ // doodle进行检查的提示
8033
+ exports.CheckDoodleErrorType = void 0;
8034
+ (function (CheckDoodleErrorType) {
8035
+ // 没有选中doodle
8036
+ CheckDoodleErrorType["NO_DOODLE_SELECTED"] = "no_doodle_selected";
8037
+ // doodle没有可移动的点
8038
+ CheckDoodleErrorType["NO_MOVABLE_POINTS"] = "no_movable_points";
8039
+ // doodle不在边界内
8040
+ CheckDoodleErrorType["DOODLE_NOT_IN_BOUNDARY"] = "doodle_not_in_boundary";
8041
+ // doodle距离边界太近
8042
+ CheckDoodleErrorType["DOODLE_DISTANCE_TOO_CLOSE"] = "doodle_distance_too_close";
8043
+ // doodle与其他元素相交
8044
+ CheckDoodleErrorType["DOODLE_INTERSECT"] = "doodle_intersect";
8045
+ // doodle与其他元素距离过近
8046
+ CheckDoodleErrorType["DOODLE_DISTANCE_TOO_CLOSE_TO_OTHER_ELEMENT"] = "doodle_distance_too_close_to_other_element";
8047
+ })(exports.CheckDoodleErrorType || (exports.CheckDoodleErrorType = {}));
8008
8048
 
8009
8049
  /**
8010
8050
  * 触摸事件工具函数
@@ -8545,23 +8585,6 @@ const useDrag = ({ dragCallbacks, onBoundaryLabelsCollapse, onTransformChange, }
8545
8585
 
8546
8586
  // 编辑模式相关常量配置
8547
8587
  // 默认的旋转图标
8548
- const DEFAULT_ROTATE_ICON = `
8549
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
8550
- <g clip-path="url(#clip0_8198_30743)">
8551
- <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)"/>
8552
- <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"/>
8553
- <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"/>
8554
- </g>
8555
- <defs>
8556
- <linearGradient id="paint0_linear_8198_30743" x1="17.7273" y1="16.3636" x2="-1.21533" y2="2.08814e-07" gradientUnits="userSpaceOnUse">
8557
- <stop stop-color="#F16629"/>
8558
- <stop offset="1" stop-color="#F1A129"/>
8559
- </linearGradient>
8560
- <clipPath id="clip0_8198_30743">
8561
- <rect width="20" height="20" fill="white" transform="matrix(-1 0 0 1 20 0)"/>
8562
- </clipPath>
8563
- </defs>
8564
- </svg>`;
8565
8588
  // 默认的拖拽图标
8566
8589
  const DEFAULT_DRAG_ICON = `
8567
8590
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -8575,41 +8598,6 @@ const DEFAULT_DRAG_ICON = `
8575
8598
  </defs>
8576
8599
  </svg>`;
8577
8600
 
8578
- function styleInject(css, ref) {
8579
- if ( ref === void 0 ) ref = {};
8580
- var insertAt = ref.insertAt;
8581
-
8582
- if (!css || typeof document === 'undefined') { return; }
8583
-
8584
- var head = document.head || document.getElementsByTagName('head')[0];
8585
- var style = document.createElement('style');
8586
- style.type = 'text/css';
8587
-
8588
- if (insertAt === 'top') {
8589
- if (head.firstChild) {
8590
- head.insertBefore(style, head.firstChild);
8591
- } else {
8592
- head.appendChild(style);
8593
- }
8594
- } else {
8595
- head.appendChild(style);
8596
- }
8597
-
8598
- if (style.styleSheet) {
8599
- style.styleSheet.cssText = css;
8600
- } else {
8601
- style.appendChild(document.createTextNode(css));
8602
- }
8603
- }
8604
-
8605
- 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}";
8606
- 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"};
8607
- styleInject(css_248z$6);
8608
-
8609
- const RotateHandle = ({ onRotateStart, isRotating }) => {
8610
- return (jsxRuntime.jsx("div", { className: styles$6.rotate, onMouseDown: (e) => onRotateStart(e), onTouchStart: (e) => onRotateStart(e), style: { cursor: isRotating ? 'grabbing' : 'grab' }, dangerouslySetInnerHTML: { __html: DEFAULT_ROTATE_ICON } }));
8611
- };
8612
-
8613
8601
  /**
8614
8602
  * 高级节流函数
8615
8603
  * @param func 要节流的函数
@@ -8661,29 +8649,63 @@ function isMobileDevice() {
8661
8649
  // 检查用户代理字符串
8662
8650
  const userAgent = navigator.userAgent.toLowerCase();
8663
8651
  const mobileKeywords = [
8664
- 'android', 'webos', 'iphone', 'ipad', 'ipod',
8665
- 'blackberry', 'windows phone', 'mobile'
8652
+ 'android',
8653
+ 'webos',
8654
+ 'iphone',
8655
+ 'ipad',
8656
+ 'ipod',
8657
+ 'blackberry',
8658
+ 'windows phone',
8659
+ 'mobile',
8666
8660
  ];
8667
- const isMobileUserAgent = mobileKeywords.some(keyword => userAgent.includes(keyword));
8661
+ const isMobileUserAgent = mobileKeywords.some((keyword) => userAgent.includes(keyword));
8668
8662
  // 检查触摸屏支持
8669
- const hasTouchScreen = 'ontouchstart' in window ||
8670
- (navigator.maxTouchPoints && navigator.maxTouchPoints > 0);
8663
+ const hasTouchScreen = 'ontouchstart' in window || (navigator.maxTouchPoints && navigator.maxTouchPoints > 0);
8671
8664
  // 检查屏幕尺寸(移动设备通常屏幕较小)
8672
8665
  const isSmallScreen = window.innerWidth <= 768;
8673
8666
  // 综合判断:用户代理包含移动设备关键词,或者有触摸屏且屏幕较小
8674
8667
  return isMobileUserAgent || (hasTouchScreen && isSmallScreen);
8675
8668
  }
8676
8669
 
8670
+ function styleInject(css, ref) {
8671
+ if ( ref === void 0 ) ref = {};
8672
+ var insertAt = ref.insertAt;
8673
+
8674
+ if (!css || typeof document === 'undefined') { return; }
8675
+
8676
+ var head = document.head || document.getElementsByTagName('head')[0];
8677
+ var style = document.createElement('style');
8678
+ style.type = 'text/css';
8679
+
8680
+ if (insertAt === 'top') {
8681
+ if (head.firstChild) {
8682
+ head.insertBefore(style, head.firstChild);
8683
+ } else {
8684
+ head.appendChild(style);
8685
+ }
8686
+ } else {
8687
+ head.appendChild(style);
8688
+ }
8689
+
8690
+ if (style.styleSheet) {
8691
+ style.styleSheet.cssText = css;
8692
+ } else {
8693
+ style.appendChild(document.createTextNode(css));
8694
+ }
8695
+ }
8696
+
8697
+ 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}";
8698
+ var styles$9 = {"edit":"index-module_edit__-5VvX","border":"index-module_border__JdNLM","drag":"index-module_drag__uvdPG","move":"index-module_move__mZF8s"};
8699
+ styleInject(css_248z$9);
8700
+
8677
8701
  const DragHandle = ({ onDragStart, isDragging }) => {
8678
8702
  // 在PC设备上隐藏拖拽手柄
8679
8703
  if (!isMobileDevice()) {
8680
8704
  return null;
8681
8705
  }
8682
- return (jsxRuntime.jsx("div", { className: styles$6.move, onMouseDown: (e) => {
8683
- console.log('down');
8706
+ return (jsxRuntime.jsx("div", { className: styles$9.move, onMouseDown: (e) => {
8684
8707
  onDragStart(e);
8685
8708
  }, onTouchStart: (e) => onDragStart(e), onMouseUp: (e) => {
8686
- console.log('drag up');
8687
8709
  // onDragEnd(e);
8688
8710
  },
8689
8711
  // onTouchEnd={(e) => onDragEnd(e)}
@@ -8691,7 +8713,7 @@ const DragHandle = ({ onDragStart, isDragging }) => {
8691
8713
  };
8692
8714
 
8693
8715
  const MapDrag = ({ map: _map, dragCallbacks, onBoundaryLabelsCollapse, onTransformChange, isDragMap = false, }) => {
8694
- const { isDragging, isRotating, handleDragStart, addGlobalListeners, } = useDrag({
8716
+ const { isDragging, handleDragStart, addGlobalListeners } = useDrag({
8695
8717
  dragCallbacks,
8696
8718
  onBoundaryLabelsCollapse,
8697
8719
  onTransformChange,
@@ -8702,10 +8724,6 @@ const MapDrag = ({ map: _map, dragCallbacks, onBoundaryLabelsCollapse, onTransfo
8702
8724
  const cleanup = addGlobalListeners();
8703
8725
  return cleanup;
8704
8726
  }, [addGlobalListeners]);
8705
- // 处理旋转开始
8706
- const handleRotateStart = (e) => {
8707
- handleDragStart(e, 'rotate', containerRef?.current);
8708
- };
8709
8727
  // 处理拖拽开始
8710
8728
  const handleDragStartEvent = (e) => {
8711
8729
  handleDragStart(e, 'drag', containerRef?.current);
@@ -8713,7 +8731,7 @@ const MapDrag = ({ map: _map, dragCallbacks, onBoundaryLabelsCollapse, onTransfo
8713
8731
  if (!isDragMap) {
8714
8732
  return null;
8715
8733
  }
8716
- return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$6.edit, style: { cursor: isDragging ? 'grabbing' : 'move' }, children: [jsxRuntime.jsx("div", { className: styles$6.border }), jsxRuntime.jsx(RotateHandle, { onRotateStart: handleRotateStart, isRotating: isRotating }), jsxRuntime.jsx("div", { className: styles$6.drag, onMouseDown: handleDragStartEvent, onTouchStart: handleDragStartEvent }), jsxRuntime.jsx(DragHandle, { onDragStart: handleDragStartEvent, isDragging: isDragging })] }));
8734
+ return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$9.edit, style: { cursor: isDragging ? 'grabbing' : 'move' }, children: [jsxRuntime.jsx("div", { className: styles$9.border }), jsxRuntime.jsx("div", { className: styles$9.drag, onMouseDown: handleDragStartEvent, onTouchStart: handleDragStartEvent }), jsxRuntime.jsx(DragHandle, { onDragStart: handleDragStartEvent, isDragging: isDragging })] }));
8717
8735
  };
8718
8736
 
8719
8737
  /**
@@ -8764,6 +8782,7 @@ class SvgMapView {
8764
8782
  svg.style.width = '100%';
8765
8783
  svg.style.height = '100%';
8766
8784
  svg.style.background = 'transparent';
8785
+ svg.style.overflow = 'visible';
8767
8786
  return svg;
8768
8787
  }
8769
8788
  /**
@@ -8855,7 +8874,7 @@ class SvgMapView {
8855
8874
  * 设置自适应视图变换 - 让SVG刚好包裹住图形
8856
8875
  */
8857
8876
  fitToView(bounds) {
8858
- const padding = 20; // 添加一些边距以避免内容贴边
8877
+ const padding = 0;
8859
8878
  const boundWidth = bounds.maxX - bounds.minX + padding * 2;
8860
8879
  const boundHeight = bounds.maxY - bounds.minY + padding * 2;
8861
8880
  // 防止宽高为0的情况
@@ -8864,7 +8883,16 @@ class SvgMapView {
8864
8883
  return;
8865
8884
  }
8866
8885
  // 获取容器的实际尺寸进行验证
8867
- this.container.getBoundingClientRect();
8886
+ const containerRect = this.container.getBoundingClientRect();
8887
+ const containerWidth = containerRect.width;
8888
+ const containerHeight = containerRect.height;
8889
+ if (containerWidth <= 0 || containerHeight <= 0) {
8890
+ console.warn('Invalid container size:', containerWidth, containerHeight);
8891
+ return;
8892
+ }
8893
+ // // 计算内容和容器的宽高比
8894
+ // const contentAspectRatio = boundWidth / boundHeight;
8895
+ // const containerAspectRatio = containerWidth / containerHeight;
8868
8896
  // 设置viewBox以包含所有内容
8869
8897
  this.viewBox = {
8870
8898
  x: bounds.minX - padding,
@@ -14126,6 +14154,7 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
14126
14154
  // 调用回调
14127
14155
  const elementCount = elements.length;
14128
14156
  onMapLoad?.(elementCount);
14157
+ x;
14129
14158
  }
14130
14159
  catch (error) {
14131
14160
  console.error('加载地图数据时出错:', error);
@@ -14179,9 +14208,7 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
14179
14208
  }, [mapConfig, onPathLoad]);
14180
14209
  // 初始化 SVG 地图视图
14181
14210
  const initializeSvgMapView = React.useCallback((container) => {
14182
- console.log('initializeSvgMapView called, container:', container, svgMapViewRef.current);
14183
14211
  if (!container || svgMapViewRef.current) {
14184
- console.log('Skipping initialization - container missing or already initialized');
14185
14212
  return;
14186
14213
  }
14187
14214
  containerRef.current = container;
@@ -14195,12 +14222,10 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
14195
14222
  offscreenContainerRef.current = offscreenContainer;
14196
14223
  // 创建 SvgMapView 实例
14197
14224
  svgMapViewRef.current = new SvgMapView(sn, offscreenContainer, 800, 600);
14198
- console.log('SvgMapView created:', svgMapViewRef.current);
14199
14225
  // 加载地图数据
14200
14226
  loadMapData();
14201
14227
  // 加载路径数据
14202
14228
  if (pathData && svgMapViewRef.current) {
14203
- console.log('Loading path data:', pathData);
14204
14229
  loadPathData(pathData, mowPartitionData);
14205
14230
  }
14206
14231
  else {
@@ -14216,7 +14241,6 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
14216
14241
  if (svgElement) {
14217
14242
  svgElementRef.current = svgElement;
14218
14243
  container.appendChild(svgElement);
14219
- console.log('SVG element added to container');
14220
14244
  }
14221
14245
  else {
14222
14246
  console.warn('Failed to get SVG element from SvgMapView');
@@ -14258,8 +14282,6 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
14258
14282
  const setTransform = React.useCallback((transform) => {
14259
14283
  if (!svgMapViewRef.current)
14260
14284
  return;
14261
- console.log('SvgMapView setTransform called with:', transform);
14262
- // 使用SvgMapView的transform API
14263
14285
  svgMapViewRef.current.setTransform(transform);
14264
14286
  }, []);
14265
14287
  // 重置到默认变换
@@ -14330,7 +14352,6 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
14330
14352
  // 监听pathData变化,确保路径数据能够被加载
14331
14353
  React.useEffect(() => {
14332
14354
  if (svgMapViewRef.current && pathData) {
14333
- console.log('PathData changed, reloading...', pathData);
14334
14355
  loadPathData(pathData, mowPartitionData);
14335
14356
  svgMapViewRef.current.refresh();
14336
14357
  }
@@ -14338,7 +14359,6 @@ const useSvgMapView = ({ mapData, pathData, unitType: _unitType = UnitsType.Impe
14338
14359
  React.useEffect(() => {
14339
14360
  if (svgMapViewRef.current && mapData) {
14340
14361
  loadMapData();
14341
- console.log('mapData changed, reloading...', mapData);
14342
14362
  svgMapViewRef.current.refresh();
14343
14363
  }
14344
14364
  }, [mapData, loadMapData]);
@@ -14422,7 +14442,6 @@ const SvgMapComponent = React.forwardRef(({ editMap, rotate, mapData, pathData,
14422
14442
  // 初始化 SVG 地图
14423
14443
  React.useEffect(() => {
14424
14444
  if (containerRef.current && mapData && !svgMapView) {
14425
- console.log('Initializing SVG map view, containerRef->', containerRef.current);
14426
14445
  initializeSvgMapView(containerRef.current);
14427
14446
  }
14428
14447
  }, [mapData, svgMapView, initializeSvgMapView, pathData]);
@@ -14436,9 +14455,9 @@ const SvgMapComponent = React.forwardRef(({ editMap, rotate, mapData, pathData,
14436
14455
  // 设置显示名称以便调试
14437
14456
  SvgMapComponent.displayName = 'SvgMapComponent';
14438
14457
 
14439
- var css_248z$5 = ".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}";
14440
- var styles$5 = {"mowerPosition":"index-module_mowerPosition__yLpIU"};
14441
- styleInject(css_248z$5);
14458
+ 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}";
14459
+ var styles$8 = {"mowerPosition":"index-module_mowerPosition__yLpIU"};
14460
+ styleInject(css_248z$8);
14442
14461
 
14443
14462
  const usePosition = ({ mowerPositionData, viewBox, modelType, hasEdger, mapData, realTimeData, onMowingPositionChange, }) => {
14444
14463
  // DOM 元素引用,用于直接操作
@@ -14664,7 +14683,7 @@ const MowerPosition = React.memo(({ editMap, mowerPositionData, viewBox, modelTy
14664
14683
  pointerEvents: 'none',
14665
14684
  zIndex: 1000,
14666
14685
  }), []);
14667
- return (jsxRuntime.jsx("div", { className: styles$5.mowerPosition, style: containerStyle, children: jsxRuntime.jsx("div", { ref: elementRef, className: "mower-position", style: {
14686
+ return (jsxRuntime.jsx("div", { className: styles$8.mowerPosition, style: containerStyle, children: jsxRuntime.jsx("div", { ref: elementRef, className: "mower-position", style: {
14668
14687
  position: 'absolute',
14669
14688
  width: 30,
14670
14689
  height: 30,
@@ -14733,9 +14752,9 @@ const CharginPile = React.memo(({ mapData, mapConfig = {}, viewBox, rotation = 0
14733
14752
  }, children: jsxRuntime.jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }, `pile-${idx}`))) }));
14734
14753
  });
14735
14754
 
14736
- var css_248z$4 = ".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}";
14737
- var styles$4 = {"container":"index-module_container__7IatW","boundaryLabel":"index-module_boundaryLabel__GDHFn","base":"index-module_base__qy2SG","extended":"index-module_extended__0TMAt"};
14738
- styleInject(css_248z$4);
14755
+ 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}";
14756
+ var styles$7 = {"container":"index-module_container__7IatW","boundaryLabel":"index-module_boundaryLabel__GDHFn","base":"index-module_base__qy2SG","extended":"index-module_extended__0TMAt"};
14757
+ styleInject(css_248z$7);
14739
14758
 
14740
14759
  const useBoundaryLabels = ({ mapData, pathData, unitType, viewBox, mowPartitionData, realTimeData = [], }) => {
14741
14760
  const [processStateIsMowing, updateProcessStateIsMowing] = React.useState(false);
@@ -14889,7 +14908,7 @@ const BoundaryLabels = React.memo(({ editMap, mapData, pathData, unitType, langu
14889
14908
  zIndex: expandedId != null ? 9999 : containerZIndex,
14890
14909
  display: editMap ? 'none' : 'block',
14891
14910
  }), [containerZIndex, expandedId, editMap]);
14892
- return (jsxRuntime.jsx("div", { className: styles$4.container, style: containerStyle, children: items.map((item) => (jsxRuntime.jsxs("div", { className: `${styles$4.boundaryLabel} boundary-label`, "data-boundary-id": item.id, style: {
14911
+ return (jsxRuntime.jsx("div", { className: styles$7.container, style: containerStyle, children: items.map((item) => (jsxRuntime.jsxs("div", { className: `${styles$7.boundaryLabel} boundary-label`, "data-boundary-id": item.id, style: {
14893
14912
  transform: `translate(-50%, -50%) rotate(${-rotation}deg)`,
14894
14913
  left: `${item.leftPct}%`,
14895
14914
  top: `${item.topPct}%`,
@@ -14899,12 +14918,12 @@ const BoundaryLabels = React.memo(({ editMap, mapData, pathData, unitType, langu
14899
14918
  if (onlyRead)
14900
14919
  return;
14901
14920
  handleClick(item.id);
14902
- }, children: [jsxRuntime.jsx("div", { className: styles$4.base, children: item.baseText }), jsxRuntime.jsxs("div", { className: styles$4.extended, style: { display: expandedId === item.id ? 'block' : 'none' }, children: [jsxRuntime.jsx("div", { style: { marginBottom: 3, fontWeight: 'bold' }, children: item.coverageText }), jsxRuntime.jsx("div", { children: item.dateText })] })] }, item.id))) }));
14921
+ }, children: [jsxRuntime.jsx("div", { className: styles$7.base, children: item.baseText }), jsxRuntime.jsxs("div", { className: styles$7.extended, style: { display: expandedId === item.id ? 'block' : 'none' }, children: [jsxRuntime.jsx("div", { style: { marginBottom: 3, fontWeight: 'bold' }, children: item.coverageText }), jsxRuntime.jsx("div", { children: item.dateText })] })] }, item.id))) }));
14903
14922
  });
14904
14923
 
14905
- var css_248z$3 = ".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}";
14906
- var styles$3 = {"container":"index-module_container__gB52e","item":"index-module_item__zHoZP","icon":"index-module_icon__CS56A","tooltip":"index-module_tooltip__NMCmR"};
14907
- styleInject(css_248z$3);
14924
+ 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}";
14925
+ var styles$6 = {"container":"index-module_container__gB52e","item":"index-module_item__zHoZP","icon":"index-module_icon__CS56A","tooltip":"index-module_tooltip__NMCmR"};
14926
+ styleInject(css_248z$6);
14908
14927
 
14909
14928
  const useAntennaInfo = (data = [], options = {}) => {
14910
14929
  const { viewBox } = options;
@@ -15013,13 +15032,13 @@ const Antennas = React.memo(({ editMap, antennaConfig = [], viewBox, rotation =
15013
15032
  document.addEventListener('pointerdown', handleOutside);
15014
15033
  return () => document.removeEventListener('pointerdown', handleOutside);
15015
15034
  }, []);
15016
- return (jsxRuntime.jsx("div", { className: styles$3.container, style: containerStyle, children: items.map((item) => (jsxRuntime.jsxs("div", { className: `antenna-container-item ${styles$3.item}`, style: {
15035
+ return (jsxRuntime.jsx("div", { className: styles$6.container, style: containerStyle, children: items.map((item) => (jsxRuntime.jsxs("div", { className: `antenna-container-item ${styles$6.item}`, style: {
15017
15036
  left: `${item.leftPct}%`,
15018
15037
  top: `${item.topPct}%`,
15019
15038
  transform: `translate(calc(-50% + ${item.offsetX || 0}px), calc(-50% + ${item.offsetY || 0}px)) rotate(${-rotation}deg)`,
15020
15039
  zIndex: openType === item.type ? 10000 : containerZIndex,
15021
15040
  pointerEvents: onlyRead ? 'none' : 'auto',
15022
- }, children: [jsxRuntime.jsx("div", { className: `antenna vector-antenna antenna-${item.type} ${item.isOnline ? 'antenna-online' : 'antenna-offline'} ${styles$3.icon}`, style: {}, onClick: (e) => {
15041
+ }, children: [jsxRuntime.jsx("div", { className: `antenna vector-antenna antenna-${item.type} ${item.isOnline ? 'antenna-online' : 'antenna-offline'} ${styles$6.icon}`, style: {}, onClick: (e) => {
15023
15042
  e.stopPropagation();
15024
15043
  if (onlyRead)
15025
15044
  return;
@@ -15034,7 +15053,7 @@ const Antennas = React.memo(({ editMap, antennaConfig = [], viewBox, rotation =
15034
15053
  return;
15035
15054
  e.currentTarget.style.transform =
15036
15055
  'scale(1)';
15037
- }, children: jsxRuntime.jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }), jsxRuntime.jsxs("div", { className: styles$3.tooltip, style: {
15056
+ }, children: jsxRuntime.jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }), jsxRuntime.jsxs("div", { className: styles$6.tooltip, style: {
15038
15057
  display: openType === item.type ? 'block' : 'none',
15039
15058
  minWidth: item.tooltip.minWidth,
15040
15059
  }, children: [jsxRuntime.jsx("div", { style: { marginBottom: 4, fontWeight: 600 }, children: item.tooltip.title }), jsxRuntime.jsxs("div", { style: { color: 'rgba(65, 93, 116, 1)', fontWeight: 400 }, children: [item.tooltip.statusText, item.tooltip.syncText || ''] })] })] }, `antenna-${item.type}`))) }));
@@ -15093,30 +15112,30 @@ const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className, }) =>
15093
15112
  };
15094
15113
 
15095
15114
  const VertexElement = React.memo(({ r, stroke, fill, ...props }) => {
15096
- const { overlayScale, platform } = useCommonContext();
15115
+ const { overlayScale } = useCommonContext();
15097
15116
  const radius = typeof r === 'number' ? r : 12;
15098
- return (jsxRuntime.jsx("circle", { r: platform === exports.PlatformType.H5 ? (radius * overlayScale) / 2 : radius * overlayScale, stroke: stroke || '#fff', fill: fill || '#fff', strokeWidth: 2 * overlayScale, ...props }));
15117
+ return (jsxRuntime.jsx("circle", { r: radius * overlayScale, stroke: stroke || '#fff', fill: fill || '#fff', strokeWidth: 2 * overlayScale, ...props }));
15099
15118
  });
15100
15119
 
15101
- var _path$2;
15102
- 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); }
15120
+ var _path$4;
15121
+ 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); }
15103
15122
  var SvgDelete = function SvgDelete(props) {
15104
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
15123
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
15105
15124
  xmlns: "http://www.w3.org/2000/svg",
15106
15125
  width: 16,
15107
15126
  height: 16,
15108
15127
  fill: "none"
15109
- }, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
15128
+ }, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
15110
15129
  fill: "#FD494D",
15111
15130
  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"
15112
15131
  })));
15113
15132
  };
15114
15133
 
15115
- const DragDistanceIndicator = ({ fontSize, dragState, strokeColor, editMode = false, createMode = false, completed = false, }) => {
15134
+ const DragDistanceIndicator = ({ fontSize, dragState, strokeColor, editMode = false, createMode = false, completed = false, unitType = UnitsType.Metric, }) => {
15116
15135
  // 计算两点间的距离(使用通用工具函数)
15117
15136
  const calculateDistance$1 = React.useCallback((point1, point2) => {
15118
15137
  const distance = calculateDistance(point1, point2);
15119
- const result = convertDistanceByUnits(distance / 50);
15138
+ const result = convertDistanceByUnits(distance / 50, unitType);
15120
15139
  return result.value;
15121
15140
  }, []);
15122
15141
  // 计算点到线段的垂足坐标(使用通用工具函数)
@@ -15217,12 +15236,13 @@ const TextElement = ({ x, y, fontSize = 30, fill = '#fff', text, background = 'r
15217
15236
  * @param point2 第二个点 [x, y]
15218
15237
  * @returns 距离(mi单位)
15219
15238
  */
15220
- const calculatePhysicalDistance$1 = (point1, point2) => {
15239
+ const calculatePhysicalDistance$1 = (point1, point2, unit) => {
15221
15240
  const dx = point2[0] - point1[0];
15222
15241
  const dy = point2[1] - point1[1];
15223
15242
  const svgDistance = Math.sqrt(dx * dx + dy * dy);
15224
15243
  const physicalDistance = svgDistance / 50; // SVG坐标是物理单位的50倍
15225
- return physicalDistance.toFixed(2) + ' m';
15244
+ // return physicalDistance.toFixed(2) + ' m';
15245
+ return convertDistanceByUnits(physicalDistance, unit).value;
15226
15246
  };
15227
15247
  /**
15228
15248
  * 计算两点间的中点坐标
@@ -15233,7 +15253,8 @@ const calculatePhysicalDistance$1 = (point1, point2) => {
15233
15253
  const calculateMidpoint$1 = (point1, point2) => {
15234
15254
  return [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
15235
15255
  };
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, }) => {
15256
+ 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, }) => {
15257
+ const { drag } = useCommonContext();
15237
15258
  // 只在显示可操作顶点时显示距离
15238
15259
  if (!((createMode && showPoints) || editMode || (createMode && completed)) ||
15239
15260
  coordinates.length < (showFirstDistance ? 1 : 2)) {
@@ -15247,7 +15268,7 @@ const DistanceLabels = ({ coordinates, createMode = false, editMode = false, com
15247
15268
  return null;
15248
15269
  }
15249
15270
  const midpoint = calculateMidpoint$1(coord, nextCoord);
15250
- const distance = calculatePhysicalDistance$1(coord, nextCoord);
15271
+ const distance = calculatePhysicalDistance$1(coord, nextCoord, unit);
15251
15272
  // 如果当前点和下一个点坐标一致则不现实,处理头尾点一样的问题
15252
15273
  if (coord[0] === nextCoord[0] && coord[1] === nextCoord[1]) {
15253
15274
  return null;
@@ -15259,23 +15280,32 @@ const DistanceLabels = ({ coordinates, createMode = false, editMode = false, com
15259
15280
  WebkitUserSelect: 'none',
15260
15281
  WebkitTouchCallout: 'none',
15261
15282
  touchAction: 'none',
15283
+ transformBox: 'fill-box',
15284
+ transformOrigin: 'center',
15285
+ transform: `rotate(-${drag.rotation}deg)`,
15262
15286
  }, text: distance }, `distance-${idx}`));
15263
15287
  }), ghostLastDistance && ghostLastMidpoint && (jsxRuntime.jsx(TextElement, { fontSize: fontSize, x: ghostLastMidpoint[0], y: ghostLastMidpoint[1], text: ghostLastDistance, style: {
15264
15288
  userSelect: 'none',
15265
15289
  WebkitUserSelect: 'none',
15266
15290
  WebkitTouchCallout: 'none',
15267
15291
  touchAction: 'none',
15292
+ transformBox: 'fill-box',
15293
+ transformOrigin: 'center',
15294
+ transform: `rotate(-${drag.rotation}deg)`,
15268
15295
  } })), ghostFirstDistance && ghostFirstMidpoint && (jsxRuntime.jsx(TextElement, { fontSize: fontSize, x: ghostFirstMidpoint[0], y: ghostFirstMidpoint[1], text: ghostFirstDistance, style: {
15269
15296
  userSelect: 'none',
15270
15297
  WebkitUserSelect: 'none',
15271
15298
  WebkitTouchCallout: 'none',
15272
15299
  touchAction: 'none',
15300
+ transformBox: 'fill-box',
15301
+ transformOrigin: 'center',
15302
+ transform: `rotate(-${drag.rotation}deg)`,
15273
15303
  } }))] }));
15274
15304
  };
15275
15305
 
15276
- var css_248z$2 = ".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}";
15277
- var styles$2 = {"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"};
15278
- styleInject(css_248z$2);
15306
+ 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}";
15307
+ 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"};
15308
+ styleInject(css_248z$5);
15279
15309
 
15280
15310
  exports.CreateStatus = void 0;
15281
15311
  (function (CreateStatus) {
@@ -15299,11 +15329,15 @@ exports.MobileEditMode = void 0;
15299
15329
  MobileEditMode[MobileEditMode["EDIT"] = 1] = "EDIT";
15300
15330
  MobileEditMode[MobileEditMode["CREATE"] = 2] = "CREATE";
15301
15331
  })(exports.MobileEditMode || (exports.MobileEditMode = {}));
15302
- var ClickEventType;
15332
+ exports.ClickEventType = void 0;
15303
15333
  (function (ClickEventType) {
15304
15334
  // 点击doodle的active time的时候触发
15305
15335
  ClickEventType["DOODLE_ACTIVE_TIME"] = "doodleActiveTime";
15306
- })(ClickEventType || (ClickEventType = {}));
15336
+ // 移动禁区点之后报错
15337
+ ClickEventType["MOVE_OBSTACLE_POINT_ERROR"] = "moveObstaclePointError";
15338
+ // 拖拽地图
15339
+ ClickEventType["DRAG_MAP"] = "dragMap";
15340
+ })(exports.ClickEventType || (exports.ClickEventType = {}));
15307
15341
  const INIT_EDIT_MAP_INFO = {
15308
15342
  editMap: false,
15309
15343
  selectElement: null,
@@ -15566,17 +15600,23 @@ function coordinatesToPoints$1(coordinates) {
15566
15600
 
15567
15601
  const useCheckElement = () => {
15568
15602
  const { editMapInfo, minDistance } = useMapEditContext();
15569
- const { platform } = useCommonContext();
15570
15603
  const { svgElementDatas } = useSvgEditContext();
15571
15604
  const checkDoodle = React.useCallback(() => {
15572
- console.log('checkdoodle', editMapInfo, svgElementDatas);
15573
15605
  if (!editMapInfo.selectElement || editMapInfo.selectElement.type !== exports.DataType.DOODLE) {
15574
- return { isValid: false, reason: 'No doodle element selected' };
15606
+ return {
15607
+ isValid: false,
15608
+ reason: 'No doodle element selected',
15609
+ code: exports.CheckDoodleErrorType.NO_DOODLE_SELECTED,
15610
+ };
15575
15611
  }
15576
15612
  const doodleElement = editMapInfo.selectElement;
15577
15613
  const doodlePoints = transformSvgElements(doodleElement).flat();
15578
15614
  if (doodlePoints.length === 0) {
15579
- return { isValid: false, reason: 'Doodle has no transformed points' };
15615
+ return {
15616
+ isValid: false,
15617
+ reason: 'Doodle has no transformed points',
15618
+ code: exports.CheckDoodleErrorType.NO_MOVABLE_POINTS,
15619
+ };
15580
15620
  }
15581
15621
  const boundary = svgElementDatas?.[exports.DataType.BOUNDARY] || [];
15582
15622
  const obstacle = svgElementDatas?.[exports.DataType.OBSTACLE] || [];
@@ -15585,18 +15625,12 @@ const useCheckElement = () => {
15585
15625
  // 1. 首先判断 doodle 是否在一个 boundary 内
15586
15626
  let isInBoundary = false;
15587
15627
  let containingBoundary = null;
15588
- console.log('doodlePoints--->', doodleElement, doodlePoints);
15589
15628
  for (const boundaryData of boundary) {
15590
15629
  const boundaryPoints = coordinatesToPoints$1(boundaryData.points);
15591
15630
  const allPointsInside = doodlePoints.every((point) => {
15592
15631
  const isIn = isPointInPolygon(point, boundaryPoints);
15593
- // console.log('isIn--->', isIn, point, boundaryPoints);
15594
- if (!isIn) {
15595
- console.log('isIn--->', isIn, point, boundaryPoints);
15596
- }
15597
15632
  return isIn;
15598
15633
  });
15599
- console.log('allPointsInside--->', allPointsInside, boundaryPoints, boundaryData);
15600
15634
  if (allPointsInside) {
15601
15635
  isInBoundary = true;
15602
15636
  containingBoundary = boundaryData;
@@ -15604,7 +15638,11 @@ const useCheckElement = () => {
15604
15638
  }
15605
15639
  }
15606
15640
  if (!isInBoundary) {
15607
- return { isValid: false, reason: 'Doodle 不在任何边界内' };
15641
+ return {
15642
+ isValid: false,
15643
+ reason: 'Doodle 不在任何边界内',
15644
+ code: exports.CheckDoodleErrorType.DOODLE_NOT_IN_BOUNDARY,
15645
+ };
15608
15646
  }
15609
15647
  // 2. 检查 doodle 所有点距离 boundary 边界至少 2m
15610
15648
  const boundaryPoints = coordinatesToPoints$1(containingBoundary.points);
@@ -15614,6 +15652,7 @@ const useCheckElement = () => {
15614
15652
  return {
15615
15653
  isValid: false,
15616
15654
  reason: `Doodle 距离边界过近 (${distanceToBoundary.toFixed(2) / SCALE_FACTOR}m < ${minDistance / SCALE_FACTOR}m)`,
15655
+ code: exports.CheckDoodleErrorType.DOODLE_DISTANCE_TOO_CLOSE,
15617
15656
  };
15618
15657
  }
15619
15658
  }
@@ -15644,11 +15683,11 @@ const useCheckElement = () => {
15644
15683
  return {
15645
15684
  isValid: false,
15646
15685
  reason: `Doodle 与${elementTypeName}相交或重叠`,
15686
+ code: exports.CheckDoodleErrorType.DOODLE_INTERSECT,
15647
15687
  };
15648
15688
  }
15649
15689
  // 检查距离是否大于 2m
15650
15690
  const distance = polygonToPolygonDistance(doodlePoints, elementPoints);
15651
- console.log('distance--->', distance, minDistance, doodlePoints, elementPoints);
15652
15691
  if (distance < minDistance) {
15653
15692
  const elementTypeName = {
15654
15693
  [exports.DataType.OBSTACLE]: '障碍物',
@@ -15659,17 +15698,16 @@ const useCheckElement = () => {
15659
15698
  return {
15660
15699
  isValid: false,
15661
15700
  reason: `Doodle 与${elementTypeName}距离过近 (${distance.toFixed(2) / SCALE_FACTOR}m < ${minDistance / SCALE_FACTOR}m)`,
15701
+ code: exports.CheckDoodleErrorType.DOODLE_DISTANCE_TOO_CLOSE_TO_OTHER_ELEMENT,
15662
15702
  };
15663
15703
  }
15664
15704
  }
15665
- // 所有检查通过
15666
- console.log('Doodle 位置检查通过');
15667
15705
  return { isValid: true };
15668
15706
  }, [editMapInfo, svgElementDatas, minDistance]);
15669
15707
  const checkCanNotCreateAtPosition = React.useCallback((checkPoint, checkPoints) => {
15670
15708
  // console.log('editMapInfo.elementType--->', editMapInfo);
15671
15709
  if (!editMapInfo.elementType)
15672
- return false;
15710
+ return { result: false };
15673
15711
  const currentPoints = editMapInfo?.selectElement?.points;
15674
15712
  const points = checkPoints || currentPoints;
15675
15713
  const firstPoint = coordinatesToPoints$1(points)?.[0] || checkPoint;
@@ -15684,14 +15722,21 @@ const useCheckElement = () => {
15684
15722
  break;
15685
15723
  }
15686
15724
  }
15687
- console.log('currentBoundary--->', currentBoundary, points);
15688
15725
  if (!currentBoundary)
15689
- return true;
15726
+ return {
15727
+ result: true,
15728
+ code: exports.CheckObstaclePointErrorType.BOUNDARY_NOT_IN_BOUNDARY,
15729
+ };
15690
15730
  if (!isPointInPolygon(checkPoint, coordinatesToPoints$1(currentBoundary.points)))
15691
- return true;
15731
+ return {
15732
+ result: true,
15733
+ code: exports.CheckObstaclePointErrorType.POINT_IN_OBSTACLE,
15734
+ };
15692
15735
  // 如果不是创建 obstacle,则不需要进一步检查
15693
15736
  if (editMapInfo.elementType !== exports.DataType.OBSTACLE)
15694
- return false;
15737
+ return {
15738
+ result: false,
15739
+ };
15695
15740
  // 获取当前正在创建的 obstacle 的点
15696
15741
  const currentObstaclePoints = coordinatesToPoints$1(points) || [];
15697
15742
  // 构建当前 obstacle 的多边形(包括检查点位置)
@@ -15711,8 +15756,10 @@ const useCheckElement = () => {
15711
15756
  for (const obstacle of obstaclesInBoundary) {
15712
15757
  const obstaclePoints = coordinatesToPoints$1(obstacle.points);
15713
15758
  if (doPolygonsIntersect(currentObstaclePolygon, obstaclePoints)) {
15714
- console.log('Obstacle intersection detected with:', obstacle);
15715
- return true; // 显示不能创建的光标
15759
+ return {
15760
+ result: true,
15761
+ code: exports.CheckObstaclePointErrorType.OBSTACLE_INTERSECT,
15762
+ };
15716
15763
  }
15717
15764
  }
15718
15765
  // 3. 找到在 currentBoundary 内的 doodle 元素
@@ -15727,18 +15774,23 @@ const useCheckElement = () => {
15727
15774
  const doodleTransformedPoints = transformSvgElements(doodle).flat();
15728
15775
  // 检查相交
15729
15776
  if (doPolygonsIntersect(currentObstaclePolygon, doodleTransformedPoints)) {
15730
- console.log('Obstacle-Doodle intersection detected with:', doodle);
15731
- return true; // 显示不能创建的光标
15777
+ return {
15778
+ result: true,
15779
+ code: exports.CheckObstaclePointErrorType.DOODLE_INTERSECT,
15780
+ };
15732
15781
  }
15733
15782
  // 检查距离
15734
15783
  const distance = polygonToPolygonDistance(currentObstaclePolygon, doodleTransformedPoints);
15735
- console.log('Obstacle-Doodle distance too close:', distance, 'required:', minDistance);
15736
15784
  if (distance < minDistance) {
15737
- console.log('Obstacle-Doodle distance too close:', distance, 'required:', minDistance);
15738
- return true; // 显示不能创建的光标
15785
+ return {
15786
+ result: true,
15787
+ code: exports.CheckObstaclePointErrorType.DOODLE_DISTANCE_TOO_CLOSE,
15788
+ };
15739
15789
  }
15740
15790
  }
15741
- return false;
15791
+ return {
15792
+ result: false,
15793
+ };
15742
15794
  }, [editMapInfo.selectElement, editMapInfo.elementType, svgElementDatas, minDistance]);
15743
15795
  return {
15744
15796
  checkDoodle,
@@ -15760,12 +15812,13 @@ const coordinatesToPoints = (coordinates) => {
15760
15812
  * @param point2 第二个点 [x, y]
15761
15813
  * @returns 距离(mi单位)
15762
15814
  */
15763
- const calculatePhysicalDistance = (point1, point2) => {
15815
+ const calculatePhysicalDistance = (point1, point2, unit) => {
15764
15816
  const dx = point2[0] - point1[0];
15765
15817
  const dy = point2[1] - point1[1];
15766
15818
  const svgDistance = Math.sqrt(dx * dx + dy * dy);
15767
15819
  const physicalDistance = svgDistance / 50; // SVG坐标是物理单位的50倍
15768
- return physicalDistance.toFixed(2) + ' m';
15820
+ // return physicalDistance.toFixed(2) + ' m';
15821
+ return convertDistanceByUnits(physicalDistance, unit).value;
15769
15822
  };
15770
15823
  /**
15771
15824
  * 计算两点间的中点坐标
@@ -15836,7 +15889,8 @@ const createPathData = (points) => {
15836
15889
  };
15837
15890
  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自动判断
15838
15891
  }) => {
15839
- const { overlayScale } = useCommonContext();
15892
+ const { overlayScale, unitType } = useCommonContext();
15893
+ const { onHandleEvent } = useMapEditContext();
15840
15894
  const { svgRef } = useSvgEditContext();
15841
15895
  const [dragState, setDragState] = React.useState({
15842
15896
  isDragging: false,
@@ -16096,19 +16150,19 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
16096
16150
  return (checkCanNotCreateAtPosition?.({
16097
16151
  x: dragState.currentPosition[0],
16098
16152
  y: dragState.currentPosition[1],
16099
- }) === true);
16153
+ }).result === true);
16100
16154
  const prePoints = coordinates.slice(0, dragState.dragIndex);
16101
16155
  const afterPoints = coordinates.slice(dragState.dragIndex + 1);
16102
16156
  const checkPoints = [...prePoints, dragState.currentPosition, ...afterPoints];
16103
16157
  return (checkCanNotCreateAtPosition?.({
16104
16158
  x: dragState.currentPosition[0],
16105
16159
  y: dragState.currentPosition[1],
16106
- }, checkPoints) === true);
16160
+ }, checkPoints).result === true);
16107
16161
  }, [dragState.currentPosition, checkCanNotCreateAtPosition, coordinates]);
16108
16162
  const generateVertexClassName = React.useMemo(() => {
16109
16163
  if (!dragState.isDragging)
16110
- return styles$2.vertex;
16111
- return showNotCreateCursor ? styles$2.notCreate : styles$2.dragging;
16164
+ return styles$5.vertex;
16165
+ return showNotCreateCursor ? styles$5.notCreate : styles$5.dragging;
16112
16166
  }, [dragState.isDragging, showNotCreateCursor]);
16113
16167
  // 使用 useRef 来存储 requestAnimationFrame ID
16114
16168
  const rafIdRef = React.useRef(null);
@@ -16230,7 +16284,15 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
16230
16284
  ? newCoordinates
16231
16285
  : newCoordinates.reverse();
16232
16286
  if (showNotCreateCursor) {
16233
- antd.message.error('Unable to place here, please select a valid spot');
16287
+ if (platform === exports.PlatformType.H5) {
16288
+ onHandleEvent?.(exports.ClickEventType.MOVE_OBSTACLE_POINT_ERROR, {
16289
+ result: true,
16290
+ code: exports.CheckObstaclePointErrorType.COMMON_ERROR,
16291
+ });
16292
+ }
16293
+ else {
16294
+ antd.message.error('Unable to place here, please select a valid spot');
16295
+ }
16234
16296
  }
16235
16297
  else {
16236
16298
  onCoordinatesChange?.(result);
@@ -16302,7 +16364,12 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
16302
16364
  ]);
16303
16365
  // 获取当前渲染用的坐标
16304
16366
  const renderCoordinates = getRenderCoordinates();
16305
- const polygonPoints = coordinatesToPoints(renderCoordinates);
16367
+ const polygonPoints = React.useMemo(() => {
16368
+ const points = editMapInfo?.createMode === exports.CreateStatus.CREATING
16369
+ ? [...renderCoordinates, mousePos ? [mousePos.x, mousePos.y] : []]
16370
+ : renderCoordinates;
16371
+ return coordinatesToPoints(points);
16372
+ }, [editMapInfo?.createMode, renderCoordinates, mousePos]);
16306
16373
  // 按type分组坐标点 - 创建模式下不自动闭合
16307
16374
  const pathSegments = groupCoordinatesByType(renderCoordinates, !createMode || completed);
16308
16375
  const dashPaths = pathSegments.filter((segment) => segment.type === 1);
@@ -16315,13 +16382,10 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
16315
16382
  : null;
16316
16383
  // 虚拟连线的距离计算
16317
16384
  const ghostLastDistance = createMode && mousePos && renderCoordinates.length > 0 && !completed
16318
- ? calculatePhysicalDistance(renderCoordinates[renderCoordinates.length - 1], [
16319
- mousePos.x,
16320
- mousePos.y,
16321
- ])
16385
+ ? calculatePhysicalDistance(renderCoordinates[renderCoordinates.length - 1], [mousePos.x, mousePos.y], unitType)
16322
16386
  : null;
16323
16387
  const ghostFirstDistance = createMode && mousePos && !completed && renderCoordinates.length >= 1
16324
- ? calculatePhysicalDistance(renderCoordinates[0], [mousePos.x, mousePos.y])
16388
+ ? calculatePhysicalDistance(renderCoordinates[0], [mousePos.x, mousePos.y], unitType)
16325
16389
  : null;
16326
16390
  // 虚拟连线的中点坐标
16327
16391
  const ghostLastMidpoint = createMode && mousePos && renderCoordinates.length > 0 && !completed
@@ -16372,30 +16436,50 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
16372
16436
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(editMode || (createMode && completed)) &&
16373
16437
  dragState.isDragging &&
16374
16438
  dragState.dragType !== 'new' &&
16375
- dragState.originalPosition && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(VertexElement, { cx: dragState.originalPosition[0], cy: dragState.originalPosition[1], stroke: strokeColor, strokeOpacity: 0.2, pointerEvents: "none" }, "ghost-vertex"), (() => {
16439
+ dragState.originalPosition && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(VertexElement, { cx: dragState.originalPosition[0], cy: dragState.originalPosition[1], stroke: strokeColor, strokeOpacity: 0.2, pointerEvents: "none", style: {
16440
+ userSelect: 'none',
16441
+ WebkitUserSelect: 'none',
16442
+ WebkitTouchCallout: 'none',
16443
+ touchAction: 'none',
16444
+ } }, "ghost-vertex"), (() => {
16376
16445
  // 获取前一个点和后一个点的索引
16377
16446
  const prevIndex = (dragState.dragIndex - 1 + coordinates.length) % coordinates.length;
16378
16447
  const nextIndex = (dragState.dragIndex + 1) % coordinates.length;
16379
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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" }), jsxRuntime.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" })] }));
16380
- })()] })), renderCoordinates.length >= 3 && (jsxRuntime.jsx("polygon", { className: editMapInfo?.editMap ? styles$2.polygonPathG : '', points: polygonPoints, fill: fillColor, fillOpacity: fillOpacity, stroke: "none" // 边框透明
16381
- , onClick: onPolygonClick })), jsxRuntime.jsxs("g", { className: styles$2.polygonPathG, children: [renderCoordinates.length >= 2 &&
16448
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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: {
16449
+ userSelect: 'none',
16450
+ WebkitUserSelect: 'none',
16451
+ WebkitTouchCallout: 'none',
16452
+ touchAction: 'none',
16453
+ } }), jsxRuntime.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: {
16454
+ userSelect: 'none',
16455
+ WebkitUserSelect: 'none',
16456
+ WebkitTouchCallout: 'none',
16457
+ touchAction: 'none',
16458
+ } })] }));
16459
+ })()] })), renderCoordinates.length >= 3 && (jsxRuntime.jsx("polygon", { className: editMapInfo?.createMode === exports.CreateStatus.CREATING ? '' : styles$5.polygonPathG, points: polygonPoints, fill: fillColor, fillOpacity: fillOpacity, stroke: "none" // 边框透明
16460
+ , onClick: onPolygonClick })), jsxRuntime.jsxs("g", { className: styles$5.polygonPathG, children: [renderCoordinates.length >= 2 &&
16382
16461
  pathSegments.map((segment, index) => {
16383
16462
  if (segment.points.length < 2)
16384
16463
  return null;
16385
16464
  const pathData = createPathData(segment.points);
16386
16465
  const isDash = segment.type === 1;
16387
- return (jsxRuntime.jsx("path", { d: pathData, fill: "none", stroke: isDash ? 'none' : strokeColor, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", className: styles$2.polygonPath, vectorEffect: "non-scaling-stroke", onClick: onPathClick }, index));
16466
+ return (jsxRuntime.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: {
16467
+ userSelect: 'none',
16468
+ WebkitUserSelect: 'none',
16469
+ WebkitTouchCallout: 'none',
16470
+ touchAction: 'none',
16471
+ } }, index));
16388
16472
  }), renderCoordinates.length >= 2 &&
16389
16473
  dashPaths.map((segment, index) => {
16390
16474
  if (segment.points.length < 2)
16391
16475
  return null;
16392
- return (jsxRuntime.jsx(DashPath, { className: styles$2.polygonPath, points: segment.points, stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity }, index));
16476
+ return (jsxRuntime.jsx(DashPath, { className: styles$5.polygonPath, points: segment.points, stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity }, index));
16393
16477
  })] }), (editMode || (createMode && completed)) &&
16394
16478
  renderCoordinates.length >= 2 &&
16395
16479
  renderCoordinates.map((coord, index) => {
16396
16480
  const nextCoord = renderCoordinates[(index + 1) % renderCoordinates.length];
16397
16481
  const isDashPath = coord[2] === 1;
16398
- return (jsxRuntime.jsx("line", { x1: coord[0], y1: coord[1], x2: nextCoord[0], y2: nextCoord[1], stroke: isDashPath ? 'transparent' : strokeColor, strokeWidth: platform === exports.PlatformType.H5 ? strokeWidth * 3 : strokeWidth, className: styles$2.addVertex, style: {
16482
+ return (jsxRuntime.jsx("line", { x1: coord[0], y1: coord[1], x2: nextCoord[0], y2: nextCoord[1], stroke: isDashPath ? 'transparent' : strokeColor, strokeWidth: platform === exports.PlatformType.H5 ? strokeWidth * 3 : strokeWidth, className: styles$5.addVertex, style: {
16399
16483
  userSelect: 'none',
16400
16484
  WebkitUserSelect: 'none',
16401
16485
  WebkitTouchCallout: 'none',
@@ -16427,7 +16511,7 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
16427
16511
  setHoverVertex(null);
16428
16512
  },
16429
16513
  }) }, `edge-${index}`));
16430
- }), ghostLastPath && (jsxRuntime.jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >= 2 && (jsxRuntime.jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), jsxRuntime.jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed, fontSize: platform === exports.PlatformType.H5 ? 12 * overlayScale : 30 * overlayScale }), jsxRuntime.jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint, fontSize: platform === exports.PlatformType.H5 ? 12 * overlayScale : 30 * overlayScale, showFirstDistance: platform !== exports.PlatformType.H5 }), hoverVertex && !dragState.isDragging && (jsxRuntime.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)) &&
16514
+ }), ghostLastPath && (jsxRuntime.jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >= 2 && (jsxRuntime.jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), jsxRuntime.jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed, fontSize: platform === exports.PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, unitType: unitType }), jsxRuntime.jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint, fontSize: platform === exports.PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, showFirstDistance: platform !== exports.PlatformType.H5, unit: unitType }), hoverVertex && !dragState.isDragging && (jsxRuntime.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)) &&
16431
16515
  renderCoordinates.map((coord, idx) => {
16432
16516
  // 判断当前顶点的状态
16433
16517
  const isLastPoint = idx === renderCoordinates.length - 1;
@@ -16436,7 +16520,8 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
16436
16520
  const isInEditMode = editMode;
16437
16521
  // H5模式下选中的顶点显示蓝色,并且放大1.5倍
16438
16522
  const isSelected = platform === exports.PlatformType.H5 && selectedVertexIndex === idx;
16439
- const vertexRadius = isSelected ? (canComplete ? 16 : 12) * 1.2 : canComplete ? 16 : 12;
16523
+ const commonRadius = canComplete ? 16 : 12;
16524
+ const vertexRadius = isSelected ? commonRadius * 1.2 : commonRadius;
16440
16525
  const vertexFill = isSelected ? '#FFAB7E' : 'white';
16441
16526
  return (jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx(VertexElement, { className: generateVertexClassName, style: {
16442
16527
  userSelect: 'none',
@@ -16614,7 +16699,6 @@ const BoundaryElement = ({ data }) => {
16614
16699
  return (jsxRuntime.jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: onPathClick, onPolygonClick: () => {
16615
16700
  onPathClick();
16616
16701
  }, onCoordinatesChange: (coordinates) => {
16617
- console.log('onCoordinatesChange', coordinates);
16618
16702
  setEditMapInfo((prev) => ({
16619
16703
  ...prev,
16620
16704
  selectElement: {
@@ -16667,7 +16751,6 @@ const useHistoryHandle = (props) => {
16667
16751
  // undo
16668
16752
  const undo = () => {
16669
16753
  setEditMapInfo((prev) => {
16670
- console.log('undo->', prev);
16671
16754
  if (prev?.historyList?.length > 0 && prev?.currentHistoryIndex > 0) {
16672
16755
  return {
16673
16756
  ...prev,
@@ -16735,10 +16818,8 @@ const ObstacleElement = ({ data }) => {
16735
16818
  const { addHistory } = useHistoryHandle();
16736
16819
  // 处理删除顶点
16737
16820
  const handleCreateVertexDelete = React.useCallback((vertexIndex) => {
16738
- console.log('ObstacleElement删除顶点', vertexIndex);
16739
16821
  if (editMapInfo?.selectElement?.points && editMapInfo?.selectElement?.points?.length > 0) {
16740
16822
  const newPoints = editMapInfo?.selectElement?.points?.filter((_, index) => index !== vertexIndex);
16741
- console.log('newPoints', newPoints);
16742
16823
  setEditMapInfo((prev) => ({
16743
16824
  ...prev,
16744
16825
  selectElement: {
@@ -16769,7 +16850,8 @@ const ObstacleElement = ({ data }) => {
16769
16850
  if (platform === exports.PlatformType.H5 &&
16770
16851
  editMapInfo?.selectElement?.id === data.id &&
16771
16852
  editMapInfo.mobileMode === exports.MobileEditMode.START) {
16772
- return dp2px((style.lineWidth || 3) * 3);
16853
+ return dp2px((style.lineWidth || 1) * 2);
16854
+ // return dp2px(((style.lineWidth as number) || 3) * 3);
16773
16855
  }
16774
16856
  return dp2px(style.lineWidth || 3);
16775
16857
  }, [platform, style, editMapInfo]);
@@ -16909,11 +16991,11 @@ const useVisionOffTransform = (data, scaleConstraints
16909
16991
  return newPoints;
16910
16992
  }, []);
16911
16993
  // 计算选择框的四个角点(每条边与内部元素对应边平行)
16912
- const calculateSelectionBoxPoints = React.useCallback((points) => {
16994
+ const calculateSelectionBoxPoints = React.useCallback((points, scale = 1) => {
16913
16995
  if (points.length < 4)
16914
16996
  return points;
16915
16997
  // 设置偏移距离(可以根据需要调整)
16916
- const offset = 12; // 12像素的偏移距离
16998
+ const offset = 20 * scale; // 偏移距离
16917
16999
  // 使用更简单的方法:计算矩形的边界框,然后向外扩展
16918
17000
  // 计算矩形的两条相邻边向量(从左上角出发)
16919
17001
  const edge1 = { x: points[1].x - points[0].x, y: points[1].y - points[0].y }; // 左上到左下
@@ -17229,15 +17311,15 @@ const useVisionOffTransform = (data, scaleConstraints
17229
17311
  };
17230
17312
  };
17231
17313
 
17232
- var _g$3, _defs$3;
17233
- 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); }
17314
+ var _g$5, _defs$5;
17315
+ 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); }
17234
17316
  var SvgTransformDelete = function SvgTransformDelete(props) {
17235
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
17317
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
17236
17318
  xmlns: "http://www.w3.org/2000/svg",
17237
17319
  width: 20,
17238
17320
  height: 20,
17239
17321
  fill: "none"
17240
- }, props), _g$3 || (_g$3 = /*#__PURE__*/React__namespace.createElement("g", {
17322
+ }, props), _g$5 || (_g$5 = /*#__PURE__*/React__namespace.createElement("g", {
17241
17323
  clipPath: "url(#transform-delete_svg__a)"
17242
17324
  }, /*#__PURE__*/React__namespace.createElement("circle", {
17243
17325
  cx: 10,
@@ -17260,7 +17342,7 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
17260
17342
  fill: "#fff",
17261
17343
  rx: 0.8,
17262
17344
  transform: "rotate(45 6.323 5.191)"
17263
- }))), _defs$3 || (_defs$3 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
17345
+ }))), _defs$5 || (_defs$5 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
17264
17346
  id: "transform-delete_svg__b",
17265
17347
  x1: 17.727,
17266
17348
  x2: -1.215,
@@ -17280,15 +17362,15 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
17280
17362
  })))));
17281
17363
  };
17282
17364
 
17283
- var _g$2, _defs$2;
17284
- 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); }
17365
+ var _g$4, _defs$4;
17366
+ 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); }
17285
17367
  var SvgTransformRotate = function SvgTransformRotate(props) {
17286
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
17368
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
17287
17369
  xmlns: "http://www.w3.org/2000/svg",
17288
17370
  width: 21,
17289
17371
  height: 20,
17290
17372
  fill: "none"
17291
- }, props), _g$2 || (_g$2 = /*#__PURE__*/React__namespace.createElement("g", {
17373
+ }, props), _g$4 || (_g$4 = /*#__PURE__*/React__namespace.createElement("g", {
17292
17374
  clipPath: "url(#transform-rotate_svg__a)"
17293
17375
  }, /*#__PURE__*/React__namespace.createElement("path", {
17294
17376
  fill: "url(#transform-rotate_svg__b)",
@@ -17296,7 +17378,7 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
17296
17378
  }), /*#__PURE__*/React__namespace.createElement("path", {
17297
17379
  fill: "#fff",
17298
17380
  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"
17299
- }))), _defs$2 || (_defs$2 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
17381
+ }))), _defs$4 || (_defs$4 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
17300
17382
  id: "transform-rotate_svg__b",
17301
17383
  x1: 17.84,
17302
17384
  x2: -1.103,
@@ -17316,15 +17398,15 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
17316
17398
  })))));
17317
17399
  };
17318
17400
 
17319
- var _g$1, _defs$1;
17320
- 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); }
17401
+ var _g$3, _defs$3;
17402
+ 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); }
17321
17403
  var SvgTransformScale = function SvgTransformScale(props) {
17322
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
17404
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
17323
17405
  xmlns: "http://www.w3.org/2000/svg",
17324
17406
  width: 21,
17325
17407
  height: 20,
17326
17408
  fill: "none"
17327
- }, props), _g$1 || (_g$1 = /*#__PURE__*/React__namespace.createElement("g", {
17409
+ }, props), _g$3 || (_g$3 = /*#__PURE__*/React__namespace.createElement("g", {
17328
17410
  clipPath: "url(#transform-scale_svg__a)"
17329
17411
  }, /*#__PURE__*/React__namespace.createElement("path", {
17330
17412
  fill: "url(#transform-scale_svg__b)",
@@ -17332,7 +17414,7 @@ var SvgTransformScale = function SvgTransformScale(props) {
17332
17414
  }), /*#__PURE__*/React__namespace.createElement("path", {
17333
17415
  fill: "#fff",
17334
17416
  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"
17335
- }))), _defs$1 || (_defs$1 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
17417
+ }))), _defs$3 || (_defs$3 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
17336
17418
  id: "transform-scale_svg__b",
17337
17419
  x1: 17.84,
17338
17420
  x2: -1.103,
@@ -17352,15 +17434,15 @@ var SvgTransformScale = function SvgTransformScale(props) {
17352
17434
  })))));
17353
17435
  };
17354
17436
 
17355
- var _g, _defs;
17356
- 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); }
17437
+ var _g$2, _defs$2;
17438
+ 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); }
17357
17439
  var SvgTransformTranslate = function SvgTransformTranslate(props) {
17358
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
17440
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
17359
17441
  xmlns: "http://www.w3.org/2000/svg",
17360
17442
  width: 20,
17361
17443
  height: 20,
17362
17444
  fill: "none"
17363
- }, props), _g || (_g = /*#__PURE__*/React__namespace.createElement("g", {
17445
+ }, props), _g$2 || (_g$2 = /*#__PURE__*/React__namespace.createElement("g", {
17364
17446
  clipPath: "url(#transform-translate_svg__a)"
17365
17447
  }, /*#__PURE__*/React__namespace.createElement("circle", {
17366
17448
  cx: 10,
@@ -17370,7 +17452,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
17370
17452
  }), /*#__PURE__*/React__namespace.createElement("path", {
17371
17453
  fill: "#fff",
17372
17454
  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"
17373
- }))), _defs || (_defs = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
17455
+ }))), _defs$2 || (_defs$2 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
17374
17456
  id: "transform-translate_svg__b",
17375
17457
  x1: 17.727,
17376
17458
  x2: -1.215,
@@ -17392,7 +17474,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
17392
17474
 
17393
17475
  const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCancel, onDragEnd, onDragMove, disabled = false, className = '', scaleConstraints = { minEdgeLength: 0.5, maxEdgeLength: 10000 }, showInfo = true, }) => {
17394
17476
  const { overlayScale } = useCommonContext();
17395
- const { platform } = useCommonContext();
17477
+ const { platform, unitType } = useCommonContext();
17396
17478
  const { editMapInfo } = useMapEditContext();
17397
17479
  const dataPoints = React.useMemo(() => {
17398
17480
  return {
@@ -17416,10 +17498,10 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
17416
17498
  if (platform === exports.PlatformType.H5) {
17417
17499
  if (editMapInfo?.mobileMode === exports.MobileEditMode.START &&
17418
17500
  editMapInfo?.selectElement?.id === data.id) {
17419
- return dp2px((style.lineWidth || 2) * 2);
17501
+ return dp2px((style.lineWidth || 1) * 2);
17420
17502
  }
17421
17503
  }
17422
- return dp2px(style.lineWidth || 2);
17504
+ return dp2px(style.lineWidth || 1);
17423
17505
  }, [style, platform, editMapInfo, data]);
17424
17506
  // 初始化 - 无论是否选中都要初始化点坐标
17425
17507
  React.useEffect(() => {
@@ -17522,7 +17604,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
17522
17604
  }) })), isSelected &&
17523
17605
  currentPoints.length === 4 &&
17524
17606
  (() => {
17525
- const selectionBoxPoints = calculateSelectionBoxPoints(currentPoints);
17607
+ const selectionBoxPoints = calculateSelectionBoxPoints(currentPoints, overlayScale);
17526
17608
  // 计算选择框的边界
17527
17609
  const minX = Math.min(...selectionBoxPoints.map((p) => p.x));
17528
17610
  const maxX = Math.max(...selectionBoxPoints.map((p) => p.x));
@@ -17530,13 +17612,23 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
17530
17612
  // 计算选择框的中心
17531
17613
  const centerX = (minX + maxX) / 2;
17532
17614
  // 计算尺寸显示框的位置(选择框下方)
17533
- const infoBoxY = maxY + 20; // 选择框下方20像素
17534
- const infoBoxWidth = 140 * overlayScale; // 信息框宽度
17535
- const infoBoxHeight = 30 * overlayScale; // 信息框高度
17615
+ const infoBoxY = maxY + 20 + 40 * overlayScale; // 选择框下方20像素
17616
+ const infoBoxWidth = 300 * overlayScale; // 信息框宽度
17617
+ const infoBoxHeight = 50 * overlayScale; // 信息框高度
17536
17618
  const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
17537
- const scale = (isWeb ? 2 : 1) * overlayScale;
17619
+ const scale = 2 * overlayScale;
17538
17620
  const offsetLeft = 10 * scale;
17539
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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 === exports.PlatformType.H5
17621
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showInfo && (jsxRuntime.jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, children: jsxRuntime.jsxs("div", { style: {
17622
+ padding: `5px ${10 * overlayScale}px`,
17623
+ background: 'linear-gradient(266.64deg, #F26A2A 4.1%, #F2942A 86.42%)',
17624
+ borderRadius: `${30 * overlayScale}px`,
17625
+ display: 'inline-flex',
17626
+ alignItems: 'center',
17627
+ justifyContent: 'center',
17628
+ fontSize: `${26 * overlayScale}px`,
17629
+ color: 'white',
17630
+ fontWeight: '400',
17631
+ }, children: [convertDistanceByUnits(dimensions.height, unitType).value, " \u00D7", ' ', convertDistanceByUnits(dimensions.width, unitType).value] }) })), jsxRuntime.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 === exports.PlatformType.H5
17540
17632
  ? {
17541
17633
  onTouchStart: createReactEventHandler((e) => {
17542
17634
  handleMouseDownWithDisabled(e);
@@ -17576,18 +17668,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
17576
17668
  }
17577
17669
  : {
17578
17670
  onMouseDown: handleScaleStartWithDisabled,
17579
- }), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsxRuntime.jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsxRuntime.jsx(SvgTransformScale, {}) }) }), showInfo && (jsxRuntime.jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, children: jsxRuntime.jsxs("div", { style: {
17580
- padding: '5px 6px',
17581
- background: 'linear-gradient(266.64deg, #F26A2A 4.1%, #F2942A 86.42%)',
17582
- borderRadius: '20px',
17583
- display: 'inline-flex',
17584
- alignItems: 'center',
17585
- justifyContent: 'center',
17586
- fontSize: '12px',
17587
- color: 'white',
17588
- fontWeight: '400',
17589
- // transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
17590
- }, children: [dimensions.height, " m \u00D7 ", dimensions.width, " m"] }) }))] }));
17671
+ }), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsxRuntime.jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsxRuntime.jsx(SvgTransformScale, {}) }) })] }));
17591
17672
  })()] }));
17592
17673
  };
17593
17674
 
@@ -17817,11 +17898,6 @@ const useDoodleTransform = (data, onTransformChange, options) => {
17817
17898
  }, [currentCenter, currentScale, currentDirection, getSvgDimensions]);
17818
17899
  // 初始化变换状态
17819
17900
  const initializeTransform = React.useCallback(() => {
17820
- console.log('useDoodleTransform: 初始化变换状态', {
17821
- center: data.center,
17822
- scale: data.scale,
17823
- direction: data.direction,
17824
- });
17825
17901
  const convertedCenter = convertPoint(data.center);
17826
17902
  setCurrentCenter({ x: convertedCenter[0], y: convertedCenter[1] });
17827
17903
  setCurrentScale(data.scale);
@@ -18048,21 +18124,6 @@ const useDoodleTransform = (data, onTransformChange, options) => {
18048
18124
  };
18049
18125
  };
18050
18126
 
18051
- var _path$1;
18052
- 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); }
18053
- var SvgTransformArrow = function SvgTransformArrow(props) {
18054
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
18055
- xmlns: "http://www.w3.org/2000/svg",
18056
- width: 7,
18057
- height: 11,
18058
- fill: "none"
18059
- }, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
18060
- fill: "#fff",
18061
- 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",
18062
- opacity: 0.5
18063
- })));
18064
- };
18065
-
18066
18127
  const DoodleTransform = ({ data, isSelected: _isSelected, onSelect }) => {
18067
18128
  const { editMapInfo } = useMapEditContext();
18068
18129
  const { platform } = useCommonContext();
@@ -18118,7 +18179,7 @@ const DoodleTransform = ({ data, isSelected: _isSelected, onSelect }) => {
18118
18179
  };
18119
18180
 
18120
18181
  const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOperation = false, onSelect, onCancel, onTransformChange, disabled = false, className = '', minScale, onMinScaleReached, onDragMove, onDragEnd, showInfo = true, onClickInfo, }) => {
18121
- const { platform, overlayScale } = useCommonContext();
18182
+ const { platform, overlayScale, unitType } = useCommonContext();
18122
18183
  // 使用自定义hook管理所有变换逻辑
18123
18184
  const { currentCenter, currentScale, currentDirection, isDragging, isRotating, isScaling, initializeTransform, calculateSelectionBoxPoints, handleMouseDown, handleRotateStart, handleScaleStart, handleMouseMove, handleMouseUp, containerRef, dimensions, } = useDoodleTransform(data, onTransformChange, {
18124
18185
  minScale,
@@ -18240,10 +18301,9 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
18240
18301
  const maxY = Math.max(...selectionBoxPoints.map((p) => p.y));
18241
18302
  // 计算选择框的中心
18242
18303
  const centerX = (minX + maxX) / 2;
18243
- // 计算尺寸显示框的位置(选择框下方)
18244
- const infoBoxY = maxY + 20; // 选择框下方20像素
18245
- const infoBoxWidth = 140 * overlayScale; // 信息框宽度
18246
- const infoBoxHeight = 100 * overlayScale; // 信息框高度
18304
+ const infoBoxY = maxY + 20 + 30 * overlayScale; // 选择框下方20像素
18305
+ const infoBoxWidth = 300 * overlayScale; // 信息框宽度
18306
+ const infoBoxHeight = 40 * overlayScale; // 信息框高度
18247
18307
  const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
18248
18308
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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 === exports.PlatformType.H5
18249
18309
  ? {
@@ -18256,14 +18316,14 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
18256
18316
  }) }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[3].x, cy: selectionBoxPoints[3].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[1].x, cy: selectionBoxPoints[1].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[2].x, cy: selectionBoxPoints[2].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), platform === exports.PlatformType.H5 && (jsxRuntime.jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
18257
18317
  onClickInfo?.();
18258
18318
  }, children: jsxRuntime.jsx("div", { style: {
18259
- padding: '5px 6px',
18319
+ padding: `5px ${10 * overlayScale}px`,
18260
18320
  background: 'rgba(201, 209, 218, 1)',
18261
- borderRadius: '10px',
18321
+ borderRadius: `${10 * overlayScale}px`,
18262
18322
  display: 'inline-flex',
18263
18323
  flexDirection: 'column',
18264
18324
  alignItems: 'flex-start',
18265
18325
  justifyContent: 'center',
18266
- fontSize: '12px',
18326
+ fontSize: `${26 * overlayScale}px`,
18267
18327
  color: 'white',
18268
18328
  fontWeight: '400',
18269
18329
  // transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
@@ -18321,14 +18381,32 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
18321
18381
  const maxY = Math.max(...selectionBoxPoints.map((p) => p.y));
18322
18382
  // 计算选择框的中心
18323
18383
  const centerX = (minX + maxX) / 2;
18324
- // 计算尺寸显示框的位置(选择框下方)
18325
- const infoBoxY = maxY + 20; // 选择框下方20像素
18326
- const infoBoxWidth = 140 * overlayScale; // 信息框宽度
18384
+ const infoBoxY = maxY + 20 + 40 * overlayScale; // 选择框下方20像素
18385
+ const infoBoxWidth = 300 * overlayScale; // 信息框宽度
18327
18386
  const infoBoxHeight = 100 * overlayScale; // 信息框高度
18328
18387
  const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
18329
- const scale = (isWeb ? 2 : 1) * overlayScale;
18388
+ const scale = 2 * overlayScale;
18330
18389
  const offsetLeft = 10 * scale;
18331
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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 === exports.PlatformType.H5
18390
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showInfo && (jsxRuntime.jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
18391
+ onClickInfo?.();
18392
+ }, children: jsxRuntime.jsxs("div", { style: {
18393
+ padding: `${10 * overlayScale}px`,
18394
+ background: 'linear-gradient(266.64deg, #F26A2A 4.1%, #F2942A 86.42%)',
18395
+ borderRadius: `${20 * overlayScale}px`,
18396
+ display: 'inline-flex',
18397
+ flexDirection: 'column',
18398
+ alignItems: 'flex-start',
18399
+ justifyContent: 'center',
18400
+ fontSize: `${26 * overlayScale}px`,
18401
+ color: 'white',
18402
+ fontWeight: '400',
18403
+ // transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
18404
+ }, children: [jsxRuntime.jsxs("div", { children: [convertDistanceByUnits(dimensions.width, unitType).value, " \u00D7", ' ', convertDistanceByUnits(dimensions.height, unitType).value] }), jsxRuntime.jsx("div", { style: {
18405
+ display: 'flex',
18406
+ alignItems: 'center',
18407
+ justifyContent: 'center',
18408
+ gap: `${10 * overlayScale}px`,
18409
+ }, children: jsxRuntime.jsxs("div", { children: ["Active Time: ", activeTime, " >"] }) })] }) })), jsxRuntime.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 === exports.PlatformType.H5
18332
18410
  ? {
18333
18411
  onTouchStart: createReactEventHandler((e) => {
18334
18412
  handleMouseDownWithDisabled(e);
@@ -18368,26 +18446,7 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
18368
18446
  }
18369
18447
  : {
18370
18448
  onMouseDown: handleScaleStartWithDisabled,
18371
- }), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsxRuntime.jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsxRuntime.jsx(SvgTransformScale, {}) }) }), showInfo && (jsxRuntime.jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
18372
- onClickInfo?.();
18373
- }, children: jsxRuntime.jsxs("div", { style: {
18374
- padding: '5px 6px',
18375
- background: 'linear-gradient(266.64deg, #F26A2A 4.1%, #F2942A 86.42%)',
18376
- borderRadius: '10px',
18377
- display: 'inline-flex',
18378
- flexDirection: 'column',
18379
- alignItems: 'flex-start',
18380
- justifyContent: 'center',
18381
- fontSize: '12px',
18382
- color: 'white',
18383
- fontWeight: '400',
18384
- // transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
18385
- }, children: [jsxRuntime.jsxs("div", { children: [dimensions.width, " m \u00D7 ", dimensions.height, " m"] }), jsxRuntime.jsxs("div", { style: {
18386
- display: 'flex',
18387
- alignItems: 'center',
18388
- justifyContent: 'center',
18389
- gap: '10px',
18390
- }, children: [jsxRuntime.jsxs("div", { children: ["Active Time: ", activeTime] }), jsxRuntime.jsx(SvgTransformArrow, {})] })] }) }))] }));
18449
+ }), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsxRuntime.jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsxRuntime.jsx(SvgTransformScale, {}) }) })] }));
18391
18450
  })()] }));
18392
18451
  };
18393
18452
 
@@ -18501,7 +18560,7 @@ const DoodleElement = ({ data }) => {
18501
18560
  }));
18502
18561
  }, []);
18503
18562
  const handleClickInfo = React.useCallback(() => {
18504
- onHandleEvent?.(ClickEventType.DOODLE_ACTIVE_TIME);
18563
+ onHandleEvent?.(exports.ClickEventType.DOODLE_ACTIVE_TIME);
18505
18564
  }, [onHandleEvent]);
18506
18565
  // const handleDragMove = useCallback(
18507
18566
  // (data: DoodleData) => {
@@ -18575,9 +18634,9 @@ const GElement = ({ type, children }) => {
18575
18634
  return jsxRuntime.jsx("g", { id: `layer-${type}`, children: children }, type);
18576
18635
  };
18577
18636
 
18578
- var css_248z$1 = ".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}";
18579
- var styles$1 = {"mapEdit":"index-module_mapEdit__XC5Gw","createMode":"index-module_createMode__14EPH","notCreateCursor":"index-module_notCreateCursor__1-OjF"};
18580
- styleInject(css_248z$1);
18637
+ 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}";
18638
+ var styles$4 = {"mapEdit":"index-module_mapEdit__XC5Gw","createMode":"index-module_createMode__14EPH","notCreateCursor":"index-module_notCreateCursor__1-OjF"};
18639
+ styleInject(css_248z$4);
18581
18640
 
18582
18641
  var classnames = {exports: {}};
18583
18642
 
@@ -19600,7 +19659,7 @@ function usePolygonDrawing(options = {}) {
19600
19659
  const p = getSvgPoint(svgEl, e.clientX, e.clientY);
19601
19660
  if (!p)
19602
19661
  return;
19603
- if (checkCanNotCreateAtPosition(p)) {
19662
+ if (checkCanNotCreateAtPosition(p)?.result) {
19604
19663
  antd.message.error('Unable to place here, please select a valid spot');
19605
19664
  return;
19606
19665
  }
@@ -19613,7 +19672,6 @@ function usePolygonDrawing(options = {}) {
19613
19672
  },
19614
19673
  };
19615
19674
  });
19616
- console.log('onSvgClick');
19617
19675
  addHistory({
19618
19676
  selectElement: {
19619
19677
  ...editMapInfo.selectElement,
@@ -19655,7 +19713,6 @@ function usePolygonDrawing(options = {}) {
19655
19713
  },
19656
19714
  };
19657
19715
  });
19658
- console.log('updatePoints');
19659
19716
  addHistory({
19660
19717
  selectElement: {
19661
19718
  ...editMapInfo.selectElement,
@@ -19703,11 +19760,6 @@ const isPointInSvgBounds = (point, svgElement) => {
19703
19760
  const maxY = minY + height;
19704
19761
  // 检查点是否在viewBox范围内
19705
19762
  const isInBounds = point.x >= minX && point.x <= maxX && point.y >= minY && point.y <= maxY;
19706
- console.log('点边界检查:', {
19707
- point: { x: point.x, y: point.y },
19708
- viewBox: { minX, minY, maxX, maxY },
19709
- isInBounds,
19710
- });
19711
19763
  return isInBounds;
19712
19764
  }
19713
19765
  catch (error) {
@@ -19734,8 +19786,6 @@ const getScreenCenterSvgPoint = (svgElement, mapInstance) => {
19734
19786
  // 计算Google Maps容器的中心点
19735
19787
  const centerX = mapRect.left + mapRect.width / 2;
19736
19788
  const centerY = mapRect.top + mapRect.height / 2;
19737
- console.log('Google Maps容器中心位置:', { centerX, centerY });
19738
- console.log('Google Maps容器尺寸:', { width: mapRect.width, height: mapRect.height });
19739
19789
  // 直接使用SVG的CTM进行坐标转换
19740
19790
  const pt = svgElement.createSVGPoint();
19741
19791
  pt.x = centerX;
@@ -19747,7 +19797,6 @@ const getScreenCenterSvgPoint = (svgElement, mapInstance) => {
19747
19797
  }
19748
19798
  const inv = ctm.inverse();
19749
19799
  const svgPoint = pt.matrixTransform(inv);
19750
- console.log('转换后的SVG坐标:', { x: svgPoint.x, y: svgPoint.y });
19751
19800
  // 检查点是否在SVG可见区域内
19752
19801
  const point = { x: svgPoint.x, y: svgPoint.y };
19753
19802
  if (!isPointInSvgBounds(point, svgElement)) {
@@ -19774,24 +19823,38 @@ const CreateObstacleElement = React.forwardRef(({ enabled = false, svgElement, o
19774
19823
  const addPoint = React.useCallback(() => {
19775
19824
  if (!enabled || !svgElement) {
19776
19825
  console.warn('未启用创建模式或SVG元素不存在');
19777
- return { isValid: false, reason: '未启用创建模式或SVG元素不存在' };
19826
+ return {
19827
+ isValid: false,
19828
+ reason: '未启用创建模式或SVG元素不存在',
19829
+ code: exports.CheckObstaclePointErrorType.COMMON_ERROR,
19830
+ };
19778
19831
  }
19779
19832
  if (!mapRef) {
19780
19833
  console.warn('地图实例不存在');
19781
- return { isValid: false, reason: '地图实例不存在' };
19834
+ return {
19835
+ isValid: false,
19836
+ reason: '地图实例不存在',
19837
+ code: exports.CheckObstaclePointErrorType.MAP_NOT_EXIST,
19838
+ };
19782
19839
  }
19783
19840
  const centerPoint = getScreenCenterSvgPoint(svgElement, mapRef);
19784
19841
  if (!centerPoint) {
19785
19842
  console.warn('无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内');
19786
- return { isValid: false, reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内' };
19843
+ return {
19844
+ isValid: false,
19845
+ reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内',
19846
+ code: exports.CheckObstaclePointErrorType.GET_POINT_FAILED,
19847
+ };
19787
19848
  }
19788
19849
  console.error('centerPoint--->', centerPoint);
19789
- console.error('checkCanNotCreateAtPosition--->', checkCanNotCreateAtPosition(centerPoint));
19850
+ console.error('checkCanNotCreateAtPosition--->', checkCanNotCreateAtPosition(centerPoint).result);
19790
19851
  // 校验是否能打点
19791
- if (checkCanNotCreateAtPosition(centerPoint)) {
19852
+ const checkResult = checkCanNotCreateAtPosition(centerPoint);
19853
+ if (checkResult.result) {
19792
19854
  return {
19793
19855
  isValid: false,
19794
- reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内',
19856
+ reason: '',
19857
+ code: checkResult.code || exports.CheckObstaclePointErrorType.COMMON_ERROR,
19795
19858
  };
19796
19859
  }
19797
19860
  const newPoints = [...points, centerPoint];
@@ -19832,37 +19895,33 @@ const CreateObstacleElement = React.forwardRef(({ enabled = false, svgElement, o
19832
19895
  if (!enabled || points.length === 0) {
19833
19896
  return null;
19834
19897
  }
19835
- return (jsxRuntime.jsx(PolygonElement, { points: points.map((p) => [p.x, p.y, 2]), fillColor: styles.fillColor, fillOpacity: 0.3, strokeColor: styles.strokeColor, strokeWidth: 2, strokeOpacity: 1, createMode: true, showPoints: true, editMode: false, completed: true, draggable: false }));
19898
+ return (jsxRuntime.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 }));
19836
19899
  });
19837
19900
  CreateObstacleElement.displayName = 'CreateObstacleElement';
19838
19901
 
19839
19902
  const MIN_ELEMENT_WIDTH = 50;
19840
19903
  const useCreateVisionOffElement = () => {
19841
- const { svgRef } = useSvgEditContext();
19842
19904
  const { editMapInfo } = useMapEditContext();
19905
+ const { svgViewBox } = useCommonContext();
19843
19906
  const centerPoint = React.useMemo(() => {
19844
- if (!svgRef)
19907
+ if (!svgViewBox)
19845
19908
  return null;
19846
- const baseVal = svgRef?.viewBox.baseVal;
19847
- const center = [
19848
- baseVal?.x + (baseVal?.width || 0) / 2,
19849
- baseVal?.y + (baseVal?.height || 0) / 2,
19850
- ];
19909
+ const center = [svgViewBox.x + svgViewBox.width / 2, -svgViewBox.y - svgViewBox.height / 2];
19851
19910
  return center;
19852
- }, [svgRef?.viewBox?.baseVal?.x]);
19911
+ }, [svgViewBox]);
19853
19912
  const elementWidth = React.useMemo(() => {
19854
- if (!svgRef)
19913
+ if (!svgViewBox)
19855
19914
  return MIN_ELEMENT_WIDTH;
19856
- const baseVal = svgRef?.viewBox.baseVal?.width;
19857
- if (baseVal && baseVal / 8 > MIN_ELEMENT_WIDTH) {
19858
- return baseVal / 8;
19915
+ const baseVal = Math.min(svgViewBox.width, svgViewBox.height);
19916
+ if (baseVal && baseVal / 4 > MIN_ELEMENT_WIDTH) {
19917
+ return baseVal / 4;
19859
19918
  }
19860
19919
  return MIN_ELEMENT_WIDTH;
19861
- }, [svgRef?.viewBox?.baseVal?.width]);
19920
+ }, [svgViewBox]);
19862
19921
  const getVisionOffPoints = React.useCallback(() => {
19863
- if (!svgRef)
19922
+ if (!svgViewBox)
19864
19923
  return null;
19865
- const offset = ((editMapInfo.allVisionOffPoints.length || 1) - 1) * 10;
19924
+ const offset = (Math.random() - 0.5) * elementWidth;
19866
19925
  const [minX, minY, maxX, maxY] = [
19867
19926
  centerPoint[0] - elementWidth / 2 + offset,
19868
19927
  centerPoint[1] - elementWidth / 2 + offset,
@@ -19923,7 +19982,7 @@ const SvgEditMap = React.forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMa
19923
19982
  }, [centerPoint]);
19924
19983
  // 调整SVG大小的函数
19925
19984
  const adjustSvgSize = (layoutData) => {
19926
- const padding = 20; // 添加一些边距以避免内容贴边
19985
+ const padding = 0; // 添加一些边距以避免内容贴边
19927
19986
  const boundWidth = bounds.maxX - bounds.minX + padding * 2;
19928
19987
  const boundHeight = bounds.maxY - bounds.minY + padding * 2;
19929
19988
  // 防止宽高为0的情况
@@ -20127,11 +20186,11 @@ const SvgEditMap = React.forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMa
20127
20186
  const showNotCreateCursor = React.useMemo(() => {
20128
20187
  if (!mousePos)
20129
20188
  return false;
20130
- return checkCanNotCreateAtPosition(mousePos);
20189
+ return checkCanNotCreateAtPosition(mousePos)?.result ?? false;
20131
20190
  }, [mousePos, checkCanNotCreateAtPosition]);
20132
- return (jsxRuntime.jsx("div", { ref: containerRef, className: classNames(styles$1.mapEdit, {
20133
- [styles$1.createMode]: isCreating,
20134
- [styles$1.notCreateCursor]: showNotCreateCursor,
20191
+ return (jsxRuntime.jsx("div", { ref: containerRef, className: classNames(styles$4.mapEdit, {
20192
+ [styles$4.createMode]: isCreating,
20193
+ [styles$4.notCreateCursor]: showNotCreateCursor,
20135
20194
  }), style: {
20136
20195
  display: editMap ? 'block' : 'none',
20137
20196
  }, children: jsxRuntime.jsxs("svg", { style: {
@@ -20139,6 +20198,7 @@ const SvgEditMap = React.forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMa
20139
20198
  left: '50%',
20140
20199
  top: '50%',
20141
20200
  transform: 'translate(-50%, -50%)',
20201
+ overflow: 'visible',
20142
20202
  // cursor: createMode ? 'crosshair' : editMode ? 'default' : 'move',
20143
20203
  // pointerEvents: 'auto', // 关键:允许接收鼠标事件
20144
20204
  }, xmlns: "http://www.w3.org/2000/svg", "shape-rendering": "geometricPrecision", "text-rendering": "geometricPrecision", "image-rendering": "optimizeQuality", ref: svgRef, onClick: editMapInfo.createMode && platform !== exports.PlatformType.H5 ? onSvgClick : undefined, onMouseMove: editMapInfo.createMode && platform !== exports.PlatformType.H5 ? onSvgMouseMove : undefined, children: [jsxRuntime.jsxs("defs", { children: [jsxRuntime.jsx("filter", { id: "vertex-tooltip-shadow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: jsxRuntime.jsx("feDropShadow", { dx: "2", dy: "2", stdDeviation: "2", floodColor: "#000", floodOpacity: "0.12" }) }), jsxRuntime.jsxs("filter", { id: `path-hover-${exports.DataType.BOUNDARY}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsxRuntime.jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsxRuntime.jsx("feFlood", { floodColor: BOUNDARY_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsxRuntime.jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxRuntime.jsxs("feMerge", { children: [jsxRuntime.jsx("feMergeNode", { in: "coloredBorder" }), jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxRuntime.jsxs("filter", { id: `path-hover-${exports.DataType.VISION_OFF}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsxRuntime.jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsxRuntime.jsx("feFlood", { floodColor: VISION_OFF_AREA_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsxRuntime.jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxRuntime.jsxs("feMerge", { children: [jsxRuntime.jsx("feMergeNode", { in: "coloredBorder" }), jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxRuntime.jsxs("filter", { id: `path-hover-${exports.DataType.OBSTACLE}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsxRuntime.jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsxRuntime.jsx("feFlood", { floodColor: OBSTACLE_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsxRuntime.jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxRuntime.jsxs("feMerge", { children: [jsxRuntime.jsx("feMergeNode", { in: "coloredBorder" }), jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })] })] })] }), Object.keys(svgElementDatas)
@@ -20229,15 +20289,15 @@ const SvgEditMap = React.forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMa
20229
20289
  });
20230
20290
  SvgEditMap.displayName = 'SvgEditMap';
20231
20291
 
20232
- var _path;
20233
- 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); }
20292
+ var _path$3;
20293
+ 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); }
20234
20294
  var SvgMobileAddPoint = function SvgMobileAddPoint(props) {
20235
- return /*#__PURE__*/React__namespace.createElement("svg", _extends({
20295
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
20236
20296
  xmlns: "http://www.w3.org/2000/svg",
20237
20297
  width: 36,
20238
20298
  height: 36,
20239
20299
  fill: "none"
20240
- }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
20300
+ }, props), _path$3 || (_path$3 = /*#__PURE__*/React__namespace.createElement("path", {
20241
20301
  stroke: "#fff",
20242
20302
  strokeLinecap: "round",
20243
20303
  strokeLinejoin: "round",
@@ -20246,9 +20306,9 @@ var SvgMobileAddPoint = function SvgMobileAddPoint(props) {
20246
20306
  })));
20247
20307
  };
20248
20308
 
20249
- 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}";
20250
- var styles = {"crosshair":"index-module_crosshair__etey6"};
20251
- styleInject(css_248z);
20309
+ 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}";
20310
+ var styles$3 = {"crosshair":"index-module_crosshair__etey6"};
20311
+ styleInject(css_248z$3);
20252
20312
 
20253
20313
  /**
20254
20314
  * 十字准心组件
@@ -20265,7 +20325,460 @@ const Crosshair = () => {
20265
20325
  }
20266
20326
  return false;
20267
20327
  }, [platform, editMapInfo]);
20268
- return isVisible ? (jsxRuntime.jsx("div", { className: styles.crosshair, children: jsxRuntime.jsx(SvgMobileAddPoint, {}) })) : null;
20328
+ return isVisible ? (jsxRuntime.jsx("div", { className: styles$3.crosshair, children: jsxRuntime.jsx(SvgMobileAddPoint, {}) })) : null;
20329
+ };
20330
+
20331
+ 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}";
20332
+ var styles$2 = {"addEntry":"index-module_addEntry__QsQHD","icon":"index-module_icon__qIgA4","addItem":"index-module_addItem__mglwZ","label":"index-module_label__QqZ-9"};
20333
+ styleInject(css_248z$2);
20334
+
20335
+ var _rect$2, _path$2, _defs$1;
20336
+ 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); }
20337
+ var SvgAddEntry = function SvgAddEntry(props) {
20338
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
20339
+ xmlns: "http://www.w3.org/2000/svg",
20340
+ width: 24,
20341
+ height: 24,
20342
+ fill: "none"
20343
+ }, props), _rect$2 || (_rect$2 = /*#__PURE__*/React__namespace.createElement("rect", {
20344
+ width: 10.95,
20345
+ height: 10.95,
20346
+ x: 10.613,
20347
+ y: 3.15,
20348
+ fill: "#1F1F1F",
20349
+ stroke: "url(#add-entry_svg__a)",
20350
+ strokeWidth: 0.3,
20351
+ opacity: 0.795,
20352
+ rx: 1.05
20353
+ })), /*#__PURE__*/React__namespace.createElement("foreignObject", {
20354
+ width: 23.468,
20355
+ height: 20.501,
20356
+ x: -1.543,
20357
+ y: 3.499
20358
+ }, /*#__PURE__*/React__namespace.createElement("div", {
20359
+ xmlns: "http://www.w3.org/1999/xhtml",
20360
+ style: {
20361
+ backdropFilter: "blur(1.63px)",
20362
+ clipPath: "url(#add-entry_svg__b)",
20363
+ height: "100%",
20364
+ width: "100%"
20365
+ }
20366
+ })), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
20367
+ fill: "#1F1F1F",
20368
+ stroke: "url(#add-entry_svg__c)",
20369
+ strokeWidth: 0.3,
20370
+ 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",
20371
+ "data-figma-bg-blur-radius": 3.262
20372
+ })), _defs$1 || (_defs$1 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
20373
+ id: "add-entry_svg__a",
20374
+ x1: 16.851,
20375
+ x2: 20.384,
20376
+ y1: 10.392,
20377
+ y2: 4.767,
20378
+ gradientUnits: "userSpaceOnUse"
20379
+ }, /*#__PURE__*/React__namespace.createElement("stop", {
20380
+ stopColor: "#fff",
20381
+ stopOpacity: 0.01
20382
+ }), /*#__PURE__*/React__namespace.createElement("stop", {
20383
+ offset: 1,
20384
+ stopColor: "#fff"
20385
+ })), /*#__PURE__*/React__namespace.createElement("linearGradient", {
20386
+ id: "add-entry_svg__c",
20387
+ x1: 21.47,
20388
+ x2: 12.314,
20389
+ y1: 15.036,
20390
+ y2: 5.769,
20391
+ gradientUnits: "userSpaceOnUse"
20392
+ }, /*#__PURE__*/React__namespace.createElement("stop", {
20393
+ stopColor: "#fff",
20394
+ stopOpacity: 0.01
20395
+ }), /*#__PURE__*/React__namespace.createElement("stop", {
20396
+ offset: 1,
20397
+ stopColor: "#fff"
20398
+ })), /*#__PURE__*/React__namespace.createElement("clipPath", {
20399
+ id: "add-entry_svg__b",
20400
+ transform: "translate(1.543 -3.499)"
20401
+ }, /*#__PURE__*/React__namespace.createElement("path", {
20402
+ 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"
20403
+ })))));
20404
+ };
20405
+
20406
+ var _path$1, _path2$1, _path3;
20407
+ 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); }
20408
+ var SvgBoundary = function SvgBoundary(props) {
20409
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
20410
+ xmlns: "http://www.w3.org/2000/svg",
20411
+ width: 16,
20412
+ height: 16,
20413
+ fill: "none"
20414
+ }, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
20415
+ fill: "#1DBEAC",
20416
+ fillRule: "evenodd",
20417
+ 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",
20418
+ clipRule: "evenodd",
20419
+ opacity: 0.602
20420
+ })), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
20421
+ fill: "#1DBEAC",
20422
+ 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",
20423
+ opacity: 0.152
20424
+ })), _path3 || (_path3 = /*#__PURE__*/React__namespace.createElement("path", {
20425
+ fill: "#1DBEAC",
20426
+ fillRule: "evenodd",
20427
+ 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",
20428
+ clipRule: "evenodd"
20429
+ })));
20430
+ };
20431
+
20432
+ var _path, _path2, _rect$1, _rect2$1;
20433
+ 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); }
20434
+ var SvgLimitIsland = function SvgLimitIsland(props) {
20435
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
20436
+ xmlns: "http://www.w3.org/2000/svg",
20437
+ width: 16,
20438
+ height: 16,
20439
+ fill: "none"
20440
+ }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
20441
+ fill: "#FFA077",
20442
+ 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"
20443
+ })), _path2 || (_path2 = /*#__PURE__*/React__namespace.createElement("path", {
20444
+ fill: "#FF5D17",
20445
+ 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"
20446
+ })), _rect$1 || (_rect$1 = /*#__PURE__*/React__namespace.createElement("rect", {
20447
+ width: 14.237,
20448
+ height: 10.667,
20449
+ x: 0.882,
20450
+ y: 2.667,
20451
+ fill: "#F50",
20452
+ opacity: 0.15,
20453
+ rx: 2
20454
+ })), _rect2$1 || (_rect2$1 = /*#__PURE__*/React__namespace.createElement("rect", {
20455
+ width: 14.237,
20456
+ height: 10.667,
20457
+ x: 0.882,
20458
+ y: 2.667,
20459
+ stroke: "#FF5D17",
20460
+ strokeWidth: 0.867,
20461
+ rx: 2
20462
+ })));
20463
+ };
20464
+
20465
+ var _rect, _rect2, _rect3, _rect4, _g$1;
20466
+ 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); }
20467
+ var SvgVisionFence = function SvgVisionFence(props) {
20468
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
20469
+ xmlns: "http://www.w3.org/2000/svg",
20470
+ width: 16,
20471
+ height: 16,
20472
+ fill: "none"
20473
+ }, props), _rect || (_rect = /*#__PURE__*/React__namespace.createElement("rect", {
20474
+ width: 14.333,
20475
+ height: 10.667,
20476
+ x: 0.833,
20477
+ y: 2.667,
20478
+ fill: "#B1D9FF",
20479
+ rx: 2.667
20480
+ })), _rect2 || (_rect2 = /*#__PURE__*/React__namespace.createElement("rect", {
20481
+ width: 13.333,
20482
+ height: 9.667,
20483
+ x: 1.333,
20484
+ y: 3.167,
20485
+ stroke: "#5C9DFF",
20486
+ strokeDasharray: "6.33 6.33",
20487
+ rx: 1.333
20488
+ })), _rect3 || (_rect3 = /*#__PURE__*/React__namespace.createElement("rect", {
20489
+ width: 6,
20490
+ height: 6,
20491
+ x: 5,
20492
+ y: 4.833,
20493
+ fill: "#B1D9FF",
20494
+ rx: 3
20495
+ })), /*#__PURE__*/React__namespace.createElement("mask", {
20496
+ id: "visionFence_svg__a",
20497
+ width: 6,
20498
+ height: 6,
20499
+ x: 5,
20500
+ y: 5,
20501
+ maskUnits: "userSpaceOnUse",
20502
+ style: {
20503
+ maskType: "alpha"
20504
+ }
20505
+ }, _rect4 || (_rect4 = /*#__PURE__*/React__namespace.createElement("rect", {
20506
+ width: 5.333,
20507
+ height: 5.333,
20508
+ x: 5.333,
20509
+ y: 5.5,
20510
+ fill: "#B1D9FF",
20511
+ rx: 2.667
20512
+ }))), _g$1 || (_g$1 = /*#__PURE__*/React__namespace.createElement("g", {
20513
+ fill: "#5C9DFF",
20514
+ mask: "url(#visionFence_svg__a)"
20515
+ }, /*#__PURE__*/React__namespace.createElement("path", {
20516
+ 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"
20517
+ }))));
20518
+ };
20519
+
20520
+ var _g, _defs;
20521
+ 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); }
20522
+ var SvgDoodle = function SvgDoodle(props) {
20523
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends({
20524
+ xmlns: "http://www.w3.org/2000/svg",
20525
+ width: 16,
20526
+ height: 16,
20527
+ fill: "none"
20528
+ }, props), _g || (_g = /*#__PURE__*/React__namespace.createElement("g", {
20529
+ clipPath: "url(#doodle_svg__a)"
20530
+ }, /*#__PURE__*/React__namespace.createElement("g", {
20531
+ clipPath: "url(#doodle_svg__b)"
20532
+ }, /*#__PURE__*/React__namespace.createElement("rect", {
20533
+ width: 14.237,
20534
+ height: 10.667,
20535
+ x: 0.333,
20536
+ y: 4.332,
20537
+ fill: "#CBFCF7",
20538
+ stroke: "#9AEEE5",
20539
+ strokeWidth: 0.867,
20540
+ rx: 2
20541
+ }), /*#__PURE__*/React__namespace.createElement("path", {
20542
+ fill: "#F2FFFD",
20543
+ 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"
20544
+ }), /*#__PURE__*/React__namespace.createElement("path", {
20545
+ fill: "#50D0C2",
20546
+ 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"
20547
+ }), /*#__PURE__*/React__namespace.createElement("path", {
20548
+ fill: "#50D0C2",
20549
+ 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"
20550
+ }), /*#__PURE__*/React__namespace.createElement("path", {
20551
+ fill: "#9CE7DE",
20552
+ 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"
20553
+ }), /*#__PURE__*/React__namespace.createElement("path", {
20554
+ fill: "#50D0C2",
20555
+ 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"
20556
+ })))), _defs || (_defs = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("clipPath", {
20557
+ id: "doodle_svg__a"
20558
+ }, /*#__PURE__*/React__namespace.createElement("path", {
20559
+ fill: "#fff",
20560
+ d: "M0 0h16v16H0z"
20561
+ })), /*#__PURE__*/React__namespace.createElement("clipPath", {
20562
+ id: "doodle_svg__b"
20563
+ }, /*#__PURE__*/React__namespace.createElement("path", {
20564
+ fill: "#fff",
20565
+ d: "M0 0h16v16H0z"
20566
+ })))));
20567
+ };
20568
+
20569
+ var HandleElementMapType;
20570
+ (function (HandleElementMapType) {
20571
+ HandleElementMapType["name"] = "name";
20572
+ HandleElementMapType["focus"] = "focus";
20573
+ HandleElementMapType["delete"] = "delete";
20574
+ HandleElementMapType["timePeriod"] = "timePeriod";
20575
+ HandleElementMapType["area"] = "area";
20576
+ HandleElementMapType["dooleExist"] = "dooleExist";
20577
+ })(HandleElementMapType || (HandleElementMapType = {}));
20578
+ const DATE_TYPE_MAP = [
20579
+ { type: exports.DataType.BOUNDARY, label: 'Boundary', icon: jsxRuntime.jsx(SvgBoundary, {}) },
20580
+ {
20581
+ type: exports.DataType.OBSTACLE,
20582
+ paramType: exports.RecordTypeEnum.OBSTACLE,
20583
+ label: 'Off-limit island',
20584
+ icon: jsxRuntime.jsx(SvgLimitIsland, {}),
20585
+ },
20586
+ // { type: DataType.CHANNEL, label: 'Channel', icon: <ChannelIcon /> },
20587
+ {
20588
+ type: exports.DataType.VISION_OFF,
20589
+ paramType: exports.RecordTypeEnum.VISI_OFF,
20590
+ label: 'VisionFence-off zone',
20591
+ icon: jsxRuntime.jsx(SvgVisionFence, {}),
20592
+ },
20593
+ {
20594
+ type: exports.DataType.DOODLE,
20595
+ paramType: exports.RecordTypeEnum.DOODLE,
20596
+ label: 'Doodle',
20597
+ icon: jsxRuntime.jsx(SvgDoodle, {}),
20598
+ },
20599
+ ];
20600
+ ({
20601
+ [exports.DataType.BOUNDARY]: {
20602
+ },
20603
+ [exports.DataType.OBSTACLE]: {
20604
+ },
20605
+ [exports.DataType.CHANNEL]: {
20606
+ },
20607
+ [exports.DataType.VISION_OFF]: {
20608
+ },
20609
+ [exports.DataType.DOODLE]: {
20610
+ },
20611
+ [exports.DataType.PATH]: undefined,
20612
+ [exports.DataType.ANTENNA]: undefined,
20613
+ [exports.DataType.CHARGING_PILE]: undefined,
20614
+ });
20615
+
20616
+ 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}";
20617
+ var styles$1 = {"modal":"index-module_modal__fkxhn","center":"index-module_center__d461v"};
20618
+ styleInject(css_248z$1);
20619
+
20620
+ const CustomModal = ({ children, titleCenter, hasMinHeight, height, ...props }) => {
20621
+ return (jsxRuntime.jsx(antd.Modal, { centered: true, styles: {
20622
+ body: {
20623
+ maxHeight: height ? `${height}px` : 'calc(100vh - 200px)',
20624
+ minHeight: hasMinHeight ? '520px' : undefined,
20625
+ overflow: 'auto',
20626
+ },
20627
+ }, wrapClassName: classNames(styles$1.modal, {
20628
+ [styles$1.center]: titleCenter,
20629
+ }), cancelButtonProps: { color: 'primary', variant: 'outlined' }, cancelText: 'Cancel', ...props, children: children }));
20630
+ };
20631
+
20632
+ 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}";
20633
+ 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-"};
20634
+ styleInject(css_248z);
20635
+
20636
+ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
20637
+ const { editMapInfo, setEditMapInfo, onHandleEnterRecord } = useMapEditContext();
20638
+ const [selectedDoodle, setSelectedDoodle] = React.useState(null);
20639
+ const noNeed = React.useMemo(() => {
20640
+ return '1234567890QWERTYUIOPASDFGHJKLZXCVBNM';
20641
+ }, []);
20642
+ // 选择 Doodle
20643
+ const handleSelectDoodle = React.useCallback((item) => {
20644
+ setSelectedDoodle(item);
20645
+ }, []);
20646
+ // 确认选择
20647
+ const handleConfirm = React.useCallback(() => {
20648
+ if (selectedDoodle) {
20649
+ const newDoodle = initDoodle();
20650
+ const svg = selectedDoodle?.svgStr;
20651
+ const minLength = selectedDoodle.minLength;
20652
+ const parseSvg = SvgParserNative.parseSvg(svg);
20653
+ const svgMinLength = parseSvg.height / SCALE_FACTOR;
20654
+ // 使用获取到的 SVG 内容,如果没有获取到则使用 URL
20655
+ newDoodle.svg = svg;
20656
+ newDoodle.scale = minLength / svgMinLength;
20657
+ newDoodle.direction = 0;
20658
+ newDoodle.center = restorePoint(centerPoint);
20659
+ onHandleEnterRecord?.({
20660
+ type: 1,
20661
+ function: 0,
20662
+ })?.then(() => {
20663
+ setEditMapInfo({
20664
+ ...editMapInfo,
20665
+ historyList: [
20666
+ {
20667
+ selectElement: newDoodle,
20668
+ },
20669
+ ],
20670
+ currentHistoryIndex: 0,
20671
+ createMode: exports.CreateStatus.COMPLETED,
20672
+ elementType: exports.DataType.DOODLE,
20673
+ selectElement: newDoodle,
20674
+ isShowDrag: true,
20675
+ });
20676
+ setOpen(false);
20677
+ onSelect?.(svg);
20678
+ }, (error) => {
20679
+ antd.message.error('Save failed, please try again');
20680
+ });
20681
+ }
20682
+ }, [selectedDoodle, setEditMapInfo, editMapInfo, setOpen, onSelect, centerPoint]);
20683
+ return (jsxRuntime.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: jsxRuntime.jsxs("div", { className: styles.doodleModal, children: [jsxRuntime.jsx("div", { className: styles.title, children: "Select the doodle that you want to create" }), jsxRuntime.jsx("div", { className: styles.content, children: doodleList
20684
+ ?.filter((item) => !noNeed.includes(item.name))
20685
+ .map((item) => {
20686
+ return (jsxRuntime.jsx("div", { className: classNames(styles.item, {
20687
+ [styles.active]: selectedDoodle?.svg === item.svg,
20688
+ }), onClick: () => handleSelectDoodle(item), children: jsxRuntime.jsx("div", { className: styles.svgImage, dangerouslySetInnerHTML: { __html: item?.svgStr } }) }, item.id));
20689
+ }) })] }) }));
20690
+ };
20691
+
20692
+ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
20693
+ const { svgRef } = useSvgEditContext();
20694
+ const { editMapInfo, setEditMapInfo, onHandleEnterRecord } = useMapEditContext();
20695
+ const divRef = React.useRef(null);
20696
+ const [open, setOpen] = React.useState(false);
20697
+ const [doodleOpen, setDoodleOpen] = React.useState(false);
20698
+ const centerPoint = React.useMemo(() => {
20699
+ if (!svgRef)
20700
+ return null;
20701
+ const baseVal = svgRef?.viewBox.baseVal;
20702
+ const center = [
20703
+ baseVal?.x + (baseVal?.width || 0) / 2,
20704
+ baseVal?.y + (baseVal?.height || 0) / 2,
20705
+ ];
20706
+ return center;
20707
+ }, [svgRef?.viewBox?.baseVal?.x]);
20708
+ const centerBounds = React.useMemo(() => {
20709
+ if (!svgRef)
20710
+ return null;
20711
+ const elementWidth = 50 * 10;
20712
+ const [minX, minY, maxX, maxY] = [
20713
+ centerPoint[0] - elementWidth / 2,
20714
+ centerPoint[1] - elementWidth / 2,
20715
+ centerPoint[0] + elementWidth / 2,
20716
+ centerPoint[1] + elementWidth / 2,
20717
+ ];
20718
+ const elementPoints = [
20719
+ [minX, minY],
20720
+ [minX, maxY],
20721
+ [maxX, maxY],
20722
+ [maxX, minY],
20723
+ ];
20724
+ return elementPoints;
20725
+ }, [centerPoint]);
20726
+ const addNewElement = React.useCallback((type, item) => {
20727
+ setOpen(false);
20728
+ let newElement = null;
20729
+ if (type === exports.DataType.BOUNDARY) {
20730
+ newElement = initBoundary();
20731
+ }
20732
+ else if (type === exports.DataType.OBSTACLE) {
20733
+ newElement = initObstacle();
20734
+ }
20735
+ else if (type === exports.DataType.CHANNEL) {
20736
+ newElement = initChannel();
20737
+ }
20738
+ else if (type === exports.DataType.VISION_OFF) {
20739
+ newElement = initVisionOff();
20740
+ newElement.points = centerBounds;
20741
+ }
20742
+ else if (type === exports.DataType.DOODLE) {
20743
+ return setDoodleOpen(true);
20744
+ }
20745
+ onHandleEnterRecord?.({
20746
+ type: item?.paramType,
20747
+ function: item?.type === exports.DataType.OBSTACLE ? 0 : undefined,
20748
+ })?.then(() => {
20749
+ setEditMapInfo({
20750
+ ...editMapInfo,
20751
+ historyList: [
20752
+ {
20753
+ selectElement: newElement,
20754
+ },
20755
+ ],
20756
+ currentHistoryIndex: 0,
20757
+ createMode: type === exports.DataType.VISION_OFF ? exports.CreateStatus.COMPLETED : exports.CreateStatus.CREATING,
20758
+ elementType: type,
20759
+ selectElement: newElement,
20760
+ });
20761
+ }, (errorText) => {
20762
+ antd.message.error('Save failed, please try again');
20763
+ });
20764
+ }, [centerBounds]);
20765
+ const addItems = React.useMemo(() => {
20766
+ return DATE_TYPE_MAP?.filter((item) => {
20767
+ if (item.type === exports.DataType.OBSTACLE) {
20768
+ return !disabledObstacles;
20769
+ }
20770
+ return item.type !== exports.DataType.BOUNDARY;
20771
+ });
20772
+ }, [disabledObstacles]);
20773
+ // console.log('addEntry->', editMapInfo, editMap);
20774
+ if (editMapInfo.createMode || editMapInfo.editMap || !editMap) {
20775
+ return null;
20776
+ }
20777
+ return (jsxRuntime.jsxs("div", { ref: divRef, className: styles$2.addEntry, children: [jsxRuntime.jsx(antd.Popover, { open: open, onOpenChange: setOpen, arrow: false, placement: "leftTop", content: addItems?.map((item) => {
20778
+ return (jsxRuntime.jsxs("div", { className: styles$2.addItem, onClick: () => {
20779
+ addNewElement(item.type, item);
20780
+ }, children: [jsxRuntime.jsx("div", { className: styles$2.icon, children: item?.icon }), jsxRuntime.jsx("div", { className: styles$2.label, children: item?.label })] }, item.label));
20781
+ }), children: jsxRuntime.jsx("div", { className: styles$2.icon, children: jsxRuntime.jsx(SvgAddEntry, {}) }) }), jsxRuntime.jsx(DoodleModal, { centerPoint: centerPoint, doodleList: doodleList, open: doodleOpen, onOk: () => setDoodleOpen(false), setOpen: setDoodleOpen })] }));
20269
20782
  };
20270
20783
 
20271
20784
  // 验证GPS坐标是否有效
@@ -20319,10 +20832,7 @@ const getValidGpsBounds = (mapData, rotation = 0) => {
20319
20832
  else {
20320
20833
  // 最后的fallback:使用默认坐标
20321
20834
  console.warn('无法获取有效的GPS边界,使用默认坐标');
20322
- bounds = {
20323
- sw: [-9.1562, -37.7503],
20324
- ne: [31.247, 5.797],
20325
- };
20835
+ bounds = DEFAULT_COORDINATES;
20326
20836
  }
20327
20837
  }
20328
20838
  // 如果有旋转角度,计算旋转后的边界
@@ -20475,7 +20985,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
20475
20985
  overlayScale,
20476
20986
  doodleList,
20477
20987
  ]);
20478
- // console.log('svgElementDatas->', svgElementDatas, unStructMapData, commonValue);
20479
20988
  // 处理地图分区边界
20480
20989
  // const partitionBoundary = useMemo(() => {
20481
20990
  // const allBoundaryElements = [];
@@ -20704,6 +21213,14 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
20704
21213
  React.useEffect(() => {
20705
21214
  setDrag(defaultTransform ?? { x: 0, y: 0, rotation: 0 });
20706
21215
  }, [defaultTransform]);
21216
+ React.useEffect(() => {
21217
+ // 监听drag变化,比较drag和defaultTransform
21218
+ onHandleEvent?.(exports.ClickEventType.DRAG_MAP, {
21219
+ isDragMap: drag.x !== defaultTransform.x ||
21220
+ drag.y !== defaultTransform.y ||
21221
+ drag.rotation !== defaultTransform.rotation,
21222
+ });
21223
+ }, [drag, defaultTransform, onHandleEvent]);
20707
21224
  // 监听地图zoom变化,计算缩放比例
20708
21225
  React.useEffect(() => {
20709
21226
  if (!mapRef)
@@ -20715,8 +21232,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
20715
21232
  // 基于固定的参考zoom级别计算overlayScale
20716
21233
  const zoomDiff = currentZoom - REFERENCE_ZOOM;
20717
21234
  const scale = Math.pow(2, -zoomDiff); // 负数实现反向缩放
20718
- console.log('scale', scale, currentZoom, zoomDiff);
20719
- setOverlayScale(scale < 1 ? 1 : scale);
21235
+ setOverlayScale(scale < 1 ? 1 : platform === exports.PlatformType.H5 ? 1.5 * scale : scale);
20720
21236
  };
20721
21237
  // 使用lodash throttle进行节流处理: 100ms内只执行一次
20722
21238
  const handleZoomChanged = throttle$2(updateScale, 50);
@@ -20798,7 +21314,9 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
20798
21314
  // 添加视觉失效区
20799
21315
  addVisionOffPoint: () => svgEditMapRef.current?.addVisionOffPoint(),
20800
21316
  // h5进入视觉失效区编辑模式
20801
- enterVisionOffEditMode: (mode) => svgEditMapRef.current?.enterVisionOffEditMode(mode),
21317
+ enterVisionOffEditMode: (mode) => {
21318
+ svgEditMapRef.current?.enterVisionOffEditMode(mode);
21319
+ },
20802
21320
  // 重做
20803
21321
  redo: () => svgEditMapRef.current?.redo(),
20804
21322
  // 撤销
@@ -20829,7 +21347,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
20829
21347
  }
20830
21348
  // console.log('mowerrender------->', svgViewBox);
20831
21349
  // 使用goole maps自定义叠加层,返回debug信息(如果启用)
20832
- return (jsxRuntime.jsx(CommonContextProvider, { value: commonValue, children: jsxRuntime.jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxRuntime.jsxs(MapEditContextProvider, { value: mapEditValue, children: [platform !== exports.PlatformType.H5 && (jsxRuntime.jsx(jsxRuntime.Fragment, {})), platform === exports.PlatformType.H5 && jsxRuntime.jsx(Crosshair, {}), jsxRuntime.jsxs(OverlayViewF, { onLoad: (lay) => {
21350
+ return (jsxRuntime.jsx(CommonContextProvider, { value: commonValue, children: jsxRuntime.jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxRuntime.jsxs(MapEditContextProvider, { value: mapEditValue, children: [platform !== exports.PlatformType.H5 && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(AddEntry, { disabledObstacles: disabledObstacles, doodleList: doodleList, editMap: editMap }) })), platform === exports.PlatformType.H5 && jsxRuntime.jsx(Crosshair, {}), jsxRuntime.jsxs(OverlayViewF, { onLoad: (lay) => {
20833
21351
  setOverlay(lay);
20834
21352
  }, onDraw: (style) => {
20835
21353
  const layout = Object.keys(style).reduce((pre, cur) => {