@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.js CHANGED
@@ -10645,12 +10645,12 @@ const SCALE_FACTOR = 50; // 50像素/米
10645
10645
  * 默认线宽设置
10646
10646
  */
10647
10647
  const DEFAULT_LINE_WIDTHS = {
10648
- BOUNDARY: 3,
10649
- OBSTACLE: 3,
10648
+ BOUNDARY: 2,
10649
+ OBSTACLE: 2,
10650
10650
  CHARGING_PILE: 3,
10651
10651
  CHANNEL: 3,
10652
10652
  PATH: 20,
10653
- VISION_OFF_AREA: 3,
10653
+ VISION_OFF_AREA: 2,
10654
10654
  TIME_LIMIT_OBSTACLE: 1,
10655
10655
  };
10656
10656
  /**
@@ -13729,7 +13729,6 @@ class BaseData {
13729
13729
  else {
13730
13730
  this.computedArea = 0;
13731
13731
  }
13732
- this.canEdit = false;
13733
13732
  }
13734
13733
  }
13735
13734
  /**
@@ -13752,7 +13751,6 @@ class BoundaryData extends BaseData {
13752
13751
  this.recBaseAngle = originalData?.rec_base_angle;
13753
13752
  this.channels = channels;
13754
13753
  this.style = style;
13755
- this.canEdit = true;
13756
13754
  }
13757
13755
  }
13758
13756
  /**
@@ -13780,7 +13778,6 @@ class ObstacleData extends BaseData {
13780
13778
  this.end_timestamp = originalData?.end_timestamp;
13781
13779
  this.name = originalData?.name || 'Noname';
13782
13780
  this.style = style;
13783
- this.canEdit = true;
13784
13781
  }
13785
13782
  }
13786
13783
  /**
@@ -13808,7 +13805,6 @@ class DoodleData extends BaseData {
13808
13805
  this.style = style;
13809
13806
  this.create_ts = originalData?.create_ts || Date.now();
13810
13807
  this.expiration_ts = originalData?.expiration_ts || Date.now() + 3600000;
13811
- this.canEdit = true;
13812
13808
  this.computedArea = this.getDoodleComputedArea();
13813
13809
  }
13814
13810
  getDoodleComputedArea() {
@@ -13825,7 +13821,6 @@ class VisionOffData extends BaseData {
13825
13821
  const convertedPoints = convertPointsFormat(originalData?.points) || [];
13826
13822
  super(originalData?.id, exports.DataType.VISION_OFF, level, exports.RenderType.POLYGON, convertedPoints, originalData);
13827
13823
  this.style = style;
13828
- this.canEdit = true;
13829
13824
  }
13830
13825
  }
13831
13826
  /**
@@ -19846,7 +19841,9 @@ function OverlayViewFunctional({ map, position, bounds, rotate, mapPaneName, zIn
19846
19841
  }, [map, overlay]);
19847
19842
  // to move the container to the foreground and background
19848
19843
  React.useEffect(() => {
19849
- container.style.zIndex = `${zIndex}`;
19844
+ if (zIndex) {
19845
+ container.style.zIndex = `${zIndex}`;
19846
+ }
19850
19847
  }, [zIndex, container]);
19851
19848
  return ReactDOM.createPortal(children, container);
19852
19849
  }
@@ -22673,15 +22670,25 @@ var index = {
22673
22670
  const CommonContext = React.createContext({
22674
22671
  sn: '',
22675
22672
  editMap: false,
22676
- mowerIconConfig: {},
22673
+ mowerIconConfig: {
22674
+ mapImgUrl: '',
22675
+ mapDisabledUrl: '',
22676
+ mapNoPositionUrl: '',
22677
+ },
22677
22678
  platform: exports.PlatformType.WEB,
22678
22679
  svgViewBox: null,
22679
22680
  unitType: UnitsType.Metric,
22681
+ mapConfig: {},
22682
+ mapJson: null,
22683
+ drag: { x: 0, y: 0, rotate: 0, rotation: 0 },
22680
22684
  mapRef: null,
22685
+ bounds: null,
22681
22686
  globalHeight: 0,
22682
22687
  heightOptions: [],
22683
22688
  overlayScale: 1,
22684
22689
  showStraddleBoundaryBorder: true,
22690
+ googleMapStaticApiKey: '',
22691
+ onH5FirstSelectObstaclePoint: undefined,
22685
22692
  });
22686
22693
  const CommonContextProvider = CommonContext.Provider;
22687
22694
  const useCommonContext = () => React.useContext(CommonContext);
@@ -22928,9 +22935,9 @@ const VertexElement = React.memo(({ r, stroke, fill, ...props }) => {
22928
22935
  });
22929
22936
 
22930
22937
  var _path$1;
22931
- 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); }
22938
+ 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); }
22932
22939
  var SvgDelete = function SvgDelete(props) {
22933
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
22940
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
22934
22941
  xmlns: "http://www.w3.org/2000/svg",
22935
22942
  width: 16,
22936
22943
  height: 16,
@@ -23113,10 +23120,6 @@ const DistanceLabels = ({ coordinates, createMode = false, editMode = false, com
23113
23120
  } }))] }));
23114
23121
  };
23115
23122
 
23116
- 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}";
23117
- var styles$6 = {"pointerCursor":"index-module_pointerCursor__Ee6pr","polygonPath":"index-module_polygonPath__PynOn","dragging":"index-module_dragging__xSFdO","notCreate":"index-module_notCreate__bFnkV"};
23118
- styleInject(css_248z$6);
23119
-
23120
23123
  exports.CreateStatus = void 0;
23121
23124
  (function (CreateStatus) {
23122
23125
  CreateStatus["CREATING"] = "creating";
@@ -23166,6 +23169,421 @@ const MapEditContext = React.createContext({
23166
23169
  const MapEditContextProvider = MapEditContext.Provider;
23167
23170
  const useMapEditContext = () => React.useContext(MapEditContext);
23168
23171
 
23172
+ var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8Y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WakEAhJrEoMzBK+mnGUGK2NxYJ7NGFCjY9cWDuxHJ4EC6h/Nrd9+2l9dadbdpumDeX+ipjKDajmaKE0iVC1kkptUqnuFtoLbvvJNOyC4tUtG3ETWOxynssx3gf9R8Pm2r2EIXgxWC4JMBcfvXunTu6djhDi80TQ90aga2uv4Ivs0bfSZtHSQbLyMwSUekfruB0PF6ppMW8UVwAE9gebywlN66b3klilD2Pf31uDi6hLOvSi8u3X3t5sOGmT9FQqxqndk2iyZ50QKXjahPxqFrchL3WlQPS0Rkd9QgwG8DovujaUw4dlCnIqkiA+2NjzR2PH5x7Gi6xXLKFy3Lnb3xhOrRhL60tT3TFnwKIe/sejGDL6DpJgAXn+YSMx7iTk28O1z3SaUe8ZIc+hfCeJ772aB8us3wgwF4+d9cXplqIM6Hrprrgm9fSimSMaasE5JhGSG494iFMVKKgKvk7B94JT7D7NL2654m/v3ygXlYEsJfpu35rArCejm23jex7q/05D+qYOYHOORZcQSmFVYgpfunoY419ODP21UOH5lbsr9RWFHBZpqd3jsMVZybJyJTO4gbCPk6YJgjrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
23173
+
23174
+ const useChargingPile = ({ viewBox, rotation = 0 }) => {
23175
+ const { svgElementDatas } = useSvgEditContext();
23176
+ const { sn } = useCommonContext();
23177
+ const items = React.useMemo(() => {
23178
+ if (!svgElementDatas || !viewBox)
23179
+ return [];
23180
+ const chargingPiles = svgElementDatas?.[exports.DataType.CHARGING_PILE];
23181
+ if (!chargingPiles)
23182
+ return [];
23183
+ const results = [];
23184
+ for (const element of chargingPiles) {
23185
+ const center = element.points?.[0];
23186
+ if (!center)
23187
+ continue;
23188
+ const size = element.style?.radius ? element.style.radius * 2 : 55;
23189
+ const direction = element?.direction || 0;
23190
+ const angle = (direction * 180) / Math.PI;
23191
+ const rotationDegree = 270 - angle; // 正东是正方向,需要处理下
23192
+ const actualRotation = rotationDegree - rotation;
23193
+ const relX = (center[0] - viewBox.x) / viewBox.width;
23194
+ const relY = (center[1] - viewBox.y) / viewBox.height;
23195
+ if (isFinite(relX) && isFinite(relY)) {
23196
+ results.push({
23197
+ leftPct: relX * 100,
23198
+ topPct: relY * 100,
23199
+ size,
23200
+ rotateDeg: actualRotation,
23201
+ imageSrc: chargingPileImage,
23202
+ });
23203
+ }
23204
+ }
23205
+ return results;
23206
+ }, [svgElementDatas, viewBox?.x, viewBox?.y, viewBox?.width, viewBox?.height, rotation, sn]);
23207
+ return items;
23208
+ };
23209
+
23210
+ const CharginPile = React.memo(({ viewBox, rotation = 0, sizeScale = 1, isHighlight = true }) => {
23211
+ const items = useChargingPile({ viewBox: viewBox || null, rotation });
23212
+ const containerStyle = React.useMemo(() => ({
23213
+ position: 'absolute',
23214
+ top: 0,
23215
+ left: 0,
23216
+ width: '100%',
23217
+ height: '100%',
23218
+ pointerEvents: 'none',
23219
+ zIndex: 750,
23220
+ opacity: isHighlight ? SvgMapOpacity.HIGHLIGHT : SvgMapOpacity.UN_HIGHLIGHT,
23221
+ }), [isHighlight]);
23222
+ return (jsxRuntime.jsx("div", { style: containerStyle, children: items?.map((item, idx) => (jsxRuntime.jsx("div", { className: "charging-pile", style: {
23223
+ position: 'absolute',
23224
+ width: item.size * sizeScale,
23225
+ height: item.size * sizeScale,
23226
+ left: `${item.leftPct}%`,
23227
+ top: `${item.topPct}%`,
23228
+ transform: `translate(-50%, -50%) rotate(${item.rotateDeg}deg)`,
23229
+ pointerEvents: 'auto',
23230
+ zIndex: 750,
23231
+ }, children: jsxRuntime.jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }, `pile-${idx}`))) }));
23232
+ });
23233
+
23234
+ const MAX_STATIC_SIZE = 640;
23235
+ const MAX_STATIC_MAP_RETRY = 3;
23236
+ const Magnifier = ({ visible, dragState, polygonPoints, fillColor = 'rgba(255, 122, 51, 0.1)', strokeColor = 'rgba(255, 122, 51, 1)', strokeWidth = 2, zoom = 3, size = 200, }) => {
23237
+ const { svgViewBox, mapRef, googleMapStaticApiKey, drag } = useCommonContext();
23238
+ const { svgElementDatas, svgRef } = useSvgEditContext();
23239
+ const { editMapInfo } = useMapEditContext();
23240
+ const [magnifierPosition, setMagnifierPosition] = React.useState({ x: 0, y: 0 });
23241
+ const [magnifierBoxSize, setMagnifierBoxSize] = React.useState({ width: size, height: size });
23242
+ // 本次拖拽中放大镜位置是否已完成初始化(未完成前隐藏,避免首帧闪动)
23243
+ const [isPlacementReady, setIsPlacementReady] = React.useState(false);
23244
+ // 放大镜所在侧边:true=右侧,false=左侧
23245
+ const [placeOnRight, setPlaceOnRight] = React.useState(true);
23246
+ // 仅在每次拖拽开始时初始化一次侧边
23247
+ const hasInitializedSideRef = React.useRef(false);
23248
+ const [mapImageFrame, setMapImageFrame] = React.useState(null);
23249
+ const [staticMapRetryCount, setStaticMapRetryCount] = React.useState(0);
23250
+ // 获取当前正在拖拽的禁区 ID
23251
+ const currentObstacleId = editMapInfo?.selectElement?.id;
23252
+ // 计算当前 SVG 单位到屏幕像素的比例(用于实现真正 1:1 预览)
23253
+ const getPixelScale = () => {
23254
+ //先拿 svgRef.getScreenCTM(),这是 SVG 到屏幕的变换矩阵(包含缩放/旋转/平移)
23255
+ const ctm = svgRef?.getScreenCTM?.();
23256
+ if (!ctm)
23257
+ return 1;
23258
+ // 使用向量长度计算缩放,兼容旋转矩阵
23259
+ // 用 Math.hypot(ctm.a, ctm.b) 算出 x 方向的实际缩放倍率(用向量长度是为了兼容旋转,不只看 a)
23260
+ const scaleX = Math.hypot(ctm.a, ctm.b);
23261
+ return Number.isFinite(scaleX) && scaleX > 0 ? scaleX : 1;
23262
+ };
23263
+ // 读取设备安全区(刘海/手势条)inset,兼容横屏 H5
23264
+ const getSafeAreaInsets = () => {
23265
+ const probe = document.createElement('div');
23266
+ probe.style.position = 'fixed';
23267
+ probe.style.left = '0';
23268
+ probe.style.top = '0';
23269
+ probe.style.width = '0';
23270
+ probe.style.height = '0';
23271
+ probe.style.visibility = 'hidden';
23272
+ probe.style.pointerEvents = 'none';
23273
+ probe.style.paddingTop = 'env(safe-area-inset-top)';
23274
+ probe.style.paddingRight = 'env(safe-area-inset-right)';
23275
+ probe.style.paddingBottom = 'env(safe-area-inset-bottom)';
23276
+ probe.style.paddingLeft = 'env(safe-area-inset-left)';
23277
+ document.body.appendChild(probe);
23278
+ const style = window.getComputedStyle(probe);
23279
+ const insets = {
23280
+ top: Number.parseFloat(style.paddingTop) || 0,
23281
+ right: Number.parseFloat(style.paddingRight) || 0,
23282
+ bottom: Number.parseFloat(style.paddingBottom) || 0,
23283
+ left: Number.parseFloat(style.paddingLeft) || 0,
23284
+ };
23285
+ document.body.removeChild(probe);
23286
+ return insets;
23287
+ };
23288
+ // 计算并获取放大镜底图:优先使用 Google Maps Static API,无图时走灰色背景兜底
23289
+ React.useEffect(() => {
23290
+ if (!visible || !dragState.currentPosition || !mapRef || !svgViewBox || !svgRef) {
23291
+ // console.log('[Magnifier] Skip static map effect: missing deps', {
23292
+ // visible,
23293
+ // hasCurrentPosition: Boolean(dragState.currentPosition),
23294
+ // hasMapRef: Boolean(mapRef),
23295
+ // hasSvgViewBox: Boolean(svgViewBox),
23296
+ // hasSvgRef: Boolean(svgRef),
23297
+ // });
23298
+ setMapImageFrame(null);
23299
+ setStaticMapRetryCount(0);
23300
+ return;
23301
+ }
23302
+ const mapDiv = mapRef.getDiv?.();
23303
+ // 获取 SVG 到屏幕的变换矩阵的逆矩阵
23304
+ const inverseCtm = svgRef.getScreenCTM?.()?.inverse?.();
23305
+ if (!mapDiv || !inverseCtm) {
23306
+ // console.log('[Magnifier] Skip static map effect: mapDiv/ctm missing', {
23307
+ // hasMapDiv: Boolean(mapDiv),
23308
+ // hasInverseCtm: Boolean(inverseCtm),
23309
+ // });
23310
+ setMapImageFrame(null);
23311
+ setStaticMapRetryCount(0);
23312
+ return;
23313
+ }
23314
+ const mapRect = mapDiv.getBoundingClientRect();
23315
+ const svgPoint = svgRef.createSVGPoint();
23316
+ // 只要有 key 就尝试 static api;请求失败时不截图,直接回退灰色背景
23317
+ if (googleMapStaticApiKey) {
23318
+ // console.log('[Magnifier] Background source: static api viewport snapshot');
23319
+ const mapBounds = mapRef.getBounds?.();
23320
+ if (!mapBounds) {
23321
+ // console.log('[Magnifier] Skip static map effect: mapBounds missing');
23322
+ setMapImageFrame(null);
23323
+ return;
23324
+ }
23325
+ const screenToSvg = (screenX, screenY) => {
23326
+ svgPoint.x = screenX;
23327
+ svgPoint.y = screenY;
23328
+ const p = svgPoint.matrixTransform(inverseCtm);
23329
+ return { x: p.x, y: p.y };
23330
+ };
23331
+ // 使用当前地图视口矩形四角,将屏幕坐标映射到 SVG 坐标,确保底图与主视口对齐
23332
+ const topLeftSvg = screenToSvg(mapRect.left, mapRect.top);
23333
+ const topRightSvg = screenToSvg(mapRect.right, mapRect.top);
23334
+ const bottomLeftSvg = screenToSvg(mapRect.left, mapRect.bottom);
23335
+ if (!topLeftSvg || !topRightSvg || !bottomLeftSvg) {
23336
+ setMapImageFrame(null);
23337
+ return;
23338
+ }
23339
+ // 把当前主地图可视区域尺寸,按比例压到 Static API 允许的最大尺寸以内(受 Static API 640 上限约束)),同时不改变宽高比。
23340
+ const mapWidth = Math.max(1, Math.round(mapRect.width));
23341
+ const mapHeight = Math.max(1, Math.round(mapRect.height));
23342
+ const shrinkRatio = Math.min(1, MAX_STATIC_SIZE / Math.max(mapWidth, mapHeight));
23343
+ const staticWidth = Math.max(1, Math.round(mapWidth * shrinkRatio));
23344
+ const staticHeight = Math.max(1, Math.round(mapHeight * shrinkRatio));
23345
+ const center = mapBounds.getCenter();
23346
+ const currentZoom = mapRef.getZoom() || 20;
23347
+ // 尺寸缩小后同步补偿 zoom,保持与当前主图一致的地理覆盖范围
23348
+ const zoomCompensation = Math.log2(shrinkRatio);
23349
+ const adjustedZoom = currentZoom + zoomCompensation;
23350
+ const staticZoom = Math.max(0, Math.min(Math.floor(adjustedZoom), 22));
23351
+ const staticMapUrl = `https://maps.googleapis.com/maps/api/staticmap?center=${center.lat()},${center.lng()}&zoom=${staticZoom}&size=${staticWidth}x${staticHeight}&maptype=satellite&key=${googleMapStaticApiKey}`;
23352
+ // 通过三角点推导静态图在 SVG 中的宽高和旋转角
23353
+ // Math.hypot(x, y) 等价于 sqrt(x*x + y*y),计算两点之间的距离
23354
+ const width = Math.hypot(topRightSvg.x - topLeftSvg.x, topRightSvg.y - topLeftSvg.y);
23355
+ const height = Math.hypot(bottomLeftSvg.x - topLeftSvg.x, bottomLeftSvg.y - topLeftSvg.y);
23356
+ // Math.atan2(y, x) 计算反正切值,返回 [-π, π] 弧度,*180/π 转换为角度
23357
+ const rotationDeg = (Math.atan2(topRightSvg.y - topLeftSvg.y, topRightSvg.x - topLeftSvg.x) * 180) / Math.PI;
23358
+ // Static API zoom 只能取整;额外补偿小数部分,避免底图视觉偏小
23359
+ // 在有旋转的坐标系里,做“以中心为锚点”的等比放大补偿。
23360
+ const fractionalZoomScale = Math.pow(2, adjustedZoom - staticZoom); //算出“还差多少缩放比例”。例子:adjustedZoom=19.6,staticZoom=19,差 0.6,比例是 2^0.6 ≈ 1.515。
23361
+ //把原始 width/height 乘这个比例,得到补偿后的尺寸。
23362
+ const compensatedWidth = width * fractionalZoomScale;
23363
+ const compensatedHeight = height * fractionalZoomScale;
23364
+ //尺寸变大后,多出来的宽/高的一半(要从两边均匀扩张)。
23365
+ const offsetAlongX = (compensatedWidth - width) / 2;
23366
+ const offsetAlongY = (compensatedHeight - height) / 2;
23367
+ //“右方向”单位向量(从左上指向右上),因为图可能旋转了,不能只按水平 x 轴算。
23368
+ const unitX = width > 0 ? (topRightSvg.x - topLeftSvg.x) / width : 1;
23369
+ const unitY = width > 0 ? (topRightSvg.y - topLeftSvg.y) / width : 0;
23370
+ //“下方向”单位向量(从左上指向左下),同理用于旋转场景。
23371
+ const unitDownX = height > 0 ? (bottomLeftSvg.x - topLeftSvg.x) / height : 0;
23372
+ const unitDownY = height > 0 ? (bottomLeftSvg.y - topLeftSvg.y) / height : 1;
23373
+ /**
23374
+ * 计算补偿后的新左上角:
23375
+ * 从原左上角沿“右方向”回退半个扩展量,再沿“下方向”回退半个扩展量。
23376
+ * 这样放大后仍以原区域中心为中心,不会放大后位置偏移。
23377
+ */
23378
+ const compensatedTopLeftX = topLeftSvg.x - unitX * offsetAlongX - unitDownX * offsetAlongY;
23379
+ const compensatedTopLeftY = topLeftSvg.y - unitY * offsetAlongX - unitDownY * offsetAlongY;
23380
+ setMapImageFrame({
23381
+ url: staticMapUrl,
23382
+ x: compensatedTopLeftX,
23383
+ y: compensatedTopLeftY,
23384
+ width: compensatedWidth,
23385
+ height: compensatedHeight,
23386
+ transform: `rotate(${rotationDeg} ${compensatedTopLeftX} ${compensatedTopLeftY})`,
23387
+ });
23388
+ }
23389
+ else {
23390
+ setMapImageFrame(null);
23391
+ setStaticMapRetryCount(0);
23392
+ // console.log('[Magnifier] Background source: gray fallback (no static api key)');
23393
+ }
23394
+ }, [
23395
+ visible,
23396
+ dragState.isDragging,
23397
+ mapRef,
23398
+ svgViewBox?.x,
23399
+ svgViewBox?.y,
23400
+ svgViewBox?.width,
23401
+ svgViewBox?.height,
23402
+ svgRef,
23403
+ size,
23404
+ zoom,
23405
+ googleMapStaticApiKey,
23406
+ staticMapRetryCount,
23407
+ ]);
23408
+ React.useLayoutEffect(() => {
23409
+ if (!visible) {
23410
+ hasInitializedSideRef.current = false;
23411
+ setIsPlacementReady(false);
23412
+ return;
23413
+ }
23414
+ const updatePosition = () => {
23415
+ const mapDiv = mapRef?.getDiv?.();
23416
+ const mapRect = mapDiv?.getBoundingClientRect?.();
23417
+ const boxSize = Math.max(120, Math.round(size));
23418
+ // 设置放大镜大小
23419
+ setMagnifierBoxSize({ width: boxSize, height: boxSize });
23420
+ const viewportWidth = window.innerWidth;
23421
+ const viewportHeight = window.innerHeight;
23422
+ const baseMargin = 10; // 放大镜与边缘的基础间距
23423
+ const insets = getSafeAreaInsets();
23424
+ const marginTop = Math.max(baseMargin, insets.top);
23425
+ const marginRight = Math.max(baseMargin, insets.right);
23426
+ const marginBottom = Math.max(baseMargin, insets.bottom);
23427
+ const marginLeft = Math.max(baseMargin, insets.left);
23428
+ const topY = mapRect ? mapRect.top + marginTop : marginTop;
23429
+ // 顶部位置限制在可视区与安全区内,避免横屏时被刘海/手势条遮挡
23430
+ const safeTopY = Math.max(marginTop, Math.min(topY, viewportHeight - boxSize - marginBottom));
23431
+ let nextPlaceOnRight = placeOnRight;
23432
+ const ctm = svgRef?.getScreenCTM?.();
23433
+ // 首次显示时先同步算出侧边,再基于该侧边定位,避免“先左后右/先右后左”闪动
23434
+ if (!hasInitializedSideRef.current && dragState.currentPosition && ctm && mapRect) {
23435
+ const p = svgRef.createSVGPoint();
23436
+ p.x = dragState.currentPosition[0];
23437
+ p.y = dragState.currentPosition[1];
23438
+ const dragScreenPoint = p.matrixTransform(ctm);
23439
+ const mapMidX = mapRect.left + mapRect.width / 2;
23440
+ nextPlaceOnRight = dragScreenPoint.x < mapMidX;
23441
+ setPlaceOnRight(nextPlaceOnRight);
23442
+ hasInitializedSideRef.current = true;
23443
+ }
23444
+ const rightX = mapRect
23445
+ ? mapRect.right - boxSize - marginRight
23446
+ : viewportWidth - boxSize - marginRight;
23447
+ const leftX = mapRect ? mapRect.left + marginLeft : marginLeft;
23448
+ const safeX = nextPlaceOnRight ? rightX : leftX;
23449
+ const boundedX = Math.max(marginLeft, Math.min(safeX, viewportWidth - boxSize - marginRight));
23450
+ // 放大镜出现后,仅当拖拽点进入放大镜区域时才切换到对侧
23451
+ if (dragState.currentPosition && ctm) {
23452
+ const p = svgRef.createSVGPoint();
23453
+ p.x = dragState.currentPosition[0];
23454
+ p.y = dragState.currentPosition[1];
23455
+ // 应用这个矩阵,变换成屏幕坐标
23456
+ const dragScreenPoint = p.matrixTransform(ctm);
23457
+ const pointInMagnifier = dragScreenPoint.x >= boundedX &&
23458
+ dragScreenPoint.x <= boundedX + boxSize &&
23459
+ dragScreenPoint.y >= safeTopY &&
23460
+ dragScreenPoint.y <= safeTopY + boxSize;
23461
+ if (pointInMagnifier) {
23462
+ setPlaceOnRight((prev) => !prev);
23463
+ return;
23464
+ }
23465
+ }
23466
+ setMagnifierPosition({
23467
+ x: boundedX,
23468
+ y: safeTopY,
23469
+ });
23470
+ setIsPlacementReady(true);
23471
+ };
23472
+ updatePosition();
23473
+ window.addEventListener('resize', updatePosition);
23474
+ return () => window.removeEventListener('resize', updatePosition);
23475
+ }, [
23476
+ visible,
23477
+ size,
23478
+ mapRef,
23479
+ svgRef,
23480
+ placeOnRight,
23481
+ dragState.currentPosition?.[0],
23482
+ dragState.currentPosition?.[1],
23483
+ ]);
23484
+ // 早期返回必须在所有 hooks 之后
23485
+ if (!visible || !dragState.currentPosition || !svgViewBox) {
23486
+ return null;
23487
+ }
23488
+ const [centerX, centerY] = dragState.currentPosition;
23489
+ // 计算放大区域范围(以拖拽点为中心)
23490
+ //effectiveZoom = Math.max(0.001, zoom * getPixelScale())
23491
+ // 得到实际放大倍率。
23492
+ // zoom 是你设置的放大倍数(比如 3)
23493
+ // getPixelScale() 是当前 SVG 到屏幕的缩放因子(地图本身被缩放时要补偿)
23494
+ // Math.max(0.001, ...) 是防止出现 0 或极小值导致除零/异常
23495
+ // magnifierWidthInSvg = magnifierBoxSize.width / effectiveZoom
23496
+ // magnifierHeightInSvg = magnifierBoxSize.height / effectiveZoom
23497
+ // 把“屏幕上放大镜框的像素尺寸”换算成“SVG 坐标里要截取的实际尺寸”
23498
+ // 放大倍率越大,分母越大,截取范围越小 => 看起来越放大
23499
+ const effectiveZoom = Math.max(0.001, zoom * getPixelScale());
23500
+ const magnifierWidthInSvg = magnifierBoxSize.width / effectiveZoom;
23501
+ const magnifierHeightInSvg = magnifierBoxSize.height / effectiveZoom;
23502
+ // 计算放大区域的 viewBox
23503
+ const magnifierViewBox = {
23504
+ x: centerX - magnifierWidthInSvg / 2,
23505
+ y: centerY - magnifierHeightInSvg / 2,
23506
+ width: magnifierWidthInSvg,
23507
+ height: magnifierHeightInSvg,
23508
+ };
23509
+ // 样式缩放采用“弱抵消”,避免随 zoom 变细,保证放大镜内点线清晰度
23510
+ const styleZoomFactor = Math.max(1, zoom * 0.4);
23511
+ // 生成多边形点字符串(仅用于当前编辑禁区)
23512
+ const polygonPointsString = polygonPoints.length > 0 ? polygonPoints.map((p) => `${p[0]},${p[1]}`).join(' ') : '';
23513
+ const actureRotate = drag?.rotate ?? drag?.rotation ?? 0;
23514
+ // 渲染放大镜内容
23515
+ const magnifierContent = (jsxRuntime.jsxs("div", { style: {
23516
+ position: 'fixed',
23517
+ left: `${magnifierPosition.x}px`,
23518
+ top: `${magnifierPosition.y}px`,
23519
+ width: `${magnifierBoxSize.width}px`,
23520
+ height: `${magnifierBoxSize.height}px`,
23521
+ borderRadius: '50%',
23522
+ border: `2px solid #fff`,
23523
+ // boxShadow: '0 4px 20px rgba(0, 0, 0, 0.3)',
23524
+ overflow: 'hidden',
23525
+ zIndex: 10000,
23526
+ pointerEvents: 'none',
23527
+ background: 'rgba(235, 236, 240, 1)',
23528
+ visibility: isPlacementReady ? 'visible' : 'hidden',
23529
+ }, children: [jsxRuntime.jsxs("svg", {
23530
+ // 逻辑尺寸:与放大镜容器一致
23531
+ width: magnifierBoxSize.width, height: magnifierBoxSize.height,
23532
+ // 核心放大参数:从整张 SVG 中裁剪出当前需要展示的区域(x y width height)
23533
+ viewBox: `${magnifierViewBox.x} ${magnifierViewBox.y} ${magnifierViewBox.width} ${magnifierViewBox.height}`,
23534
+ // 保持内容居中并铺满窗口;比例不一致时裁边,不留空白
23535
+ preserveAspectRatio: "xMidYMid slice", style: {
23536
+ // CSS 尺寸:让 SVG 完全填满放大镜容器
23537
+ width: '100%',
23538
+ height: '100%',
23539
+ }, children: [mapImageFrame && (jsxRuntime.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: () => {
23540
+ // console.log('✅ Map background loaded in magnifier');
23541
+ setStaticMapRetryCount(0);
23542
+ }, onError: (_e) => {
23543
+ // console.error('❌ Failed to load map background in magnifier', {
23544
+ // retryCount: staticMapRetryCount,
23545
+ // maxRetry: MAX_STATIC_MAP_RETRY,
23546
+ // url: mapImageFrame.url,
23547
+ // error: _e,
23548
+ // });
23549
+ setStaticMapRetryCount((prev) => {
23550
+ if (prev < MAX_STATIC_MAP_RETRY)
23551
+ return prev + 1;
23552
+ setMapImageFrame(null);
23553
+ return 0;
23554
+ });
23555
+ } }, `magnifier-static-map-${staticMapRetryCount}`)), svgElementDatas &&
23556
+ Object.keys(svgElementDatas).map((key) => {
23557
+ const elements = svgElementDatas[key] || [];
23558
+ // 过滤掉当前正在拖拽的禁区(稍后单独渲染拖拽后的状态)
23559
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23560
+ const filteredElements = key === exports.DataType.OBSTACLE
23561
+ ? elements.filter((item) => item.id !== currentObstacleId)
23562
+ : elements;
23563
+ if (filteredElements.length === 0)
23564
+ return null;
23565
+ return (jsxRuntime.jsxs(GElement, { type: key, children: [key === 'channel' && jsxRuntime.jsx(ChannelClipPath, {}), filteredElements.map((item) => (
23566
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23567
+ jsxRuntime.jsx(SvgElement, { type: key, data: item }, item?.id)))] }, key));
23568
+ }), polygonPoints.length >= 3 && polygonPointsString && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("polygon", { points: polygonPointsString, fill: fillColor, stroke: strokeColor, strokeWidth: (strokeWidth * 3.2) / styleZoomFactor, strokeOpacity: 1 }), polygonPoints.map((point, idx) => {
23569
+ const [x, y] = point;
23570
+ const isDraggingPoint = dragState.dragIndex === idx;
23571
+ const pointRadius = isDraggingPoint ? 14 / styleZoomFactor : 10 / styleZoomFactor;
23572
+ const pointFill = isDraggingPoint ? '#FFAB7E' : strokeColor;
23573
+ const pointStroke = isDraggingPoint ? strokeColor : '#fff';
23574
+ const pointStrokeWidth = isDraggingPoint
23575
+ ? 3.6 / styleZoomFactor
23576
+ : 3 / styleZoomFactor;
23577
+ return (jsxRuntime.jsx("circle", { cx: x, cy: y, r: pointRadius, fill: pointFill, stroke: pointStroke, strokeWidth: pointStrokeWidth }, idx));
23578
+ })] })), dragState.dragType === 'new' && dragState.edgeInfo && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.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}` }) }))] }), jsxRuntime.jsx(CharginPile, { viewBox: magnifierViewBox || null, rotation: actureRotate, sizeScale: Math.max(1, zoom) })] }));
23579
+ // 使用 Portal 渲染到 body,避免层级问题
23580
+ return ReactDOM.createPortal(magnifierContent, document.body);
23581
+ };
23582
+
23583
+ 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}";
23584
+ var styles$6 = {"pointerCursor":"index-module_pointerCursor__Ee6pr","polygonPath":"index-module_polygonPath__PynOn","dragging":"index-module_dragging__xSFdO","notCreate":"index-module_notCreate__bFnkV"};
23585
+ styleInject(css_248z$6);
23586
+
23169
23587
  /**
23170
23588
  * 几何计算工具函数
23171
23589
  */
@@ -23587,6 +24005,34 @@ const useCheckElement = () => {
23587
24005
  };
23588
24006
  };
23589
24007
 
24008
+ const Tooltip = ({ open, x, y, text, style, onClick }) => {
24009
+ if (!open)
24010
+ return null;
24011
+ const tooltipStyle = {
24012
+ position: 'fixed',
24013
+ left: x,
24014
+ top: y,
24015
+ backgroundColor: '#fff',
24016
+ borderRadius: '4px',
24017
+ height: '20px',
24018
+ lineHeight: '16px',
24019
+ fontSize: '12px',
24020
+ color: '#211F1F',
24021
+ padding: '2px 4px',
24022
+ whiteSpace: 'nowrap',
24023
+ zIndex: 9999,
24024
+ cursor: 'pointer',
24025
+ userSelect: 'none',
24026
+ ...style,
24027
+ };
24028
+ // 使用 createPortal 挂载到 body
24029
+ return ReactDOM.createPortal(jsxRuntime.jsx("div", { style: tooltipStyle, onClick: (e) => {
24030
+ e.preventDefault();
24031
+ e.stopPropagation();
24032
+ onClick?.();
24033
+ }, children: text }), document.body);
24034
+ };
24035
+
23590
24036
  /**
23591
24037
  * 将坐标点数组转换为polygon points字符串
23592
24038
  * @param coordinates 坐标点数组 [[x1, y1], [x2, y2], ...]
@@ -23678,7 +24124,7 @@ const createPathData = (points) => {
23678
24124
  };
23679
24125
  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自动判断
23680
24126
  }) => {
23681
- const { overlayScale, unitType, showStraddleBoundaryBorder } = useCommonContext();
24127
+ const { overlayScale, unitType, showStraddleBoundaryBorder, platform, onH5FirstSelectObstaclePoint } = useCommonContext();
23682
24128
  const { onHandleEvent } = useMapEditContext();
23683
24129
  const { svgRef } = useSvgEditContext();
23684
24130
  const [dragState, setDragState] = React.useState({
@@ -23696,7 +24142,6 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23696
24142
  const [selectedVertexIndex, setSelectedVertexIndex] = React.useState(-1);
23697
24143
  const { checkCanNotCreateAtPosition } = useCheckElement();
23698
24144
  const { editMapInfo } = useMapEditContext();
23699
- const { platform } = useCommonContext();
23700
24145
  // delete icon可能被上一个点遮挡,因为delete在右上方,所以手动处理点让点按照顺时针渲染,这样delete icon层级就会高一些
23701
24146
  // 编辑的场景禁区的点最后一个和第一个相同,会导致一个位置渲染两个点,需要额外处理下
23702
24147
  const coordinates = React.useMemo(() => {
@@ -23725,6 +24170,15 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23725
24170
  }, [svgRef]);
23726
24171
  // 删除确认 Tooltip 状态
23727
24172
  const [tooltipIndex, setTooltipIndex] = React.useState(null);
24173
+ const [tooltipPos, setTooltipPos] = React.useState({ x: 0, y: 0 });
24174
+ const [completeTooltipOpen, setCompleteTooltipOpen] = React.useState(false);
24175
+ const updateTooltipPos = (target) => {
24176
+ const rect = target.getBoundingClientRect();
24177
+ setTooltipPos({
24178
+ x: rect.left + rect.width + 4,
24179
+ y: rect.top - 10
24180
+ });
24181
+ };
23728
24182
  // 处理顶点点击(仅透出点击;不触发删除)
23729
24183
  const handleVertexClick = React.useCallback((e, index) => {
23730
24184
  // 阻止事件冒泡到Google Maps
@@ -23739,6 +24193,7 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23739
24193
  window.clearTimeout(clickTimerRef.current);
23740
24194
  }
23741
24195
  clickTimerRef.current = window.setTimeout(() => {
24196
+ setCompleteTooltipOpen(false);
23742
24197
  // 创建模式下点击顶点回调(仅透出点击)
23743
24198
  if (onPointClick) {
23744
24199
  onPointClick(index, e);
@@ -23929,9 +24384,14 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23929
24384
  // 开始长按计时器(1000ms)
23930
24385
  vertexLongPressTimerRef.current = window.setTimeout(() => {
23931
24386
  isVertexLongPressedRef.current = true;
23932
- setSelectedVertexIndex(index);
24387
+ setSelectedVertexIndex((prev) => {
24388
+ if (prev !== index) {
24389
+ onH5FirstSelectObstaclePoint?.();
24390
+ }
24391
+ return index;
24392
+ });
23933
24393
  }, 1000);
23934
- }, [editMode, createMode, completed, dragState.isDragging]);
24394
+ }, [editMode, createMode, completed, dragState.isDragging, onH5FirstSelectObstaclePoint]);
23935
24395
  const handleVertexLongPressEnd = React.useCallback(() => {
23936
24396
  if (vertexLongPressTimerRef.current !== null) {
23937
24397
  window.clearTimeout(vertexLongPressTimerRef.current);
@@ -24262,12 +24722,17 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24262
24722
  if (isDash && showStraddleBoundaryBorder) {
24263
24723
  return (jsxRuntime.jsx(DashPath, { className: canSelect ? styles$6.polygonPath : '', points: segment.points, stroke: strokeColor, strokeWidth: isHover ? strokeWidth + 1 : strokeWidth, strokeOpacity: strokeOpacity }, index));
24264
24724
  }
24265
- return (jsxRuntime.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: {
24266
- userSelect: 'none',
24267
- WebkitUserSelect: 'none',
24268
- WebkitTouchCallout: 'none',
24269
- touchAction: 'none',
24270
- } }, index));
24725
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(editMode || createMode) && (jsxRuntime.jsx("path", { d: pathData, fill: "none", stroke: '#fff', strokeWidth: strokeWidth * 2, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke", style: {
24726
+ userSelect: 'none',
24727
+ WebkitUserSelect: 'none',
24728
+ WebkitTouchCallout: 'none',
24729
+ touchAction: 'none',
24730
+ } }, 'warp' + index)), jsxRuntime.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: {
24731
+ userSelect: 'none',
24732
+ WebkitUserSelect: 'none',
24733
+ WebkitTouchCallout: 'none',
24734
+ touchAction: 'none',
24735
+ } }, index)] }));
24271
24736
  }) }), (editMode || (createMode && completed)) &&
24272
24737
  renderCoordinates.length >= 2 &&
24273
24738
  renderCoordinates.map((coord, index) => {
@@ -24305,7 +24770,11 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24305
24770
  setHoverVertex(null);
24306
24771
  },
24307
24772
  }) }, `edge-${index}`));
24308
- }), 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)) &&
24773
+ }), ghostLastPath && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("path", { d: ghostLastPath, stroke: '#fff', strokeWidth: strokeWidth * 2, vectorEffect: "non-scaling-stroke", opacity: 0.7 }), jsxRuntime.jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })] })), ghostFirstPath && renderCoordinates.length >= 2 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("path", { d: ghostFirstPath, stroke: '#fff', strokeWidth: strokeWidth * 2, vectorEffect: "non-scaling-stroke", opacity: 0.7 }), 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(Magnifier, { visible: platform === exports.PlatformType.H5 &&
24774
+ dragState.isDragging &&
24775
+ dragState.dragIndex !== -1 &&
24776
+ dragState.currentPosition !== null &&
24777
+ (editMode || (createMode && completed)), dragState: dragState, polygonPoints: renderCoordinates, fillColor: fillColor, strokeColor: strokeColor, strokeWidth: strokeWidth, zoom: 3, size: 130 }), 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)) &&
24309
24778
  renderCoordinates.map((coord, idx) => {
24310
24779
  // 判断当前顶点的状态
24311
24780
  const isLastPoint = idx === renderCoordinates.length - 1;
@@ -24345,6 +24814,7 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24345
24814
  }, 300);
24346
24815
  // 打开删除确认 Tooltip(仅在可编辑时)
24347
24816
  if (editMode || (createMode && completed)) {
24817
+ updateTooltipPos(e.target);
24348
24818
  setTooltipIndex(idx);
24349
24819
  }
24350
24820
  }, ...(platform === exports.PlatformType.H5
@@ -24420,7 +24890,14 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24420
24890
  }
24421
24891
  }
24422
24892
  },
24423
- }) }), tooltipIndex === idx && coordinates.length > 3 && (jsxRuntime.jsxs("g", { transform: `translate(${coord[0] + 4 * overlayScale * 2}, ${coord[1] - 4 * overlayScale * 2}) scale(${overlayScale * 2})`, onClick: (e) => {
24893
+ onMouseEnter: canComplete ? (e) => {
24894
+ setCompleteTooltipOpen(true);
24895
+ updateTooltipPos(e.target);
24896
+ } : undefined,
24897
+ onMouseLeave: canComplete ? () => {
24898
+ setCompleteTooltipOpen(false);
24899
+ } : undefined,
24900
+ }) }), platform === exports.PlatformType.H5 && tooltipIndex === idx && coordinates.length > 3 && (jsxRuntime.jsxs("g", { transform: `translate(${coord[0] + 4 * overlayScale * 2}, ${coord[1] - 4 * overlayScale * 2}) scale(${overlayScale * 2})`, onClick: (e) => {
24424
24901
  e.preventDefault();
24425
24902
  e.stopPropagation();
24426
24903
  if (onVertexDelete &&
@@ -24443,7 +24920,12 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24443
24920
  // >
24444
24921
  // </rect>
24445
24922
  )] }, `vertex-${idx}`));
24446
- })] }));
24923
+ }), platform === exports.PlatformType.WEB && tooltipIndex !== null && (jsxRuntime.jsx(Tooltip, { open: true, x: tooltipPos.x, y: tooltipPos.y, text: "Remove", onClick: () => {
24924
+ if (onVertexDelete && (editMode || (createMode && completed)) && coordinates.length > 3) {
24925
+ onVertexDelete(renderCoordinates?.length - 1 - tooltipIndex);
24926
+ }
24927
+ setTooltipIndex(null);
24928
+ } })), platform === exports.PlatformType.WEB && completeTooltipOpen && (jsxRuntime.jsx(Tooltip, { open: true, x: tooltipPos.x, y: tooltipPos.y, text: "Click to finish" }))] }));
24447
24929
  };
24448
24930
 
24449
24931
  const MowPartitionContext = React.createContext({
@@ -25122,15 +25604,15 @@ const useVisionOffTransform = (data, scaleConstraints
25122
25604
  };
25123
25605
  };
25124
25606
 
25125
- var _g$3, _defs$3;
25126
- 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); }
25607
+ var _g$6, _defs$6;
25608
+ 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); }
25127
25609
  var SvgTransformDelete = function SvgTransformDelete(props) {
25128
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
25610
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
25129
25611
  xmlns: "http://www.w3.org/2000/svg",
25130
25612
  width: 20,
25131
25613
  height: 20,
25132
25614
  fill: "none"
25133
- }, props), _g$3 || (_g$3 = /*#__PURE__*/React__namespace.createElement("g", {
25615
+ }, props), _g$6 || (_g$6 = /*#__PURE__*/React__namespace.createElement("g", {
25134
25616
  clipPath: "url(#transform-delete_svg__a)"
25135
25617
  }, /*#__PURE__*/React__namespace.createElement("circle", {
25136
25618
  cx: 10,
@@ -25153,7 +25635,7 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
25153
25635
  fill: "#fff",
25154
25636
  rx: 0.8,
25155
25637
  transform: "rotate(45 6.323 5.191)"
25156
- }))), _defs$3 || (_defs$3 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
25638
+ }))), _defs$6 || (_defs$6 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
25157
25639
  id: "transform-delete_svg__b",
25158
25640
  x1: 17.727,
25159
25641
  x2: -1.215,
@@ -25173,15 +25655,15 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
25173
25655
  })))));
25174
25656
  };
25175
25657
 
25176
- var _g$2, _defs$2;
25177
- 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); }
25658
+ var _g$5, _defs$5;
25659
+ 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); }
25178
25660
  var SvgTransformRotate = function SvgTransformRotate(props) {
25179
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
25661
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
25180
25662
  xmlns: "http://www.w3.org/2000/svg",
25181
25663
  width: 21,
25182
25664
  height: 20,
25183
25665
  fill: "none"
25184
- }, props), _g$2 || (_g$2 = /*#__PURE__*/React__namespace.createElement("g", {
25666
+ }, props), _g$5 || (_g$5 = /*#__PURE__*/React__namespace.createElement("g", {
25185
25667
  clipPath: "url(#transform-rotate_svg__a)"
25186
25668
  }, /*#__PURE__*/React__namespace.createElement("path", {
25187
25669
  fill: "url(#transform-rotate_svg__b)",
@@ -25189,7 +25671,7 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
25189
25671
  }), /*#__PURE__*/React__namespace.createElement("path", {
25190
25672
  fill: "#fff",
25191
25673
  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"
25192
- }))), _defs$2 || (_defs$2 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
25674
+ }))), _defs$5 || (_defs$5 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
25193
25675
  id: "transform-rotate_svg__b",
25194
25676
  x1: 17.84,
25195
25677
  x2: -1.103,
@@ -25209,15 +25691,15 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
25209
25691
  })))));
25210
25692
  };
25211
25693
 
25212
- var _g$1, _defs$1;
25213
- 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); }
25694
+ var _g$4, _defs$4;
25695
+ 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); }
25214
25696
  var SvgTransformScale = function SvgTransformScale(props) {
25215
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
25697
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
25216
25698
  xmlns: "http://www.w3.org/2000/svg",
25217
25699
  width: 21,
25218
25700
  height: 20,
25219
25701
  fill: "none"
25220
- }, props), _g$1 || (_g$1 = /*#__PURE__*/React__namespace.createElement("g", {
25702
+ }, props), _g$4 || (_g$4 = /*#__PURE__*/React__namespace.createElement("g", {
25221
25703
  clipPath: "url(#transform-scale_svg__a)"
25222
25704
  }, /*#__PURE__*/React__namespace.createElement("path", {
25223
25705
  fill: "url(#transform-scale_svg__b)",
@@ -25225,7 +25707,7 @@ var SvgTransformScale = function SvgTransformScale(props) {
25225
25707
  }), /*#__PURE__*/React__namespace.createElement("path", {
25226
25708
  fill: "#fff",
25227
25709
  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"
25228
- }))), _defs$1 || (_defs$1 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
25710
+ }))), _defs$4 || (_defs$4 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
25229
25711
  id: "transform-scale_svg__b",
25230
25712
  x1: 17.84,
25231
25713
  x2: -1.103,
@@ -25245,15 +25727,15 @@ var SvgTransformScale = function SvgTransformScale(props) {
25245
25727
  })))));
25246
25728
  };
25247
25729
 
25248
- var _g, _defs;
25249
- 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); }
25730
+ var _g$3, _defs$3;
25731
+ 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); }
25250
25732
  var SvgTransformTranslate = function SvgTransformTranslate(props) {
25251
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
25733
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
25252
25734
  xmlns: "http://www.w3.org/2000/svg",
25253
25735
  width: 20,
25254
25736
  height: 20,
25255
25737
  fill: "none"
25256
- }, props), _g || (_g = /*#__PURE__*/React__namespace.createElement("g", {
25738
+ }, props), _g$3 || (_g$3 = /*#__PURE__*/React__namespace.createElement("g", {
25257
25739
  clipPath: "url(#transform-translate_svg__a)"
25258
25740
  }, /*#__PURE__*/React__namespace.createElement("circle", {
25259
25741
  cx: 10,
@@ -25263,7 +25745,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
25263
25745
  }), /*#__PURE__*/React__namespace.createElement("path", {
25264
25746
  fill: "#fff",
25265
25747
  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"
25266
- }))), _defs || (_defs = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
25748
+ }))), _defs$3 || (_defs$3 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
25267
25749
  id: "transform-translate_svg__b",
25268
25750
  x1: 17.727,
25269
25751
  x2: -1.215,
@@ -25936,6 +26418,97 @@ const useDoodleTransform = (data, onTransformChange, options) => {
25936
26418
  };
25937
26419
  };
25938
26420
 
26421
+ var _g$2, _defs$2;
26422
+ 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); }
26423
+ var SvgDisabledRotate = function SvgDisabledRotate(props) {
26424
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
26425
+ xmlns: "http://www.w3.org/2000/svg",
26426
+ width: 16,
26427
+ height: 16,
26428
+ fill: "none"
26429
+ }, props), _g$2 || (_g$2 = /*#__PURE__*/React__namespace.createElement("g", {
26430
+ clipPath: "url(#disabled-rotate_svg__a)"
26431
+ }, /*#__PURE__*/React__namespace.createElement("path", {
26432
+ fill: "#fff",
26433
+ d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0"
26434
+ }), /*#__PURE__*/React__namespace.createElement("path", {
26435
+ fill: "#211F1F",
26436
+ fillOpacity: 0.4,
26437
+ d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0"
26438
+ }), /*#__PURE__*/React__namespace.createElement("path", {
26439
+ fill: "#fff",
26440
+ fillOpacity: 0.7,
26441
+ 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"
26442
+ }))), _defs$2 || (_defs$2 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("clipPath", {
26443
+ id: "disabled-rotate_svg__a"
26444
+ }, /*#__PURE__*/React__namespace.createElement("path", {
26445
+ fill: "#fff",
26446
+ d: "M16 0H0v16h16z"
26447
+ })))));
26448
+ };
26449
+
26450
+ var _g$1, _defs$1;
26451
+ 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); }
26452
+ var SvgDisabledScale = function SvgDisabledScale(props) {
26453
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
26454
+ xmlns: "http://www.w3.org/2000/svg",
26455
+ width: 16,
26456
+ height: 16,
26457
+ fill: "none"
26458
+ }, props), _g$1 || (_g$1 = /*#__PURE__*/React__namespace.createElement("g", {
26459
+ clipPath: "url(#disabled-scale_svg__a)"
26460
+ }, /*#__PURE__*/React__namespace.createElement("path", {
26461
+ fill: "#fff",
26462
+ d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0"
26463
+ }), /*#__PURE__*/React__namespace.createElement("path", {
26464
+ fill: "#211F1F",
26465
+ fillOpacity: 0.4,
26466
+ d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0"
26467
+ }), /*#__PURE__*/React__namespace.createElement("path", {
26468
+ fill: "#fff",
26469
+ fillOpacity: 0.7,
26470
+ 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"
26471
+ }))), _defs$1 || (_defs$1 = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("clipPath", {
26472
+ id: "disabled-scale_svg__a"
26473
+ }, /*#__PURE__*/React__namespace.createElement("path", {
26474
+ fill: "#fff",
26475
+ d: "M0 16h16V0H0z"
26476
+ })))));
26477
+ };
26478
+
26479
+ var _g, _defs;
26480
+ 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); }
26481
+ var SvgDisabledTranslate = function SvgDisabledTranslate(props) {
26482
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
26483
+ xmlns: "http://www.w3.org/2000/svg",
26484
+ width: 16,
26485
+ height: 16,
26486
+ fill: "none"
26487
+ }, props), _g || (_g = /*#__PURE__*/React__namespace.createElement("g", {
26488
+ clipPath: "url(#disabled-translate_svg__a)"
26489
+ }, /*#__PURE__*/React__namespace.createElement("circle", {
26490
+ cx: 8,
26491
+ cy: 8,
26492
+ r: 8,
26493
+ fill: "#fff"
26494
+ }), /*#__PURE__*/React__namespace.createElement("circle", {
26495
+ cx: 8,
26496
+ cy: 8,
26497
+ r: 8,
26498
+ fill: "#211F1F",
26499
+ fillOpacity: 0.4
26500
+ }), /*#__PURE__*/React__namespace.createElement("path", {
26501
+ fill: "#fff",
26502
+ fillOpacity: 0.7,
26503
+ 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"
26504
+ }))), _defs || (_defs = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("clipPath", {
26505
+ id: "disabled-translate_svg__a"
26506
+ }, /*#__PURE__*/React__namespace.createElement("path", {
26507
+ fill: "#fff",
26508
+ d: "M16 0H0v16h16z"
26509
+ })))));
26510
+ };
26511
+
25939
26512
  var css_248z$5 = ".index-module_doodleHover__jIZHV path {\n fill: #2EC1B2;\n}";
25940
26513
  var styles$5 = {"doodleHover":"index-module_doodleHover__jIZHV"};
25941
26514
  styleInject(css_248z$5);
@@ -26134,15 +26707,16 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
26134
26707
  const infoBoxHeight = 40 * overlayScale; // 信息框高度
26135
26708
  const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
26136
26709
  const circleScale = platform === exports.PlatformType.H5 ? 1.5 * overlayScale : 2 * overlayScale;
26137
- 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
26710
+ const disacledScale = circleScale * 1.2;
26711
+ 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", ...(platform === exports.PlatformType.H5
26138
26712
  ? {
26139
26713
  onTouchStart: createReactEventHandler((e) => {
26140
26714
  handleMouseDownWithDisabled(e);
26141
26715
  }),
26142
26716
  }
26143
26717
  : {
26144
- onMouseDown: handleMouseDownWithDisabled,
26145
- }) }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r: 10 * circleScale, fill: "#B2B4B9", stroke: "none" }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[3].x, cy: selectionBoxPoints[3].y, r: 10 * circleScale, fill: "#B2B4B9", stroke: "none" }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[1].x, cy: selectionBoxPoints[1].y, r: 10 * circleScale, fill: "#B2B4B9", stroke: "none" }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[2].x, cy: selectionBoxPoints[2].y, r: 10 * circleScale, fill: "#B2B4B9", stroke: "none" }), platform === exports.PlatformType.H5 && (jsxRuntime.jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
26718
+ // onMouseDown: handleMouseDownWithDisabled,
26719
+ }) }), jsxRuntime.jsx("g", { transform: `translate(${selectionBoxPoints[3].x}, ${selectionBoxPoints[3].y})`, children: jsxRuntime.jsx("g", { transformOrigin: "center", transform: `translate(-${10 * circleScale}, -${10 * circleScale}) scale(${disacledScale})`, children: jsxRuntime.jsx(SvgDisabledRotate, {}) }) }), jsxRuntime.jsx("g", { transform: `translate(${selectionBoxPoints[1].x}, ${selectionBoxPoints[1].y})`, children: jsxRuntime.jsx("g", { transformOrigin: "center", transform: `translate(-${10 * circleScale}, -${10 * circleScale}) scale(${disacledScale})`, children: jsxRuntime.jsx(SvgDisabledTranslate, {}) }) }), jsxRuntime.jsx("g", { transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsxRuntime.jsx("g", { transformOrigin: "center", transform: `translate(-${10 * circleScale}, -${10 * circleScale}) scale(${disacledScale})`, children: jsxRuntime.jsx(SvgDisabledScale, {}) }) }), platform === exports.PlatformType.H5 && (jsxRuntime.jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
26146
26720
  onClickInfo?.();
26147
26721
  }, children: jsxRuntime.jsx("div", { style: {
26148
26722
  padding: `5px ${10 * overlayScale}px`,
@@ -27073,68 +27647,6 @@ const MowerPosition = React.memo(({ editMap, mowerPositionData, viewBox, modelTy
27073
27647
  }, children: jsxRuntime.jsx("img", { src: mowerImage, style: { width: '100%', height: '100%', objectFit: 'contain' } }) }) }));
27074
27648
  });
27075
27649
 
27076
- var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHHSURBVHgBtVtdjF3VdV7rnHPHtLbUkRrALwmDidSSgD1JqWQ3UMaNMaFq63FIKyoVZFRF6kMkbCmVcP9mrBARoJUnLRL9c+3WSVsqIkwrtRBKfaGmQFuFazBpK0wYnmLSF6MYx557zt5Zv3vvO/Z4bDPZ9pl97rlnztnfXmt969s/g/AjKrN7nxwf634wBTFMYIQNAWASAcYjxAmI+T5EnAeIdFQnYwxHqwr6Z5s1g9ld20/Cj6AgrGBhkKva0/d1MUxBiFMxEjw7gGv5RyUWL+cfiCD/0I4KoULs04ensKkP7d716/OwQmVFAD/4yMGpLsJM7MJUiIGMGiDQwUBDYHR8DgocFG/54gQ0HRVUFQPnuoK6qvp0ec/u3767Dx+wfCDAXyKg2MWZELopBth1BJQAB6ujgY5RANNpRI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M6Hrprrgm9fSimSMaasE5JhGSG494iFMVKKgKvk7B94JT7D7NL2654m/v3ygXlYEsJfpu35rArCejm23jex7q/05D+qYOYHOORZcQSmFVYgpfunoY419ODP21UOH5lbsr9RWFHBZpqd3jsMVZybJyJTO4gbCPk6YJgjrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
27077
-
27078
- const useChargingPile = ({ viewBox, rotation = 0 }) => {
27079
- const { svgElementDatas } = useSvgEditContext();
27080
- const { sn } = useCommonContext();
27081
- const items = React.useMemo(() => {
27082
- if (!svgElementDatas || !viewBox)
27083
- return [];
27084
- const chargingPiles = svgElementDatas?.[exports.DataType.CHARGING_PILE];
27085
- if (!chargingPiles)
27086
- return [];
27087
- const results = [];
27088
- for (const element of chargingPiles) {
27089
- const center = element.points?.[0];
27090
- if (!center)
27091
- continue;
27092
- const size = element.style?.radius ? element.style.radius * 2 : 55;
27093
- const direction = element?.direction || 0;
27094
- const angle = (direction * 180) / Math.PI;
27095
- const rotationDegree = 270 - angle; // 正东是正方向,需要处理下
27096
- const actualRotation = rotationDegree - rotation;
27097
- const relX = (center[0] - viewBox.x) / viewBox.width;
27098
- const relY = (center[1] - viewBox.y) / viewBox.height;
27099
- if (isFinite(relX) && isFinite(relY)) {
27100
- results.push({
27101
- leftPct: relX * 100,
27102
- topPct: relY * 100,
27103
- size,
27104
- rotateDeg: actualRotation,
27105
- imageSrc: chargingPileImage,
27106
- });
27107
- }
27108
- }
27109
- return results;
27110
- }, [svgElementDatas, viewBox?.x, viewBox?.y, viewBox?.width, viewBox?.height, rotation, sn]);
27111
- return items;
27112
- };
27113
-
27114
- const CharginPile = React.memo(({ viewBox, rotation = 0, isHighlight = true }) => {
27115
- const items = useChargingPile({ viewBox: viewBox || null, rotation });
27116
- const containerStyle = React.useMemo(() => ({
27117
- position: 'absolute',
27118
- top: 0,
27119
- left: 0,
27120
- width: '100%',
27121
- height: '100%',
27122
- pointerEvents: 'none',
27123
- zIndex: 750,
27124
- opacity: isHighlight ? SvgMapOpacity.HIGHLIGHT : SvgMapOpacity.UN_HIGHLIGHT,
27125
- }), [isHighlight]);
27126
- return (jsxRuntime.jsx("div", { style: containerStyle, children: items?.map((item, idx) => (jsxRuntime.jsx("div", { className: "charging-pile", style: {
27127
- position: 'absolute',
27128
- width: item.size,
27129
- height: item.size,
27130
- left: `${item.leftPct}%`,
27131
- top: `${item.topPct}%`,
27132
- transform: `translate(-50%, -50%) rotate(${item.rotateDeg}deg)`,
27133
- pointerEvents: 'auto',
27134
- zIndex: 750,
27135
- }, children: jsxRuntime.jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }, `pile-${idx}`))) }));
27136
- });
27137
-
27138
27650
  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}";
27139
27651
  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"};
27140
27652
  styleInject(css_248z$3);
@@ -28974,7 +29486,7 @@ const defaultMapConfig$1 = DEFAULT_STYLES;
28974
29486
  // 地图渲染器组件
28975
29487
  const MowerMapRenderer = React.forwardRef(({ sn, mowerIconConfig = {}, platform = exports.PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, isHighlight = true, mapConfig,
28976
29488
  // pathConfig,
28977
- 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) => {
29489
+ 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) => {
28978
29490
  const [currentError, setCurrentError] = React.useState(null);
28979
29491
  // const mapRef = useMap();
28980
29492
  const [processStateIsMowing, setProcessStateIsMowing] = React.useState(false);
@@ -29132,48 +29644,6 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29132
29644
  currentMowingPartitionId,
29133
29645
  processStateIsMowing,
29134
29646
  ]);
29135
- const commonValue = React.useMemo(() => {
29136
- return {
29137
- sn,
29138
- editMap,
29139
- platform,
29140
- language,
29141
- unitType,
29142
- svgViewBox,
29143
- heightOptions,
29144
- globalHeight,
29145
- mapConfig: mergedMapConfig,
29146
- mapJson,
29147
- drag: {
29148
- x: defaultTransform?.x ?? 0,
29149
- y: defaultTransform?.y ?? 0,
29150
- rotate: (defaultTransform?.rotation ?? 0) + originNorthRotate,
29151
- },
29152
- mapRef,
29153
- overlayScale,
29154
- doodleList,
29155
- mowerIconConfig,
29156
- showStraddleBoundaryBorder,
29157
- };
29158
- }, [
29159
- sn,
29160
- editMap,
29161
- platform,
29162
- svgViewBox,
29163
- unitType,
29164
- language,
29165
- heightOptions,
29166
- globalHeight,
29167
- mergedMapConfig,
29168
- mapJson,
29169
- defaultTransform,
29170
- originNorthRotate,
29171
- mapRef,
29172
- overlayScale,
29173
- doodleList,
29174
- mowerIconConfig,
29175
- showStraddleBoundaryBorder,
29176
- ]);
29177
29647
  const mowerPositionData = React.useMemo(() => {
29178
29648
  // realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
29179
29649
  // 在初始的状态按照正常图标进行渲染,所以构造一个基本在rtk桩的一个数据
@@ -29219,15 +29689,12 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29219
29689
  const bounds = React.useMemo(() => {
29220
29690
  if (!mapJson)
29221
29691
  return null;
29222
- // 计算边界
29223
- const bounds = calculateMapBounds(mapJson);
29224
- if (!bounds) {
29225
- handleError('无法计算地图边界');
29226
- return;
29692
+ const mapBoundsData = calculateMapBounds(mapJson);
29693
+ if (!mapBoundsData) {
29694
+ console.warn('Failed to calculate map bounds');
29695
+ return null;
29227
29696
  }
29228
- // 将自定义边界转换为Google Maps LatLngBounds(使用有效的GPS坐标)
29229
29697
  const validBounds = getValidGpsBounds(mapJson, 0);
29230
- // 地图数据中的坐标格式是 [longitude, latitude]
29231
29698
  const [swLng0, swLat0] = validBounds.sw;
29232
29699
  const [neLng0, neLat0] = validBounds.ne;
29233
29700
  const [swX0, swY0] = proj4(WGS84, WEB_MERCATOR, [swLng0, swLat0]);
@@ -29238,11 +29705,58 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29238
29705
  const neY = neY0 + drag.y;
29239
29706
  const [swLng, swLat] = proj4(WEB_MERCATOR, WGS84, [swX, swY]);
29240
29707
  const [neLng, neLat] = proj4(WEB_MERCATOR, WGS84, [neX, neY]);
29241
- const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
29242
- new window.google.maps.LatLng(neLat, neLng) // 东北角
29243
- );
29244
- return googleBounds;
29708
+ return new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), new window.google.maps.LatLng(neLat, neLng));
29245
29709
  }, [mapJson, drag.x, drag.y]);
29710
+ const commonValue = React.useMemo(() => {
29711
+ return {
29712
+ sn,
29713
+ editMap,
29714
+ platform,
29715
+ language,
29716
+ unitType,
29717
+ svgViewBox,
29718
+ heightOptions,
29719
+ globalHeight,
29720
+ mapConfig: mergedMapConfig,
29721
+ mapJson,
29722
+ drag: {
29723
+ x: defaultTransform?.x ?? 0,
29724
+ y: defaultTransform?.y ?? 0,
29725
+ rotate: (defaultTransform?.rotation ?? 0) + originNorthRotate,
29726
+ },
29727
+ mapRef,
29728
+ bounds,
29729
+ overlayScale,
29730
+ doodleList,
29731
+ mowerIconConfig,
29732
+ showStraddleBoundaryBorder,
29733
+ overlayLayout,
29734
+ googleMapStaticApiKey,
29735
+ onH5FirstSelectObstaclePoint,
29736
+ };
29737
+ }, [
29738
+ sn,
29739
+ editMap,
29740
+ platform,
29741
+ svgViewBox,
29742
+ unitType,
29743
+ language,
29744
+ heightOptions,
29745
+ globalHeight,
29746
+ mergedMapConfig,
29747
+ mapJson,
29748
+ defaultTransform,
29749
+ originNorthRotate,
29750
+ mapRef,
29751
+ bounds,
29752
+ overlayScale,
29753
+ doodleList,
29754
+ mowerIconConfig,
29755
+ showStraddleBoundaryBorder,
29756
+ overlayLayout,
29757
+ googleMapStaticApiKey,
29758
+ onH5FirstSelectObstaclePoint,
29759
+ ]);
29246
29760
  const fitBounds = React.useCallback((padding = 0) => {
29247
29761
  if (!mapJson || !mapRef)
29248
29762
  return null;
@@ -29557,7 +30071,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29557
30071
  // svgEditMapRef?.current?.adjustSvgSize?.(layout);
29558
30072
  setOverlayLayout(layout);
29559
30073
  }
29560
- }, map: mapRef, mapPaneName: 'overlayMouseTarget', bounds: bounds, rotate: actureRotate, children: [jsxRuntime.jsx(MapDrag, { map: mapRef, dragCallbacks: dragCallbacks, onBoundaryLabelsCollapse: () => { }, onTransformChange: handleDragMove, isDragMap: dragMap, canRotateMap: canRotateMap }), jsxRuntime.jsx(MowPartitionContextProvider, { value: mowPartitionValue, children: jsxRuntime.jsx(SvgMapComponent, { isHighlight: isHighlight, editMap: editMap, ref: svgMapRef, pathData: pathJson, mapConfig: mergedMapConfig, mowPartitionData: mowPartitionData }) }), jsxRuntime.jsx(MowerPosition, { editMap: editMap, mowerPositionData: mowerPositionData, viewBox: svgViewBox || null, modelType: modelType, hasEdger: edger, mapData: mapJson, mapConfig: mergedMapConfig, realTimeData: realTimeData, onMowingPositionChange: onMowingPositionChange, isHighlight: isHighlight }), jsxRuntime.jsx(CharginPile, { viewBox: svgViewBox || null, rotation: actureRotate, isHighlight: isHighlight }), jsxRuntime.jsx(BoundaryLabels, { editMap: editMap, mapData: mapJson, onlyRead: onlyRead, pathData: pathJson, unitType: unitType, viewBox: svgViewBox || null, rotation: actureRotate, mowPartitionData: mowPartitionData, realTimeData: realTimeData, isHighlight: isHighlight }), jsxRuntime.jsx(Antennas, { editMap: editMap, antennaConfig: antennaConfig || [], layout: overlayLayout || undefined, viewBox: svgViewBox || null, rotation: actureRotate, onlyRead: onlyRead, isHighlight: isHighlight }), jsxRuntime.jsx(SvgEditMap, { editMap: editMap, ref: svgEditMapRef, mapConfig: mergedMapConfig, onEditInfoMapChange: onEditInfoMapChange })] })] }) }) }));
30074
+ }, map: mapRef, mapPaneName: 'overlayMouseTarget', bounds: bounds, rotate: actureRotate, zIndex: zIndex, children: [jsxRuntime.jsx(MapDrag, { map: mapRef, dragCallbacks: dragCallbacks, onBoundaryLabelsCollapse: () => { }, onTransformChange: handleDragMove, isDragMap: dragMap, canRotateMap: canRotateMap }), jsxRuntime.jsx(MowPartitionContextProvider, { value: mowPartitionValue, children: jsxRuntime.jsx(SvgMapComponent, { isHighlight: isHighlight, editMap: editMap, ref: svgMapRef, pathData: pathJson, mapConfig: mergedMapConfig, mowPartitionData: mowPartitionData }) }), jsxRuntime.jsx(MowerPosition, { editMap: editMap, mowerPositionData: mowerPositionData, viewBox: svgViewBox || null, modelType: modelType, hasEdger: edger, mapData: mapJson, mapConfig: mergedMapConfig, realTimeData: realTimeData, onMowingPositionChange: onMowingPositionChange, isHighlight: isHighlight }), jsxRuntime.jsx(CharginPile, { viewBox: svgViewBox || null, rotation: actureRotate, isHighlight: isHighlight }), jsxRuntime.jsx(BoundaryLabels, { editMap: editMap, mapData: mapJson, onlyRead: onlyRead, pathData: pathJson, unitType: unitType, viewBox: svgViewBox || null, rotation: actureRotate, mowPartitionData: mowPartitionData, realTimeData: realTimeData, isHighlight: isHighlight }), jsxRuntime.jsx(Antennas, { editMap: editMap, antennaConfig: antennaConfig || [], layout: overlayLayout || undefined, viewBox: svgViewBox || null, rotation: actureRotate, onlyRead: onlyRead, isHighlight: isHighlight }), jsxRuntime.jsx(SvgEditMap, { editMap: editMap, ref: svgEditMapRef, mapConfig: mergedMapConfig, onEditInfoMapChange: onEditInfoMapChange })] })] }) }) }));
29561
30075
  });
29562
30076
  MowerMapRenderer.displayName = 'MowerMapRenderer';
29563
30077