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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -19821,7 +19821,9 @@ function OverlayViewFunctional({ map, position, bounds, rotate, mapPaneName, zIn
19821
19821
  }, [map, overlay]);
19822
19822
  // to move the container to the foreground and background
19823
19823
  useEffect(() => {
19824
- container.style.zIndex = `${zIndex}`;
19824
+ if (zIndex) {
19825
+ container.style.zIndex = `${zIndex}`;
19826
+ }
19825
19827
  }, [zIndex, container]);
19826
19828
  return ReactDOM.createPortal(children, container);
19827
19829
  }
@@ -22648,15 +22650,25 @@ var index = {
22648
22650
  const CommonContext = createContext({
22649
22651
  sn: '',
22650
22652
  editMap: false,
22651
- mowerIconConfig: {},
22653
+ mowerIconConfig: {
22654
+ mapImgUrl: '',
22655
+ mapDisabledUrl: '',
22656
+ mapNoPositionUrl: '',
22657
+ },
22652
22658
  platform: PlatformType.WEB,
22653
22659
  svgViewBox: null,
22654
22660
  unitType: UnitsType.Metric,
22661
+ mapConfig: {},
22662
+ mapJson: null,
22663
+ drag: { x: 0, y: 0, rotate: 0, rotation: 0 },
22655
22664
  mapRef: null,
22665
+ bounds: null,
22656
22666
  globalHeight: 0,
22657
22667
  heightOptions: [],
22658
22668
  overlayScale: 1,
22659
22669
  showStraddleBoundaryBorder: true,
22670
+ googleMapStaticApiKey: '',
22671
+ onH5FirstSelectObstaclePoint: undefined,
22660
22672
  });
22661
22673
  const CommonContextProvider = CommonContext.Provider;
22662
22674
  const useCommonContext = () => useContext(CommonContext);
@@ -23088,10 +23100,6 @@ const DistanceLabels = ({ coordinates, createMode = false, editMode = false, com
23088
23100
  } }))] }));
23089
23101
  };
23090
23102
 
23091
- 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}";
23092
- var styles$6 = {"pointerCursor":"index-module_pointerCursor__Ee6pr","polygonPath":"index-module_polygonPath__PynOn","dragging":"index-module_dragging__xSFdO","notCreate":"index-module_notCreate__bFnkV"};
23093
- styleInject(css_248z$6);
23094
-
23095
23103
  var CreateStatus;
23096
23104
  (function (CreateStatus) {
23097
23105
  CreateStatus["CREATING"] = "creating";
@@ -23141,6 +23149,421 @@ const MapEditContext = createContext({
23141
23149
  const MapEditContextProvider = MapEditContext.Provider;
23142
23150
  const useMapEditContext = () => useContext(MapEditContext);
23143
23151
 
23152
+ var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHHSURBVHgBtVtdjF3VdV7rnHPHtLbUkRrALwmDidSSgD1JqWQ3UMaNMaFq63FIKyoVZFRF6kMkbCmVcP9mrBARoJUnLRL9c+3WSVsqIkwrtRBKfaGmQFuFazBpK0wYnmLSF6MYx557zt5Zv3vvO/Z4bDPZ9pl97rlnztnfXmt969s/g/AjKrN7nxwf634wBTFMYIQNAWASAcYjxAmI+T5EnAeIdFQnYwxHqwr6Z5s1g9ld20/Cj6AgrGBhkKva0/d1MUxBiFMxEjw7gGv5RyUWL+cfiCD/0I4KoULs04ensKkP7d716/OwQmVFAD/4yMGpLsJM7MJUiIGMGiDQwUBDYHR8DgocFG/54gQ0HRVUFQPnuoK6qvp0ec/u3767Dx+wfCDAXyKg2MWZELopBth1BJQAB6ujgY5RANNpRIbLuPnFETAaxgSUawYpVhawtdQV1XWN81hXu37ni3cfgssslwX4wQf/bqLD4f6uY6AdAaWDagYqdRi18qhrn/vmc61bRbIwZqAKmms9rw/Usbdn9+5Ld/VLBvzlhw/e17XtLIEcbzsG2SpgOQQkYe0wu7SD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jrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
23153
+
23154
+ const useChargingPile = ({ viewBox, rotation = 0 }) => {
23155
+ const { svgElementDatas } = useSvgEditContext();
23156
+ const { sn } = useCommonContext();
23157
+ const items = useMemo(() => {
23158
+ if (!svgElementDatas || !viewBox)
23159
+ return [];
23160
+ const chargingPiles = svgElementDatas?.[DataType.CHARGING_PILE];
23161
+ if (!chargingPiles)
23162
+ return [];
23163
+ const results = [];
23164
+ for (const element of chargingPiles) {
23165
+ const center = element.points?.[0];
23166
+ if (!center)
23167
+ continue;
23168
+ const size = element.style?.radius ? element.style.radius * 2 : 55;
23169
+ const direction = element?.direction || 0;
23170
+ const angle = (direction * 180) / Math.PI;
23171
+ const rotationDegree = 270 - angle; // 正东是正方向,需要处理下
23172
+ const actualRotation = rotationDegree - rotation;
23173
+ const relX = (center[0] - viewBox.x) / viewBox.width;
23174
+ const relY = (center[1] - viewBox.y) / viewBox.height;
23175
+ if (isFinite(relX) && isFinite(relY)) {
23176
+ results.push({
23177
+ leftPct: relX * 100,
23178
+ topPct: relY * 100,
23179
+ size,
23180
+ rotateDeg: actualRotation,
23181
+ imageSrc: chargingPileImage,
23182
+ });
23183
+ }
23184
+ }
23185
+ return results;
23186
+ }, [svgElementDatas, viewBox?.x, viewBox?.y, viewBox?.width, viewBox?.height, rotation, sn]);
23187
+ return items;
23188
+ };
23189
+
23190
+ const CharginPile = React__default.memo(({ viewBox, rotation = 0, sizeScale = 1, isHighlight = true }) => {
23191
+ const items = useChargingPile({ viewBox: viewBox || null, rotation });
23192
+ const containerStyle = useMemo(() => ({
23193
+ position: 'absolute',
23194
+ top: 0,
23195
+ left: 0,
23196
+ width: '100%',
23197
+ height: '100%',
23198
+ pointerEvents: 'none',
23199
+ zIndex: 750,
23200
+ opacity: isHighlight ? SvgMapOpacity.HIGHLIGHT : SvgMapOpacity.UN_HIGHLIGHT,
23201
+ }), [isHighlight]);
23202
+ return (jsx("div", { style: containerStyle, children: items?.map((item, idx) => (jsx("div", { className: "charging-pile", style: {
23203
+ position: 'absolute',
23204
+ width: item.size * sizeScale,
23205
+ height: item.size * sizeScale,
23206
+ left: `${item.leftPct}%`,
23207
+ top: `${item.topPct}%`,
23208
+ transform: `translate(-50%, -50%) rotate(${item.rotateDeg}deg)`,
23209
+ pointerEvents: 'auto',
23210
+ zIndex: 750,
23211
+ }, children: jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }, `pile-${idx}`))) }));
23212
+ });
23213
+
23214
+ const MAX_STATIC_SIZE = 640;
23215
+ const MAX_STATIC_MAP_RETRY = 3;
23216
+ const Magnifier = ({ visible, dragState, polygonPoints, fillColor = 'rgba(255, 122, 51, 0.1)', strokeColor = 'rgba(255, 122, 51, 1)', strokeWidth = 2, zoom = 3, size = 200, }) => {
23217
+ const { svgViewBox, mapRef, googleMapStaticApiKey, drag } = useCommonContext();
23218
+ const { svgElementDatas, svgRef } = useSvgEditContext();
23219
+ const { editMapInfo } = useMapEditContext();
23220
+ const [magnifierPosition, setMagnifierPosition] = useState({ x: 0, y: 0 });
23221
+ const [magnifierBoxSize, setMagnifierBoxSize] = useState({ width: size, height: size });
23222
+ // 本次拖拽中放大镜位置是否已完成初始化(未完成前隐藏,避免首帧闪动)
23223
+ const [isPlacementReady, setIsPlacementReady] = useState(false);
23224
+ // 放大镜所在侧边:true=右侧,false=左侧
23225
+ const [placeOnRight, setPlaceOnRight] = useState(true);
23226
+ // 仅在每次拖拽开始时初始化一次侧边
23227
+ const hasInitializedSideRef = useRef(false);
23228
+ const [mapImageFrame, setMapImageFrame] = useState(null);
23229
+ const [staticMapRetryCount, setStaticMapRetryCount] = useState(0);
23230
+ // 获取当前正在拖拽的禁区 ID
23231
+ const currentObstacleId = editMapInfo?.selectElement?.id;
23232
+ // 计算当前 SVG 单位到屏幕像素的比例(用于实现真正 1:1 预览)
23233
+ const getPixelScale = () => {
23234
+ //先拿 svgRef.getScreenCTM(),这是 SVG 到屏幕的变换矩阵(包含缩放/旋转/平移)
23235
+ const ctm = svgRef?.getScreenCTM?.();
23236
+ if (!ctm)
23237
+ return 1;
23238
+ // 使用向量长度计算缩放,兼容旋转矩阵
23239
+ // 用 Math.hypot(ctm.a, ctm.b) 算出 x 方向的实际缩放倍率(用向量长度是为了兼容旋转,不只看 a)
23240
+ const scaleX = Math.hypot(ctm.a, ctm.b);
23241
+ return Number.isFinite(scaleX) && scaleX > 0 ? scaleX : 1;
23242
+ };
23243
+ // 读取设备安全区(刘海/手势条)inset,兼容横屏 H5
23244
+ const getSafeAreaInsets = () => {
23245
+ const probe = document.createElement('div');
23246
+ probe.style.position = 'fixed';
23247
+ probe.style.left = '0';
23248
+ probe.style.top = '0';
23249
+ probe.style.width = '0';
23250
+ probe.style.height = '0';
23251
+ probe.style.visibility = 'hidden';
23252
+ probe.style.pointerEvents = 'none';
23253
+ probe.style.paddingTop = 'env(safe-area-inset-top)';
23254
+ probe.style.paddingRight = 'env(safe-area-inset-right)';
23255
+ probe.style.paddingBottom = 'env(safe-area-inset-bottom)';
23256
+ probe.style.paddingLeft = 'env(safe-area-inset-left)';
23257
+ document.body.appendChild(probe);
23258
+ const style = window.getComputedStyle(probe);
23259
+ const insets = {
23260
+ top: Number.parseFloat(style.paddingTop) || 0,
23261
+ right: Number.parseFloat(style.paddingRight) || 0,
23262
+ bottom: Number.parseFloat(style.paddingBottom) || 0,
23263
+ left: Number.parseFloat(style.paddingLeft) || 0,
23264
+ };
23265
+ document.body.removeChild(probe);
23266
+ return insets;
23267
+ };
23268
+ // 计算并获取放大镜底图:优先使用 Google Maps Static API,无图时走灰色背景兜底
23269
+ useEffect(() => {
23270
+ if (!visible || !dragState.currentPosition || !mapRef || !svgViewBox || !svgRef) {
23271
+ // console.log('[Magnifier] Skip static map effect: missing deps', {
23272
+ // visible,
23273
+ // hasCurrentPosition: Boolean(dragState.currentPosition),
23274
+ // hasMapRef: Boolean(mapRef),
23275
+ // hasSvgViewBox: Boolean(svgViewBox),
23276
+ // hasSvgRef: Boolean(svgRef),
23277
+ // });
23278
+ setMapImageFrame(null);
23279
+ setStaticMapRetryCount(0);
23280
+ return;
23281
+ }
23282
+ const mapDiv = mapRef.getDiv?.();
23283
+ // 获取 SVG 到屏幕的变换矩阵的逆矩阵
23284
+ const inverseCtm = svgRef.getScreenCTM?.()?.inverse?.();
23285
+ if (!mapDiv || !inverseCtm) {
23286
+ // console.log('[Magnifier] Skip static map effect: mapDiv/ctm missing', {
23287
+ // hasMapDiv: Boolean(mapDiv),
23288
+ // hasInverseCtm: Boolean(inverseCtm),
23289
+ // });
23290
+ setMapImageFrame(null);
23291
+ setStaticMapRetryCount(0);
23292
+ return;
23293
+ }
23294
+ const mapRect = mapDiv.getBoundingClientRect();
23295
+ const svgPoint = svgRef.createSVGPoint();
23296
+ // 只要有 key 就尝试 static api;请求失败时不截图,直接回退灰色背景
23297
+ if (googleMapStaticApiKey) {
23298
+ // console.log('[Magnifier] Background source: static api viewport snapshot');
23299
+ const mapBounds = mapRef.getBounds?.();
23300
+ if (!mapBounds) {
23301
+ // console.log('[Magnifier] Skip static map effect: mapBounds missing');
23302
+ setMapImageFrame(null);
23303
+ return;
23304
+ }
23305
+ const screenToSvg = (screenX, screenY) => {
23306
+ svgPoint.x = screenX;
23307
+ svgPoint.y = screenY;
23308
+ const p = svgPoint.matrixTransform(inverseCtm);
23309
+ return { x: p.x, y: p.y };
23310
+ };
23311
+ // 使用当前地图视口矩形四角,将屏幕坐标映射到 SVG 坐标,确保底图与主视口对齐
23312
+ const topLeftSvg = screenToSvg(mapRect.left, mapRect.top);
23313
+ const topRightSvg = screenToSvg(mapRect.right, mapRect.top);
23314
+ const bottomLeftSvg = screenToSvg(mapRect.left, mapRect.bottom);
23315
+ if (!topLeftSvg || !topRightSvg || !bottomLeftSvg) {
23316
+ setMapImageFrame(null);
23317
+ return;
23318
+ }
23319
+ // 把当前主地图可视区域尺寸,按比例压到 Static API 允许的最大尺寸以内(受 Static API 640 上限约束)),同时不改变宽高比。
23320
+ const mapWidth = Math.max(1, Math.round(mapRect.width));
23321
+ const mapHeight = Math.max(1, Math.round(mapRect.height));
23322
+ const shrinkRatio = Math.min(1, MAX_STATIC_SIZE / Math.max(mapWidth, mapHeight));
23323
+ const staticWidth = Math.max(1, Math.round(mapWidth * shrinkRatio));
23324
+ const staticHeight = Math.max(1, Math.round(mapHeight * shrinkRatio));
23325
+ const center = mapBounds.getCenter();
23326
+ const currentZoom = mapRef.getZoom() || 20;
23327
+ // 尺寸缩小后同步补偿 zoom,保持与当前主图一致的地理覆盖范围
23328
+ const zoomCompensation = Math.log2(shrinkRatio);
23329
+ const adjustedZoom = currentZoom + zoomCompensation;
23330
+ const staticZoom = Math.max(0, Math.min(Math.floor(adjustedZoom), 22));
23331
+ const staticMapUrl = `https://maps.googleapis.com/maps/api/staticmap?center=${center.lat()},${center.lng()}&zoom=${staticZoom}&size=${staticWidth}x${staticHeight}&maptype=satellite&key=${googleMapStaticApiKey}`;
23332
+ // 通过三角点推导静态图在 SVG 中的宽高和旋转角
23333
+ // Math.hypot(x, y) 等价于 sqrt(x*x + y*y),计算两点之间的距离
23334
+ const width = Math.hypot(topRightSvg.x - topLeftSvg.x, topRightSvg.y - topLeftSvg.y);
23335
+ const height = Math.hypot(bottomLeftSvg.x - topLeftSvg.x, bottomLeftSvg.y - topLeftSvg.y);
23336
+ // Math.atan2(y, x) 计算反正切值,返回 [-π, π] 弧度,*180/π 转换为角度
23337
+ const rotationDeg = (Math.atan2(topRightSvg.y - topLeftSvg.y, topRightSvg.x - topLeftSvg.x) * 180) / Math.PI;
23338
+ // Static API zoom 只能取整;额外补偿小数部分,避免底图视觉偏小
23339
+ // 在有旋转的坐标系里,做“以中心为锚点”的等比放大补偿。
23340
+ const fractionalZoomScale = Math.pow(2, adjustedZoom - staticZoom); //算出“还差多少缩放比例”。例子:adjustedZoom=19.6,staticZoom=19,差 0.6,比例是 2^0.6 ≈ 1.515。
23341
+ //把原始 width/height 乘这个比例,得到补偿后的尺寸。
23342
+ const compensatedWidth = width * fractionalZoomScale;
23343
+ const compensatedHeight = height * fractionalZoomScale;
23344
+ //尺寸变大后,多出来的宽/高的一半(要从两边均匀扩张)。
23345
+ const offsetAlongX = (compensatedWidth - width) / 2;
23346
+ const offsetAlongY = (compensatedHeight - height) / 2;
23347
+ //“右方向”单位向量(从左上指向右上),因为图可能旋转了,不能只按水平 x 轴算。
23348
+ const unitX = width > 0 ? (topRightSvg.x - topLeftSvg.x) / width : 1;
23349
+ const unitY = width > 0 ? (topRightSvg.y - topLeftSvg.y) / width : 0;
23350
+ //“下方向”单位向量(从左上指向左下),同理用于旋转场景。
23351
+ const unitDownX = height > 0 ? (bottomLeftSvg.x - topLeftSvg.x) / height : 0;
23352
+ const unitDownY = height > 0 ? (bottomLeftSvg.y - topLeftSvg.y) / height : 1;
23353
+ /**
23354
+ * 计算补偿后的新左上角:
23355
+ * 从原左上角沿“右方向”回退半个扩展量,再沿“下方向”回退半个扩展量。
23356
+ * 这样放大后仍以原区域中心为中心,不会放大后位置偏移。
23357
+ */
23358
+ const compensatedTopLeftX = topLeftSvg.x - unitX * offsetAlongX - unitDownX * offsetAlongY;
23359
+ const compensatedTopLeftY = topLeftSvg.y - unitY * offsetAlongX - unitDownY * offsetAlongY;
23360
+ setMapImageFrame({
23361
+ url: staticMapUrl,
23362
+ x: compensatedTopLeftX,
23363
+ y: compensatedTopLeftY,
23364
+ width: compensatedWidth,
23365
+ height: compensatedHeight,
23366
+ transform: `rotate(${rotationDeg} ${compensatedTopLeftX} ${compensatedTopLeftY})`,
23367
+ });
23368
+ }
23369
+ else {
23370
+ setMapImageFrame(null);
23371
+ setStaticMapRetryCount(0);
23372
+ // console.log('[Magnifier] Background source: gray fallback (no static api key)');
23373
+ }
23374
+ }, [
23375
+ visible,
23376
+ dragState.isDragging,
23377
+ mapRef,
23378
+ svgViewBox?.x,
23379
+ svgViewBox?.y,
23380
+ svgViewBox?.width,
23381
+ svgViewBox?.height,
23382
+ svgRef,
23383
+ size,
23384
+ zoom,
23385
+ googleMapStaticApiKey,
23386
+ staticMapRetryCount,
23387
+ ]);
23388
+ useLayoutEffect(() => {
23389
+ if (!visible) {
23390
+ hasInitializedSideRef.current = false;
23391
+ setIsPlacementReady(false);
23392
+ return;
23393
+ }
23394
+ const updatePosition = () => {
23395
+ const mapDiv = mapRef?.getDiv?.();
23396
+ const mapRect = mapDiv?.getBoundingClientRect?.();
23397
+ const boxSize = Math.max(120, Math.round(size));
23398
+ // 设置放大镜大小
23399
+ setMagnifierBoxSize({ width: boxSize, height: boxSize });
23400
+ const viewportWidth = window.innerWidth;
23401
+ const viewportHeight = window.innerHeight;
23402
+ const baseMargin = 10; // 放大镜与边缘的基础间距
23403
+ const insets = getSafeAreaInsets();
23404
+ const marginTop = Math.max(baseMargin, insets.top);
23405
+ const marginRight = Math.max(baseMargin, insets.right);
23406
+ const marginBottom = Math.max(baseMargin, insets.bottom);
23407
+ const marginLeft = Math.max(baseMargin, insets.left);
23408
+ const topY = mapRect ? mapRect.top + marginTop : marginTop;
23409
+ // 顶部位置限制在可视区与安全区内,避免横屏时被刘海/手势条遮挡
23410
+ const safeTopY = Math.max(marginTop, Math.min(topY, viewportHeight - boxSize - marginBottom));
23411
+ let nextPlaceOnRight = placeOnRight;
23412
+ const ctm = svgRef?.getScreenCTM?.();
23413
+ // 首次显示时先同步算出侧边,再基于该侧边定位,避免“先左后右/先右后左”闪动
23414
+ if (!hasInitializedSideRef.current && dragState.currentPosition && ctm && mapRect) {
23415
+ const p = svgRef.createSVGPoint();
23416
+ p.x = dragState.currentPosition[0];
23417
+ p.y = dragState.currentPosition[1];
23418
+ const dragScreenPoint = p.matrixTransform(ctm);
23419
+ const mapMidX = mapRect.left + mapRect.width / 2;
23420
+ nextPlaceOnRight = dragScreenPoint.x < mapMidX;
23421
+ setPlaceOnRight(nextPlaceOnRight);
23422
+ hasInitializedSideRef.current = true;
23423
+ }
23424
+ const rightX = mapRect
23425
+ ? mapRect.right - boxSize - marginRight
23426
+ : viewportWidth - boxSize - marginRight;
23427
+ const leftX = mapRect ? mapRect.left + marginLeft : marginLeft;
23428
+ const safeX = nextPlaceOnRight ? rightX : leftX;
23429
+ const boundedX = Math.max(marginLeft, Math.min(safeX, viewportWidth - boxSize - marginRight));
23430
+ // 放大镜出现后,仅当拖拽点进入放大镜区域时才切换到对侧
23431
+ if (dragState.currentPosition && ctm) {
23432
+ const p = svgRef.createSVGPoint();
23433
+ p.x = dragState.currentPosition[0];
23434
+ p.y = dragState.currentPosition[1];
23435
+ // 应用这个矩阵,变换成屏幕坐标
23436
+ const dragScreenPoint = p.matrixTransform(ctm);
23437
+ const pointInMagnifier = dragScreenPoint.x >= boundedX &&
23438
+ dragScreenPoint.x <= boundedX + boxSize &&
23439
+ dragScreenPoint.y >= safeTopY &&
23440
+ dragScreenPoint.y <= safeTopY + boxSize;
23441
+ if (pointInMagnifier) {
23442
+ setPlaceOnRight((prev) => !prev);
23443
+ return;
23444
+ }
23445
+ }
23446
+ setMagnifierPosition({
23447
+ x: boundedX,
23448
+ y: safeTopY,
23449
+ });
23450
+ setIsPlacementReady(true);
23451
+ };
23452
+ updatePosition();
23453
+ window.addEventListener('resize', updatePosition);
23454
+ return () => window.removeEventListener('resize', updatePosition);
23455
+ }, [
23456
+ visible,
23457
+ size,
23458
+ mapRef,
23459
+ svgRef,
23460
+ placeOnRight,
23461
+ dragState.currentPosition?.[0],
23462
+ dragState.currentPosition?.[1],
23463
+ ]);
23464
+ // 早期返回必须在所有 hooks 之后
23465
+ if (!visible || !dragState.currentPosition || !svgViewBox) {
23466
+ return null;
23467
+ }
23468
+ const [centerX, centerY] = dragState.currentPosition;
23469
+ // 计算放大区域范围(以拖拽点为中心)
23470
+ //effectiveZoom = Math.max(0.001, zoom * getPixelScale())
23471
+ // 得到实际放大倍率。
23472
+ // zoom 是你设置的放大倍数(比如 3)
23473
+ // getPixelScale() 是当前 SVG 到屏幕的缩放因子(地图本身被缩放时要补偿)
23474
+ // Math.max(0.001, ...) 是防止出现 0 或极小值导致除零/异常
23475
+ // magnifierWidthInSvg = magnifierBoxSize.width / effectiveZoom
23476
+ // magnifierHeightInSvg = magnifierBoxSize.height / effectiveZoom
23477
+ // 把“屏幕上放大镜框的像素尺寸”换算成“SVG 坐标里要截取的实际尺寸”
23478
+ // 放大倍率越大,分母越大,截取范围越小 => 看起来越放大
23479
+ const effectiveZoom = Math.max(0.001, zoom * getPixelScale());
23480
+ const magnifierWidthInSvg = magnifierBoxSize.width / effectiveZoom;
23481
+ const magnifierHeightInSvg = magnifierBoxSize.height / effectiveZoom;
23482
+ // 计算放大区域的 viewBox
23483
+ const magnifierViewBox = {
23484
+ x: centerX - magnifierWidthInSvg / 2,
23485
+ y: centerY - magnifierHeightInSvg / 2,
23486
+ width: magnifierWidthInSvg,
23487
+ height: magnifierHeightInSvg,
23488
+ };
23489
+ // 样式缩放采用“弱抵消”,避免随 zoom 变细,保证放大镜内点线清晰度
23490
+ const styleZoomFactor = Math.max(1, zoom * 0.4);
23491
+ // 生成多边形点字符串(仅用于当前编辑禁区)
23492
+ const polygonPointsString = polygonPoints.length > 0 ? polygonPoints.map((p) => `${p[0]},${p[1]}`).join(' ') : '';
23493
+ const actureRotate = drag?.rotate ?? drag?.rotation ?? 0;
23494
+ // 渲染放大镜内容
23495
+ const magnifierContent = (jsxs("div", { style: {
23496
+ position: 'fixed',
23497
+ left: `${magnifierPosition.x}px`,
23498
+ top: `${magnifierPosition.y}px`,
23499
+ width: `${magnifierBoxSize.width}px`,
23500
+ height: `${magnifierBoxSize.height}px`,
23501
+ borderRadius: '50%',
23502
+ border: `2px solid #fff`,
23503
+ // boxShadow: '0 4px 20px rgba(0, 0, 0, 0.3)',
23504
+ overflow: 'hidden',
23505
+ zIndex: 10000,
23506
+ pointerEvents: 'none',
23507
+ background: 'rgba(235, 236, 240, 1)',
23508
+ visibility: isPlacementReady ? 'visible' : 'hidden',
23509
+ }, children: [jsxs("svg", {
23510
+ // 逻辑尺寸:与放大镜容器一致
23511
+ width: magnifierBoxSize.width, height: magnifierBoxSize.height,
23512
+ // 核心放大参数:从整张 SVG 中裁剪出当前需要展示的区域(x y width height)
23513
+ viewBox: `${magnifierViewBox.x} ${magnifierViewBox.y} ${magnifierViewBox.width} ${magnifierViewBox.height}`,
23514
+ // 保持内容居中并铺满窗口;比例不一致时裁边,不留空白
23515
+ preserveAspectRatio: "xMidYMid slice", style: {
23516
+ // CSS 尺寸:让 SVG 完全填满放大镜容器
23517
+ width: '100%',
23518
+ height: '100%',
23519
+ }, children: [mapImageFrame && (jsx("image", { href: mapImageFrame.url, x: mapImageFrame.x, y: mapImageFrame.y, width: mapImageFrame.width, height: mapImageFrame.height, transform: mapImageFrame.transform, preserveAspectRatio: "none", style: { opacity: 1 }, onLoad: () => {
23520
+ // console.log('✅ Map background loaded in magnifier');
23521
+ setStaticMapRetryCount(0);
23522
+ }, onError: (_e) => {
23523
+ // console.error('❌ Failed to load map background in magnifier', {
23524
+ // retryCount: staticMapRetryCount,
23525
+ // maxRetry: MAX_STATIC_MAP_RETRY,
23526
+ // url: mapImageFrame.url,
23527
+ // error: _e,
23528
+ // });
23529
+ setStaticMapRetryCount((prev) => {
23530
+ if (prev < MAX_STATIC_MAP_RETRY)
23531
+ return prev + 1;
23532
+ setMapImageFrame(null);
23533
+ return 0;
23534
+ });
23535
+ } }, `magnifier-static-map-${staticMapRetryCount}`)), svgElementDatas &&
23536
+ Object.keys(svgElementDatas).map((key) => {
23537
+ const elements = svgElementDatas[key] || [];
23538
+ // 过滤掉当前正在拖拽的禁区(稍后单独渲染拖拽后的状态)
23539
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23540
+ const filteredElements = key === DataType.OBSTACLE
23541
+ ? elements.filter((item) => item.id !== currentObstacleId)
23542
+ : elements;
23543
+ if (filteredElements.length === 0)
23544
+ return null;
23545
+ return (jsxs(GElement, { type: key, children: [key === 'channel' && jsx(ChannelClipPath, {}), filteredElements.map((item) => (
23546
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23547
+ jsx(SvgElement, { type: key, data: item }, item?.id)))] }, key));
23548
+ }), polygonPoints.length >= 3 && polygonPointsString && (jsxs(Fragment, { children: [jsx("polygon", { points: polygonPointsString, fill: fillColor, stroke: strokeColor, strokeWidth: (strokeWidth * 3.2) / styleZoomFactor, strokeOpacity: 1 }), polygonPoints.map((point, idx) => {
23549
+ const [x, y] = point;
23550
+ const isDraggingPoint = dragState.dragIndex === idx;
23551
+ const pointRadius = isDraggingPoint ? 14 / styleZoomFactor : 10 / styleZoomFactor;
23552
+ const pointFill = isDraggingPoint ? '#FFAB7E' : strokeColor;
23553
+ const pointStroke = isDraggingPoint ? strokeColor : '#fff';
23554
+ const pointStrokeWidth = isDraggingPoint
23555
+ ? 3.6 / styleZoomFactor
23556
+ : 3 / styleZoomFactor;
23557
+ return (jsx("circle", { cx: x, cy: y, r: pointRadius, fill: pointFill, stroke: pointStroke, strokeWidth: pointStrokeWidth }, idx));
23558
+ })] })), dragState.dragType === 'new' && dragState.edgeInfo && (jsx(Fragment, { children: jsx("line", { x1: dragState.edgeInfo.startPoint.x, y1: dragState.edgeInfo.startPoint.y, x2: dragState.edgeInfo.endPoint.x, y2: dragState.edgeInfo.endPoint.y, stroke: "#999", strokeWidth: (strokeWidth * 3.2) / styleZoomFactor, strokeDasharray: `${6 / styleZoomFactor},${6 / styleZoomFactor}` }) }))] }), jsx(CharginPile, { viewBox: magnifierViewBox || null, rotation: actureRotate, sizeScale: Math.max(1, zoom) })] }));
23559
+ // 使用 Portal 渲染到 body,避免层级问题
23560
+ return ReactDOM.createPortal(magnifierContent, document.body);
23561
+ };
23562
+
23563
+ var css_248z$6 = ".index-module_pointerCursor__Ee6pr {\n cursor: pointer;\n}\n\n.index-module_polygonPath__PynOn {\n pointer-events: stroke;\n cursor: pointer;\n}\n\n.index-module_dragging__xSFdO {\n cursor: grabbing;\n}\n\n.index-module_notCreate__bFnkV {\n cursor: no-drop;\n}";
23564
+ var styles$6 = {"pointerCursor":"index-module_pointerCursor__Ee6pr","polygonPath":"index-module_polygonPath__PynOn","dragging":"index-module_dragging__xSFdO","notCreate":"index-module_notCreate__bFnkV"};
23565
+ styleInject(css_248z$6);
23566
+
23144
23567
  /**
23145
23568
  * 几何计算工具函数
23146
23569
  */
@@ -23681,7 +24104,7 @@ const createPathData = (points) => {
23681
24104
  };
23682
24105
  const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor = 'rgba(0, 0, 0, 0.1)', hoverFillColor = '', fillOpacity = 1, strokeColor = '#000', strokeWidth = 2, strokeOpacity = 1, createMode = false, showPoints = false, onPointClick, completed = false, mousePos = null, editMode = false, onCoordinatesChange, onPathClick, onPolygonClick, onVertexDelete, draggable = true, // 新增参数,如果未指定则根据createMode和editMode自动判断
23683
24106
  }) => {
23684
- const { overlayScale, unitType, showStraddleBoundaryBorder } = useCommonContext();
24107
+ const { overlayScale, unitType, showStraddleBoundaryBorder, platform, onH5FirstSelectObstaclePoint } = useCommonContext();
23685
24108
  const { onHandleEvent } = useMapEditContext();
23686
24109
  const { svgRef } = useSvgEditContext();
23687
24110
  const [dragState, setDragState] = useState({
@@ -23699,7 +24122,6 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23699
24122
  const [selectedVertexIndex, setSelectedVertexIndex] = useState(-1);
23700
24123
  const { checkCanNotCreateAtPosition } = useCheckElement();
23701
24124
  const { editMapInfo } = useMapEditContext();
23702
- const { platform } = useCommonContext();
23703
24125
  // delete icon可能被上一个点遮挡,因为delete在右上方,所以手动处理点让点按照顺时针渲染,这样delete icon层级就会高一些
23704
24126
  // 编辑的场景禁区的点最后一个和第一个相同,会导致一个位置渲染两个点,需要额外处理下
23705
24127
  const coordinates = useMemo(() => {
@@ -23942,9 +24364,14 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
23942
24364
  // 开始长按计时器(1000ms)
23943
24365
  vertexLongPressTimerRef.current = window.setTimeout(() => {
23944
24366
  isVertexLongPressedRef.current = true;
23945
- setSelectedVertexIndex(index);
24367
+ setSelectedVertexIndex((prev) => {
24368
+ if (prev !== index) {
24369
+ onH5FirstSelectObstaclePoint?.();
24370
+ }
24371
+ return index;
24372
+ });
23946
24373
  }, 1000);
23947
- }, [editMode, createMode, completed, dragState.isDragging]);
24374
+ }, [editMode, createMode, completed, dragState.isDragging, onH5FirstSelectObstaclePoint]);
23948
24375
  const handleVertexLongPressEnd = useCallback(() => {
23949
24376
  if (vertexLongPressTimerRef.current !== null) {
23950
24377
  window.clearTimeout(vertexLongPressTimerRef.current);
@@ -24323,7 +24750,11 @@ const PolygonElement = ({ canSelect = false, isHover = false, points, fillColor
24323
24750
  setHoverVertex(null);
24324
24751
  },
24325
24752
  }) }, `edge-${index}`));
24326
- }), ghostLastPath && (jsxs(Fragment, { children: [jsx("path", { d: ghostLastPath, stroke: '#fff', strokeWidth: strokeWidth * 2, vectorEffect: "non-scaling-stroke", opacity: 0.7 }), jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })] })), ghostFirstPath && renderCoordinates.length >= 2 && (jsxs(Fragment, { children: [jsx("path", { d: ghostFirstPath, stroke: '#fff', strokeWidth: strokeWidth * 2, vectorEffect: "non-scaling-stroke", opacity: 0.7 }), jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })] })), jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed, fontSize: platform === PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, unitType: unitType }), jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint, fontSize: platform === PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, showFirstDistance: platform !== PlatformType.H5, unit: unitType }), hoverVertex && !dragState.isDragging && (jsx(VertexElement, { cx: hoverVertex.position.x, cy: hoverVertex.position.y, stroke: strokeColor, strokeOpacity: 0.6, fill: "white", fillOpacity: 0.8, pointerEvents: "none" })), ((createMode && showPoints) || editMode || (createMode && completed)) &&
24753
+ }), ghostLastPath && (jsxs(Fragment, { children: [jsx("path", { d: ghostLastPath, stroke: '#fff', strokeWidth: strokeWidth * 2, vectorEffect: "non-scaling-stroke", opacity: 0.7 }), jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })] })), ghostFirstPath && renderCoordinates.length >= 2 && (jsxs(Fragment, { children: [jsx("path", { d: ghostFirstPath, stroke: '#fff', strokeWidth: strokeWidth * 2, vectorEffect: "non-scaling-stroke", opacity: 0.7 }), jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })] })), jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed, fontSize: platform === PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, unitType: unitType }), jsx(Magnifier, { visible: platform === PlatformType.H5 &&
24754
+ dragState.isDragging &&
24755
+ dragState.dragIndex !== -1 &&
24756
+ dragState.currentPosition !== null &&
24757
+ (editMode || (createMode && completed)), dragState: dragState, polygonPoints: renderCoordinates, fillColor: fillColor, strokeColor: strokeColor, strokeWidth: strokeWidth, zoom: 3, size: 130 }), jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint, fontSize: platform === PlatformType.H5 ? 12 * overlayScale * 1.5 : 30 * overlayScale, showFirstDistance: platform !== PlatformType.H5, unit: unitType }), hoverVertex && !dragState.isDragging && (jsx(VertexElement, { cx: hoverVertex.position.x, cy: hoverVertex.position.y, stroke: strokeColor, strokeOpacity: 0.6, fill: "white", fillOpacity: 0.8, pointerEvents: "none" })), ((createMode && showPoints) || editMode || (createMode && completed)) &&
24327
24758
  renderCoordinates.map((coord, idx) => {
24328
24759
  // 判断当前顶点的状态
24329
24760
  const isLastPoint = idx === renderCoordinates.length - 1;
@@ -27196,68 +27627,6 @@ const MowerPosition = React__default.memo(({ editMap, mowerPositionData, viewBox
27196
27627
  }, children: jsx("img", { src: mowerImage, style: { width: '100%', height: '100%', objectFit: 'contain' } }) }) }));
27197
27628
  });
27198
27629
 
27199
- var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHHSURBVHgBtVtdjF3VdV7rnHPHtLbUkRrALwmDidSSgD1JqWQ3UMaNMaFq63FIKyoVZFRF6kMkbCmVcP9mrBARoJUnLRL9c+3WSVsqIkwrtRBKfaGmQFuFazBpK0wYnmLSF6MYx557zt5Zv3vvO/Z4bDPZ9pl97rlnztnfXmt969s/g/AjKrN7nxwf634wBTFMYIQNAWASAcYjxAmI+T5EnAeIdFQnYwxHqwr6Z5s1g9ld20/Cj6AgrGBhkKva0/d1MUxBiFMxEjw7gGv5RyUWL+cfiCD/0I4KoULs04ensKkP7d716/OwQmVFAD/4yMGpLsJM7MJUiIGMGiDQwUBDYHR8DgocFG/54gQ0HRVUFQPnuoK6qvp0ec/u3767Dx+wfCDAXyKg2MWZELopBth1BJQAB6ujgY5RANNpRIbLuPnFETAaxgSUawYpVhawtdQV1XWN81hXu37ni3cfgssslwX4wQf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654m/v3ygXlYEsJfpu35rArCejm23jex7q/05D+qYOYHOORZcQSmFVYgpfunoY419ODP21UOH5lbsr9RWFHBZpqd3jsMVZybJyJTO4gbCPk6YJgjrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
27200
-
27201
- const useChargingPile = ({ viewBox, rotation = 0 }) => {
27202
- const { svgElementDatas } = useSvgEditContext();
27203
- const { sn } = useCommonContext();
27204
- const items = useMemo(() => {
27205
- if (!svgElementDatas || !viewBox)
27206
- return [];
27207
- const chargingPiles = svgElementDatas?.[DataType.CHARGING_PILE];
27208
- if (!chargingPiles)
27209
- return [];
27210
- const results = [];
27211
- for (const element of chargingPiles) {
27212
- const center = element.points?.[0];
27213
- if (!center)
27214
- continue;
27215
- const size = element.style?.radius ? element.style.radius * 2 : 55;
27216
- const direction = element?.direction || 0;
27217
- const angle = (direction * 180) / Math.PI;
27218
- const rotationDegree = 270 - angle; // 正东是正方向,需要处理下
27219
- const actualRotation = rotationDegree - rotation;
27220
- const relX = (center[0] - viewBox.x) / viewBox.width;
27221
- const relY = (center[1] - viewBox.y) / viewBox.height;
27222
- if (isFinite(relX) && isFinite(relY)) {
27223
- results.push({
27224
- leftPct: relX * 100,
27225
- topPct: relY * 100,
27226
- size,
27227
- rotateDeg: actualRotation,
27228
- imageSrc: chargingPileImage,
27229
- });
27230
- }
27231
- }
27232
- return results;
27233
- }, [svgElementDatas, viewBox?.x, viewBox?.y, viewBox?.width, viewBox?.height, rotation, sn]);
27234
- return items;
27235
- };
27236
-
27237
- const CharginPile = React__default.memo(({ viewBox, rotation = 0, isHighlight = true }) => {
27238
- const items = useChargingPile({ viewBox: viewBox || null, rotation });
27239
- const containerStyle = useMemo(() => ({
27240
- position: 'absolute',
27241
- top: 0,
27242
- left: 0,
27243
- width: '100%',
27244
- height: '100%',
27245
- pointerEvents: 'none',
27246
- zIndex: 750,
27247
- opacity: isHighlight ? SvgMapOpacity.HIGHLIGHT : SvgMapOpacity.UN_HIGHLIGHT,
27248
- }), [isHighlight]);
27249
- return (jsx("div", { style: containerStyle, children: items?.map((item, idx) => (jsx("div", { className: "charging-pile", style: {
27250
- position: 'absolute',
27251
- width: item.size,
27252
- height: item.size,
27253
- left: `${item.leftPct}%`,
27254
- top: `${item.topPct}%`,
27255
- transform: `translate(-50%, -50%) rotate(${item.rotateDeg}deg)`,
27256
- pointerEvents: 'auto',
27257
- zIndex: 750,
27258
- }, children: jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }, `pile-${idx}`))) }));
27259
- });
27260
-
27261
27630
  var css_248z$3 = ".index-module_container__7IatW {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\n.index-module_boundaryLabel__GDHFn {\n position: absolute;\n background-color: rgba(30, 30, 31, 0.6);\n color: rgb(255, 255, 255);\n padding: 6px;\n border-radius: 12px;\n font-size: 12px;\n font-weight: bold;\n max-width: 220px;\n pointer-events: auto;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n}\n.index-module_boundaryLabel__GDHFn .index-module_isolatedIcon__1pRXN {\n position: absolute;\n width: 24px;\n height: 24px;\n top: -30px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.index-module_base__qy2SG {\n font-size: 14px;\n}\n\n.index-module_extended__0TMAt {\n margin-top: 6px;\n font-size: 11px;\n opacity: 0.9;\n border-top: 1px solid rgba(255, 255, 255, 0.2);\n padding-top: 6px;\n}";
27262
27631
  var styles$3 = {"container":"index-module_container__7IatW","boundaryLabel":"index-module_boundaryLabel__GDHFn","isolatedIcon":"index-module_isolatedIcon__1pRXN","base":"index-module_base__qy2SG","extended":"index-module_extended__0TMAt"};
27263
27632
  styleInject(css_248z$3);
@@ -29097,7 +29466,7 @@ const defaultMapConfig$1 = DEFAULT_STYLES;
29097
29466
  // 地图渲染器组件
29098
29467
  const MowerMapRenderer = forwardRef(({ sn, mowerIconConfig = {}, platform = PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, isHighlight = true, mapConfig,
29099
29468
  // pathConfig,
29100
- modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onError, className, style, googleMapInstance: _googleMapInstance, dragMap = false, canRotateMap = false, dragCallbacks, defaultTransform, debug: _debug = false, doodleList = [], editMap = false, unStructMapData, disabledObstacles = false, onHandleEnterRecord, onHandleCompleteRecord, onHandleStopRecord, onHandleDeleteElement, onSaveBoundaryData, onSaveMap, onEditInfoMapChange, onUpdateBoundary, heightOptions, globalHeight, onHandleEvent, onSelectElement, }, ref) => {
29469
+ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onError, className, style, zIndex, googleMapInstance: _googleMapInstance, dragMap = false, canRotateMap = false, dragCallbacks, defaultTransform, debug: _debug = false, doodleList = [], editMap = false, unStructMapData, disabledObstacles = false, onHandleEnterRecord, onHandleCompleteRecord, onHandleStopRecord, onHandleDeleteElement, onSaveBoundaryData, onSaveMap, onEditInfoMapChange, onUpdateBoundary, heightOptions, globalHeight, googleMapStaticApiKey, onHandleEvent, onSelectElement, onH5FirstSelectObstaclePoint, }, ref) => {
29101
29470
  const [currentError, setCurrentError] = useState(null);
29102
29471
  // const mapRef = useMap();
29103
29472
  const [processStateIsMowing, setProcessStateIsMowing] = useState(false);
@@ -29255,48 +29624,6 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29255
29624
  currentMowingPartitionId,
29256
29625
  processStateIsMowing,
29257
29626
  ]);
29258
- const commonValue = useMemo(() => {
29259
- return {
29260
- sn,
29261
- editMap,
29262
- platform,
29263
- language,
29264
- unitType,
29265
- svgViewBox,
29266
- heightOptions,
29267
- globalHeight,
29268
- mapConfig: mergedMapConfig,
29269
- mapJson,
29270
- drag: {
29271
- x: defaultTransform?.x ?? 0,
29272
- y: defaultTransform?.y ?? 0,
29273
- rotate: (defaultTransform?.rotation ?? 0) + originNorthRotate,
29274
- },
29275
- mapRef,
29276
- overlayScale,
29277
- doodleList,
29278
- mowerIconConfig,
29279
- showStraddleBoundaryBorder,
29280
- };
29281
- }, [
29282
- sn,
29283
- editMap,
29284
- platform,
29285
- svgViewBox,
29286
- unitType,
29287
- language,
29288
- heightOptions,
29289
- globalHeight,
29290
- mergedMapConfig,
29291
- mapJson,
29292
- defaultTransform,
29293
- originNorthRotate,
29294
- mapRef,
29295
- overlayScale,
29296
- doodleList,
29297
- mowerIconConfig,
29298
- showStraddleBoundaryBorder,
29299
- ]);
29300
29627
  const mowerPositionData = useMemo(() => {
29301
29628
  // realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
29302
29629
  // 在初始的状态按照正常图标进行渲染,所以构造一个基本在rtk桩的一个数据
@@ -29342,15 +29669,12 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29342
29669
  const bounds = useMemo(() => {
29343
29670
  if (!mapJson)
29344
29671
  return null;
29345
- // 计算边界
29346
- const bounds = calculateMapBounds(mapJson);
29347
- if (!bounds) {
29348
- handleError('无法计算地图边界');
29349
- return;
29672
+ const mapBoundsData = calculateMapBounds(mapJson);
29673
+ if (!mapBoundsData) {
29674
+ console.warn('Failed to calculate map bounds');
29675
+ return null;
29350
29676
  }
29351
- // 将自定义边界转换为Google Maps LatLngBounds(使用有效的GPS坐标)
29352
29677
  const validBounds = getValidGpsBounds(mapJson, 0);
29353
- // 地图数据中的坐标格式是 [longitude, latitude]
29354
29678
  const [swLng0, swLat0] = validBounds.sw;
29355
29679
  const [neLng0, neLat0] = validBounds.ne;
29356
29680
  const [swX0, swY0] = proj4(WGS84, WEB_MERCATOR, [swLng0, swLat0]);
@@ -29361,11 +29685,58 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29361
29685
  const neY = neY0 + drag.y;
29362
29686
  const [swLng, swLat] = proj4(WEB_MERCATOR, WGS84, [swX, swY]);
29363
29687
  const [neLng, neLat] = proj4(WEB_MERCATOR, WGS84, [neX, neY]);
29364
- const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
29365
- new window.google.maps.LatLng(neLat, neLng) // 东北角
29366
- );
29367
- return googleBounds;
29688
+ return new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), new window.google.maps.LatLng(neLat, neLng));
29368
29689
  }, [mapJson, drag.x, drag.y]);
29690
+ const commonValue = useMemo(() => {
29691
+ return {
29692
+ sn,
29693
+ editMap,
29694
+ platform,
29695
+ language,
29696
+ unitType,
29697
+ svgViewBox,
29698
+ heightOptions,
29699
+ globalHeight,
29700
+ mapConfig: mergedMapConfig,
29701
+ mapJson,
29702
+ drag: {
29703
+ x: defaultTransform?.x ?? 0,
29704
+ y: defaultTransform?.y ?? 0,
29705
+ rotate: (defaultTransform?.rotation ?? 0) + originNorthRotate,
29706
+ },
29707
+ mapRef,
29708
+ bounds,
29709
+ overlayScale,
29710
+ doodleList,
29711
+ mowerIconConfig,
29712
+ showStraddleBoundaryBorder,
29713
+ overlayLayout,
29714
+ googleMapStaticApiKey,
29715
+ onH5FirstSelectObstaclePoint,
29716
+ };
29717
+ }, [
29718
+ sn,
29719
+ editMap,
29720
+ platform,
29721
+ svgViewBox,
29722
+ unitType,
29723
+ language,
29724
+ heightOptions,
29725
+ globalHeight,
29726
+ mergedMapConfig,
29727
+ mapJson,
29728
+ defaultTransform,
29729
+ originNorthRotate,
29730
+ mapRef,
29731
+ bounds,
29732
+ overlayScale,
29733
+ doodleList,
29734
+ mowerIconConfig,
29735
+ showStraddleBoundaryBorder,
29736
+ overlayLayout,
29737
+ googleMapStaticApiKey,
29738
+ onH5FirstSelectObstaclePoint,
29739
+ ]);
29369
29740
  const fitBounds = useCallback((padding = 0) => {
29370
29741
  if (!mapJson || !mapRef)
29371
29742
  return null;
@@ -29680,7 +30051,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29680
30051
  // svgEditMapRef?.current?.adjustSvgSize?.(layout);
29681
30052
  setOverlayLayout(layout);
29682
30053
  }
29683
- }, map: mapRef, mapPaneName: 'overlayMouseTarget', bounds: bounds, rotate: actureRotate, children: [jsx(MapDrag, { map: mapRef, dragCallbacks: dragCallbacks, onBoundaryLabelsCollapse: () => { }, onTransformChange: handleDragMove, isDragMap: dragMap, canRotateMap: canRotateMap }), jsx(MowPartitionContextProvider, { value: mowPartitionValue, children: jsx(SvgMapComponent, { isHighlight: isHighlight, editMap: editMap, ref: svgMapRef, pathData: pathJson, mapConfig: mergedMapConfig, mowPartitionData: mowPartitionData }) }), jsx(MowerPosition, { editMap: editMap, mowerPositionData: mowerPositionData, viewBox: svgViewBox || null, modelType: modelType, hasEdger: edger, mapData: mapJson, mapConfig: mergedMapConfig, realTimeData: realTimeData, onMowingPositionChange: onMowingPositionChange, isHighlight: isHighlight }), jsx(CharginPile, { viewBox: svgViewBox || null, rotation: actureRotate, isHighlight: isHighlight }), jsx(BoundaryLabels, { editMap: editMap, mapData: mapJson, onlyRead: onlyRead, pathData: pathJson, unitType: unitType, viewBox: svgViewBox || null, rotation: actureRotate, mowPartitionData: mowPartitionData, realTimeData: realTimeData, isHighlight: isHighlight }), jsx(Antennas, { editMap: editMap, antennaConfig: antennaConfig || [], layout: overlayLayout || undefined, viewBox: svgViewBox || null, rotation: actureRotate, onlyRead: onlyRead, isHighlight: isHighlight }), jsx(SvgEditMap, { editMap: editMap, ref: svgEditMapRef, mapConfig: mergedMapConfig, onEditInfoMapChange: onEditInfoMapChange })] })] }) }) }));
30054
+ }, map: mapRef, mapPaneName: 'overlayMouseTarget', bounds: bounds, rotate: actureRotate, zIndex: zIndex, children: [jsx(MapDrag, { map: mapRef, dragCallbacks: dragCallbacks, onBoundaryLabelsCollapse: () => { }, onTransformChange: handleDragMove, isDragMap: dragMap, canRotateMap: canRotateMap }), jsx(MowPartitionContextProvider, { value: mowPartitionValue, children: jsx(SvgMapComponent, { isHighlight: isHighlight, editMap: editMap, ref: svgMapRef, pathData: pathJson, mapConfig: mergedMapConfig, mowPartitionData: mowPartitionData }) }), jsx(MowerPosition, { editMap: editMap, mowerPositionData: mowerPositionData, viewBox: svgViewBox || null, modelType: modelType, hasEdger: edger, mapData: mapJson, mapConfig: mergedMapConfig, realTimeData: realTimeData, onMowingPositionChange: onMowingPositionChange, isHighlight: isHighlight }), jsx(CharginPile, { viewBox: svgViewBox || null, rotation: actureRotate, isHighlight: isHighlight }), jsx(BoundaryLabels, { editMap: editMap, mapData: mapJson, onlyRead: onlyRead, pathData: pathJson, unitType: unitType, viewBox: svgViewBox || null, rotation: actureRotate, mowPartitionData: mowPartitionData, realTimeData: realTimeData, isHighlight: isHighlight }), jsx(Antennas, { editMap: editMap, antennaConfig: antennaConfig || [], layout: overlayLayout || undefined, viewBox: svgViewBox || null, rotation: actureRotate, onlyRead: onlyRead, isHighlight: isHighlight }), jsx(SvgEditMap, { editMap: editMap, ref: svgEditMapRef, mapConfig: mergedMapConfig, onEditInfoMapChange: onEditInfoMapChange })] })] }) }) }));
29684
30055
  });
29685
30056
  MowerMapRenderer.displayName = 'MowerMapRenderer';
29686
30057