@fleet-frontend/mower-maps 0.2.5-beta.7 → 0.2.5-beta.9

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
@@ -13925,6 +13925,16 @@ exports.CheckDoodleErrorType = void 0;
13925
13925
  // doodle与其他元素距离过近
13926
13926
  CheckDoodleErrorType["DOODLE_DISTANCE_TOO_CLOSE_TO_OTHER_ELEMENT"] = "doodle_distance_too_close_to_other_element";
13927
13927
  })(exports.CheckDoodleErrorType || (exports.CheckDoodleErrorType = {}));
13928
+ exports.MapType = void 0;
13929
+ (function (MapType) {
13930
+ // 普通地图
13931
+ MapType["NORMAL"] = "normal";
13932
+ /**
13933
+ * 主要是用在地理围栏相关的
13934
+ * 此地图没有分区名称气泡,没有孤立子地块,没有设备图标,没有天线
13935
+ */
13936
+ MapType["GEO_FENCE"] = "geo-fence";
13937
+ })(exports.MapType || (exports.MapType = {}));
13928
13938
 
13929
13939
  var RealTimeDataType;
13930
13940
  (function (RealTimeDataType) {
@@ -19841,7 +19851,9 @@ function OverlayViewFunctional({ map, position, bounds, rotate, mapPaneName, zIn
19841
19851
  }, [map, overlay]);
19842
19852
  // to move the container to the foreground and background
19843
19853
  React.useEffect(() => {
19844
- container.style.zIndex = `${zIndex}`;
19854
+ if (zIndex) {
19855
+ container.style.zIndex = `${zIndex}`;
19856
+ }
19845
19857
  }, [zIndex, container]);
19846
19858
  return ReactDOM.createPortal(children, container);
19847
19859
  }
@@ -22668,15 +22680,25 @@ var index = {
22668
22680
  const CommonContext = React.createContext({
22669
22681
  sn: '',
22670
22682
  editMap: false,
22671
- mowerIconConfig: {},
22683
+ mowerIconConfig: {
22684
+ mapImgUrl: '',
22685
+ mapDisabledUrl: '',
22686
+ mapNoPositionUrl: '',
22687
+ },
22672
22688
  platform: exports.PlatformType.WEB,
22673
22689
  svgViewBox: null,
22674
22690
  unitType: UnitsType.Metric,
22691
+ mapConfig: {},
22692
+ mapJson: null,
22693
+ drag: { x: 0, y: 0, rotate: 0, rotation: 0 },
22675
22694
  mapRef: null,
22695
+ bounds: null,
22676
22696
  globalHeight: 0,
22677
22697
  heightOptions: [],
22678
22698
  overlayScale: 1,
22679
22699
  showStraddleBoundaryBorder: true,
22700
+ googleMapStaticApiKey: '',
22701
+ onH5FirstSelectObstaclePoint: undefined,
22680
22702
  });
22681
22703
  const CommonContextProvider = CommonContext.Provider;
22682
22704
  const useCommonContext = () => React.useContext(CommonContext);
@@ -23108,10 +23130,6 @@ const DistanceLabels = ({ coordinates, createMode = false, editMode = false, com
23108
23130
  } }))] }));
23109
23131
  };
23110
23132
 
23111
- 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}";
23112
- var styles$6 = {"pointerCursor":"index-module_pointerCursor__Ee6pr","polygonPath":"index-module_polygonPath__PynOn","dragging":"index-module_dragging__xSFdO","notCreate":"index-module_notCreate__bFnkV"};
23113
- styleInject(css_248z$6);
23114
-
23115
23133
  exports.CreateStatus = void 0;
23116
23134
  (function (CreateStatus) {
23117
23135
  CreateStatus["CREATING"] = "creating";
@@ -23161,6 +23179,439 @@ const MapEditContext = React.createContext({
23161
23179
  const MapEditContextProvider = MapEditContext.Provider;
23162
23180
  const useMapEditContext = () => React.useContext(MapEditContext);
23163
23181
 
23182
+ var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHHSURBVHgBtVtdjF3VdV7rnHPHtLbUkRrALwmDidSSgD1JqWQ3UMaNMaFq63FIKyoVZFRF6kMkbCmVcP9mrBARoJUnLRL9c+3WSVsqIkwrtRB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WOxynssx3gf9R8Pm2r2EIXgxWC4JMBcfvXunTu6djhDi80TQ90aga2uv4Ivs0bfSZtHSQbLyMwSUekfruB0PF6ppMW8UVwAE9gebywlN66b3klilD2Pf31uDi6hLOvSi8u3X3t5sOGmT9FQqxqndk2iyZ50QKXjahPxqFrchL3WlQPS0Rkd9QgwG8DovujaUw4dlCnIqkiA+2NjzR2PH5x7Gi6xXLKFy3Lnb3xhOrRhL60tT3TFnwKIe/sejGDL6DpJgAXn+YSMx7iTk28O1z3SaUe8ZIc+hfCeJ772aB8us3wgwF4+d9cXplqIM6Hrprrgm9fSimSMaasE5JhGSG494iFMVKKgKvk7B94JT7D7NL2654m/v3ygXlYEsJfpu35rArCejm23jex7q/05D+qYOYHOORZcQSmFVYgpfunoY419ODP21UOH5lbsr9RWFHBZpqd3jsMVZybJyJTO4gbCPk6YJgjrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
23183
+
23184
+ const useChargingPile = ({ viewBox, rotation = 0 }) => {
23185
+ const { svgElementDatas } = useSvgEditContext();
23186
+ const { sn } = useCommonContext();
23187
+ const items = React.useMemo(() => {
23188
+ if (!svgElementDatas || !viewBox)
23189
+ return [];
23190
+ const chargingPiles = svgElementDatas?.[exports.DataType.CHARGING_PILE];
23191
+ if (!chargingPiles)
23192
+ return [];
23193
+ const results = [];
23194
+ for (const element of chargingPiles) {
23195
+ const center = element.points?.[0];
23196
+ if (!center)
23197
+ continue;
23198
+ const size = element.style?.radius ? element.style.radius * 2 : 55;
23199
+ const direction = element?.direction || 0;
23200
+ const angle = (direction * 180) / Math.PI;
23201
+ const rotationDegree = 270 - angle; // 正东是正方向,需要处理下
23202
+ const actualRotation = rotationDegree - rotation;
23203
+ const relX = (center[0] - viewBox.x) / viewBox.width;
23204
+ const relY = (center[1] - viewBox.y) / viewBox.height;
23205
+ if (isFinite(relX) && isFinite(relY)) {
23206
+ results.push({
23207
+ leftPct: relX * 100,
23208
+ topPct: relY * 100,
23209
+ size,
23210
+ rotateDeg: actualRotation,
23211
+ imageSrc: chargingPileImage,
23212
+ });
23213
+ }
23214
+ }
23215
+ return results;
23216
+ }, [svgElementDatas, viewBox?.x, viewBox?.y, viewBox?.width, viewBox?.height, rotation, sn]);
23217
+ return items;
23218
+ };
23219
+
23220
+ const CharginPile = React.memo(({ viewBox, rotation = 0, sizeScale = 1, sizeInSvgUnits = false, isHighlight = true, }) => {
23221
+ const items = useChargingPile({ viewBox: viewBox || null, rotation });
23222
+ const containerStyle = React.useMemo(() => ({
23223
+ position: 'absolute',
23224
+ top: 0,
23225
+ left: 0,
23226
+ width: '100%',
23227
+ height: '100%',
23228
+ pointerEvents: 'none',
23229
+ zIndex: 750,
23230
+ opacity: isHighlight ? SvgMapOpacity.HIGHLIGHT : SvgMapOpacity.UN_HIGHLIGHT,
23231
+ }), [isHighlight]);
23232
+ return (jsxRuntime.jsx("div", { style: containerStyle, children: items?.map((item, idx) => (jsxRuntime.jsx("div", { className: "charging-pile", style: {
23233
+ position: 'absolute',
23234
+ width: sizeInSvgUnits && viewBox
23235
+ ? `${(item.size / Math.max(viewBox.width, 1)) * 100 * sizeScale}%`
23236
+ : item.size * sizeScale,
23237
+ height: sizeInSvgUnits && viewBox
23238
+ ? `${(item.size / Math.max(viewBox.height, 1)) * 100 * sizeScale}%`
23239
+ : item.size * sizeScale,
23240
+ left: `${item.leftPct}%`,
23241
+ top: `${item.topPct}%`,
23242
+ transform: `translate(-50%, -50%) rotate(${item.rotateDeg}deg)`,
23243
+ pointerEvents: 'auto',
23244
+ zIndex: 750,
23245
+ }, children: jsxRuntime.jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }, `pile-${idx}`))) }));
23246
+ });
23247
+
23248
+ const MAX_STATIC_SIZE = 640;
23249
+ const MAX_STATIC_MAP_RETRY = 3;
23250
+ const STATIC_MAP_RETRY_COOLDOWN_MS = 5000;
23251
+ const Magnifier = ({ visible, dragState, polygonPoints, fillColor = 'rgba(255, 122, 51, 0.1)', strokeColor = 'rgba(255, 122, 51, 1)', strokeWidth = 2, zoom = 3, size = 200, }) => {
23252
+ const { svgViewBox, mapRef, googleMapStaticApiKey, drag } = useCommonContext();
23253
+ const { svgElementDatas, svgRef } = useSvgEditContext();
23254
+ const { editMapInfo } = useMapEditContext();
23255
+ const [magnifierPosition, setMagnifierPosition] = React.useState({ x: 0, y: 0 });
23256
+ const [magnifierBoxSize, setMagnifierBoxSize] = React.useState({ width: size, height: size });
23257
+ // 本次拖拽中放大镜位置是否已完成初始化(未完成前隐藏,避免首帧闪动)
23258
+ const [isPlacementReady, setIsPlacementReady] = React.useState(false);
23259
+ // 放大镜所在侧边:true=右侧,false=左侧
23260
+ const [placeOnRight, setPlaceOnRight] = React.useState(true);
23261
+ // 仅在每次拖拽开始时初始化一次侧边
23262
+ const hasInitializedSideRef = React.useRef(false);
23263
+ const [mapImageFrame, setMapImageFrame] = React.useState(null);
23264
+ const [staticMapRetryCount, setStaticMapRetryCount] = React.useState(0);
23265
+ const [staticMapBlockedUntil, setStaticMapBlockedUntil] = React.useState(0);
23266
+ // 获取当前正在拖拽的禁区 ID
23267
+ const currentObstacleId = editMapInfo?.selectElement?.id;
23268
+ // 计算当前 SVG 单位到屏幕像素的比例(用于实现真正 1:1 预览)
23269
+ const getPixelScale = () => {
23270
+ //先拿 svgRef.getScreenCTM(),这是 SVG 到屏幕的变换矩阵(包含缩放/旋转/平移)
23271
+ const ctm = svgRef?.getScreenCTM?.();
23272
+ if (!ctm)
23273
+ return 1;
23274
+ // 使用向量长度计算缩放,兼容旋转矩阵
23275
+ // 用 Math.hypot(ctm.a, ctm.b) 算出 x 方向的实际缩放倍率(用向量长度是为了兼容旋转,不只看 a)
23276
+ const scaleX = Math.hypot(ctm.a, ctm.b);
23277
+ return Number.isFinite(scaleX) && scaleX > 0 ? scaleX : 1;
23278
+ };
23279
+ // 读取设备安全区(刘海/手势条)inset,兼容横屏 H5
23280
+ const getSafeAreaInsets = () => {
23281
+ const probe = document.createElement('div');
23282
+ probe.style.position = 'fixed';
23283
+ probe.style.left = '0';
23284
+ probe.style.top = '0';
23285
+ probe.style.width = '0';
23286
+ probe.style.height = '0';
23287
+ probe.style.visibility = 'hidden';
23288
+ probe.style.pointerEvents = 'none';
23289
+ probe.style.paddingTop = 'env(safe-area-inset-top)';
23290
+ probe.style.paddingRight = 'env(safe-area-inset-right)';
23291
+ probe.style.paddingBottom = 'env(safe-area-inset-bottom)';
23292
+ probe.style.paddingLeft = 'env(safe-area-inset-left)';
23293
+ document.body.appendChild(probe);
23294
+ const style = window.getComputedStyle(probe);
23295
+ const insets = {
23296
+ top: Number.parseFloat(style.paddingTop) || 0,
23297
+ right: Number.parseFloat(style.paddingRight) || 0,
23298
+ bottom: Number.parseFloat(style.paddingBottom) || 0,
23299
+ left: Number.parseFloat(style.paddingLeft) || 0,
23300
+ };
23301
+ document.body.removeChild(probe);
23302
+ return insets;
23303
+ };
23304
+ // 计算并获取放大镜底图:优先使用 Google Maps Static API,无图时走灰色背景兜底
23305
+ React.useEffect(() => {
23306
+ if (!visible || !dragState.currentPosition || !mapRef || !svgViewBox || !svgRef) {
23307
+ // console.log('[Magnifier] Skip static map effect: missing deps', {
23308
+ // visible,
23309
+ // hasCurrentPosition: Boolean(dragState.currentPosition),
23310
+ // hasMapRef: Boolean(mapRef),
23311
+ // hasSvgViewBox: Boolean(svgViewBox),
23312
+ // hasSvgRef: Boolean(svgRef),
23313
+ // });
23314
+ setMapImageFrame(null);
23315
+ setStaticMapRetryCount(0);
23316
+ setStaticMapBlockedUntil(0);
23317
+ return;
23318
+ }
23319
+ // 弱网连续失败时进入短暂冷却,避免重试风暴导致底图反复闪烁
23320
+ if (Date.now() < staticMapBlockedUntil) {
23321
+ return;
23322
+ }
23323
+ const mapDiv = mapRef.getDiv?.();
23324
+ // 获取 SVG 到屏幕的变换矩阵的逆矩阵
23325
+ const inverseCtm = svgRef.getScreenCTM?.()?.inverse?.();
23326
+ if (!mapDiv || !inverseCtm) {
23327
+ // console.log('[Magnifier] Skip static map effect: mapDiv/ctm missing', {
23328
+ // hasMapDiv: Boolean(mapDiv),
23329
+ // hasInverseCtm: Boolean(inverseCtm),
23330
+ // });
23331
+ setMapImageFrame(null);
23332
+ setStaticMapRetryCount(0);
23333
+ setStaticMapBlockedUntil(0);
23334
+ return;
23335
+ }
23336
+ const mapRect = mapDiv.getBoundingClientRect();
23337
+ const svgPoint = svgRef.createSVGPoint();
23338
+ // 只要有 key 就尝试 static api;请求失败时不截图,直接回退灰色背景
23339
+ if (googleMapStaticApiKey) {
23340
+ // console.log('[Magnifier] Background source: static api viewport snapshot');
23341
+ const mapBounds = mapRef.getBounds?.();
23342
+ if (!mapBounds) {
23343
+ // console.log('[Magnifier] Skip static map effect: mapBounds missing');
23344
+ setMapImageFrame(null);
23345
+ return;
23346
+ }
23347
+ const screenToSvg = (screenX, screenY) => {
23348
+ svgPoint.x = screenX;
23349
+ svgPoint.y = screenY;
23350
+ const p = svgPoint.matrixTransform(inverseCtm);
23351
+ return { x: p.x, y: p.y };
23352
+ };
23353
+ // 使用当前地图视口矩形四角,将屏幕坐标映射到 SVG 坐标,确保底图与主视口对齐
23354
+ const topLeftSvg = screenToSvg(mapRect.left, mapRect.top);
23355
+ const topRightSvg = screenToSvg(mapRect.right, mapRect.top);
23356
+ const bottomLeftSvg = screenToSvg(mapRect.left, mapRect.bottom);
23357
+ if (!topLeftSvg || !topRightSvg || !bottomLeftSvg) {
23358
+ setMapImageFrame(null);
23359
+ return;
23360
+ }
23361
+ // 把当前主地图可视区域尺寸,按比例压到 Static API 允许的最大尺寸以内(受 Static API 640 上限约束)),同时不改变宽高比。
23362
+ const mapWidth = Math.max(1, Math.round(mapRect.width));
23363
+ const mapHeight = Math.max(1, Math.round(mapRect.height));
23364
+ const shrinkRatio = Math.min(1, MAX_STATIC_SIZE / Math.max(mapWidth, mapHeight));
23365
+ const staticWidth = Math.max(1, Math.round(mapWidth * shrinkRatio));
23366
+ const staticHeight = Math.max(1, Math.round(mapHeight * shrinkRatio));
23367
+ const center = mapBounds.getCenter();
23368
+ const currentZoom = mapRef.getZoom() || 20;
23369
+ // 尺寸缩小后同步补偿 zoom,保持与当前主图一致的地理覆盖范围
23370
+ const zoomCompensation = Math.log2(shrinkRatio);
23371
+ const adjustedZoom = currentZoom + zoomCompensation;
23372
+ const staticZoom = Math.max(0, Math.min(Math.floor(adjustedZoom), 22));
23373
+ const staticMapUrl = `https://maps.googleapis.com/maps/api/staticmap?center=${center.lat()},${center.lng()}&zoom=${staticZoom}&size=${staticWidth}x${staticHeight}&maptype=satellite&key=${googleMapStaticApiKey}`;
23374
+ // 通过三角点推导静态图在 SVG 中的宽高和旋转角
23375
+ // Math.hypot(x, y) 等价于 sqrt(x*x + y*y),计算两点之间的距离
23376
+ const width = Math.hypot(topRightSvg.x - topLeftSvg.x, topRightSvg.y - topLeftSvg.y);
23377
+ const height = Math.hypot(bottomLeftSvg.x - topLeftSvg.x, bottomLeftSvg.y - topLeftSvg.y);
23378
+ // Math.atan2(y, x) 计算反正切值,返回 [-π, π] 弧度,*180/π 转换为角度
23379
+ const rotationDeg = (Math.atan2(topRightSvg.y - topLeftSvg.y, topRightSvg.x - topLeftSvg.x) * 180) / Math.PI;
23380
+ // Static API zoom 只能取整;额外补偿小数部分,避免底图视觉偏小
23381
+ // 在有旋转的坐标系里,做“以中心为锚点”的等比放大补偿。
23382
+ const fractionalZoomScale = Math.pow(2, adjustedZoom - staticZoom); //算出“还差多少缩放比例”。例子:adjustedZoom=19.6,staticZoom=19,差 0.6,比例是 2^0.6 ≈ 1.515。
23383
+ //把原始 width/height 乘这个比例,得到补偿后的尺寸。
23384
+ const compensatedWidth = width * fractionalZoomScale;
23385
+ const compensatedHeight = height * fractionalZoomScale;
23386
+ //尺寸变大后,多出来的宽/高的一半(要从两边均匀扩张)。
23387
+ const offsetAlongX = (compensatedWidth - width) / 2;
23388
+ const offsetAlongY = (compensatedHeight - height) / 2;
23389
+ //“右方向”单位向量(从左上指向右上),因为图可能旋转了,不能只按水平 x 轴算。
23390
+ const unitX = width > 0 ? (topRightSvg.x - topLeftSvg.x) / width : 1;
23391
+ const unitY = width > 0 ? (topRightSvg.y - topLeftSvg.y) / width : 0;
23392
+ //“下方向”单位向量(从左上指向左下),同理用于旋转场景。
23393
+ const unitDownX = height > 0 ? (bottomLeftSvg.x - topLeftSvg.x) / height : 0;
23394
+ const unitDownY = height > 0 ? (bottomLeftSvg.y - topLeftSvg.y) / height : 1;
23395
+ /**
23396
+ * 计算补偿后的新左上角:
23397
+ * 从原左上角沿“右方向”回退半个扩展量,再沿“下方向”回退半个扩展量。
23398
+ * 这样放大后仍以原区域中心为中心,不会放大后位置偏移。
23399
+ */
23400
+ const compensatedTopLeftX = topLeftSvg.x - unitX * offsetAlongX - unitDownX * offsetAlongY;
23401
+ const compensatedTopLeftY = topLeftSvg.y - unitY * offsetAlongX - unitDownY * offsetAlongY;
23402
+ setMapImageFrame({
23403
+ url: staticMapUrl,
23404
+ x: compensatedTopLeftX,
23405
+ y: compensatedTopLeftY,
23406
+ width: compensatedWidth,
23407
+ height: compensatedHeight,
23408
+ transform: `rotate(${rotationDeg} ${compensatedTopLeftX} ${compensatedTopLeftY})`,
23409
+ });
23410
+ }
23411
+ else {
23412
+ setMapImageFrame(null);
23413
+ setStaticMapRetryCount(0);
23414
+ setStaticMapBlockedUntil(0);
23415
+ // console.log('[Magnifier] Background source: gray fallback (no static api key)');
23416
+ }
23417
+ }, [
23418
+ visible,
23419
+ dragState.isDragging,
23420
+ mapRef,
23421
+ svgViewBox?.x,
23422
+ svgViewBox?.y,
23423
+ svgViewBox?.width,
23424
+ svgViewBox?.height,
23425
+ svgRef,
23426
+ size,
23427
+ zoom,
23428
+ googleMapStaticApiKey,
23429
+ staticMapRetryCount,
23430
+ staticMapBlockedUntil,
23431
+ ]);
23432
+ React.useLayoutEffect(() => {
23433
+ if (!visible) {
23434
+ hasInitializedSideRef.current = false;
23435
+ setIsPlacementReady(false);
23436
+ return;
23437
+ }
23438
+ const updatePosition = () => {
23439
+ const mapDiv = mapRef?.getDiv?.();
23440
+ const mapRect = mapDiv?.getBoundingClientRect?.();
23441
+ const boxSize = Math.max(120, Math.round(size));
23442
+ // 设置放大镜大小
23443
+ setMagnifierBoxSize({ width: boxSize, height: boxSize });
23444
+ const viewportWidth = window.innerWidth;
23445
+ const viewportHeight = window.innerHeight;
23446
+ const baseMargin = 10; // 放大镜与边缘的基础间距
23447
+ const insets = getSafeAreaInsets();
23448
+ const marginTop = Math.max(baseMargin, insets.top);
23449
+ const marginRight = Math.max(baseMargin, insets.right);
23450
+ const marginBottom = Math.max(baseMargin, insets.bottom);
23451
+ const marginLeft = Math.max(baseMargin, insets.left);
23452
+ const topY = mapRect ? mapRect.top + marginTop : marginTop;
23453
+ // 顶部位置限制在可视区与安全区内,避免横屏时被刘海/手势条遮挡
23454
+ const safeTopY = Math.max(marginTop, Math.min(topY, viewportHeight - boxSize - marginBottom));
23455
+ let nextPlaceOnRight = placeOnRight;
23456
+ const ctm = svgRef?.getScreenCTM?.();
23457
+ // 首次显示时先同步算出侧边,再基于该侧边定位,避免“先左后右/先右后左”闪动
23458
+ if (!hasInitializedSideRef.current && dragState.currentPosition && ctm && mapRect) {
23459
+ const p = svgRef.createSVGPoint();
23460
+ p.x = dragState.currentPosition[0];
23461
+ p.y = dragState.currentPosition[1];
23462
+ const dragScreenPoint = p.matrixTransform(ctm);
23463
+ const mapMidX = mapRect.left + mapRect.width / 2;
23464
+ nextPlaceOnRight = dragScreenPoint.x < mapMidX;
23465
+ setPlaceOnRight(nextPlaceOnRight);
23466
+ hasInitializedSideRef.current = true;
23467
+ }
23468
+ const rightX = mapRect
23469
+ ? mapRect.right - boxSize - marginRight
23470
+ : viewportWidth - boxSize - marginRight;
23471
+ const leftX = mapRect ? mapRect.left + marginLeft : marginLeft;
23472
+ const safeX = nextPlaceOnRight ? rightX : leftX;
23473
+ const boundedX = Math.max(marginLeft, Math.min(safeX, viewportWidth - boxSize - marginRight));
23474
+ // 放大镜出现后,仅当拖拽点进入放大镜区域时才切换到对侧
23475
+ if (dragState.currentPosition && ctm) {
23476
+ const p = svgRef.createSVGPoint();
23477
+ p.x = dragState.currentPosition[0];
23478
+ p.y = dragState.currentPosition[1];
23479
+ // 应用这个矩阵,变换成屏幕坐标
23480
+ const dragScreenPoint = p.matrixTransform(ctm);
23481
+ const pointInMagnifier = dragScreenPoint.x >= boundedX &&
23482
+ dragScreenPoint.x <= boundedX + boxSize &&
23483
+ dragScreenPoint.y >= safeTopY &&
23484
+ dragScreenPoint.y <= safeTopY + boxSize;
23485
+ if (pointInMagnifier) {
23486
+ setPlaceOnRight((prev) => !prev);
23487
+ return;
23488
+ }
23489
+ }
23490
+ setMagnifierPosition({
23491
+ x: boundedX,
23492
+ y: safeTopY,
23493
+ });
23494
+ setIsPlacementReady(true);
23495
+ };
23496
+ updatePosition();
23497
+ window.addEventListener('resize', updatePosition);
23498
+ return () => window.removeEventListener('resize', updatePosition);
23499
+ }, [
23500
+ visible,
23501
+ size,
23502
+ mapRef,
23503
+ svgRef,
23504
+ placeOnRight,
23505
+ dragState.currentPosition?.[0],
23506
+ dragState.currentPosition?.[1],
23507
+ ]);
23508
+ // 早期返回必须在所有 hooks 之后
23509
+ if (!visible || !dragState.currentPosition || !svgViewBox) {
23510
+ return null;
23511
+ }
23512
+ const [centerX, centerY] = dragState.currentPosition;
23513
+ // 计算放大区域范围(以拖拽点为中心)
23514
+ //effectiveZoom = Math.max(0.001, zoom * getPixelScale())
23515
+ // 得到实际放大倍率。
23516
+ // zoom 是你设置的放大倍数(比如 3)
23517
+ // getPixelScale() 是当前 SVG 到屏幕的缩放因子(地图本身被缩放时要补偿)
23518
+ // Math.max(0.001, ...) 是防止出现 0 或极小值导致除零/异常
23519
+ // magnifierWidthInSvg = magnifierBoxSize.width / effectiveZoom
23520
+ // magnifierHeightInSvg = magnifierBoxSize.height / effectiveZoom
23521
+ // 把“屏幕上放大镜框的像素尺寸”换算成“SVG 坐标里要截取的实际尺寸”
23522
+ // 放大倍率越大,分母越大,截取范围越小 => 看起来越放大
23523
+ const effectiveZoom = Math.max(0.001, zoom * getPixelScale());
23524
+ const magnifierWidthInSvg = magnifierBoxSize.width / effectiveZoom;
23525
+ const magnifierHeightInSvg = magnifierBoxSize.height / effectiveZoom;
23526
+ // 计算放大区域的 viewBox
23527
+ const magnifierViewBox = {
23528
+ x: centerX - magnifierWidthInSvg / 2,
23529
+ y: centerY - magnifierHeightInSvg / 2,
23530
+ width: magnifierWidthInSvg,
23531
+ height: magnifierHeightInSvg,
23532
+ };
23533
+ // 样式缩放采用“弱抵消”,避免随 zoom 变细,保证放大镜内点线清晰度
23534
+ const styleZoomFactor = Math.max(1, zoom * 0.4);
23535
+ // 生成多边形点字符串(仅用于当前编辑禁区)
23536
+ const polygonPointsString = polygonPoints.length > 0 ? polygonPoints.map((p) => `${p[0]},${p[1]}`).join(' ') : '';
23537
+ const actureRotate = drag?.rotate ?? drag?.rotation ?? 0;
23538
+ // 渲染放大镜内容
23539
+ const magnifierContent = (jsxRuntime.jsxs("div", { style: {
23540
+ position: 'fixed',
23541
+ left: `${magnifierPosition.x}px`,
23542
+ top: `${magnifierPosition.y}px`,
23543
+ width: `${magnifierBoxSize.width}px`,
23544
+ height: `${magnifierBoxSize.height}px`,
23545
+ borderRadius: '50%',
23546
+ border: `2px solid #fff`,
23547
+ // boxShadow: '0 4px 20px rgba(0, 0, 0, 0.3)',
23548
+ overflow: 'hidden',
23549
+ zIndex: 10000,
23550
+ pointerEvents: 'none',
23551
+ background: 'rgba(235, 236, 240, 1)',
23552
+ visibility: isPlacementReady ? 'visible' : 'hidden',
23553
+ }, children: [jsxRuntime.jsxs("svg", {
23554
+ // 逻辑尺寸:与放大镜容器一致
23555
+ width: magnifierBoxSize.width, height: magnifierBoxSize.height,
23556
+ // 核心放大参数:从整张 SVG 中裁剪出当前需要展示的区域(x y width height)
23557
+ viewBox: `${magnifierViewBox.x} ${magnifierViewBox.y} ${magnifierViewBox.width} ${magnifierViewBox.height}`,
23558
+ // 保持内容居中并铺满窗口;比例不一致时裁边,不留空白
23559
+ preserveAspectRatio: "xMidYMid slice", style: {
23560
+ // CSS 尺寸:让 SVG 完全填满放大镜容器
23561
+ width: '100%',
23562
+ height: '100%',
23563
+ }, 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: () => {
23564
+ // console.log('✅ Map background loaded in magnifier');
23565
+ setStaticMapRetryCount(0);
23566
+ setStaticMapBlockedUntil(0);
23567
+ }, onError: (_e) => {
23568
+ // console.error('❌ Failed to load map background in magnifier', {
23569
+ // retryCount: staticMapRetryCount,
23570
+ // maxRetry: MAX_STATIC_MAP_RETRY,
23571
+ // url: mapImageFrame.url,
23572
+ // error: _e,
23573
+ // });
23574
+ setStaticMapRetryCount((prev) => {
23575
+ if (prev < MAX_STATIC_MAP_RETRY)
23576
+ return prev + 1;
23577
+ // 重试上限后进入冷却,不立刻清空已显示底图,避免弱网下闪烁
23578
+ setStaticMapBlockedUntil(Date.now() + STATIC_MAP_RETRY_COOLDOWN_MS);
23579
+ return 0;
23580
+ });
23581
+ } }, `magnifier-static-map-${staticMapRetryCount}`)), svgElementDatas &&
23582
+ Object.keys(svgElementDatas).map((key) => {
23583
+ const elements = svgElementDatas[key] || [];
23584
+ // 过滤掉当前正在拖拽的禁区(稍后单独渲染拖拽后的状态)
23585
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23586
+ const filteredElements = key === exports.DataType.OBSTACLE
23587
+ ? elements.filter((item) => item.id !== currentObstacleId)
23588
+ : elements;
23589
+ if (filteredElements.length === 0)
23590
+ return null;
23591
+ return (jsxRuntime.jsxs(GElement, { type: key, children: [key === 'channel' && jsxRuntime.jsx(ChannelClipPath, {}), filteredElements.map((item) => (
23592
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23593
+ jsxRuntime.jsx(SvgElement, { type: key, data: item }, item?.id)))] }, key));
23594
+ }), 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) => {
23595
+ const [x, y] = point;
23596
+ const isDraggingPoint = dragState.dragIndex === idx;
23597
+ const pointRadius = isDraggingPoint ? 14 / styleZoomFactor : 10 / styleZoomFactor;
23598
+ const pointFill = isDraggingPoint ? '#FFAB7E' : strokeColor;
23599
+ const pointStroke = isDraggingPoint ? strokeColor : '#fff';
23600
+ const pointStrokeWidth = isDraggingPoint
23601
+ ? 3.6 / styleZoomFactor
23602
+ : 3 / styleZoomFactor;
23603
+ return (jsxRuntime.jsx("circle", { cx: x, cy: y, r: pointRadius, fill: pointFill, stroke: pointStroke, strokeWidth: pointStrokeWidth }, idx));
23604
+ })] })), 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, sizeInSvgUnits: true,
23605
+ // 充电桩最多保持原始尺寸,不允许放大超过 1 倍
23606
+ sizeScale: Math.min(1, 1 / styleZoomFactor) })] }));
23607
+ // 使用 Portal 渲染到 body,避免层级问题
23608
+ return ReactDOM.createPortal(magnifierContent, document.body);
23609
+ };
23610
+
23611
+ 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}";
23612
+ var styles$6 = {"pointerCursor":"index-module_pointerCursor__Ee6pr","polygonPath":"index-module_polygonPath__PynOn","dragging":"index-module_dragging__xSFdO","notCreate":"index-module_notCreate__bFnkV"};
23613
+ styleInject(css_248z$6);
23614
+
23164
23615
  /**
23165
23616
  * 几何计算工具函数
23166
23617
  */
@@ -23701,7 +24152,7 @@ const createPathData = (points) => {
23701
24152
  };
23702
24153
  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自动判断
23703
24154
  }) => {
23704
- const { overlayScale, unitType, showStraddleBoundaryBorder } = useCommonContext();
24155
+ const { overlayScale, unitType, showStraddleBoundaryBorder, platform, onH5FirstSelectObstaclePoint } = useCommonContext();
23705
24156
  const { onHandleEvent } = useMapEditContext();
23706
24157
  const { svgRef } = useSvgEditContext();
23707
24158
  const [dragState, setDragState] = React.useState({
@@ -23719,7 +24170,6 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23719
24170
  const [selectedVertexIndex, setSelectedVertexIndex] = React.useState(-1);
23720
24171
  const { checkCanNotCreateAtPosition } = useCheckElement();
23721
24172
  const { editMapInfo } = useMapEditContext();
23722
- const { platform } = useCommonContext();
23723
24173
  // delete icon可能被上一个点遮挡,因为delete在右上方,所以手动处理点让点按照顺时针渲染,这样delete icon层级就会高一些
23724
24174
  // 编辑的场景禁区的点最后一个和第一个相同,会导致一个位置渲染两个点,需要额外处理下
23725
24175
  const coordinates = React.useMemo(() => {
@@ -23962,9 +24412,14 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23962
24412
  // 开始长按计时器(1000ms)
23963
24413
  vertexLongPressTimerRef.current = window.setTimeout(() => {
23964
24414
  isVertexLongPressedRef.current = true;
23965
- setSelectedVertexIndex(index);
24415
+ setSelectedVertexIndex((prev) => {
24416
+ if (prev !== index) {
24417
+ onH5FirstSelectObstaclePoint?.();
24418
+ }
24419
+ return index;
24420
+ });
23966
24421
  }, 1000);
23967
- }, [editMode, createMode, completed, dragState.isDragging]);
24422
+ }, [editMode, createMode, completed, dragState.isDragging, onH5FirstSelectObstaclePoint]);
23968
24423
  const handleVertexLongPressEnd = React.useCallback(() => {
23969
24424
  if (vertexLongPressTimerRef.current !== null) {
23970
24425
  window.clearTimeout(vertexLongPressTimerRef.current);
@@ -24343,7 +24798,11 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24343
24798
  setHoverVertex(null);
24344
24799
  },
24345
24800
  }) }, `edge-${index}`));
24346
- }), 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(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)) &&
24801
+ }), 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 &&
24802
+ dragState.isDragging &&
24803
+ dragState.dragIndex !== -1 &&
24804
+ dragState.currentPosition !== null &&
24805
+ (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)) &&
24347
24806
  renderCoordinates.map((coord, idx) => {
24348
24807
  // 判断当前顶点的状态
24349
24808
  const isLastPoint = idx === renderCoordinates.length - 1;
@@ -27216,68 +27675,6 @@ const MowerPosition = React.memo(({ editMap, mowerPositionData, viewBox, modelTy
27216
27675
  }, children: jsxRuntime.jsx("img", { src: mowerImage, style: { width: '100%', height: '100%', objectFit: 'contain' } }) }) }));
27217
27676
  });
27218
27677
 
27219
- var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHHSURBVHgBtVtdjF3VdV7rnHPHtLbUkRrALwmDidSSgD1JqWQ3UMaNMaFq63FIKyoVZFRF6kMkbCmVcP9mrBARoJUnLRL9c+3W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OyC4tUtG3ETWOxynssx3gf9R8Pm2r2EIXgxWC4JMBcfvXunTu6djhDi80TQ90aga2uv4Ivs0bfSZtHSQbLyMwSUekfruB0PF6ppMW8UVwAE9gebywlN66b3klilD2Pf31uDi6hLOvSi8u3X3t5sOGmT9FQqxqndk2iyZ50QKXjahPxqFrchL3WlQPS0Rkd9QgwG8DovujaUw4dlCnIqkiA+2NjzR2PH5x7Gi6xXLKFy3Lnb3xhOrRhL60tT3TFnwKIe/sejGDL6DpJgAXn+YSMx7iTk28O1z3SaUe8ZIc+hfCeJ772aB8us3wgwF4+d9cXplqIM6Hrprrgm9fSimSMaasE5JhGSG494iFMVKKgKvk7B94JT7D7NL2654m/v3ygXlYEsJfpu35rArCejm23jex7q/05D+qYOYHOORZcQSmFVYgpfunoY419ODP21UOH5lbsr9RWFHBZpqd3jsMVZybJyJTO4gbCPk6YJgjrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
27220
-
27221
- const useChargingPile = ({ viewBox, rotation = 0 }) => {
27222
- const { svgElementDatas } = useSvgEditContext();
27223
- const { sn } = useCommonContext();
27224
- const items = React.useMemo(() => {
27225
- if (!svgElementDatas || !viewBox)
27226
- return [];
27227
- const chargingPiles = svgElementDatas?.[exports.DataType.CHARGING_PILE];
27228
- if (!chargingPiles)
27229
- return [];
27230
- const results = [];
27231
- for (const element of chargingPiles) {
27232
- const center = element.points?.[0];
27233
- if (!center)
27234
- continue;
27235
- const size = element.style?.radius ? element.style.radius * 2 : 55;
27236
- const direction = element?.direction || 0;
27237
- const angle = (direction * 180) / Math.PI;
27238
- const rotationDegree = 270 - angle; // 正东是正方向,需要处理下
27239
- const actualRotation = rotationDegree - rotation;
27240
- const relX = (center[0] - viewBox.x) / viewBox.width;
27241
- const relY = (center[1] - viewBox.y) / viewBox.height;
27242
- if (isFinite(relX) && isFinite(relY)) {
27243
- results.push({
27244
- leftPct: relX * 100,
27245
- topPct: relY * 100,
27246
- size,
27247
- rotateDeg: actualRotation,
27248
- imageSrc: chargingPileImage,
27249
- });
27250
- }
27251
- }
27252
- return results;
27253
- }, [svgElementDatas, viewBox?.x, viewBox?.y, viewBox?.width, viewBox?.height, rotation, sn]);
27254
- return items;
27255
- };
27256
-
27257
- const CharginPile = React.memo(({ viewBox, rotation = 0, isHighlight = true }) => {
27258
- const items = useChargingPile({ viewBox: viewBox || null, rotation });
27259
- const containerStyle = React.useMemo(() => ({
27260
- position: 'absolute',
27261
- top: 0,
27262
- left: 0,
27263
- width: '100%',
27264
- height: '100%',
27265
- pointerEvents: 'none',
27266
- zIndex: 750,
27267
- opacity: isHighlight ? SvgMapOpacity.HIGHLIGHT : SvgMapOpacity.UN_HIGHLIGHT,
27268
- }), [isHighlight]);
27269
- return (jsxRuntime.jsx("div", { style: containerStyle, children: items?.map((item, idx) => (jsxRuntime.jsx("div", { className: "charging-pile", style: {
27270
- position: 'absolute',
27271
- width: item.size,
27272
- height: item.size,
27273
- left: `${item.leftPct}%`,
27274
- top: `${item.topPct}%`,
27275
- transform: `translate(-50%, -50%) rotate(${item.rotateDeg}deg)`,
27276
- pointerEvents: 'auto',
27277
- zIndex: 750,
27278
- }, children: jsxRuntime.jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }, `pile-${idx}`))) }));
27279
- });
27280
-
27281
27678
  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}";
27282
27679
  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"};
27283
27680
  styleInject(css_248z$3);
@@ -29115,9 +29512,9 @@ proj4.defs(WEB_MERCATOR, '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +u
29115
29512
  // 默认配置
29116
29513
  const defaultMapConfig$1 = DEFAULT_STYLES;
29117
29514
  // 地图渲染器组件
29118
- const MowerMapRenderer = React.forwardRef(({ sn, mowerIconConfig = {}, platform = exports.PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, isHighlight = true, mapConfig,
29515
+ const MowerMapRenderer = React.forwardRef(({ sn, mowerIconConfig = {}, platform = exports.PlatformType.WEB, mapType = exports.MapType.NORMAL, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, isHighlight = true, mapConfig,
29119
29516
  // pathConfig,
29120
- 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) => {
29517
+ 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) => {
29121
29518
  const [currentError, setCurrentError] = React.useState(null);
29122
29519
  // const mapRef = useMap();
29123
29520
  const [processStateIsMowing, setProcessStateIsMowing] = React.useState(false);
@@ -29275,48 +29672,6 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29275
29672
  currentMowingPartitionId,
29276
29673
  processStateIsMowing,
29277
29674
  ]);
29278
- const commonValue = React.useMemo(() => {
29279
- return {
29280
- sn,
29281
- editMap,
29282
- platform,
29283
- language,
29284
- unitType,
29285
- svgViewBox,
29286
- heightOptions,
29287
- globalHeight,
29288
- mapConfig: mergedMapConfig,
29289
- mapJson,
29290
- drag: {
29291
- x: defaultTransform?.x ?? 0,
29292
- y: defaultTransform?.y ?? 0,
29293
- rotate: (defaultTransform?.rotation ?? 0) + originNorthRotate,
29294
- },
29295
- mapRef,
29296
- overlayScale,
29297
- doodleList,
29298
- mowerIconConfig,
29299
- showStraddleBoundaryBorder,
29300
- };
29301
- }, [
29302
- sn,
29303
- editMap,
29304
- platform,
29305
- svgViewBox,
29306
- unitType,
29307
- language,
29308
- heightOptions,
29309
- globalHeight,
29310
- mergedMapConfig,
29311
- mapJson,
29312
- defaultTransform,
29313
- originNorthRotate,
29314
- mapRef,
29315
- overlayScale,
29316
- doodleList,
29317
- mowerIconConfig,
29318
- showStraddleBoundaryBorder,
29319
- ]);
29320
29675
  const mowerPositionData = React.useMemo(() => {
29321
29676
  // realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
29322
29677
  // 在初始的状态按照正常图标进行渲染,所以构造一个基本在rtk桩的一个数据
@@ -29362,15 +29717,12 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29362
29717
  const bounds = React.useMemo(() => {
29363
29718
  if (!mapJson)
29364
29719
  return null;
29365
- // 计算边界
29366
- const bounds = calculateMapBounds(mapJson);
29367
- if (!bounds) {
29368
- handleError('无法计算地图边界');
29369
- return;
29720
+ const mapBoundsData = calculateMapBounds(mapJson);
29721
+ if (!mapBoundsData) {
29722
+ console.warn('Failed to calculate map bounds');
29723
+ return null;
29370
29724
  }
29371
- // 将自定义边界转换为Google Maps LatLngBounds(使用有效的GPS坐标)
29372
29725
  const validBounds = getValidGpsBounds(mapJson, 0);
29373
- // 地图数据中的坐标格式是 [longitude, latitude]
29374
29726
  const [swLng0, swLat0] = validBounds.sw;
29375
29727
  const [neLng0, neLat0] = validBounds.ne;
29376
29728
  const [swX0, swY0] = proj4(WGS84, WEB_MERCATOR, [swLng0, swLat0]);
@@ -29381,11 +29733,78 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29381
29733
  const neY = neY0 + drag.y;
29382
29734
  const [swLng, swLat] = proj4(WEB_MERCATOR, WGS84, [swX, swY]);
29383
29735
  const [neLng, neLat] = proj4(WEB_MERCATOR, WGS84, [neX, neY]);
29384
- const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
29385
- new window.google.maps.LatLng(neLat, neLng) // 东北角
29386
- );
29387
- return googleBounds;
29736
+ return new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), new window.google.maps.LatLng(neLat, neLng));
29388
29737
  }, [mapJson, drag.x, drag.y]);
29738
+ const commonValue = React.useMemo(() => {
29739
+ return {
29740
+ sn,
29741
+ editMap,
29742
+ platform,
29743
+ language,
29744
+ unitType,
29745
+ svgViewBox,
29746
+ heightOptions,
29747
+ globalHeight,
29748
+ mapConfig: mergedMapConfig,
29749
+ mapJson,
29750
+ drag: {
29751
+ x: defaultTransform?.x ?? 0,
29752
+ y: defaultTransform?.y ?? 0,
29753
+ rotate: (defaultTransform?.rotation ?? 0) + originNorthRotate,
29754
+ },
29755
+ mapRef,
29756
+ bounds,
29757
+ overlayScale,
29758
+ doodleList,
29759
+ mowerIconConfig,
29760
+ showStraddleBoundaryBorder,
29761
+ overlayLayout,
29762
+ googleMapStaticApiKey,
29763
+ onH5FirstSelectObstaclePoint,
29764
+ };
29765
+ }, [
29766
+ sn,
29767
+ editMap,
29768
+ platform,
29769
+ svgViewBox,
29770
+ unitType,
29771
+ language,
29772
+ heightOptions,
29773
+ globalHeight,
29774
+ mergedMapConfig,
29775
+ mapJson,
29776
+ defaultTransform,
29777
+ originNorthRotate,
29778
+ mapRef,
29779
+ bounds,
29780
+ overlayScale,
29781
+ doodleList,
29782
+ mowerIconConfig,
29783
+ showStraddleBoundaryBorder,
29784
+ overlayLayout,
29785
+ googleMapStaticApiKey,
29786
+ onH5FirstSelectObstaclePoint,
29787
+ ]);
29788
+ /**
29789
+ * 这里做了一个配置,以防以后如果有多种不同的类型的情况,需要展示不同的元素
29790
+ */
29791
+ const mapHasElements = React.useMemo(() => {
29792
+ // 地理围栏地图,没有充电桩,没有天线,没有割草机位置,没有边界标签
29793
+ if (mapType === exports.MapType.GEO_FENCE) {
29794
+ return {
29795
+ hasChargingPile: true,
29796
+ hasAntenna: false,
29797
+ hasMowerPosition: false,
29798
+ hasBoundaryLabels: false,
29799
+ };
29800
+ }
29801
+ return {
29802
+ hasChargingPile: true,
29803
+ hasAntenna: true,
29804
+ hasMowerPosition: true,
29805
+ hasBoundaryLabels: true,
29806
+ };
29807
+ }, [mapType]);
29389
29808
  const fitBounds = React.useCallback((padding = 0) => {
29390
29809
  if (!mapJson || !mapRef)
29391
29810
  return null;
@@ -29700,7 +30119,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29700
30119
  // svgEditMapRef?.current?.adjustSvgSize?.(layout);
29701
30120
  setOverlayLayout(layout);
29702
30121
  }
29703
- }, 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 })] })] }) }) }));
30122
+ }, 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 }) }), mapHasElements.hasMowerPosition && (jsxRuntime.jsx(MowerPosition, { editMap: editMap, mowerPositionData: mowerPositionData, viewBox: svgViewBox || null, modelType: modelType, hasEdger: edger, mapData: mapJson, mapConfig: mergedMapConfig, realTimeData: realTimeData, onMowingPositionChange: onMowingPositionChange, isHighlight: isHighlight })), mapHasElements.hasChargingPile && (jsxRuntime.jsx(CharginPile, { viewBox: svgViewBox || null, rotation: actureRotate, isHighlight: isHighlight })), mapHasElements.hasBoundaryLabels && (jsxRuntime.jsx(BoundaryLabels, { editMap: editMap, mapData: mapJson, onlyRead: onlyRead, pathData: pathJson, unitType: unitType, viewBox: svgViewBox || null, rotation: actureRotate, mowPartitionData: mowPartitionData, realTimeData: realTimeData, isHighlight: isHighlight })), mapHasElements.hasAntenna && (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 })] })] }) }) }));
29704
30123
  });
29705
30124
  MowerMapRenderer.displayName = 'MowerMapRenderer';
29706
30125