@fleet-frontend/mower-maps 0.2.5-beta.6 → 0.2.5-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { memo, useMemo, useEffect, useState, useRef, useCallback, createContext, useContext, useLayoutEffect, forwardRef, useImperativeHandle } from 'react';
4
- import ReactDOM from 'react-dom';
4
+ import ReactDOM, { createPortal } from 'react-dom';
5
5
 
6
6
  function globals (defs) {
7
7
  defs('EPSG:4326', '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees');
@@ -10625,12 +10625,12 @@ const SCALE_FACTOR = 50; // 50像素/米
10625
10625
  * 默认线宽设置
10626
10626
  */
10627
10627
  const DEFAULT_LINE_WIDTHS = {
10628
- BOUNDARY: 3,
10629
- OBSTACLE: 3,
10628
+ BOUNDARY: 2,
10629
+ OBSTACLE: 2,
10630
10630
  CHARGING_PILE: 3,
10631
10631
  CHANNEL: 3,
10632
10632
  PATH: 20,
10633
- VISION_OFF_AREA: 3,
10633
+ VISION_OFF_AREA: 2,
10634
10634
  TIME_LIMIT_OBSTACLE: 1,
10635
10635
  };
10636
10636
  /**
@@ -13709,7 +13709,6 @@ class BaseData {
13709
13709
  else {
13710
13710
  this.computedArea = 0;
13711
13711
  }
13712
- this.canEdit = false;
13713
13712
  }
13714
13713
  }
13715
13714
  /**
@@ -13732,7 +13731,6 @@ class BoundaryData extends BaseData {
13732
13731
  this.recBaseAngle = originalData?.rec_base_angle;
13733
13732
  this.channels = channels;
13734
13733
  this.style = style;
13735
- this.canEdit = true;
13736
13734
  }
13737
13735
  }
13738
13736
  /**
@@ -13760,7 +13758,6 @@ class ObstacleData extends BaseData {
13760
13758
  this.end_timestamp = originalData?.end_timestamp;
13761
13759
  this.name = originalData?.name || 'Noname';
13762
13760
  this.style = style;
13763
- this.canEdit = true;
13764
13761
  }
13765
13762
  }
13766
13763
  /**
@@ -13788,7 +13785,6 @@ class DoodleData extends BaseData {
13788
13785
  this.style = style;
13789
13786
  this.create_ts = originalData?.create_ts || Date.now();
13790
13787
  this.expiration_ts = originalData?.expiration_ts || Date.now() + 3600000;
13791
- this.canEdit = true;
13792
13788
  this.computedArea = this.getDoodleComputedArea();
13793
13789
  }
13794
13790
  getDoodleComputedArea() {
@@ -13805,7 +13801,6 @@ class VisionOffData extends BaseData {
13805
13801
  const convertedPoints = convertPointsFormat(originalData?.points) || [];
13806
13802
  super(originalData?.id, DataType.VISION_OFF, level, RenderType.POLYGON, convertedPoints, originalData);
13807
13803
  this.style = style;
13808
- this.canEdit = true;
13809
13804
  }
13810
13805
  }
13811
13806
  /**
@@ -19826,7 +19821,9 @@ function OverlayViewFunctional({ map, position, bounds, rotate, mapPaneName, zIn
19826
19821
  }, [map, overlay]);
19827
19822
  // to move the container to the foreground and background
19828
19823
  useEffect(() => {
19829
- container.style.zIndex = `${zIndex}`;
19824
+ if (zIndex) {
19825
+ container.style.zIndex = `${zIndex}`;
19826
+ }
19830
19827
  }, [zIndex, container]);
19831
19828
  return ReactDOM.createPortal(children, container);
19832
19829
  }
@@ -22653,15 +22650,25 @@ var index = {
22653
22650
  const CommonContext = createContext({
22654
22651
  sn: '',
22655
22652
  editMap: false,
22656
- mowerIconConfig: {},
22653
+ mowerIconConfig: {
22654
+ mapImgUrl: '',
22655
+ mapDisabledUrl: '',
22656
+ mapNoPositionUrl: '',
22657
+ },
22657
22658
  platform: PlatformType.WEB,
22658
22659
  svgViewBox: null,
22659
22660
  unitType: UnitsType.Metric,
22661
+ mapConfig: {},
22662
+ mapJson: null,
22663
+ drag: { x: 0, y: 0, rotate: 0, rotation: 0 },
22660
22664
  mapRef: null,
22665
+ bounds: null,
22661
22666
  globalHeight: 0,
22662
22667
  heightOptions: [],
22663
22668
  overlayScale: 1,
22664
22669
  showStraddleBoundaryBorder: true,
22670
+ googleMapStaticApiKey: '',
22671
+ onH5FirstSelectObstaclePoint: undefined,
22665
22672
  });
22666
22673
  const CommonContextProvider = CommonContext.Provider;
22667
22674
  const useCommonContext = () => useContext(CommonContext);
@@ -22908,9 +22915,9 @@ const VertexElement = React__default.memo(({ r, stroke, fill, ...props }) => {
22908
22915
  });
22909
22916
 
22910
22917
  var _path$1;
22911
- 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); }
22918
+ 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); }
22912
22919
  var SvgDelete = function SvgDelete(props) {
22913
- return /*#__PURE__*/React.createElement("svg", _extends$5({
22920
+ return /*#__PURE__*/React.createElement("svg", _extends$8({
22914
22921
  xmlns: "http://www.w3.org/2000/svg",
22915
22922
  width: 16,
22916
22923
  height: 16,
@@ -23093,10 +23100,6 @@ const DistanceLabels = ({ coordinates, createMode = false, editMode = false, com
23093
23100
  } }))] }));
23094
23101
  };
23095
23102
 
23096
- var css_248z$6 = ".index-module_pointerCursor__Ee6pr {\n cursor: pointer;\n}\n\n.index-module_polygonPath__PynOn {\n pointer-events: stroke;\n cursor: pointer;\n}\n\n.index-module_dragging__xSFdO {\n cursor: grabbing;\n}\n\n.index-module_notCreate__bFnkV {\n cursor: no-drop;\n}";
23097
- var styles$6 = {"pointerCursor":"index-module_pointerCursor__Ee6pr","polygonPath":"index-module_polygonPath__PynOn","dragging":"index-module_dragging__xSFdO","notCreate":"index-module_notCreate__bFnkV"};
23098
- styleInject(css_248z$6);
23099
-
23100
23103
  var CreateStatus;
23101
23104
  (function (CreateStatus) {
23102
23105
  CreateStatus["CREATING"] = "creating";
@@ -23146,6 +23149,421 @@ const MapEditContext = createContext({
23146
23149
  const MapEditContextProvider = MapEditContext.Provider;
23147
23150
  const useMapEditContext = () => useContext(MapEditContext);
23148
23151
 
23152
+ var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHHSURBVHgBtVtdjF3VdV7rnHPHtLbUkRrALwmDidSSgD1JqWQ3UMaNMaFq63FIKyoVZFRF6kMkbCmVcP9mrBARoJUnLRL9c+3WSVsqIkwrtRBKfaGmQFuFazBpK0wYnmLSF6MYx557zt5Zv3vvO/Z4bDPZ9pl97rlnztnfXmt969s/g/AjKrN7nxwf634wBTFMYIQNAWASAcYjxAmI+T5EnAeIdFQnYwxHqwr6Z5s1g9ld20/Cj6AgrGBhkKva0/d1MUxBiFMxEjw7gGv5RyUWL+cfiCD/0I4KoULs04ensKkP7d716/OwQmVFAD/4yMGpLsJM7MJUiIGMGiDQwUBDYHR8DgocFG/54gQ0HRVUFQPnuoK6qvp0ec/u3767Dx+wfCDAXyKg2MWZELopBth1BJQAB6ujgY5RANNpRIbLuPnFETAaxgSUawYpVhawtdQV1XWN81hXu37ni3cfgssslwX4wQf/bqLD4f6uY6AdAaWDagYqdRi18qhrn/vmc61bRbIwZqAKmms9rw/Usbdn9+5Ld/VLBvzlhw/e17XtLIEcbzsG2SpgOQQkYe0wu7SDZqgRvS7Bcisq/oFVRAZqVlaQXDeRgKIDFtBNPd9Aved3d99zAC6hXDTg2dknx6sr3psJbbezZZBtB14TWApfAqmgyYPpnF07ZMIKeqLviymMoxIWY0VEJ6/zWNgsG5uGgTdANXBNwOf+4P4duy4Wx0UBnp3dP45jcJgsO6kgWxi2BLIdYtcGBisWDqHFji3qMbzIlY2jLZgRyxaUbl1hJiwBzLWBdqBNo0fNR90MxhC279597/xyWJYF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Vw0tuRVwS8IEDcyd7sdtMrjLfU9ACXLb76b5HIQzfAetSzjvA03NKXSEx92gHFHXM6c6x2pBHdb6wcd5DLVsQ+ZD29XiTWu8d+rkdLlDqC305GLx85obJjU8RuGl62bhJRxihk5H4zB6LpsoKNsYiRLH0eZGFkAY34KoYc25VyL5/WkipQXVjjtkxZud3yHybv3bgD+fhcgFzOTZ4+eQNnyDQWE/R69dGI5xCCY2knRKOc1JeqQBMX2aBlsavWbTr7AWakEAhJrEoMzBK+mnGUGK2NxYJ7NGFCjY9cWDuxHJ4EC6h/Nrd9+2l9dadbdpumDeX+ipjKDajmaKE0iVC1kkptUqnuFtoLbvvJNOyC4tUtG3ETWOxynssx3gf9R8Pm2r2EIXgxWC4JMBcfvXunTu6djhDi80TQ90aga2uv4Ivs0bfSZtHSQbLyMwSUekfruB0PF6ppMW8UVwAE9gebywlN66b3klilD2Pf31uDi6hLOvSi8u3X3t5sOGmT9FQqxqndk2iyZ50QKXjahPxqFrchL3WlQPS0Rkd9QgwG8DovujaUw4dlCnIqkiA+2NjzR2PH5x7Gi6xXLKFy3Lnb3xhOrRhL60tT3TFnwKIe/sejGDL6DpJgAXn+YSMx7iTk28O1z3SaUe8ZIc+hfCeJ772aB8us3wgwF4+d9cXplqIM6Hrprrgm9fSimSMaasE5JhGSG494iFMVKKgKvk7B94JT7D7NL2654m/v3ygXlYEsJfpu35rArCejm23jex7q/05D+qYOYHOORZcQSmFVYgpfunoY419ODP21UOH5lbsr9RWFHBZpqd3jsMVZybJyJTO4gbCPk6YJgjrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
23153
+
23154
+ const useChargingPile = ({ viewBox, rotation = 0 }) => {
23155
+ const { svgElementDatas } = useSvgEditContext();
23156
+ const { sn } = useCommonContext();
23157
+ const items = useMemo(() => {
23158
+ if (!svgElementDatas || !viewBox)
23159
+ return [];
23160
+ const chargingPiles = svgElementDatas?.[DataType.CHARGING_PILE];
23161
+ if (!chargingPiles)
23162
+ return [];
23163
+ const results = [];
23164
+ for (const element of chargingPiles) {
23165
+ const center = element.points?.[0];
23166
+ if (!center)
23167
+ continue;
23168
+ const size = element.style?.radius ? element.style.radius * 2 : 55;
23169
+ const direction = element?.direction || 0;
23170
+ const angle = (direction * 180) / Math.PI;
23171
+ const rotationDegree = 270 - angle; // 正东是正方向,需要处理下
23172
+ const actualRotation = rotationDegree - rotation;
23173
+ const relX = (center[0] - viewBox.x) / viewBox.width;
23174
+ const relY = (center[1] - viewBox.y) / viewBox.height;
23175
+ if (isFinite(relX) && isFinite(relY)) {
23176
+ results.push({
23177
+ leftPct: relX * 100,
23178
+ topPct: relY * 100,
23179
+ size,
23180
+ rotateDeg: actualRotation,
23181
+ imageSrc: chargingPileImage,
23182
+ });
23183
+ }
23184
+ }
23185
+ return results;
23186
+ }, [svgElementDatas, viewBox?.x, viewBox?.y, viewBox?.width, viewBox?.height, rotation, sn]);
23187
+ return items;
23188
+ };
23189
+
23190
+ const CharginPile = React__default.memo(({ viewBox, rotation = 0, sizeScale = 1, isHighlight = true }) => {
23191
+ const items = useChargingPile({ viewBox: viewBox || null, rotation });
23192
+ const containerStyle = useMemo(() => ({
23193
+ position: 'absolute',
23194
+ top: 0,
23195
+ left: 0,
23196
+ width: '100%',
23197
+ height: '100%',
23198
+ pointerEvents: 'none',
23199
+ zIndex: 750,
23200
+ opacity: isHighlight ? SvgMapOpacity.HIGHLIGHT : SvgMapOpacity.UN_HIGHLIGHT,
23201
+ }), [isHighlight]);
23202
+ return (jsx("div", { style: containerStyle, children: items?.map((item, idx) => (jsx("div", { className: "charging-pile", style: {
23203
+ position: 'absolute',
23204
+ width: item.size * sizeScale,
23205
+ height: item.size * sizeScale,
23206
+ left: `${item.leftPct}%`,
23207
+ top: `${item.topPct}%`,
23208
+ transform: `translate(-50%, -50%) rotate(${item.rotateDeg}deg)`,
23209
+ pointerEvents: 'auto',
23210
+ zIndex: 750,
23211
+ }, children: jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }, `pile-${idx}`))) }));
23212
+ });
23213
+
23214
+ const MAX_STATIC_SIZE = 640;
23215
+ const MAX_STATIC_MAP_RETRY = 3;
23216
+ const Magnifier = ({ visible, dragState, polygonPoints, fillColor = 'rgba(255, 122, 51, 0.1)', strokeColor = 'rgba(255, 122, 51, 1)', strokeWidth = 2, zoom = 3, size = 200, }) => {
23217
+ const { svgViewBox, mapRef, googleMapStaticApiKey, drag } = useCommonContext();
23218
+ const { svgElementDatas, svgRef } = useSvgEditContext();
23219
+ const { editMapInfo } = useMapEditContext();
23220
+ const [magnifierPosition, setMagnifierPosition] = useState({ x: 0, y: 0 });
23221
+ const [magnifierBoxSize, setMagnifierBoxSize] = useState({ width: size, height: size });
23222
+ // 本次拖拽中放大镜位置是否已完成初始化(未完成前隐藏,避免首帧闪动)
23223
+ const [isPlacementReady, setIsPlacementReady] = useState(false);
23224
+ // 放大镜所在侧边:true=右侧,false=左侧
23225
+ const [placeOnRight, setPlaceOnRight] = useState(true);
23226
+ // 仅在每次拖拽开始时初始化一次侧边
23227
+ const hasInitializedSideRef = useRef(false);
23228
+ const [mapImageFrame, setMapImageFrame] = useState(null);
23229
+ const [staticMapRetryCount, setStaticMapRetryCount] = useState(0);
23230
+ // 获取当前正在拖拽的禁区 ID
23231
+ const currentObstacleId = editMapInfo?.selectElement?.id;
23232
+ // 计算当前 SVG 单位到屏幕像素的比例(用于实现真正 1:1 预览)
23233
+ const getPixelScale = () => {
23234
+ //先拿 svgRef.getScreenCTM(),这是 SVG 到屏幕的变换矩阵(包含缩放/旋转/平移)
23235
+ const ctm = svgRef?.getScreenCTM?.();
23236
+ if (!ctm)
23237
+ return 1;
23238
+ // 使用向量长度计算缩放,兼容旋转矩阵
23239
+ // 用 Math.hypot(ctm.a, ctm.b) 算出 x 方向的实际缩放倍率(用向量长度是为了兼容旋转,不只看 a)
23240
+ const scaleX = Math.hypot(ctm.a, ctm.b);
23241
+ return Number.isFinite(scaleX) && scaleX > 0 ? scaleX : 1;
23242
+ };
23243
+ // 读取设备安全区(刘海/手势条)inset,兼容横屏 H5
23244
+ const getSafeAreaInsets = () => {
23245
+ const probe = document.createElement('div');
23246
+ probe.style.position = 'fixed';
23247
+ probe.style.left = '0';
23248
+ probe.style.top = '0';
23249
+ probe.style.width = '0';
23250
+ probe.style.height = '0';
23251
+ probe.style.visibility = 'hidden';
23252
+ probe.style.pointerEvents = 'none';
23253
+ probe.style.paddingTop = 'env(safe-area-inset-top)';
23254
+ probe.style.paddingRight = 'env(safe-area-inset-right)';
23255
+ probe.style.paddingBottom = 'env(safe-area-inset-bottom)';
23256
+ probe.style.paddingLeft = 'env(safe-area-inset-left)';
23257
+ document.body.appendChild(probe);
23258
+ const style = window.getComputedStyle(probe);
23259
+ const insets = {
23260
+ top: Number.parseFloat(style.paddingTop) || 0,
23261
+ right: Number.parseFloat(style.paddingRight) || 0,
23262
+ bottom: Number.parseFloat(style.paddingBottom) || 0,
23263
+ left: Number.parseFloat(style.paddingLeft) || 0,
23264
+ };
23265
+ document.body.removeChild(probe);
23266
+ return insets;
23267
+ };
23268
+ // 计算并获取放大镜底图:优先使用 Google Maps Static API,无图时走灰色背景兜底
23269
+ useEffect(() => {
23270
+ if (!visible || !dragState.currentPosition || !mapRef || !svgViewBox || !svgRef) {
23271
+ // console.log('[Magnifier] Skip static map effect: missing deps', {
23272
+ // visible,
23273
+ // hasCurrentPosition: Boolean(dragState.currentPosition),
23274
+ // hasMapRef: Boolean(mapRef),
23275
+ // hasSvgViewBox: Boolean(svgViewBox),
23276
+ // hasSvgRef: Boolean(svgRef),
23277
+ // });
23278
+ setMapImageFrame(null);
23279
+ setStaticMapRetryCount(0);
23280
+ return;
23281
+ }
23282
+ const mapDiv = mapRef.getDiv?.();
23283
+ // 获取 SVG 到屏幕的变换矩阵的逆矩阵
23284
+ const inverseCtm = svgRef.getScreenCTM?.()?.inverse?.();
23285
+ if (!mapDiv || !inverseCtm) {
23286
+ // console.log('[Magnifier] Skip static map effect: mapDiv/ctm missing', {
23287
+ // hasMapDiv: Boolean(mapDiv),
23288
+ // hasInverseCtm: Boolean(inverseCtm),
23289
+ // });
23290
+ setMapImageFrame(null);
23291
+ setStaticMapRetryCount(0);
23292
+ return;
23293
+ }
23294
+ const mapRect = mapDiv.getBoundingClientRect();
23295
+ const svgPoint = svgRef.createSVGPoint();
23296
+ // 只要有 key 就尝试 static api;请求失败时不截图,直接回退灰色背景
23297
+ if (googleMapStaticApiKey) {
23298
+ // console.log('[Magnifier] Background source: static api viewport snapshot');
23299
+ const mapBounds = mapRef.getBounds?.();
23300
+ if (!mapBounds) {
23301
+ // console.log('[Magnifier] Skip static map effect: mapBounds missing');
23302
+ setMapImageFrame(null);
23303
+ return;
23304
+ }
23305
+ const screenToSvg = (screenX, screenY) => {
23306
+ svgPoint.x = screenX;
23307
+ svgPoint.y = screenY;
23308
+ const p = svgPoint.matrixTransform(inverseCtm);
23309
+ return { x: p.x, y: p.y };
23310
+ };
23311
+ // 使用当前地图视口矩形四角,将屏幕坐标映射到 SVG 坐标,确保底图与主视口对齐
23312
+ const topLeftSvg = screenToSvg(mapRect.left, mapRect.top);
23313
+ const topRightSvg = screenToSvg(mapRect.right, mapRect.top);
23314
+ const bottomLeftSvg = screenToSvg(mapRect.left, mapRect.bottom);
23315
+ if (!topLeftSvg || !topRightSvg || !bottomLeftSvg) {
23316
+ setMapImageFrame(null);
23317
+ return;
23318
+ }
23319
+ // 把当前主地图可视区域尺寸,按比例压到 Static API 允许的最大尺寸以内(受 Static API 640 上限约束)),同时不改变宽高比。
23320
+ const mapWidth = Math.max(1, Math.round(mapRect.width));
23321
+ const mapHeight = Math.max(1, Math.round(mapRect.height));
23322
+ const shrinkRatio = Math.min(1, MAX_STATIC_SIZE / Math.max(mapWidth, mapHeight));
23323
+ const staticWidth = Math.max(1, Math.round(mapWidth * shrinkRatio));
23324
+ const staticHeight = Math.max(1, Math.round(mapHeight * shrinkRatio));
23325
+ const center = mapBounds.getCenter();
23326
+ const currentZoom = mapRef.getZoom() || 20;
23327
+ // 尺寸缩小后同步补偿 zoom,保持与当前主图一致的地理覆盖范围
23328
+ const zoomCompensation = Math.log2(shrinkRatio);
23329
+ const adjustedZoom = currentZoom + zoomCompensation;
23330
+ const staticZoom = Math.max(0, Math.min(Math.floor(adjustedZoom), 22));
23331
+ const staticMapUrl = `https://maps.googleapis.com/maps/api/staticmap?center=${center.lat()},${center.lng()}&zoom=${staticZoom}&size=${staticWidth}x${staticHeight}&maptype=satellite&key=${googleMapStaticApiKey}`;
23332
+ // 通过三角点推导静态图在 SVG 中的宽高和旋转角
23333
+ // Math.hypot(x, y) 等价于 sqrt(x*x + y*y),计算两点之间的距离
23334
+ const width = Math.hypot(topRightSvg.x - topLeftSvg.x, topRightSvg.y - topLeftSvg.y);
23335
+ const height = Math.hypot(bottomLeftSvg.x - topLeftSvg.x, bottomLeftSvg.y - topLeftSvg.y);
23336
+ // Math.atan2(y, x) 计算反正切值,返回 [-π, π] 弧度,*180/π 转换为角度
23337
+ const rotationDeg = (Math.atan2(topRightSvg.y - topLeftSvg.y, topRightSvg.x - topLeftSvg.x) * 180) / Math.PI;
23338
+ // Static API zoom 只能取整;额外补偿小数部分,避免底图视觉偏小
23339
+ // 在有旋转的坐标系里,做“以中心为锚点”的等比放大补偿。
23340
+ const fractionalZoomScale = Math.pow(2, adjustedZoom - staticZoom); //算出“还差多少缩放比例”。例子:adjustedZoom=19.6,staticZoom=19,差 0.6,比例是 2^0.6 ≈ 1.515。
23341
+ //把原始 width/height 乘这个比例,得到补偿后的尺寸。
23342
+ const compensatedWidth = width * fractionalZoomScale;
23343
+ const compensatedHeight = height * fractionalZoomScale;
23344
+ //尺寸变大后,多出来的宽/高的一半(要从两边均匀扩张)。
23345
+ const offsetAlongX = (compensatedWidth - width) / 2;
23346
+ const offsetAlongY = (compensatedHeight - height) / 2;
23347
+ //“右方向”单位向量(从左上指向右上),因为图可能旋转了,不能只按水平 x 轴算。
23348
+ const unitX = width > 0 ? (topRightSvg.x - topLeftSvg.x) / width : 1;
23349
+ const unitY = width > 0 ? (topRightSvg.y - topLeftSvg.y) / width : 0;
23350
+ //“下方向”单位向量(从左上指向左下),同理用于旋转场景。
23351
+ const unitDownX = height > 0 ? (bottomLeftSvg.x - topLeftSvg.x) / height : 0;
23352
+ const unitDownY = height > 0 ? (bottomLeftSvg.y - topLeftSvg.y) / height : 1;
23353
+ /**
23354
+ * 计算补偿后的新左上角:
23355
+ * 从原左上角沿“右方向”回退半个扩展量,再沿“下方向”回退半个扩展量。
23356
+ * 这样放大后仍以原区域中心为中心,不会放大后位置偏移。
23357
+ */
23358
+ const compensatedTopLeftX = topLeftSvg.x - unitX * offsetAlongX - unitDownX * offsetAlongY;
23359
+ const compensatedTopLeftY = topLeftSvg.y - unitY * offsetAlongX - unitDownY * offsetAlongY;
23360
+ setMapImageFrame({
23361
+ url: staticMapUrl,
23362
+ x: compensatedTopLeftX,
23363
+ y: compensatedTopLeftY,
23364
+ width: compensatedWidth,
23365
+ height: compensatedHeight,
23366
+ transform: `rotate(${rotationDeg} ${compensatedTopLeftX} ${compensatedTopLeftY})`,
23367
+ });
23368
+ }
23369
+ else {
23370
+ setMapImageFrame(null);
23371
+ setStaticMapRetryCount(0);
23372
+ // console.log('[Magnifier] Background source: gray fallback (no static api key)');
23373
+ }
23374
+ }, [
23375
+ visible,
23376
+ dragState.isDragging,
23377
+ mapRef,
23378
+ svgViewBox?.x,
23379
+ svgViewBox?.y,
23380
+ svgViewBox?.width,
23381
+ svgViewBox?.height,
23382
+ svgRef,
23383
+ size,
23384
+ zoom,
23385
+ googleMapStaticApiKey,
23386
+ staticMapRetryCount,
23387
+ ]);
23388
+ useLayoutEffect(() => {
23389
+ if (!visible) {
23390
+ hasInitializedSideRef.current = false;
23391
+ setIsPlacementReady(false);
23392
+ return;
23393
+ }
23394
+ const updatePosition = () => {
23395
+ const mapDiv = mapRef?.getDiv?.();
23396
+ const mapRect = mapDiv?.getBoundingClientRect?.();
23397
+ const boxSize = Math.max(120, Math.round(size));
23398
+ // 设置放大镜大小
23399
+ setMagnifierBoxSize({ width: boxSize, height: boxSize });
23400
+ const viewportWidth = window.innerWidth;
23401
+ const viewportHeight = window.innerHeight;
23402
+ const baseMargin = 10; // 放大镜与边缘的基础间距
23403
+ const insets = getSafeAreaInsets();
23404
+ const marginTop = Math.max(baseMargin, insets.top);
23405
+ const marginRight = Math.max(baseMargin, insets.right);
23406
+ const marginBottom = Math.max(baseMargin, insets.bottom);
23407
+ const marginLeft = Math.max(baseMargin, insets.left);
23408
+ const topY = mapRect ? mapRect.top + marginTop : marginTop;
23409
+ // 顶部位置限制在可视区与安全区内,避免横屏时被刘海/手势条遮挡
23410
+ const safeTopY = Math.max(marginTop, Math.min(topY, viewportHeight - boxSize - marginBottom));
23411
+ let nextPlaceOnRight = placeOnRight;
23412
+ const ctm = svgRef?.getScreenCTM?.();
23413
+ // 首次显示时先同步算出侧边,再基于该侧边定位,避免“先左后右/先右后左”闪动
23414
+ if (!hasInitializedSideRef.current && dragState.currentPosition && ctm && mapRect) {
23415
+ const p = svgRef.createSVGPoint();
23416
+ p.x = dragState.currentPosition[0];
23417
+ p.y = dragState.currentPosition[1];
23418
+ const dragScreenPoint = p.matrixTransform(ctm);
23419
+ const mapMidX = mapRect.left + mapRect.width / 2;
23420
+ nextPlaceOnRight = dragScreenPoint.x < mapMidX;
23421
+ setPlaceOnRight(nextPlaceOnRight);
23422
+ hasInitializedSideRef.current = true;
23423
+ }
23424
+ const rightX = mapRect
23425
+ ? mapRect.right - boxSize - marginRight
23426
+ : viewportWidth - boxSize - marginRight;
23427
+ const leftX = mapRect ? mapRect.left + marginLeft : marginLeft;
23428
+ const safeX = nextPlaceOnRight ? rightX : leftX;
23429
+ const boundedX = Math.max(marginLeft, Math.min(safeX, viewportWidth - boxSize - marginRight));
23430
+ // 放大镜出现后,仅当拖拽点进入放大镜区域时才切换到对侧
23431
+ if (dragState.currentPosition && ctm) {
23432
+ const p = svgRef.createSVGPoint();
23433
+ p.x = dragState.currentPosition[0];
23434
+ p.y = dragState.currentPosition[1];
23435
+ // 应用这个矩阵,变换成屏幕坐标
23436
+ const dragScreenPoint = p.matrixTransform(ctm);
23437
+ const pointInMagnifier = dragScreenPoint.x >= boundedX &&
23438
+ dragScreenPoint.x <= boundedX + boxSize &&
23439
+ dragScreenPoint.y >= safeTopY &&
23440
+ dragScreenPoint.y <= safeTopY + boxSize;
23441
+ if (pointInMagnifier) {
23442
+ setPlaceOnRight((prev) => !prev);
23443
+ return;
23444
+ }
23445
+ }
23446
+ setMagnifierPosition({
23447
+ x: boundedX,
23448
+ y: safeTopY,
23449
+ });
23450
+ setIsPlacementReady(true);
23451
+ };
23452
+ updatePosition();
23453
+ window.addEventListener('resize', updatePosition);
23454
+ return () => window.removeEventListener('resize', updatePosition);
23455
+ }, [
23456
+ visible,
23457
+ size,
23458
+ mapRef,
23459
+ svgRef,
23460
+ placeOnRight,
23461
+ dragState.currentPosition?.[0],
23462
+ dragState.currentPosition?.[1],
23463
+ ]);
23464
+ // 早期返回必须在所有 hooks 之后
23465
+ if (!visible || !dragState.currentPosition || !svgViewBox) {
23466
+ return null;
23467
+ }
23468
+ const [centerX, centerY] = dragState.currentPosition;
23469
+ // 计算放大区域范围(以拖拽点为中心)
23470
+ //effectiveZoom = Math.max(0.001, zoom * getPixelScale())
23471
+ // 得到实际放大倍率。
23472
+ // zoom 是你设置的放大倍数(比如 3)
23473
+ // getPixelScale() 是当前 SVG 到屏幕的缩放因子(地图本身被缩放时要补偿)
23474
+ // Math.max(0.001, ...) 是防止出现 0 或极小值导致除零/异常
23475
+ // magnifierWidthInSvg = magnifierBoxSize.width / effectiveZoom
23476
+ // magnifierHeightInSvg = magnifierBoxSize.height / effectiveZoom
23477
+ // 把“屏幕上放大镜框的像素尺寸”换算成“SVG 坐标里要截取的实际尺寸”
23478
+ // 放大倍率越大,分母越大,截取范围越小 => 看起来越放大
23479
+ const effectiveZoom = Math.max(0.001, zoom * getPixelScale());
23480
+ const magnifierWidthInSvg = magnifierBoxSize.width / effectiveZoom;
23481
+ const magnifierHeightInSvg = magnifierBoxSize.height / effectiveZoom;
23482
+ // 计算放大区域的 viewBox
23483
+ const magnifierViewBox = {
23484
+ x: centerX - magnifierWidthInSvg / 2,
23485
+ y: centerY - magnifierHeightInSvg / 2,
23486
+ width: magnifierWidthInSvg,
23487
+ height: magnifierHeightInSvg,
23488
+ };
23489
+ // 样式缩放采用“弱抵消”,避免随 zoom 变细,保证放大镜内点线清晰度
23490
+ const styleZoomFactor = Math.max(1, zoom * 0.4);
23491
+ // 生成多边形点字符串(仅用于当前编辑禁区)
23492
+ const polygonPointsString = polygonPoints.length > 0 ? polygonPoints.map((p) => `${p[0]},${p[1]}`).join(' ') : '';
23493
+ const actureRotate = drag?.rotate ?? drag?.rotation ?? 0;
23494
+ // 渲染放大镜内容
23495
+ const magnifierContent = (jsxs("div", { style: {
23496
+ position: 'fixed',
23497
+ left: `${magnifierPosition.x}px`,
23498
+ top: `${magnifierPosition.y}px`,
23499
+ width: `${magnifierBoxSize.width}px`,
23500
+ height: `${magnifierBoxSize.height}px`,
23501
+ borderRadius: '50%',
23502
+ border: `2px solid #fff`,
23503
+ // boxShadow: '0 4px 20px rgba(0, 0, 0, 0.3)',
23504
+ overflow: 'hidden',
23505
+ zIndex: 10000,
23506
+ pointerEvents: 'none',
23507
+ background: 'rgba(235, 236, 240, 1)',
23508
+ visibility: isPlacementReady ? 'visible' : 'hidden',
23509
+ }, children: [jsxs("svg", {
23510
+ // 逻辑尺寸:与放大镜容器一致
23511
+ width: magnifierBoxSize.width, height: magnifierBoxSize.height,
23512
+ // 核心放大参数:从整张 SVG 中裁剪出当前需要展示的区域(x y width height)
23513
+ viewBox: `${magnifierViewBox.x} ${magnifierViewBox.y} ${magnifierViewBox.width} ${magnifierViewBox.height}`,
23514
+ // 保持内容居中并铺满窗口;比例不一致时裁边,不留空白
23515
+ preserveAspectRatio: "xMidYMid slice", style: {
23516
+ // CSS 尺寸:让 SVG 完全填满放大镜容器
23517
+ width: '100%',
23518
+ height: '100%',
23519
+ }, children: [mapImageFrame && (jsx("image", { href: mapImageFrame.url, x: mapImageFrame.x, y: mapImageFrame.y, width: mapImageFrame.width, height: mapImageFrame.height, transform: mapImageFrame.transform, preserveAspectRatio: "none", style: { opacity: 1 }, onLoad: () => {
23520
+ // console.log('✅ Map background loaded in magnifier');
23521
+ setStaticMapRetryCount(0);
23522
+ }, onError: (_e) => {
23523
+ // console.error('❌ Failed to load map background in magnifier', {
23524
+ // retryCount: staticMapRetryCount,
23525
+ // maxRetry: MAX_STATIC_MAP_RETRY,
23526
+ // url: mapImageFrame.url,
23527
+ // error: _e,
23528
+ // });
23529
+ setStaticMapRetryCount((prev) => {
23530
+ if (prev < MAX_STATIC_MAP_RETRY)
23531
+ return prev + 1;
23532
+ setMapImageFrame(null);
23533
+ return 0;
23534
+ });
23535
+ } }, `magnifier-static-map-${staticMapRetryCount}`)), svgElementDatas &&
23536
+ Object.keys(svgElementDatas).map((key) => {
23537
+ const elements = svgElementDatas[key] || [];
23538
+ // 过滤掉当前正在拖拽的禁区(稍后单独渲染拖拽后的状态)
23539
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23540
+ const filteredElements = key === DataType.OBSTACLE
23541
+ ? elements.filter((item) => item.id !== currentObstacleId)
23542
+ : elements;
23543
+ if (filteredElements.length === 0)
23544
+ return null;
23545
+ return (jsxs(GElement, { type: key, children: [key === 'channel' && jsx(ChannelClipPath, {}), filteredElements.map((item) => (
23546
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23547
+ jsx(SvgElement, { type: key, data: item }, item?.id)))] }, key));
23548
+ }), polygonPoints.length >= 3 && polygonPointsString && (jsxs(Fragment, { children: [jsx("polygon", { points: polygonPointsString, fill: fillColor, stroke: strokeColor, strokeWidth: (strokeWidth * 3.2) / styleZoomFactor, strokeOpacity: 1 }), polygonPoints.map((point, idx) => {
23549
+ const [x, y] = point;
23550
+ const isDraggingPoint = dragState.dragIndex === idx;
23551
+ const pointRadius = isDraggingPoint ? 14 / styleZoomFactor : 10 / styleZoomFactor;
23552
+ const pointFill = isDraggingPoint ? '#FFAB7E' : strokeColor;
23553
+ const pointStroke = isDraggingPoint ? strokeColor : '#fff';
23554
+ const pointStrokeWidth = isDraggingPoint
23555
+ ? 3.6 / styleZoomFactor
23556
+ : 3 / styleZoomFactor;
23557
+ return (jsx("circle", { cx: x, cy: y, r: pointRadius, fill: pointFill, stroke: pointStroke, strokeWidth: pointStrokeWidth }, idx));
23558
+ })] })), dragState.dragType === 'new' && dragState.edgeInfo && (jsx(Fragment, { children: jsx("line", { x1: dragState.edgeInfo.startPoint.x, y1: dragState.edgeInfo.startPoint.y, x2: dragState.edgeInfo.endPoint.x, y2: dragState.edgeInfo.endPoint.y, stroke: "#999", strokeWidth: (strokeWidth * 3.2) / styleZoomFactor, strokeDasharray: `${6 / styleZoomFactor},${6 / styleZoomFactor}` }) }))] }), jsx(CharginPile, { viewBox: magnifierViewBox || null, rotation: actureRotate, sizeScale: Math.max(1, zoom) })] }));
23559
+ // 使用 Portal 渲染到 body,避免层级问题
23560
+ return ReactDOM.createPortal(magnifierContent, document.body);
23561
+ };
23562
+
23563
+ var css_248z$6 = ".index-module_pointerCursor__Ee6pr {\n cursor: pointer;\n}\n\n.index-module_polygonPath__PynOn {\n pointer-events: stroke;\n cursor: pointer;\n}\n\n.index-module_dragging__xSFdO {\n cursor: grabbing;\n}\n\n.index-module_notCreate__bFnkV {\n cursor: no-drop;\n}";
23564
+ var styles$6 = {"pointerCursor":"index-module_pointerCursor__Ee6pr","polygonPath":"index-module_polygonPath__PynOn","dragging":"index-module_dragging__xSFdO","notCreate":"index-module_notCreate__bFnkV"};
23565
+ styleInject(css_248z$6);
23566
+
23149
23567
  /**
23150
23568
  * 几何计算工具函数
23151
23569
  */
@@ -23567,6 +23985,34 @@ const useCheckElement = () => {
23567
23985
  };
23568
23986
  };
23569
23987
 
23988
+ const Tooltip = ({ open, x, y, text, style, onClick }) => {
23989
+ if (!open)
23990
+ return null;
23991
+ const tooltipStyle = {
23992
+ position: 'fixed',
23993
+ left: x,
23994
+ top: y,
23995
+ backgroundColor: '#fff',
23996
+ borderRadius: '4px',
23997
+ height: '20px',
23998
+ lineHeight: '16px',
23999
+ fontSize: '12px',
24000
+ color: '#211F1F',
24001
+ padding: '2px 4px',
24002
+ whiteSpace: 'nowrap',
24003
+ zIndex: 9999,
24004
+ cursor: 'pointer',
24005
+ userSelect: 'none',
24006
+ ...style,
24007
+ };
24008
+ // 使用 createPortal 挂载到 body
24009
+ return createPortal(jsx("div", { style: tooltipStyle, onClick: (e) => {
24010
+ e.preventDefault();
24011
+ e.stopPropagation();
24012
+ onClick?.();
24013
+ }, children: text }), document.body);
24014
+ };
24015
+
23570
24016
  /**
23571
24017
  * 将坐标点数组转换为polygon points字符串
23572
24018
  * @param coordinates 坐标点数组 [[x1, y1], [x2, y2], ...]
@@ -23658,7 +24104,7 @@ const createPathData = (points) => {
23658
24104
  };
23659
24105
  const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor = 'rgba(0, 0, 0, 0.1)', hoverFillColor = '', 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自动判断
23660
24106
  }) => {
23661
- const { overlayScale, unitType, showStraddleBoundaryBorder } = useCommonContext();
24107
+ const { overlayScale, unitType, showStraddleBoundaryBorder, platform, onH5FirstSelectObstaclePoint } = useCommonContext();
23662
24108
  const { onHandleEvent } = useMapEditContext();
23663
24109
  const { svgRef } = useSvgEditContext();
23664
24110
  const [dragState, setDragState] = useState({
@@ -23676,7 +24122,6 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23676
24122
  const [selectedVertexIndex, setSelectedVertexIndex] = useState(-1);
23677
24123
  const { checkCanNotCreateAtPosition } = useCheckElement();
23678
24124
  const { editMapInfo } = useMapEditContext();
23679
- const { platform } = useCommonContext();
23680
24125
  // delete icon可能被上一个点遮挡,因为delete在右上方,所以手动处理点让点按照顺时针渲染,这样delete icon层级就会高一些
23681
24126
  // 编辑的场景禁区的点最后一个和第一个相同,会导致一个位置渲染两个点,需要额外处理下
23682
24127
  const coordinates = useMemo(() => {
@@ -23705,6 +24150,15 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23705
24150
  }, [svgRef]);
23706
24151
  // 删除确认 Tooltip 状态
23707
24152
  const [tooltipIndex, setTooltipIndex] = useState(null);
24153
+ const [tooltipPos, setTooltipPos] = useState({ x: 0, y: 0 });
24154
+ const [completeTooltipOpen, setCompleteTooltipOpen] = useState(false);
24155
+ const updateTooltipPos = (target) => {
24156
+ const rect = target.getBoundingClientRect();
24157
+ setTooltipPos({
24158
+ x: rect.left + rect.width + 4,
24159
+ y: rect.top - 10
24160
+ });
24161
+ };
23708
24162
  // 处理顶点点击(仅透出点击;不触发删除)
23709
24163
  const handleVertexClick = useCallback((e, index) => {
23710
24164
  // 阻止事件冒泡到Google Maps
@@ -23719,6 +24173,7 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23719
24173
  window.clearTimeout(clickTimerRef.current);
23720
24174
  }
23721
24175
  clickTimerRef.current = window.setTimeout(() => {
24176
+ setCompleteTooltipOpen(false);
23722
24177
  // 创建模式下点击顶点回调(仅透出点击)
23723
24178
  if (onPointClick) {
23724
24179
  onPointClick(index, e);
@@ -23909,9 +24364,14 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23909
24364
  // 开始长按计时器(1000ms)
23910
24365
  vertexLongPressTimerRef.current = window.setTimeout(() => {
23911
24366
  isVertexLongPressedRef.current = true;
23912
- setSelectedVertexIndex(index);
24367
+ setSelectedVertexIndex((prev) => {
24368
+ if (prev !== index) {
24369
+ onH5FirstSelectObstaclePoint?.();
24370
+ }
24371
+ return index;
24372
+ });
23913
24373
  }, 1000);
23914
- }, [editMode, createMode, completed, dragState.isDragging]);
24374
+ }, [editMode, createMode, completed, dragState.isDragging, onH5FirstSelectObstaclePoint]);
23915
24375
  const handleVertexLongPressEnd = useCallback(() => {
23916
24376
  if (vertexLongPressTimerRef.current !== null) {
23917
24377
  window.clearTimeout(vertexLongPressTimerRef.current);
@@ -24242,12 +24702,17 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24242
24702
  if (isDash && showStraddleBoundaryBorder) {
24243
24703
  return (jsx(DashPath, { className: canSelect ? styles$6.polygonPath : '', points: segment.points, stroke: strokeColor, strokeWidth: isHover ? strokeWidth + 1 : strokeWidth, strokeOpacity: strokeOpacity }, index));
24244
24704
  }
24245
- return (jsx("path", { d: pathData, fill: "none", stroke: strokeColor, strokeWidth: isHover ? strokeWidth + 1 : strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", className: canSelect ? styles$6.polygonPath : '', vectorEffect: "non-scaling-stroke", onClick: onPathClick, style: {
24246
- userSelect: 'none',
24247
- WebkitUserSelect: 'none',
24248
- WebkitTouchCallout: 'none',
24249
- touchAction: 'none',
24250
- } }, index));
24705
+ return (jsxs(Fragment, { children: [(editMode || createMode) && (jsx("path", { d: pathData, fill: "none", stroke: '#fff', strokeWidth: strokeWidth * 2, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke", style: {
24706
+ userSelect: 'none',
24707
+ WebkitUserSelect: 'none',
24708
+ WebkitTouchCallout: 'none',
24709
+ touchAction: 'none',
24710
+ } }, 'warp' + index)), jsx("path", { d: pathData, fill: "none", stroke: strokeColor, strokeWidth: isHover ? strokeWidth + 1 : strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", className: canSelect ? styles$6.polygonPath : '', vectorEffect: "non-scaling-stroke", onClick: onPathClick, style: {
24711
+ userSelect: 'none',
24712
+ WebkitUserSelect: 'none',
24713
+ WebkitTouchCallout: 'none',
24714
+ touchAction: 'none',
24715
+ } }, index)] }));
24251
24716
  }) }), (editMode || (createMode && completed)) &&
24252
24717
  renderCoordinates.length >= 2 &&
24253
24718
  renderCoordinates.map((coord, index) => {
@@ -24285,7 +24750,11 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24285
24750
  setHoverVertex(null);
24286
24751
  },
24287
24752
  }) }, `edge-${index}`));
24288
- }), ghostLastPath && (jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >= 2 && (jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed, fontSize: platform === PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, unitType: unitType }), jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint, fontSize: platform === PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, showFirstDistance: platform !== PlatformType.H5, unit: unitType }), hoverVertex && !dragState.isDragging && (jsx(VertexElement, { cx: hoverVertex.position.x, cy: hoverVertex.position.y, stroke: strokeColor, strokeOpacity: 0.6, fill: "white", fillOpacity: 0.8, pointerEvents: "none" })), ((createMode && showPoints) || editMode || (createMode && completed)) &&
24753
+ }), ghostLastPath && (jsxs(Fragment, { children: [jsx("path", { d: ghostLastPath, stroke: '#fff', strokeWidth: strokeWidth * 2, vectorEffect: "non-scaling-stroke", opacity: 0.7 }), jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })] })), ghostFirstPath && renderCoordinates.length >= 2 && (jsxs(Fragment, { children: [jsx("path", { d: ghostFirstPath, stroke: '#fff', strokeWidth: strokeWidth * 2, vectorEffect: "non-scaling-stroke", opacity: 0.7 }), jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })] })), jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed, fontSize: platform === PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, unitType: unitType }), jsx(Magnifier, { visible: platform === PlatformType.H5 &&
24754
+ dragState.isDragging &&
24755
+ dragState.dragIndex !== -1 &&
24756
+ dragState.currentPosition !== null &&
24757
+ (editMode || (createMode && completed)), dragState: dragState, polygonPoints: renderCoordinates, fillColor: fillColor, strokeColor: strokeColor, strokeWidth: strokeWidth, zoom: 3, size: 130 }), jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint, fontSize: platform === PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, showFirstDistance: platform !== PlatformType.H5, unit: unitType }), hoverVertex && !dragState.isDragging && (jsx(VertexElement, { cx: hoverVertex.position.x, cy: hoverVertex.position.y, stroke: strokeColor, strokeOpacity: 0.6, fill: "white", fillOpacity: 0.8, pointerEvents: "none" })), ((createMode && showPoints) || editMode || (createMode && completed)) &&
24289
24758
  renderCoordinates.map((coord, idx) => {
24290
24759
  // 判断当前顶点的状态
24291
24760
  const isLastPoint = idx === renderCoordinates.length - 1;
@@ -24325,6 +24794,7 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24325
24794
  }, 300);
24326
24795
  // 打开删除确认 Tooltip(仅在可编辑时)
24327
24796
  if (editMode || (createMode && completed)) {
24797
+ updateTooltipPos(e.target);
24328
24798
  setTooltipIndex(idx);
24329
24799
  }
24330
24800
  }, ...(platform === PlatformType.H5
@@ -24400,7 +24870,14 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24400
24870
  }
24401
24871
  }
24402
24872
  },
24403
- }) }), tooltipIndex === idx && coordinates.length > 3 && (jsxs("g", { transform: `translate(${coord[0] + 4 * overlayScale * 2}, ${coord[1] - 4 * overlayScale * 2}) scale(${overlayScale * 2})`, onClick: (e) => {
24873
+ onMouseEnter: canComplete ? (e) => {
24874
+ setCompleteTooltipOpen(true);
24875
+ updateTooltipPos(e.target);
24876
+ } : undefined,
24877
+ onMouseLeave: canComplete ? () => {
24878
+ setCompleteTooltipOpen(false);
24879
+ } : undefined,
24880
+ }) }), platform === PlatformType.H5 && tooltipIndex === idx && coordinates.length > 3 && (jsxs("g", { transform: `translate(${coord[0] + 4 * overlayScale * 2}, ${coord[1] - 4 * overlayScale * 2}) scale(${overlayScale * 2})`, onClick: (e) => {
24404
24881
  e.preventDefault();
24405
24882
  e.stopPropagation();
24406
24883
  if (onVertexDelete &&
@@ -24423,7 +24900,12 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24423
24900
  // >
24424
24901
  // </rect>
24425
24902
  )] }, `vertex-${idx}`));
24426
- })] }));
24903
+ }), platform === PlatformType.WEB && tooltipIndex !== null && (jsx(Tooltip, { open: true, x: tooltipPos.x, y: tooltipPos.y, text: "Remove", onClick: () => {
24904
+ if (onVertexDelete && (editMode || (createMode && completed)) && coordinates.length > 3) {
24905
+ onVertexDelete(renderCoordinates?.length - 1 - tooltipIndex);
24906
+ }
24907
+ setTooltipIndex(null);
24908
+ } })), platform === PlatformType.WEB && completeTooltipOpen && (jsx(Tooltip, { open: true, x: tooltipPos.x, y: tooltipPos.y, text: "Click to finish" }))] }));
24427
24909
  };
24428
24910
 
24429
24911
  const MowPartitionContext = createContext({
@@ -25102,15 +25584,15 @@ const useVisionOffTransform = (data, scaleConstraints
25102
25584
  };
25103
25585
  };
25104
25586
 
25105
- var _g$3, _defs$3;
25106
- 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); }
25587
+ var _g$6, _defs$6;
25588
+ 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); }
25107
25589
  var SvgTransformDelete = function SvgTransformDelete(props) {
25108
- return /*#__PURE__*/React.createElement("svg", _extends$4({
25590
+ return /*#__PURE__*/React.createElement("svg", _extends$7({
25109
25591
  xmlns: "http://www.w3.org/2000/svg",
25110
25592
  width: 20,
25111
25593
  height: 20,
25112
25594
  fill: "none"
25113
- }, props), _g$3 || (_g$3 = /*#__PURE__*/React.createElement("g", {
25595
+ }, props), _g$6 || (_g$6 = /*#__PURE__*/React.createElement("g", {
25114
25596
  clipPath: "url(#transform-delete_svg__a)"
25115
25597
  }, /*#__PURE__*/React.createElement("circle", {
25116
25598
  cx: 10,
@@ -25133,7 +25615,7 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
25133
25615
  fill: "#fff",
25134
25616
  rx: 0.8,
25135
25617
  transform: "rotate(45 6.323 5.191)"
25136
- }))), _defs$3 || (_defs$3 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
25618
+ }))), _defs$6 || (_defs$6 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
25137
25619
  id: "transform-delete_svg__b",
25138
25620
  x1: 17.727,
25139
25621
  x2: -1.215,
@@ -25153,15 +25635,15 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
25153
25635
  })))));
25154
25636
  };
25155
25637
 
25156
- var _g$2, _defs$2;
25157
- 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); }
25638
+ var _g$5, _defs$5;
25639
+ 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); }
25158
25640
  var SvgTransformRotate = function SvgTransformRotate(props) {
25159
- return /*#__PURE__*/React.createElement("svg", _extends$3({
25641
+ return /*#__PURE__*/React.createElement("svg", _extends$6({
25160
25642
  xmlns: "http://www.w3.org/2000/svg",
25161
25643
  width: 21,
25162
25644
  height: 20,
25163
25645
  fill: "none"
25164
- }, props), _g$2 || (_g$2 = /*#__PURE__*/React.createElement("g", {
25646
+ }, props), _g$5 || (_g$5 = /*#__PURE__*/React.createElement("g", {
25165
25647
  clipPath: "url(#transform-rotate_svg__a)"
25166
25648
  }, /*#__PURE__*/React.createElement("path", {
25167
25649
  fill: "url(#transform-rotate_svg__b)",
@@ -25169,7 +25651,7 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
25169
25651
  }), /*#__PURE__*/React.createElement("path", {
25170
25652
  fill: "#fff",
25171
25653
  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"
25172
- }))), _defs$2 || (_defs$2 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
25654
+ }))), _defs$5 || (_defs$5 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
25173
25655
  id: "transform-rotate_svg__b",
25174
25656
  x1: 17.84,
25175
25657
  x2: -1.103,
@@ -25189,15 +25671,15 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
25189
25671
  })))));
25190
25672
  };
25191
25673
 
25192
- var _g$1, _defs$1;
25193
- 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); }
25674
+ var _g$4, _defs$4;
25675
+ 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); }
25194
25676
  var SvgTransformScale = function SvgTransformScale(props) {
25195
- return /*#__PURE__*/React.createElement("svg", _extends$2({
25677
+ return /*#__PURE__*/React.createElement("svg", _extends$5({
25196
25678
  xmlns: "http://www.w3.org/2000/svg",
25197
25679
  width: 21,
25198
25680
  height: 20,
25199
25681
  fill: "none"
25200
- }, props), _g$1 || (_g$1 = /*#__PURE__*/React.createElement("g", {
25682
+ }, props), _g$4 || (_g$4 = /*#__PURE__*/React.createElement("g", {
25201
25683
  clipPath: "url(#transform-scale_svg__a)"
25202
25684
  }, /*#__PURE__*/React.createElement("path", {
25203
25685
  fill: "url(#transform-scale_svg__b)",
@@ -25205,7 +25687,7 @@ var SvgTransformScale = function SvgTransformScale(props) {
25205
25687
  }), /*#__PURE__*/React.createElement("path", {
25206
25688
  fill: "#fff",
25207
25689
  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"
25208
- }))), _defs$1 || (_defs$1 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
25690
+ }))), _defs$4 || (_defs$4 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
25209
25691
  id: "transform-scale_svg__b",
25210
25692
  x1: 17.84,
25211
25693
  x2: -1.103,
@@ -25225,15 +25707,15 @@ var SvgTransformScale = function SvgTransformScale(props) {
25225
25707
  })))));
25226
25708
  };
25227
25709
 
25228
- var _g, _defs;
25229
- 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); }
25710
+ var _g$3, _defs$3;
25711
+ 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); }
25230
25712
  var SvgTransformTranslate = function SvgTransformTranslate(props) {
25231
- return /*#__PURE__*/React.createElement("svg", _extends$1({
25713
+ return /*#__PURE__*/React.createElement("svg", _extends$4({
25232
25714
  xmlns: "http://www.w3.org/2000/svg",
25233
25715
  width: 20,
25234
25716
  height: 20,
25235
25717
  fill: "none"
25236
- }, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
25718
+ }, props), _g$3 || (_g$3 = /*#__PURE__*/React.createElement("g", {
25237
25719
  clipPath: "url(#transform-translate_svg__a)"
25238
25720
  }, /*#__PURE__*/React.createElement("circle", {
25239
25721
  cx: 10,
@@ -25243,7 +25725,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
25243
25725
  }), /*#__PURE__*/React.createElement("path", {
25244
25726
  fill: "#fff",
25245
25727
  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"
25246
- }))), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
25728
+ }))), _defs$3 || (_defs$3 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
25247
25729
  id: "transform-translate_svg__b",
25248
25730
  x1: 17.727,
25249
25731
  x2: -1.215,
@@ -25916,6 +26398,97 @@ const useDoodleTransform = (data, onTransformChange, options) => {
25916
26398
  };
25917
26399
  };
25918
26400
 
26401
+ var _g$2, _defs$2;
26402
+ 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); }
26403
+ var SvgDisabledRotate = function SvgDisabledRotate(props) {
26404
+ return /*#__PURE__*/React.createElement("svg", _extends$3({
26405
+ xmlns: "http://www.w3.org/2000/svg",
26406
+ width: 16,
26407
+ height: 16,
26408
+ fill: "none"
26409
+ }, props), _g$2 || (_g$2 = /*#__PURE__*/React.createElement("g", {
26410
+ clipPath: "url(#disabled-rotate_svg__a)"
26411
+ }, /*#__PURE__*/React.createElement("path", {
26412
+ fill: "#fff",
26413
+ d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0"
26414
+ }), /*#__PURE__*/React.createElement("path", {
26415
+ fill: "#211F1F",
26416
+ fillOpacity: 0.4,
26417
+ d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0"
26418
+ }), /*#__PURE__*/React.createElement("path", {
26419
+ fill: "#fff",
26420
+ fillOpacity: 0.7,
26421
+ d: "M9.192 11.775a4.36 4.36 0 0 1-5.277-3.93l-.013-.326v-.002a.655.655 0 0 1 1.31 0v.002a3.05 3.05 0 0 0 1.71 2.738l.208.091a3.05 3.05 0 0 0 1.781.147l.22-.057q.234-.07.451-.175l-.919-.354a.653.653 0 1 1 .47-1.22l2.033.782a.654.654 0 0 1 .251 1.047l.002.001a4.36 4.36 0 0 1-2.227 1.256M6.809 3.639a4.36 4.36 0 0 1 5.289 4.256v.002a.654.654 0 1 1-1.309 0v-.002a3.05 3.05 0 0 0-1.71-2.738l-.208-.091a3.05 3.05 0 0 0-1.781-.147l-.22.057a3 3 0 0 0-.451.175l.919.354a.654.654 0 0 1-.47 1.22l-2.033-.782a.654.654 0 0 1-.251-1.046l-.002-.002a4.36 4.36 0 0 1 2.227-1.256"
26422
+ }))), _defs$2 || (_defs$2 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
26423
+ id: "disabled-rotate_svg__a"
26424
+ }, /*#__PURE__*/React.createElement("path", {
26425
+ fill: "#fff",
26426
+ d: "M16 0H0v16h16z"
26427
+ })))));
26428
+ };
26429
+
26430
+ var _g$1, _defs$1;
26431
+ 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); }
26432
+ var SvgDisabledScale = function SvgDisabledScale(props) {
26433
+ return /*#__PURE__*/React.createElement("svg", _extends$2({
26434
+ xmlns: "http://www.w3.org/2000/svg",
26435
+ width: 16,
26436
+ height: 16,
26437
+ fill: "none"
26438
+ }, props), _g$1 || (_g$1 = /*#__PURE__*/React.createElement("g", {
26439
+ clipPath: "url(#disabled-scale_svg__a)"
26440
+ }, /*#__PURE__*/React.createElement("path", {
26441
+ fill: "#fff",
26442
+ d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0"
26443
+ }), /*#__PURE__*/React.createElement("path", {
26444
+ fill: "#211F1F",
26445
+ fillOpacity: 0.4,
26446
+ d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0"
26447
+ }), /*#__PURE__*/React.createElement("path", {
26448
+ fill: "#fff",
26449
+ fillOpacity: 0.7,
26450
+ d: "M3.972 6.612a.64.64 0 0 0 1.28 0v-.437l4.554 4.554H9.41a.64.64 0 0 0 0 1.28h1.979a.64.64 0 0 0 .636-.606l.003-.036.001-1.98a.64.64 0 1 0-1.28.001v.474L6.158 5.27h.435a.64.64 0 0 0 0-1.28h-1.98a.64.64 0 0 0-.64.64z"
26451
+ }))), _defs$1 || (_defs$1 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
26452
+ id: "disabled-scale_svg__a"
26453
+ }, /*#__PURE__*/React.createElement("path", {
26454
+ fill: "#fff",
26455
+ d: "M0 16h16V0H0z"
26456
+ })))));
26457
+ };
26458
+
26459
+ var _g, _defs;
26460
+ 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); }
26461
+ var SvgDisabledTranslate = function SvgDisabledTranslate(props) {
26462
+ return /*#__PURE__*/React.createElement("svg", _extends$1({
26463
+ xmlns: "http://www.w3.org/2000/svg",
26464
+ width: 16,
26465
+ height: 16,
26466
+ fill: "none"
26467
+ }, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
26468
+ clipPath: "url(#disabled-translate_svg__a)"
26469
+ }, /*#__PURE__*/React.createElement("circle", {
26470
+ cx: 8,
26471
+ cy: 8,
26472
+ r: 8,
26473
+ fill: "#fff"
26474
+ }), /*#__PURE__*/React.createElement("circle", {
26475
+ cx: 8,
26476
+ cy: 8,
26477
+ r: 8,
26478
+ fill: "#211F1F",
26479
+ fillOpacity: 0.4
26480
+ }), /*#__PURE__*/React.createElement("path", {
26481
+ fill: "#fff",
26482
+ fillOpacity: 0.7,
26483
+ d: "M12.944 8.608a.64.64 0 0 0-.079-.97l-1.333-1.334a.64.64 0 0 0-.905.905l.305.305H8.564V5.136l.308.308a.642.642 0 0 0 .906-.906l-1.4-1.399a.64.64 0 0 0-.906 0q-.036.037-.064.08L6.075 4.55a.64.64 0 0 0 .905.905l.305-.304v2.362H4.91l.306-.306a.64.64 0 0 0-.904-.904l-1.4 1.4a.64.64 0 0 0 .077.97l1.334 1.333a.64.64 0 0 0 .906-.905l-.31-.309h2.367v2.38l-.304-.305a.64.64 0 1 0-.905.906l1.4 1.4a.64.64 0 0 0 .97-.08l1.332-1.333a.64.64 0 0 0-.905-.905l-.309.308v-2.37h2.385l-.31.309a.64.64 0 1 0 .905.904z"
26484
+ }))), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
26485
+ id: "disabled-translate_svg__a"
26486
+ }, /*#__PURE__*/React.createElement("path", {
26487
+ fill: "#fff",
26488
+ d: "M16 0H0v16h16z"
26489
+ })))));
26490
+ };
26491
+
25919
26492
  var css_248z$5 = ".index-module_doodleHover__jIZHV path {\n fill: #2EC1B2;\n}";
25920
26493
  var styles$5 = {"doodleHover":"index-module_doodleHover__jIZHV"};
25921
26494
  styleInject(css_248z$5);
@@ -26114,15 +26687,16 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
26114
26687
  const infoBoxHeight = 40 * overlayScale; // 信息框高度
26115
26688
  const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
26116
26689
  const circleScale = platform === PlatformType.H5 ? 1.5 * overlayScale : 2 * overlayScale;
26117
- return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#B2B4B9", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
26690
+ const disacledScale = circleScale * 1.2;
26691
+ return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#B2B4B9", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", ...(platform === PlatformType.H5
26118
26692
  ? {
26119
26693
  onTouchStart: createReactEventHandler((e) => {
26120
26694
  handleMouseDownWithDisabled(e);
26121
26695
  }),
26122
26696
  }
26123
26697
  : {
26124
- onMouseDown: handleMouseDownWithDisabled,
26125
- }) }), jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r: 10 * circleScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[3].x, cy: selectionBoxPoints[3].y, r: 10 * circleScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[1].x, cy: selectionBoxPoints[1].y, r: 10 * circleScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[2].x, cy: selectionBoxPoints[2].y, r: 10 * circleScale, fill: "#B2B4B9", stroke: "none" }), platform === PlatformType.H5 && (jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
26698
+ // onMouseDown: handleMouseDownWithDisabled,
26699
+ }) }), jsx("g", { transform: `translate(${selectionBoxPoints[3].x}, ${selectionBoxPoints[3].y})`, children: jsx("g", { transformOrigin: "center", transform: `translate(-${10 * circleScale}, -${10 * circleScale}) scale(${disacledScale})`, children: jsx(SvgDisabledRotate, {}) }) }), jsx("g", { transform: `translate(${selectionBoxPoints[1].x}, ${selectionBoxPoints[1].y})`, children: jsx("g", { transformOrigin: "center", transform: `translate(-${10 * circleScale}, -${10 * circleScale}) scale(${disacledScale})`, children: jsx(SvgDisabledTranslate, {}) }) }), jsx("g", { transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsx("g", { transformOrigin: "center", transform: `translate(-${10 * circleScale}, -${10 * circleScale}) scale(${disacledScale})`, children: jsx(SvgDisabledScale, {}) }) }), platform === PlatformType.H5 && (jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
26126
26700
  onClickInfo?.();
26127
26701
  }, children: jsx("div", { style: {
26128
26702
  padding: `5px ${10 * overlayScale}px`,
@@ -27053,68 +27627,6 @@ const MowerPosition = React__default.memo(({ editMap, mowerPositionData, viewBox
27053
27627
  }, children: jsx("img", { src: mowerImage, style: { width: '100%', height: '100%', objectFit: 'contain' } }) }) }));
27054
27628
  });
27055
27629
 
27056
- var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHHSURBVHgBtVtdjF3VdV7rnHPHtLbUkRr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DuxHJ4EC6h/Nrd9+2l9dadbdpumDeX+ipjKDajmaKE0iVC1kkptUqnuFtoLbvvJNOyC4tUtG3ETWOxynssx3gf9R8Pm2r2EIXgxWC4JMBcfvXunTu6djhDi80TQ90aga2uv4Ivs0bfSZtHSQbLyMwSUekfruB0PF6ppMW8UVwAE9gebywlN66b3klilD2Pf31uDi6hLOvSi8u3X3t5sOGmT9FQqxqndk2iyZ50QKXjahPxqFrchL3WlQPS0Rkd9QgwG8DovujaUw4dlCnIqkiA+2NjzR2PH5x7Gi6xXLKFy3Lnb3xhOrRhL60tT3TFnwKIe/sejGDL6DpJgAXn+YSMx7iTk28O1z3SaUe8ZIc+hfCeJ772aB8us3wgwF4+d9cXplqIM6Hrprrgm9fSimSMaasE5JhGSG494iFMVKKgKvk7B94JT7D7NL2654m/v3ygXlYEsJfpu35rArCejm23jex7q/05D+qYOYHOORZcQSmFVYgpfunoY419ODP21UOH5lbsr9RWFHBZpqd3jsMVZybJyJTO4gbCPk6YJgjrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
27057
-
27058
- const useChargingPile = ({ viewBox, rotation = 0 }) => {
27059
- const { svgElementDatas } = useSvgEditContext();
27060
- const { sn } = useCommonContext();
27061
- const items = useMemo(() => {
27062
- if (!svgElementDatas || !viewBox)
27063
- return [];
27064
- const chargingPiles = svgElementDatas?.[DataType.CHARGING_PILE];
27065
- if (!chargingPiles)
27066
- return [];
27067
- const results = [];
27068
- for (const element of chargingPiles) {
27069
- const center = element.points?.[0];
27070
- if (!center)
27071
- continue;
27072
- const size = element.style?.radius ? element.style.radius * 2 : 55;
27073
- const direction = element?.direction || 0;
27074
- const angle = (direction * 180) / Math.PI;
27075
- const rotationDegree = 270 - angle; // 正东是正方向,需要处理下
27076
- const actualRotation = rotationDegree - rotation;
27077
- const relX = (center[0] - viewBox.x) / viewBox.width;
27078
- const relY = (center[1] - viewBox.y) / viewBox.height;
27079
- if (isFinite(relX) && isFinite(relY)) {
27080
- results.push({
27081
- leftPct: relX * 100,
27082
- topPct: relY * 100,
27083
- size,
27084
- rotateDeg: actualRotation,
27085
- imageSrc: chargingPileImage,
27086
- });
27087
- }
27088
- }
27089
- return results;
27090
- }, [svgElementDatas, viewBox?.x, viewBox?.y, viewBox?.width, viewBox?.height, rotation, sn]);
27091
- return items;
27092
- };
27093
-
27094
- const CharginPile = React__default.memo(({ viewBox, rotation = 0, isHighlight = true }) => {
27095
- const items = useChargingPile({ viewBox: viewBox || null, rotation });
27096
- const containerStyle = useMemo(() => ({
27097
- position: 'absolute',
27098
- top: 0,
27099
- left: 0,
27100
- width: '100%',
27101
- height: '100%',
27102
- pointerEvents: 'none',
27103
- zIndex: 750,
27104
- opacity: isHighlight ? SvgMapOpacity.HIGHLIGHT : SvgMapOpacity.UN_HIGHLIGHT,
27105
- }), [isHighlight]);
27106
- return (jsx("div", { style: containerStyle, children: items?.map((item, idx) => (jsx("div", { className: "charging-pile", style: {
27107
- position: 'absolute',
27108
- width: item.size,
27109
- height: item.size,
27110
- left: `${item.leftPct}%`,
27111
- top: `${item.topPct}%`,
27112
- transform: `translate(-50%, -50%) rotate(${item.rotateDeg}deg)`,
27113
- pointerEvents: 'auto',
27114
- zIndex: 750,
27115
- }, children: jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }, `pile-${idx}`))) }));
27116
- });
27117
-
27118
27630
  var css_248z$3 = ".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.index-module_boundaryLabel__GDHFn .index-module_isolatedIcon__1pRXN {\n position: absolute;\n width: 24px;\n height: 24px;\n top: -30px;\n left: 50%;\n transform: translateX(-50%);\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}";
27119
27631
  var styles$3 = {"container":"index-module_container__7IatW","boundaryLabel":"index-module_boundaryLabel__GDHFn","isolatedIcon":"index-module_isolatedIcon__1pRXN","base":"index-module_base__qy2SG","extended":"index-module_extended__0TMAt"};
27120
27632
  styleInject(css_248z$3);
@@ -28954,7 +29466,7 @@ const defaultMapConfig$1 = DEFAULT_STYLES;
28954
29466
  // 地图渲染器组件
28955
29467
  const MowerMapRenderer = forwardRef(({ sn, mowerIconConfig = {}, platform = PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, isHighlight = true, mapConfig,
28956
29468
  // pathConfig,
28957
- modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onError, className, style, googleMapInstance: _googleMapInstance, dragMap = false, canRotateMap = false, dragCallbacks, defaultTransform, debug: _debug = false, doodleList = [], editMap = false, unStructMapData, disabledObstacles = false, onHandleEnterRecord, onHandleCompleteRecord, onHandleStopRecord, onHandleDeleteElement, onSaveBoundaryData, onSaveMap, onEditInfoMapChange, onUpdateBoundary, heightOptions, globalHeight, onHandleEvent, onSelectElement, }, ref) => {
29469
+ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onError, className, style, zIndex, googleMapInstance: _googleMapInstance, dragMap = false, canRotateMap = false, dragCallbacks, defaultTransform, debug: _debug = false, doodleList = [], editMap = false, unStructMapData, disabledObstacles = false, onHandleEnterRecord, onHandleCompleteRecord, onHandleStopRecord, onHandleDeleteElement, onSaveBoundaryData, onSaveMap, onEditInfoMapChange, onUpdateBoundary, heightOptions, globalHeight, googleMapStaticApiKey, onHandleEvent, onSelectElement, onH5FirstSelectObstaclePoint, }, ref) => {
28958
29470
  const [currentError, setCurrentError] = useState(null);
28959
29471
  // const mapRef = useMap();
28960
29472
  const [processStateIsMowing, setProcessStateIsMowing] = useState(false);
@@ -29112,48 +29624,6 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29112
29624
  currentMowingPartitionId,
29113
29625
  processStateIsMowing,
29114
29626
  ]);
29115
- const commonValue = useMemo(() => {
29116
- return {
29117
- sn,
29118
- editMap,
29119
- platform,
29120
- language,
29121
- unitType,
29122
- svgViewBox,
29123
- heightOptions,
29124
- globalHeight,
29125
- mapConfig: mergedMapConfig,
29126
- mapJson,
29127
- drag: {
29128
- x: defaultTransform?.x ?? 0,
29129
- y: defaultTransform?.y ?? 0,
29130
- rotate: (defaultTransform?.rotation ?? 0) + originNorthRotate,
29131
- },
29132
- mapRef,
29133
- overlayScale,
29134
- doodleList,
29135
- mowerIconConfig,
29136
- showStraddleBoundaryBorder,
29137
- };
29138
- }, [
29139
- sn,
29140
- editMap,
29141
- platform,
29142
- svgViewBox,
29143
- unitType,
29144
- language,
29145
- heightOptions,
29146
- globalHeight,
29147
- mergedMapConfig,
29148
- mapJson,
29149
- defaultTransform,
29150
- originNorthRotate,
29151
- mapRef,
29152
- overlayScale,
29153
- doodleList,
29154
- mowerIconConfig,
29155
- showStraddleBoundaryBorder,
29156
- ]);
29157
29627
  const mowerPositionData = useMemo(() => {
29158
29628
  // realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
29159
29629
  // 在初始的状态按照正常图标进行渲染,所以构造一个基本在rtk桩的一个数据
@@ -29199,15 +29669,12 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29199
29669
  const bounds = useMemo(() => {
29200
29670
  if (!mapJson)
29201
29671
  return null;
29202
- // 计算边界
29203
- const bounds = calculateMapBounds(mapJson);
29204
- if (!bounds) {
29205
- handleError('无法计算地图边界');
29206
- return;
29672
+ const mapBoundsData = calculateMapBounds(mapJson);
29673
+ if (!mapBoundsData) {
29674
+ console.warn('Failed to calculate map bounds');
29675
+ return null;
29207
29676
  }
29208
- // 将自定义边界转换为Google Maps LatLngBounds(使用有效的GPS坐标)
29209
29677
  const validBounds = getValidGpsBounds(mapJson, 0);
29210
- // 地图数据中的坐标格式是 [longitude, latitude]
29211
29678
  const [swLng0, swLat0] = validBounds.sw;
29212
29679
  const [neLng0, neLat0] = validBounds.ne;
29213
29680
  const [swX0, swY0] = proj4(WGS84, WEB_MERCATOR, [swLng0, swLat0]);
@@ -29218,11 +29685,58 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29218
29685
  const neY = neY0 + drag.y;
29219
29686
  const [swLng, swLat] = proj4(WEB_MERCATOR, WGS84, [swX, swY]);
29220
29687
  const [neLng, neLat] = proj4(WEB_MERCATOR, WGS84, [neX, neY]);
29221
- const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
29222
- new window.google.maps.LatLng(neLat, neLng) // 东北角
29223
- );
29224
- return googleBounds;
29688
+ return new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), new window.google.maps.LatLng(neLat, neLng));
29225
29689
  }, [mapJson, drag.x, drag.y]);
29690
+ const commonValue = useMemo(() => {
29691
+ return {
29692
+ sn,
29693
+ editMap,
29694
+ platform,
29695
+ language,
29696
+ unitType,
29697
+ svgViewBox,
29698
+ heightOptions,
29699
+ globalHeight,
29700
+ mapConfig: mergedMapConfig,
29701
+ mapJson,
29702
+ drag: {
29703
+ x: defaultTransform?.x ?? 0,
29704
+ y: defaultTransform?.y ?? 0,
29705
+ rotate: (defaultTransform?.rotation ?? 0) + originNorthRotate,
29706
+ },
29707
+ mapRef,
29708
+ bounds,
29709
+ overlayScale,
29710
+ doodleList,
29711
+ mowerIconConfig,
29712
+ showStraddleBoundaryBorder,
29713
+ overlayLayout,
29714
+ googleMapStaticApiKey,
29715
+ onH5FirstSelectObstaclePoint,
29716
+ };
29717
+ }, [
29718
+ sn,
29719
+ editMap,
29720
+ platform,
29721
+ svgViewBox,
29722
+ unitType,
29723
+ language,
29724
+ heightOptions,
29725
+ globalHeight,
29726
+ mergedMapConfig,
29727
+ mapJson,
29728
+ defaultTransform,
29729
+ originNorthRotate,
29730
+ mapRef,
29731
+ bounds,
29732
+ overlayScale,
29733
+ doodleList,
29734
+ mowerIconConfig,
29735
+ showStraddleBoundaryBorder,
29736
+ overlayLayout,
29737
+ googleMapStaticApiKey,
29738
+ onH5FirstSelectObstaclePoint,
29739
+ ]);
29226
29740
  const fitBounds = useCallback((padding = 0) => {
29227
29741
  if (!mapJson || !mapRef)
29228
29742
  return null;
@@ -29537,7 +30051,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29537
30051
  // svgEditMapRef?.current?.adjustSvgSize?.(layout);
29538
30052
  setOverlayLayout(layout);
29539
30053
  }
29540
- }, map: mapRef, mapPaneName: 'overlayMouseTarget', bounds: bounds, rotate: actureRotate, children: [jsx(MapDrag, { map: mapRef, dragCallbacks: dragCallbacks, onBoundaryLabelsCollapse: () => { }, onTransformChange: handleDragMove, isDragMap: dragMap, canRotateMap: canRotateMap }), jsx(MowPartitionContextProvider, { value: mowPartitionValue, children: jsx(SvgMapComponent, { isHighlight: isHighlight, editMap: editMap, ref: svgMapRef, pathData: pathJson, mapConfig: mergedMapConfig, mowPartitionData: mowPartitionData }) }), jsx(MowerPosition, { editMap: editMap, mowerPositionData: mowerPositionData, viewBox: svgViewBox || null, modelType: modelType, hasEdger: edger, mapData: mapJson, mapConfig: mergedMapConfig, realTimeData: realTimeData, onMowingPositionChange: onMowingPositionChange, isHighlight: isHighlight }), jsx(CharginPile, { viewBox: svgViewBox || null, rotation: actureRotate, isHighlight: isHighlight }), jsx(BoundaryLabels, { editMap: editMap, mapData: mapJson, onlyRead: onlyRead, pathData: pathJson, unitType: unitType, viewBox: svgViewBox || null, rotation: actureRotate, mowPartitionData: mowPartitionData, realTimeData: realTimeData, isHighlight: isHighlight }), jsx(Antennas, { editMap: editMap, antennaConfig: antennaConfig || [], layout: overlayLayout || undefined, viewBox: svgViewBox || null, rotation: actureRotate, onlyRead: onlyRead, isHighlight: isHighlight }), jsx(SvgEditMap, { editMap: editMap, ref: svgEditMapRef, mapConfig: mergedMapConfig, onEditInfoMapChange: onEditInfoMapChange })] })] }) }) }));
30054
+ }, map: mapRef, mapPaneName: 'overlayMouseTarget', bounds: bounds, rotate: actureRotate, zIndex: zIndex, children: [jsx(MapDrag, { map: mapRef, dragCallbacks: dragCallbacks, onBoundaryLabelsCollapse: () => { }, onTransformChange: handleDragMove, isDragMap: dragMap, canRotateMap: canRotateMap }), jsx(MowPartitionContextProvider, { value: mowPartitionValue, children: jsx(SvgMapComponent, { isHighlight: isHighlight, editMap: editMap, ref: svgMapRef, pathData: pathJson, mapConfig: mergedMapConfig, mowPartitionData: mowPartitionData }) }), jsx(MowerPosition, { editMap: editMap, mowerPositionData: mowerPositionData, viewBox: svgViewBox || null, modelType: modelType, hasEdger: edger, mapData: mapJson, mapConfig: mergedMapConfig, realTimeData: realTimeData, onMowingPositionChange: onMowingPositionChange, isHighlight: isHighlight }), jsx(CharginPile, { viewBox: svgViewBox || null, rotation: actureRotate, isHighlight: isHighlight }), jsx(BoundaryLabels, { editMap: editMap, mapData: mapJson, onlyRead: onlyRead, pathData: pathJson, unitType: unitType, viewBox: svgViewBox || null, rotation: actureRotate, mowPartitionData: mowPartitionData, realTimeData: realTimeData, isHighlight: isHighlight }), jsx(Antennas, { editMap: editMap, antennaConfig: antennaConfig || [], layout: overlayLayout || undefined, viewBox: svgViewBox || null, rotation: actureRotate, onlyRead: onlyRead, isHighlight: isHighlight }), jsx(SvgEditMap, { editMap: editMap, ref: svgEditMapRef, mapConfig: mergedMapConfig, onEditInfoMapChange: onEditInfoMapChange })] })] }) }) }));
29541
30055
  });
29542
30056
  MowerMapRenderer.displayName = 'MowerMapRenderer';
29543
30057