@fleet-frontend/mower-maps 0.2.0-beta.3 → 0.2.0-beta.4
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 +505 -216
- package/dist/index.js +504 -215
- package/dist/src/context/common.d.ts +2 -0
- package/dist/src/context/common.d.ts.map +1 -1
- package/dist/src/context/mapEdit.d.ts +1 -1
- package/dist/src/context/mapEdit.d.ts.map +1 -1
- package/dist/src/processor/unified/BaseData.d.ts +3 -4
- package/dist/src/processor/unified/BaseData.d.ts.map +1 -1
- package/dist/src/processor/unified/UnifiedMapDataProcessor.d.ts.map +1 -1
- package/dist/src/render/MowerMapRenderer.d.ts.map +1 -1
- package/dist/src/render/layers/ObstacleLayer.d.ts +16 -0
- package/dist/src/render/layers/ObstacleLayer.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/AddEntry/components/DoodleModal/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/AddEntry/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/boundary.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/TimePeriod/index.d.ts +4 -4
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/TimePeriod/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/doodle.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/obstacle.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/visionOff.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/index.d.ts +8 -1
- package/dist/src/render/svgEditMap/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/DoodleElement/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/Mobile/CreateObstacleElement/index.d.ts +4 -1
- package/dist/src/render/svgElement/Mobile/CreateObstacleElement/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/PolygonELement/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/TransformWrapper/DoodleTransformWrapper/DoodleTransformWrapper.d.ts.map +1 -1
- package/dist/src/render/svgElement/TransformWrapper/VisionOffTransformWrapper/VisionOffTransformWrapper.d.ts.map +1 -1
- package/dist/src/types/renderer.d.ts +10 -2
- package/dist/src/types/renderer.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { memo, useMemo, useEffect, useState, useRef, useCallback, createContext, useContext, forwardRef, useImperativeHandle, useLayoutEffect } from 'react';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
|
-
import { Modal, message, Popover, Input, Switch, Slider, Radio, Button, DatePicker, Select } from 'antd';
|
|
5
|
+
import { Modal, message, Popover, Input, Switch, Slider, Radio, Button, DatePicker, Select, Space } from 'antd';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 常量和枚举类型定义
|
|
@@ -190,14 +190,13 @@ class ChannelData extends BaseData {
|
|
|
190
190
|
* 障碍物数据类
|
|
191
191
|
*/
|
|
192
192
|
class ObstacleData extends BaseData {
|
|
193
|
-
constructor(originalData, level,
|
|
193
|
+
constructor(originalData, level, style) {
|
|
194
194
|
const convertedPoints = convertPointsFormat(originalData?.points) || [];
|
|
195
195
|
super(originalData?.id, DataType.OBSTACLE, level, RenderType.POLYGON, convertedPoints, originalData);
|
|
196
196
|
this.area = originalData?.area;
|
|
197
197
|
this.status = originalData?.status || 1;
|
|
198
|
-
this.
|
|
199
|
-
this.
|
|
200
|
-
this.isTimeLimit = isTimeLimit;
|
|
198
|
+
this.start_timestamp = originalData?.start_timestamp;
|
|
199
|
+
this.end_timestamp = originalData?.end_timestamp;
|
|
201
200
|
this.name = originalData?.name || 'Obstacle';
|
|
202
201
|
this.style = style;
|
|
203
202
|
}
|
|
@@ -329,8 +328,8 @@ function initDoodle() {
|
|
|
329
328
|
svg: '',
|
|
330
329
|
scale: 1,
|
|
331
330
|
direction: 0,
|
|
332
|
-
create_ts: Date.now(),
|
|
333
|
-
expiration_ts: Date.now() +
|
|
331
|
+
create_ts: Math.floor(Date.now() / 1000),
|
|
332
|
+
expiration_ts: Math.floor(Date.now() / 1000) + 3600 * 24 * 7, // 1小时后过期
|
|
334
333
|
type: 'TIME_LIMIT_OBSTACLE',
|
|
335
334
|
};
|
|
336
335
|
return new DoodleData(doodle, 100);
|
|
@@ -616,7 +615,7 @@ class UnifiedMapDataProcessor {
|
|
|
616
615
|
continue;
|
|
617
616
|
}
|
|
618
617
|
const obstacleData = new ObstacleData(element, 150, // 高层级
|
|
619
|
-
|
|
618
|
+
this.mapConfig.obstacle || {});
|
|
620
619
|
obstacleDataList.push(obstacleData);
|
|
621
620
|
}
|
|
622
621
|
catch (error) {
|
|
@@ -746,7 +745,7 @@ class UnifiedMapDataProcessor {
|
|
|
746
745
|
continue;
|
|
747
746
|
}
|
|
748
747
|
const obstacleData = new ObstacleData(element, 150, // 高层级
|
|
749
|
-
|
|
748
|
+
this.mapConfig.obstacle || {});
|
|
750
749
|
obstacleDataList.push(obstacleData);
|
|
751
750
|
}
|
|
752
751
|
}
|
|
@@ -8693,7 +8692,7 @@ function styleInject(css, ref) {
|
|
|
8693
8692
|
}
|
|
8694
8693
|
}
|
|
8695
8694
|
|
|
8696
|
-
var css_248z$i = ".index-module_edit__-5VvX {\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n pointer-events: auto;\n z-index: 1000;\n cursor: move;\n touch-action: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n.index-module_edit__-5VvX .index-module_border__JdNLM {\n position: absolute;\n inset: -10px;\n border: 2px dashed rgb(241, 102, 41);\n border-radius: 2px;\n pointer-events: none;\n}\n.index-module_edit__-5VvX .index-module_drag__uvdPG {\n position: absolute;\n inset: -10px;\n border-radius: 2px;\n}\n.index-module_edit__-5VvX .index-module_rotate__H-KIZ {\n position: absolute;\n top: -20px;\n right: -20px;\n width: 20px;\n height: 20px;\n cursor: grab;\n z-index: 1001;\n pointer-events: auto;\n}\n.index-module_edit__-5VvX .index-module_move__mZF8s {\n position: absolute;\n bottom: -20px;\n left: -20px;\n width: 20px;\n height: 20px;\n cursor: move;\n z-index: 1001;\n pointer-events: auto;\n
|
|
8695
|
+
var css_248z$i = ".index-module_edit__-5VvX {\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n pointer-events: auto;\n z-index: 1000;\n cursor: move;\n touch-action: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n.index-module_edit__-5VvX .index-module_border__JdNLM {\n position: absolute;\n inset: -10px;\n border: 2px dashed rgb(241, 102, 41);\n border-radius: 2px;\n pointer-events: none;\n}\n.index-module_edit__-5VvX .index-module_drag__uvdPG {\n position: absolute;\n inset: -10px;\n border-radius: 2px;\n}\n.index-module_edit__-5VvX .index-module_rotate__H-KIZ {\n position: absolute;\n top: -20px;\n right: -20px;\n width: 20px;\n height: 20px;\n cursor: grab;\n z-index: 1001;\n pointer-events: auto;\n}\n.index-module_edit__-5VvX .index-module_move__mZF8s {\n position: absolute;\n bottom: -20px;\n left: -20px;\n width: 20px;\n height: 20px;\n cursor: move;\n z-index: 1001;\n pointer-events: auto;\n}";
|
|
8697
8696
|
var styles$i = {"edit":"index-module_edit__-5VvX","border":"index-module_border__JdNLM","drag":"index-module_drag__uvdPG","rotate":"index-module_rotate__H-KIZ","move":"index-module_move__mZF8s"};
|
|
8698
8697
|
styleInject(css_248z$i);
|
|
8699
8698
|
|
|
@@ -8775,8 +8774,10 @@ const DragHandle = ({ onDragStart, isDragging }) => {
|
|
|
8775
8774
|
onDragStart(e);
|
|
8776
8775
|
}, onTouchStart: (e) => onDragStart(e), onMouseUp: (e) => {
|
|
8777
8776
|
console.log('drag up');
|
|
8778
|
-
onDragEnd(e);
|
|
8779
|
-
},
|
|
8777
|
+
// onDragEnd(e);
|
|
8778
|
+
},
|
|
8779
|
+
// onTouchEnd={(e) => onDragEnd(e)}
|
|
8780
|
+
style: { cursor: isDragging ? 'grabbing' : 'move' }, dangerouslySetInnerHTML: { __html: DEFAULT_DRAG_ICON } }));
|
|
8780
8781
|
};
|
|
8781
8782
|
|
|
8782
8783
|
const MapDrag = ({ map: _map, dragCallbacks, onBoundaryLabelsCollapse, onTransformChange, isDragMap = false, }) => {
|
|
@@ -12513,11 +12514,74 @@ class ObstacleLayer extends BaseLayer {
|
|
|
12513
12514
|
}
|
|
12514
12515
|
}
|
|
12515
12516
|
}
|
|
12517
|
+
/**
|
|
12518
|
+
* 将坐标点按type分组
|
|
12519
|
+
*/
|
|
12520
|
+
groupCoordinatesByType(coordinates) {
|
|
12521
|
+
const segments = [];
|
|
12522
|
+
let currentSegment = null;
|
|
12523
|
+
for (let i = 0; i < coordinates.length; i++) {
|
|
12524
|
+
const coord = coordinates[i];
|
|
12525
|
+
const type = coord[2] || 2; // 默认type为2
|
|
12526
|
+
if (!currentSegment || currentSegment.type !== type) {
|
|
12527
|
+
// 开始新的段
|
|
12528
|
+
if (currentSegment && currentSegment.points.length > 0) {
|
|
12529
|
+
// 为了连接线段,将当前点也加入上一段的结尾
|
|
12530
|
+
currentSegment.points.push(coord);
|
|
12531
|
+
}
|
|
12532
|
+
currentSegment = {
|
|
12533
|
+
type: type,
|
|
12534
|
+
points: [coord],
|
|
12535
|
+
};
|
|
12536
|
+
segments.push(currentSegment);
|
|
12537
|
+
}
|
|
12538
|
+
else {
|
|
12539
|
+
// 继续当前段
|
|
12540
|
+
currentSegment.points.push(coord);
|
|
12541
|
+
}
|
|
12542
|
+
}
|
|
12543
|
+
// 处理封闭边界:如果第一段和最后一段type相同,需要连接起来
|
|
12544
|
+
if (segments.length > 1 && segments[0].type === segments[segments.length - 1].type) {
|
|
12545
|
+
const firstSegment = segments[0];
|
|
12546
|
+
const lastSegment = segments[segments.length - 1];
|
|
12547
|
+
// 将第一个点添加到最后一段,形成封闭
|
|
12548
|
+
lastSegment.points.push(firstSegment.points[0]);
|
|
12549
|
+
}
|
|
12550
|
+
else if (segments.length === 1) {
|
|
12551
|
+
// 只有一段的情况,添加第一个点到末尾形成封闭
|
|
12552
|
+
segments[0].points.push(coordinates[0]);
|
|
12553
|
+
}
|
|
12554
|
+
return segments;
|
|
12555
|
+
}
|
|
12516
12556
|
/**
|
|
12517
12557
|
* 渲染障碍物元素
|
|
12518
12558
|
*/
|
|
12519
12559
|
renderObstacle(svgGroup, element) {
|
|
12520
|
-
const { coordinates, style } = element;
|
|
12560
|
+
const { coordinates, style, originalData } = element;
|
|
12561
|
+
const { status, start_timestamp, end_timestamp } = originalData || {};
|
|
12562
|
+
if (coordinates.length < 2 || status === 0) {
|
|
12563
|
+
return;
|
|
12564
|
+
}
|
|
12565
|
+
if (status === 1 &&
|
|
12566
|
+
(start_timestamp > Date.now() / 1000 || end_timestamp < Date.now() / 1000)) {
|
|
12567
|
+
return;
|
|
12568
|
+
}
|
|
12569
|
+
// 1. 先遍历所有的coordinates,把所有点分为若干段的path
|
|
12570
|
+
const pathSegments = this.groupCoordinatesByType(coordinates);
|
|
12571
|
+
// 2&3. 根据type处理每个path段
|
|
12572
|
+
pathSegments.forEach((segment) => {
|
|
12573
|
+
if (segment.points.length < 2)
|
|
12574
|
+
return;
|
|
12575
|
+
if (segment.type === 2) {
|
|
12576
|
+
// type=2: 直接添加到svgGroup中
|
|
12577
|
+
this.createDirectPath(svgGroup, segment.points, style);
|
|
12578
|
+
}
|
|
12579
|
+
else if (segment.type === 1) {
|
|
12580
|
+
// type=1: 使用PathMeasure逻辑生成平行路径
|
|
12581
|
+
// this.createDirectPath(svgGroup, segment.points, style);
|
|
12582
|
+
this.createParallelPathsWithMeasure(svgGroup, segment.points, style);
|
|
12583
|
+
}
|
|
12584
|
+
});
|
|
12521
12585
|
if (coordinates.length < 3)
|
|
12522
12586
|
return;
|
|
12523
12587
|
const polygon = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');
|
|
@@ -12525,7 +12589,7 @@ class ObstacleLayer extends BaseLayer {
|
|
|
12525
12589
|
const points = coordinates.map((coord) => `${coord[0]},${coord[1]}`).join(' ');
|
|
12526
12590
|
polygon.setAttribute('points', points);
|
|
12527
12591
|
polygon.setAttribute('fill', style.fillColor || 'rgba(220, 53, 69, 0.2)');
|
|
12528
|
-
polygon.setAttribute('stroke',
|
|
12592
|
+
polygon.setAttribute('stroke', 'transparent');
|
|
12529
12593
|
// 确保最小线条宽度
|
|
12530
12594
|
const lineWidth = Math.max(style.lineWidth || 2, 0.5);
|
|
12531
12595
|
polygon.setAttribute('stroke-width', lineWidth.toString());
|
|
@@ -12536,6 +12600,113 @@ class ObstacleLayer extends BaseLayer {
|
|
|
12536
12600
|
polygon.classList.add('vector-obstacle');
|
|
12537
12601
|
svgGroup.appendChild(polygon);
|
|
12538
12602
|
}
|
|
12603
|
+
/**
|
|
12604
|
+
* 创建直接路径(type=2)
|
|
12605
|
+
*/
|
|
12606
|
+
createDirectPath(svgGroup, points, style) {
|
|
12607
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
12608
|
+
const strokeColor = style.lineColor;
|
|
12609
|
+
// 构建路径数据
|
|
12610
|
+
let pathData = '';
|
|
12611
|
+
for (let i = 0; i < points.length; i++) {
|
|
12612
|
+
const [x, y] = points[i];
|
|
12613
|
+
if (i === 0) {
|
|
12614
|
+
pathData += `M ${x} ${y}`;
|
|
12615
|
+
}
|
|
12616
|
+
else {
|
|
12617
|
+
pathData += ` L ${x} ${y}`;
|
|
12618
|
+
}
|
|
12619
|
+
}
|
|
12620
|
+
path.setAttribute('d', pathData);
|
|
12621
|
+
path.setAttribute('stroke', strokeColor);
|
|
12622
|
+
path.setAttribute('fill', 'none');
|
|
12623
|
+
// 确保最小线条宽度
|
|
12624
|
+
const lineWidth = dp2px(style.lineWidth || 3);
|
|
12625
|
+
path.setAttribute('stroke-width', lineWidth.toString());
|
|
12626
|
+
path.setAttribute('stroke-linecap', 'round');
|
|
12627
|
+
path.setAttribute('stroke-linejoin', 'round');
|
|
12628
|
+
path.setAttribute('opacity', (style.opacity || 1).toString());
|
|
12629
|
+
path.setAttribute('vector-effect', 'non-scaling-stroke');
|
|
12630
|
+
path.classList.add('vector-obstacle');
|
|
12631
|
+
svgGroup.appendChild(path);
|
|
12632
|
+
}
|
|
12633
|
+
/**
|
|
12634
|
+
* 使用PathMeasure逻辑创建平行路径(type=1)
|
|
12635
|
+
*/
|
|
12636
|
+
createParallelPathsWithMeasure(svgGroup, points, style) {
|
|
12637
|
+
const strokeColor = style.lineColor;
|
|
12638
|
+
const lineWidth = dp2px(style.lineWidth || 3);
|
|
12639
|
+
// 获取当前SVG的缩放级别,计算固定屏幕像素间距
|
|
12640
|
+
const fixedScreenDistance = lineWidth; // 固定的屏幕像素距离
|
|
12641
|
+
const offsetDistance = fixedScreenDistance; // 转换为SVG坐标系距离
|
|
12642
|
+
// 直接对每个线段生成平行直线段
|
|
12643
|
+
const parallelPaths = this.generateStraightParallelPaths(points, offsetDistance);
|
|
12644
|
+
// 渲染两条平行虚线
|
|
12645
|
+
parallelPaths.forEach((pathData, index) => {
|
|
12646
|
+
if (!pathData)
|
|
12647
|
+
return;
|
|
12648
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
12649
|
+
path.setAttribute('d', pathData);
|
|
12650
|
+
path.setAttribute('fill', 'none');
|
|
12651
|
+
path.setAttribute('stroke', strokeColor);
|
|
12652
|
+
path.setAttribute('stroke-width', lineWidth.toString());
|
|
12653
|
+
path.setAttribute('stroke-linecap', 'round');
|
|
12654
|
+
path.setAttribute('stroke-linejoin', 'round');
|
|
12655
|
+
path.setAttribute('opacity', (style.opacity || 1).toString());
|
|
12656
|
+
// 使用CSS样式设置虚线,避免随SVG缩放变化
|
|
12657
|
+
// 或者可以根据当前缩放级别动态计算dash array
|
|
12658
|
+
path.style.strokeDasharray = `${lineWidth}px ${lineWidth * 2}px`;
|
|
12659
|
+
path.classList.add(`vector-boundary-parallel-${index + 1}`);
|
|
12660
|
+
svgGroup.appendChild(path);
|
|
12661
|
+
});
|
|
12662
|
+
}
|
|
12663
|
+
/**
|
|
12664
|
+
* 生成直线平行路径(每个线段分别处理)
|
|
12665
|
+
*/
|
|
12666
|
+
generateStraightParallelPaths(points, offsetDistance) {
|
|
12667
|
+
if (points.length < 2)
|
|
12668
|
+
return ['', ''];
|
|
12669
|
+
let parallelPath1Data = '';
|
|
12670
|
+
let parallelPath2Data = '';
|
|
12671
|
+
// 对每个线段分别计算平行线
|
|
12672
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
12673
|
+
const startPoint = points[i];
|
|
12674
|
+
const endPoint = points[i + 1];
|
|
12675
|
+
// 计算线段的方向向量
|
|
12676
|
+
const dx = endPoint[0] - startPoint[0];
|
|
12677
|
+
const dy = endPoint[1] - startPoint[1];
|
|
12678
|
+
const length = Math.sqrt(dx * dx + dy * dy);
|
|
12679
|
+
if (length === 0)
|
|
12680
|
+
continue; // 跳过零长度线段
|
|
12681
|
+
// 标准化方向向量
|
|
12682
|
+
const unitX = dx / length;
|
|
12683
|
+
const unitY = dy / length;
|
|
12684
|
+
// 计算垂直向量
|
|
12685
|
+
const perpendicularX = -unitY;
|
|
12686
|
+
const perpendicularY = unitX;
|
|
12687
|
+
// 计算平行线的起点和终点
|
|
12688
|
+
const start1X = startPoint[0] + perpendicularX * offsetDistance;
|
|
12689
|
+
const start1Y = startPoint[1] + perpendicularY * offsetDistance;
|
|
12690
|
+
const end1X = endPoint[0] + perpendicularX * offsetDistance;
|
|
12691
|
+
const end1Y = endPoint[1] + perpendicularY * offsetDistance;
|
|
12692
|
+
const start2X = startPoint[0] - perpendicularX * offsetDistance;
|
|
12693
|
+
const start2Y = startPoint[1] - perpendicularY * offsetDistance;
|
|
12694
|
+
const end2X = endPoint[0] - perpendicularX * offsetDistance;
|
|
12695
|
+
const end2Y = endPoint[1] - perpendicularY * offsetDistance;
|
|
12696
|
+
// 构建路径数据
|
|
12697
|
+
if (i === 0) {
|
|
12698
|
+
parallelPath1Data = `M ${start1X} ${start1Y}`;
|
|
12699
|
+
parallelPath2Data = `M ${start2X} ${start2Y}`;
|
|
12700
|
+
}
|
|
12701
|
+
else {
|
|
12702
|
+
parallelPath1Data += ` M ${start1X} ${start1Y}`;
|
|
12703
|
+
parallelPath2Data += ` M ${start2X} ${start2Y}`;
|
|
12704
|
+
}
|
|
12705
|
+
parallelPath1Data += ` L ${end1X} ${end1Y}`;
|
|
12706
|
+
parallelPath2Data += ` L ${end2X} ${end2Y}`;
|
|
12707
|
+
}
|
|
12708
|
+
return [parallelPath2Data, parallelPath1Data];
|
|
12709
|
+
}
|
|
12539
12710
|
}
|
|
12540
12711
|
|
|
12541
12712
|
var chargingPileImage = "data:image/png;base64,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";
|
|
@@ -15018,15 +15189,15 @@ const VertexElement = React__default.memo(({ r, stroke, ...props }) => {
|
|
|
15018
15189
|
return (jsx("circle", { r: radius * overlayScale, stroke: stroke || '#fff', fill: '#fff', strokeWidth: 2 * overlayScale, ...props }));
|
|
15019
15190
|
});
|
|
15020
15191
|
|
|
15021
|
-
var _path$
|
|
15022
|
-
function _extends$
|
|
15192
|
+
var _path$b;
|
|
15193
|
+
function _extends$j() { return _extends$j = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$j.apply(null, arguments); }
|
|
15023
15194
|
var SvgDelete$1 = function SvgDelete(props) {
|
|
15024
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
15195
|
+
return /*#__PURE__*/React.createElement("svg", _extends$j({
|
|
15025
15196
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15026
15197
|
width: 16,
|
|
15027
15198
|
height: 16,
|
|
15028
15199
|
fill: "none"
|
|
15029
|
-
}, props), _path$
|
|
15200
|
+
}, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
|
|
15030
15201
|
fill: "#FD494D",
|
|
15031
15202
|
d: "M6.667 12a.667.667 0 0 0 .666-.667v-4a.667.667 0 1 0-1.333 0v4a.667.667 0 0 0 .667.667m6.666-8h-2.666v-.667a2 2 0 0 0-2-2H7.333a2 2 0 0 0-2 2V4H2.667a.667.667 0 0 0 0 1.333h.666v7.334a2 2 0 0 0 2 2h5.334a2 2 0 0 0 2-2V5.333h.666a.667.667 0 1 0 0-1.333m-6.666-.667a.667.667 0 0 1 .666-.666h1.334a.667.667 0 0 1 .666.666V4H6.667zm4.666 9.334a.667.667 0 0 1-.666.666H5.333a.667.667 0 0 1-.666-.666V5.333h6.666zm-2-.667a.667.667 0 0 0 .667-.667v-4a.667.667 0 0 0-1.333 0v4a.667.667 0 0 0 .666.667"
|
|
15032
15203
|
})));
|
|
@@ -15199,6 +15370,7 @@ var MobileEditMode;
|
|
|
15199
15370
|
})(MobileEditMode || (MobileEditMode = {}));
|
|
15200
15371
|
var ClickEventType;
|
|
15201
15372
|
(function (ClickEventType) {
|
|
15373
|
+
// 点击doodle的active time的时候触发
|
|
15202
15374
|
ClickEventType["DOODLE_ACTIVE_TIME"] = "doodleActiveTime";
|
|
15203
15375
|
})(ClickEventType || (ClickEventType = {}));
|
|
15204
15376
|
const INIT_EDIT_MAP_INFO = {
|
|
@@ -15561,7 +15733,7 @@ const useCheckElement = () => {
|
|
|
15561
15733
|
return { isValid: true };
|
|
15562
15734
|
}, [editMapInfo, svgElementDatas, minDistance]);
|
|
15563
15735
|
const checkCanNotCreateAtPosition = useCallback((checkPoint) => {
|
|
15564
|
-
|
|
15736
|
+
console.log('editMapInfo.elementType--->', editMapInfo.elementType);
|
|
15565
15737
|
if (!editMapInfo.elementType)
|
|
15566
15738
|
return false;
|
|
15567
15739
|
const points = editMapInfo?.selectElement?.points || [];
|
|
@@ -15951,17 +16123,13 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
15951
16123
|
console.log('handleMouseUp', JSON.stringify(dragState));
|
|
15952
16124
|
if (dragState.isDragging && dragState.currentPosition) {
|
|
15953
16125
|
// 构建新的坐标数组
|
|
15954
|
-
const newCoordinates =
|
|
15955
|
-
? [...coordinates]
|
|
15956
|
-
: [...coordinates].reverse();
|
|
16126
|
+
const newCoordinates = [...coordinates];
|
|
15957
16127
|
// 如果是新创建的顶点,需要确保它已经被插入
|
|
15958
16128
|
if (dragState.dragType === 'new' && dragState.newVertexIndex !== -1) {
|
|
15959
16129
|
if (showNotCreateCursor) ;
|
|
15960
16130
|
else {
|
|
15961
16131
|
// mouseUp 时才真正插入新顶点
|
|
15962
16132
|
newCoordinates.splice(dragState.newVertexIndex, 0, dragState.currentPosition);
|
|
15963
|
-
// 通知外部坐标变化
|
|
15964
|
-
onCoordinatesChange?.(newCoordinates);
|
|
15965
16133
|
}
|
|
15966
16134
|
}
|
|
15967
16135
|
else {
|
|
@@ -15972,9 +16140,11 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
15972
16140
|
else {
|
|
15973
16141
|
newCoordinates[dragState.dragIndex] = dragState.currentPosition;
|
|
15974
16142
|
}
|
|
15975
|
-
// 通知外部坐标变化
|
|
15976
|
-
onCoordinatesChange?.(newCoordinates);
|
|
15977
16143
|
}
|
|
16144
|
+
const result = editMapInfo?.createMode === CreateStatus.CREATING
|
|
16145
|
+
? newCoordinates
|
|
16146
|
+
: newCoordinates.reverse();
|
|
16147
|
+
onCoordinatesChange?.(result);
|
|
15978
16148
|
}
|
|
15979
16149
|
setDragState({
|
|
15980
16150
|
isDragging: false,
|
|
@@ -16067,7 +16237,6 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
16067
16237
|
const ghostFirstMidpoint = createMode && mousePos && !completed && renderCoordinates.length >= 1
|
|
16068
16238
|
? calculateMidpoint(renderCoordinates[0], [mousePos.x, mousePos.y])
|
|
16069
16239
|
: null;
|
|
16070
|
-
console.log('ghostFirstMidpoint', ghostFirstMidpoint, ghostFirstDistance);
|
|
16071
16240
|
return (jsxs(Fragment, { children: [(editMode || (createMode && completed)) &&
|
|
16072
16241
|
dragState.isDragging &&
|
|
16073
16242
|
dragState.dragType !== 'new' &&
|
|
@@ -16191,7 +16360,8 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
16191
16360
|
if (onVertexDelete &&
|
|
16192
16361
|
(editMode || (createMode && completed)) &&
|
|
16193
16362
|
coordinates.length > 3) {
|
|
16194
|
-
|
|
16363
|
+
// 当前是逆时针展示的,但是外部数据是顺时针的,所以idx需要转换一下
|
|
16364
|
+
onVertexDelete(renderCoordinates?.length - 1 - idx);
|
|
16195
16365
|
}
|
|
16196
16366
|
setTooltipIndex(null);
|
|
16197
16367
|
}, style: { cursor: 'pointer' }, children: [jsx("rect", { x: 0, y: -24, width: 20, height: 20, rx: 2, ry: 2, fill: "#fff", strokeWidth: 1, filter: "url(#vertex-tooltip-shadow)" }), jsx("g", { transform: `translate(2, -22)`, children: jsx(SvgDelete$1, {}) })] })), canComplete && (jsx("g", { style: { pointerEvents: 'none' }, transform: `translate(${coord[0] - 5 * overlayScale * 3}, ${coord[1] - 2.5 * overlayScale * 3}) scale(${overlayScale * 3})`, children: jsx("svg", { width: "10", height: "5", viewBox: "0 0 6 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M0.5 2.5L1.3452 3.3452C1.71469 3.71469 2.30636 3.73741 2.7031 3.39735L5.5 1", stroke: "#FF7A33", "stroke-linecap": "round" }) }) })
|
|
@@ -16883,9 +17053,9 @@ const useVisionOffTransform = (data, scaleConstraints
|
|
|
16883
17053
|
};
|
|
16884
17054
|
|
|
16885
17055
|
var _g$7, _defs$7;
|
|
16886
|
-
function _extends$
|
|
17056
|
+
function _extends$i() { return _extends$i = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$i.apply(null, arguments); }
|
|
16887
17057
|
var SvgTransformDelete = function SvgTransformDelete(props) {
|
|
16888
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17058
|
+
return /*#__PURE__*/React.createElement("svg", _extends$i({
|
|
16889
17059
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16890
17060
|
width: 20,
|
|
16891
17061
|
height: 20,
|
|
@@ -16934,9 +17104,9 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
|
|
|
16934
17104
|
};
|
|
16935
17105
|
|
|
16936
17106
|
var _g$6, _defs$6;
|
|
16937
|
-
function _extends$
|
|
17107
|
+
function _extends$h() { return _extends$h = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$h.apply(null, arguments); }
|
|
16938
17108
|
var SvgTransformRotate = function SvgTransformRotate(props) {
|
|
16939
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17109
|
+
return /*#__PURE__*/React.createElement("svg", _extends$h({
|
|
16940
17110
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16941
17111
|
width: 21,
|
|
16942
17112
|
height: 20,
|
|
@@ -16970,9 +17140,9 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
|
|
|
16970
17140
|
};
|
|
16971
17141
|
|
|
16972
17142
|
var _g$5, _defs$5;
|
|
16973
|
-
function _extends$
|
|
17143
|
+
function _extends$g() { return _extends$g = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$g.apply(null, arguments); }
|
|
16974
17144
|
var SvgTransformScale = function SvgTransformScale(props) {
|
|
16975
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17145
|
+
return /*#__PURE__*/React.createElement("svg", _extends$g({
|
|
16976
17146
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16977
17147
|
width: 21,
|
|
16978
17148
|
height: 20,
|
|
@@ -17006,9 +17176,9 @@ var SvgTransformScale = function SvgTransformScale(props) {
|
|
|
17006
17176
|
};
|
|
17007
17177
|
|
|
17008
17178
|
var _g$4, _defs$4;
|
|
17009
|
-
function _extends$
|
|
17179
|
+
function _extends$f() { return _extends$f = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$f.apply(null, arguments); }
|
|
17010
17180
|
var SvgTransformTranslate = function SvgTransformTranslate(props) {
|
|
17011
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17181
|
+
return /*#__PURE__*/React.createElement("svg", _extends$f({
|
|
17012
17182
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17013
17183
|
width: 20,
|
|
17014
17184
|
height: 20,
|
|
@@ -17186,8 +17356,8 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
17186
17356
|
const centerX = (minX + maxX) / 2;
|
|
17187
17357
|
// 计算尺寸显示框的位置(选择框下方)
|
|
17188
17358
|
const infoBoxY = maxY + 20; // 选择框下方20像素
|
|
17189
|
-
const infoBoxWidth = 140; // 信息框宽度
|
|
17190
|
-
const infoBoxHeight = 30; // 信息框高度
|
|
17359
|
+
const infoBoxWidth = 140 * overlayScale; // 信息框宽度
|
|
17360
|
+
const infoBoxHeight = 30 * overlayScale; // 信息框高度
|
|
17191
17361
|
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
17192
17362
|
const scale = (isWeb ? 2 : 1) * overlayScale;
|
|
17193
17363
|
const offsetLeft = 10 * scale;
|
|
@@ -17241,6 +17411,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
17241
17411
|
fontSize: '12px',
|
|
17242
17412
|
color: 'white',
|
|
17243
17413
|
fontWeight: '400',
|
|
17414
|
+
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
17244
17415
|
}, children: [dimensions.height, "m \u00D7 ", dimensions.width, "m"] }) }))] }));
|
|
17245
17416
|
})()] }));
|
|
17246
17417
|
};
|
|
@@ -17664,8 +17835,8 @@ const useDoodleTransform = (data, onTransformChange, options) => {
|
|
|
17664
17835
|
const scaledHeight = height * currentScale;
|
|
17665
17836
|
// 转换为米单位(假设SVG坐标单位是米)
|
|
17666
17837
|
// 这里可以根据实际的地图比例尺进行调整
|
|
17667
|
-
const widthInMeters = scaledWidth;
|
|
17668
|
-
const heightInMeters = scaledHeight;
|
|
17838
|
+
const widthInMeters = scaledWidth / SCALE_FACTOR;
|
|
17839
|
+
const heightInMeters = scaledHeight / SCALE_FACTOR;
|
|
17669
17840
|
return {
|
|
17670
17841
|
width: Math.round(widthInMeters * 100) / 100, // 保留2位小数
|
|
17671
17842
|
height: Math.round(heightInMeters * 100) / 100, // 保留2位小数
|
|
@@ -17697,15 +17868,15 @@ const useDoodleTransform = (data, onTransformChange, options) => {
|
|
|
17697
17868
|
};
|
|
17698
17869
|
};
|
|
17699
17870
|
|
|
17700
|
-
var _path$
|
|
17701
|
-
function _extends$
|
|
17871
|
+
var _path$a;
|
|
17872
|
+
function _extends$e() { return _extends$e = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$e.apply(null, arguments); }
|
|
17702
17873
|
var SvgTransformArrow = function SvgTransformArrow(props) {
|
|
17703
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17874
|
+
return /*#__PURE__*/React.createElement("svg", _extends$e({
|
|
17704
17875
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17705
17876
|
width: 7,
|
|
17706
17877
|
height: 11,
|
|
17707
17878
|
fill: "none"
|
|
17708
|
-
}, props), _path$
|
|
17879
|
+
}, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
|
|
17709
17880
|
fill: "#fff",
|
|
17710
17881
|
d: "M2.156 1.032a.777.777 0 0 0-1.061 0 .69.69 0 0 0-.062.943l.062.068 3.97 3.78-3.97 3.78a.69.69 0 0 0-.062.944l.062.067c.27.257.696.277.99.06l.07-.06 4.5-4.286a.69.69 0 0 0 .063-.943l-.062-.067z",
|
|
17711
17882
|
opacity: 0.5
|
|
@@ -17767,7 +17938,7 @@ const DoodleTransform = ({ data, isSelected: _isSelected, onSelect }) => {
|
|
|
17767
17938
|
};
|
|
17768
17939
|
|
|
17769
17940
|
const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOperation = false, onSelect, onCancel, onTransformChange, disabled = false, className = '', minScale, onMinScaleReached, onDragMove, onDragEnd, showInfo = true, onClickInfo, }) => {
|
|
17770
|
-
const { platform } = useCommonContext();
|
|
17941
|
+
const { platform, overlayScale } = useCommonContext();
|
|
17771
17942
|
// 使用自定义hook管理所有变换逻辑
|
|
17772
17943
|
const { currentCenter, currentScale, currentDirection, isDragging, isRotating, isScaling, initializeTransform, calculateSelectionBoxPoints, handleMouseDown, handleRotateStart, handleScaleStart, handleMouseMove, handleMouseUp, containerRef, dimensions, } = useDoodleTransform(data, onTransformChange, {
|
|
17773
17944
|
minScale,
|
|
@@ -17789,16 +17960,20 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17789
17960
|
}, [data?.svg, currentCenter, currentScale, currentDirection]);
|
|
17790
17961
|
const isWeb = useMemo(() => platform === 'web', [platform]);
|
|
17791
17962
|
const activeTime = useMemo(() => {
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
console.log('now------->', now);
|
|
17795
|
-
console.log('data.create_ts------->', data.create_ts);
|
|
17796
|
-
console.log('data.expiration_ts------->', data.expiration_ts);
|
|
17797
|
-
if (data.create_ts <= now && data.expiration_ts >= now) {
|
|
17798
|
-
return Math.floor((data.expiration_ts - now) / (60 * 60 * 24 * 1000));
|
|
17963
|
+
if (data.create_ts && data.expiration_ts) {
|
|
17964
|
+
return Math.floor((data.expiration_ts - data.create_ts) / (60 * 60 * 24));
|
|
17799
17965
|
}
|
|
17800
17966
|
return 0;
|
|
17801
17967
|
}, [data]);
|
|
17968
|
+
const remainingTime = useMemo(() => {
|
|
17969
|
+
const currentTime = Math.floor(Date.now() / 1000);
|
|
17970
|
+
console.log('data.expiration_ts--', data.expiration_ts);
|
|
17971
|
+
if (data.expiration_ts <= currentTime) {
|
|
17972
|
+
return 0;
|
|
17973
|
+
}
|
|
17974
|
+
// 保留一位小数
|
|
17975
|
+
return ((currentTime - data.expiration_ts) / (24 * 60 * 60)).toFixed(1);
|
|
17976
|
+
}, [data]);
|
|
17802
17977
|
// 初始化变换状态
|
|
17803
17978
|
useEffect(() => {
|
|
17804
17979
|
initializeTransform();
|
|
@@ -17879,7 +18054,18 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17879
18054
|
};
|
|
17880
18055
|
const selectionBoxWithoutOperation = () => {
|
|
17881
18056
|
const selectionBoxPoints = calculateSelectionBoxPoints();
|
|
17882
|
-
|
|
18057
|
+
// 计算选择框的边界
|
|
18058
|
+
const minX = Math.min(...selectionBoxPoints.map((p) => p.x));
|
|
18059
|
+
const maxX = Math.max(...selectionBoxPoints.map((p) => p.x));
|
|
18060
|
+
const maxY = Math.max(...selectionBoxPoints.map((p) => p.y));
|
|
18061
|
+
// 计算选择框的中心
|
|
18062
|
+
const centerX = (minX + maxX) / 2;
|
|
18063
|
+
// 计算尺寸显示框的位置(选择框下方)
|
|
18064
|
+
const infoBoxY = maxY + 20; // 选择框下方20像素
|
|
18065
|
+
const infoBoxWidth = 140 * overlayScale; // 信息框宽度
|
|
18066
|
+
const infoBoxHeight = 100 * overlayScale; // 信息框高度
|
|
18067
|
+
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
18068
|
+
return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#B2B4B9", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
|
|
17883
18069
|
? {
|
|
17884
18070
|
onTouchStart: createReactEventHandler((e) => {
|
|
17885
18071
|
handleMouseDownWithDisabled(e);
|
|
@@ -17887,7 +18073,26 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17887
18073
|
}
|
|
17888
18074
|
: {
|
|
17889
18075
|
onMouseDown: handleMouseDownWithDisabled,
|
|
17890
|
-
}) }), jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r:
|
|
18076
|
+
}) }), jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[3].x, cy: selectionBoxPoints[3].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[1].x, cy: selectionBoxPoints[1].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[2].x, cy: selectionBoxPoints[2].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
|
|
18077
|
+
onClickInfo?.();
|
|
18078
|
+
}, children: jsx("div", { style: {
|
|
18079
|
+
padding: '5px 6px',
|
|
18080
|
+
background: 'rgba(201, 209, 218, 1)',
|
|
18081
|
+
borderRadius: '10px',
|
|
18082
|
+
display: 'inline-flex',
|
|
18083
|
+
flexDirection: 'column',
|
|
18084
|
+
alignItems: 'flex-start',
|
|
18085
|
+
justifyContent: 'center',
|
|
18086
|
+
fontSize: '12px',
|
|
18087
|
+
color: 'white',
|
|
18088
|
+
fontWeight: '400',
|
|
18089
|
+
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
18090
|
+
}, children: jsx("div", { style: {
|
|
18091
|
+
display: 'flex',
|
|
18092
|
+
alignItems: 'center',
|
|
18093
|
+
justifyContent: 'center',
|
|
18094
|
+
gap: '10px',
|
|
18095
|
+
}, children: jsxs("div", { children: ["Remaining Time: ", remainingTime] }) }) }) })] }));
|
|
17891
18096
|
};
|
|
17892
18097
|
useEffect(() => {
|
|
17893
18098
|
const isMove = isDragging || isRotating || isScaling;
|
|
@@ -17935,10 +18140,10 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17935
18140
|
const centerX = (minX + maxX) / 2;
|
|
17936
18141
|
// 计算尺寸显示框的位置(选择框下方)
|
|
17937
18142
|
const infoBoxY = maxY + 20; // 选择框下方20像素
|
|
17938
|
-
const infoBoxWidth = 140; // 信息框宽度
|
|
17939
|
-
const infoBoxHeight =
|
|
18143
|
+
const infoBoxWidth = 140 * overlayScale; // 信息框宽度
|
|
18144
|
+
const infoBoxHeight = 100 * overlayScale; // 信息框高度
|
|
17940
18145
|
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
17941
|
-
const scale = isWeb ? 2 : 1;
|
|
18146
|
+
const scale = (isWeb ? 2 : 1) * overlayScale;
|
|
17942
18147
|
const offsetLeft = 10 * scale;
|
|
17943
18148
|
return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#9EA6BA", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
|
|
17944
18149
|
? {
|
|
@@ -17993,6 +18198,7 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17993
18198
|
fontSize: '12px',
|
|
17994
18199
|
color: 'white',
|
|
17995
18200
|
fontWeight: '400',
|
|
18201
|
+
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
17996
18202
|
}, children: [jsxs("div", { children: [dimensions.height, "m \u00D7 ", dimensions.width, "m"] }), jsxs("div", { style: {
|
|
17997
18203
|
display: 'flex',
|
|
17998
18204
|
alignItems: 'center',
|
|
@@ -18003,9 +18209,9 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
18003
18209
|
};
|
|
18004
18210
|
|
|
18005
18211
|
const DoodleElement = ({ data }) => {
|
|
18006
|
-
const { editMapInfo, setEditMapInfo, onHandleEnterRecord,
|
|
18212
|
+
const { editMapInfo, setEditMapInfo, onHandleEnterRecord, onHandleEvent } = useMapEditContext();
|
|
18007
18213
|
const { addHistory } = useHistoryHandle();
|
|
18008
|
-
const { platform } = useCommonContext();
|
|
18214
|
+
const { platform, doodleList } = useCommonContext();
|
|
18009
18215
|
const isSelected = useMemo(() => {
|
|
18010
18216
|
if (platform === PlatformType.H5) {
|
|
18011
18217
|
if (editMapInfo.mobileMode !== MobileEditMode.START &&
|
|
@@ -18022,6 +18228,23 @@ const DoodleElement = ({ data }) => {
|
|
|
18022
18228
|
}
|
|
18023
18229
|
return data;
|
|
18024
18230
|
}, [data, editMapInfo?.selectElement]);
|
|
18231
|
+
const minScale = useMemo(() => {
|
|
18232
|
+
const doodleInfo = doodleList.find((item) => {
|
|
18233
|
+
// 移除所有空白字符(包括\n、\r、\t等)进行比较
|
|
18234
|
+
const normalizedItemSvg = item.svgStr?.replace(/[\s\n\r\t]+/g, '').replace(/\\n/g, '');
|
|
18235
|
+
const normalizedOriginSvg = originData.svg?.replace(/[\s\n\r\t]+/g, '').replace(/\\n/g, '');
|
|
18236
|
+
// console.log('normalizedItemSvg--->', normalizedItemSvg, normalizedOriginSvg);
|
|
18237
|
+
return normalizedItemSvg === normalizedOriginSvg;
|
|
18238
|
+
});
|
|
18239
|
+
console.log('doodleList--->', doodleList, originData, doodleInfo);
|
|
18240
|
+
if (!doodleInfo) {
|
|
18241
|
+
return 1;
|
|
18242
|
+
}
|
|
18243
|
+
const minLength = doodleInfo?.minLength;
|
|
18244
|
+
const parseSvg = SvgParserNative.parseSvg(originData.svg);
|
|
18245
|
+
const svgMinLength = parseSvg.height / SCALE_FACTOR;
|
|
18246
|
+
return minLength / svgMinLength;
|
|
18247
|
+
}, [doodleList, originData]);
|
|
18025
18248
|
const isSelectedWithoutOperation = useMemo(() => {
|
|
18026
18249
|
if (platform === PlatformType.H5) {
|
|
18027
18250
|
if (editMapInfo.mobileMode === MobileEditMode.START &&
|
|
@@ -18100,8 +18323,8 @@ const DoodleElement = ({ data }) => {
|
|
|
18100
18323
|
}));
|
|
18101
18324
|
}, []);
|
|
18102
18325
|
const handleClickInfo = useCallback(() => {
|
|
18103
|
-
|
|
18104
|
-
}, [
|
|
18326
|
+
onHandleEvent?.(ClickEventType.DOODLE_ACTIVE_TIME);
|
|
18327
|
+
}, [onHandleEvent]);
|
|
18105
18328
|
// const handleDragMove = useCallback(
|
|
18106
18329
|
// (data: DoodleData) => {
|
|
18107
18330
|
// setEditMapInfo((prev: EditMapInfo) => ({
|
|
@@ -18129,7 +18352,8 @@ const DoodleElement = ({ data }) => {
|
|
|
18129
18352
|
},
|
|
18130
18353
|
});
|
|
18131
18354
|
}, [transformedElements]);
|
|
18132
|
-
|
|
18355
|
+
console.log('originData--->', originData, minScale);
|
|
18356
|
+
return (jsx(DoodleTransformWrapper, { data: originData, onTransformChange: handleTransformChange, isSelected: isSelected, isSelectedWithoutOperation: isSelectedWithoutOperation, onSelect: handleSelect, onCancel: handleCancel, onDragEnd: handleDragEnd, showInfo: platform === PlatformType.H5, onClickInfo: handleClickInfo, minScale: minScale }));
|
|
18133
18357
|
};
|
|
18134
18358
|
|
|
18135
18359
|
const SvgElement = React__default.memo(({ type, data, interactive = false }) => {
|
|
@@ -19363,27 +19587,37 @@ const getScreenCenterSvgPoint = (svgElement, mapInstance) => {
|
|
|
19363
19587
|
*/
|
|
19364
19588
|
const CreateObstacleElement = forwardRef(({ enabled = false, svgElement, onPointsChange, styles, points }, ref) => {
|
|
19365
19589
|
const { mapRef } = useCommonContext();
|
|
19590
|
+
const { checkCanNotCreateAtPosition } = useCheckElement();
|
|
19366
19591
|
// 使用固定的样式,确保能正常渲染
|
|
19367
19592
|
// 在十字准心位置添加点
|
|
19368
19593
|
const addPoint = useCallback(() => {
|
|
19369
19594
|
if (!enabled || !svgElement) {
|
|
19370
19595
|
console.warn('未启用创建模式或SVG元素不存在');
|
|
19371
|
-
return false;
|
|
19596
|
+
return { isValid: false, reason: '未启用创建模式或SVG元素不存在' };
|
|
19372
19597
|
}
|
|
19373
19598
|
if (!mapRef) {
|
|
19374
19599
|
console.warn('地图实例不存在');
|
|
19375
|
-
return false;
|
|
19600
|
+
return { isValid: false, reason: '地图实例不存在' };
|
|
19376
19601
|
}
|
|
19377
19602
|
const centerPoint = getScreenCenterSvgPoint(svgElement, mapRef);
|
|
19378
19603
|
if (!centerPoint) {
|
|
19379
19604
|
console.warn('无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内');
|
|
19380
|
-
|
|
19381
|
-
|
|
19382
|
-
|
|
19605
|
+
return { isValid: false, reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内' };
|
|
19606
|
+
}
|
|
19607
|
+
console.error('centerPoint--->', centerPoint);
|
|
19608
|
+
console.error('checkCanNotCreateAtPosition--->', checkCanNotCreateAtPosition(centerPoint));
|
|
19609
|
+
// 校验是否能打点
|
|
19610
|
+
if (checkCanNotCreateAtPosition(centerPoint)) {
|
|
19611
|
+
return {
|
|
19612
|
+
isValid: false,
|
|
19613
|
+
reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内',
|
|
19614
|
+
};
|
|
19383
19615
|
}
|
|
19384
19616
|
const newPoints = [...points, centerPoint];
|
|
19385
19617
|
onPointsChange?.(newPoints);
|
|
19386
|
-
return
|
|
19618
|
+
return {
|
|
19619
|
+
isValid: true,
|
|
19620
|
+
};
|
|
19387
19621
|
}, [enabled, svgElement, mapRef, points, onPointsChange]);
|
|
19388
19622
|
// 撤销最后一个点
|
|
19389
19623
|
const undoLastPoint = useCallback(() => {
|
|
@@ -19473,7 +19707,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
|
|
|
19473
19707
|
const { editMapInfo, setEditMapInfo } = useMapEditContext();
|
|
19474
19708
|
const { getVisionOffPoints, centerPoint } = useCreateVisionOffElement();
|
|
19475
19709
|
const { svgElementDatas } = useSvgEditContext();
|
|
19476
|
-
const { checkCanNotCreateAtPosition } = useCheckElement();
|
|
19710
|
+
const { checkCanNotCreateAtPosition, checkDoodle } = useCheckElement();
|
|
19477
19711
|
const svgRef = useRef(null);
|
|
19478
19712
|
const containerRef = useRef(null);
|
|
19479
19713
|
const { platform } = useCommonContext();
|
|
@@ -19607,7 +19841,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
|
|
|
19607
19841
|
getEditMapInfo,
|
|
19608
19842
|
// 十字准心点管理器方法
|
|
19609
19843
|
addCreateObstaclePoint: () => {
|
|
19610
|
-
return pointManagerRef.current?.addPoint();
|
|
19844
|
+
return pointManagerRef.current?.addPoint?.();
|
|
19611
19845
|
},
|
|
19612
19846
|
undoCreateObstaclePoint: () => {
|
|
19613
19847
|
pointManagerRef.current?.undoLastPoint();
|
|
@@ -19629,6 +19863,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
|
|
|
19629
19863
|
clearHistory,
|
|
19630
19864
|
addHistory,
|
|
19631
19865
|
addDoodle,
|
|
19866
|
+
checkDoodle: () => checkDoodle?.(),
|
|
19632
19867
|
}));
|
|
19633
19868
|
// 初始化多边形绘制 Hook
|
|
19634
19869
|
const { onSvgClick, onSvgMouseMove, onPointClick, points, completed, mousePos, updatePoints } = usePolygonDrawing({ createMode: isCreating });
|
|
@@ -19748,10 +19983,10 @@ var css_248z$c = ".index-module_addEntry__QsQHD {\n position: absolute;\n righ
|
|
|
19748
19983
|
var styles$c = {"addEntry":"index-module_addEntry__QsQHD","icon":"index-module_icon__qIgA4","addItem":"index-module_addItem__mglwZ","label":"index-module_label__QqZ-9"};
|
|
19749
19984
|
styleInject(css_248z$c);
|
|
19750
19985
|
|
|
19751
|
-
var _rect$2, _path$
|
|
19752
|
-
function _extends$
|
|
19986
|
+
var _rect$2, _path$9, _defs$3;
|
|
19987
|
+
function _extends$d() { return _extends$d = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$d.apply(null, arguments); }
|
|
19753
19988
|
var SvgAddEntry = function SvgAddEntry(props) {
|
|
19754
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
19989
|
+
return /*#__PURE__*/React.createElement("svg", _extends$d({
|
|
19755
19990
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19756
19991
|
width: 24,
|
|
19757
19992
|
height: 24,
|
|
@@ -19779,7 +20014,7 @@ var SvgAddEntry = function SvgAddEntry(props) {
|
|
|
19779
20014
|
height: "100%",
|
|
19780
20015
|
width: "100%"
|
|
19781
20016
|
}
|
|
19782
|
-
})), _path$
|
|
20017
|
+
})), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
|
|
19783
20018
|
fill: "#1F1F1F",
|
|
19784
20019
|
stroke: "url(#add-entry_svg__c)",
|
|
19785
20020
|
strokeWidth: 0.3,
|
|
@@ -19819,15 +20054,15 @@ var SvgAddEntry = function SvgAddEntry(props) {
|
|
|
19819
20054
|
})))));
|
|
19820
20055
|
};
|
|
19821
20056
|
|
|
19822
|
-
var _path$
|
|
19823
|
-
function _extends$
|
|
20057
|
+
var _path$8, _path2$3, _path3;
|
|
20058
|
+
function _extends$c() { return _extends$c = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$c.apply(null, arguments); }
|
|
19824
20059
|
var SvgBoundary = function SvgBoundary(props) {
|
|
19825
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
20060
|
+
return /*#__PURE__*/React.createElement("svg", _extends$c({
|
|
19826
20061
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19827
20062
|
width: 16,
|
|
19828
20063
|
height: 16,
|
|
19829
20064
|
fill: "none"
|
|
19830
|
-
}, props), _path$
|
|
20065
|
+
}, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
|
|
19831
20066
|
fill: "#1DBEAC",
|
|
19832
20067
|
fillRule: "evenodd",
|
|
19833
20068
|
d: "M3.385 2h9.23C13.38 2 14 2.62 14 3.385v9.23C14 13.38 13.38 14 12.615 14h-9.23C2.62 14 2 13.38 2 12.615v-9.23C2 2.62 2.62 2 3.385 2m9.692 1.385a.46.46 0 0 0-.462-.462h-9.23a.46.46 0 0 0-.462.462v9.23c0 .255.207.462.462.462h9.23a.46.46 0 0 0 .462-.462z",
|
|
@@ -19845,15 +20080,15 @@ var SvgBoundary = function SvgBoundary(props) {
|
|
|
19845
20080
|
})));
|
|
19846
20081
|
};
|
|
19847
20082
|
|
|
19848
|
-
var _path$
|
|
19849
|
-
function _extends$
|
|
20083
|
+
var _path$7, _path2$2, _rect$1, _rect2$1;
|
|
20084
|
+
function _extends$b() { return _extends$b = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$b.apply(null, arguments); }
|
|
19850
20085
|
var SvgLimitIsland = function SvgLimitIsland(props) {
|
|
19851
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
20086
|
+
return /*#__PURE__*/React.createElement("svg", _extends$b({
|
|
19852
20087
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19853
20088
|
width: 16,
|
|
19854
20089
|
height: 16,
|
|
19855
20090
|
fill: "none"
|
|
19856
|
-
}, props), _path$
|
|
20091
|
+
}, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
|
|
19857
20092
|
fill: "#FFA077",
|
|
19858
20093
|
d: "M11.725 6.714c-1.019-.137-2.516-1.488-1.9-2.14.588-.621 1.91.344 1.9 2.14"
|
|
19859
20094
|
})), _path2$2 || (_path2$2 = /*#__PURE__*/React.createElement("path", {
|
|
@@ -19879,9 +20114,9 @@ var SvgLimitIsland = function SvgLimitIsland(props) {
|
|
|
19879
20114
|
};
|
|
19880
20115
|
|
|
19881
20116
|
var _rect, _rect2, _rect3, _rect4, _g$3;
|
|
19882
|
-
function _extends$
|
|
20117
|
+
function _extends$a() { return _extends$a = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$a.apply(null, arguments); }
|
|
19883
20118
|
var SvgVisionFence = function SvgVisionFence(props) {
|
|
19884
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
20119
|
+
return /*#__PURE__*/React.createElement("svg", _extends$a({
|
|
19885
20120
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19886
20121
|
width: 16,
|
|
19887
20122
|
height: 16,
|
|
@@ -19934,9 +20169,9 @@ var SvgVisionFence = function SvgVisionFence(props) {
|
|
|
19934
20169
|
};
|
|
19935
20170
|
|
|
19936
20171
|
var _g$2, _defs$2;
|
|
19937
|
-
function _extends$
|
|
20172
|
+
function _extends$9() { return _extends$9 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$9.apply(null, arguments); }
|
|
19938
20173
|
var SvgDoodle = function SvgDoodle(props) {
|
|
19939
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
20174
|
+
return /*#__PURE__*/React.createElement("svg", _extends$9({
|
|
19940
20175
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19941
20176
|
width: 16,
|
|
19942
20177
|
height: 16,
|
|
@@ -20045,25 +20280,10 @@ const CustomModal = ({ children, titleCenter, hasMinHeight, height, ...props })
|
|
|
20045
20280
|
}), cancelButtonProps: { color: 'primary', variant: 'outlined' }, cancelText: 'Cancel', ...props, children: children }));
|
|
20046
20281
|
};
|
|
20047
20282
|
|
|
20048
|
-
var css_248z$a = ".index-module_doodleModal__EGNPW .index-module_title__ViZuB {\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: rgb(29, 29, 29);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n max-height: 230px;\n overflow-y: auto;\n width: 470px;\n margin: 20px auto 0;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 {\n width: 70px;\n height: 70px;\n padding: 10px;\n border-radius: 8px;\n cursor: pointer;\n border: 2px solid transparent;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ease;\n position: relative;\n background: rgb(233, 242, 241);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7.index-module_active__1OHfd {\n border: 2px solid
|
|
20049
|
-
var styles$a = {"doodleModal":"index-module_doodleModal__EGNPW","title":"index-module_title__ViZuB","content":"index-module_content__h-60T","item":"index-module_item__dvoq7","active":"index-module_active__1OHfd","
|
|
20283
|
+
var css_248z$a = ".index-module_doodleModal__EGNPW .index-module_title__ViZuB {\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: rgb(29, 29, 29);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n max-height: 230px;\n overflow-y: auto;\n width: 470px;\n margin: 20px auto 0;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 {\n width: 70px;\n height: 70px;\n padding: 10px;\n border-radius: 8px;\n cursor: pointer;\n border: 2px solid transparent;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ease;\n position: relative;\n background: rgb(233, 242, 241);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7.index-module_active__1OHfd {\n border: 2px solid #ff5a00;\n background-color: rgba(110, 220, 207, 0.1);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7.index-module_active__1OHfd .index-module_selectIcon__EFQF- {\n display: block;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_svgImage__2OT8- {\n width: 100%;\n height: 100%;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_svgImage__2OT8- svg {\n width: 100%;\n height: 100%;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_selectIcon__EFQF- {\n position: absolute;\n bottom: 4px;\n right: 4px;\n display: none;\n}";
|
|
20284
|
+
var styles$a = {"doodleModal":"index-module_doodleModal__EGNPW","title":"index-module_title__ViZuB","content":"index-module_content__h-60T","item":"index-module_item__dvoq7","active":"index-module_active__1OHfd","svgImage":"index-module_svgImage__2OT8-"};
|
|
20050
20285
|
styleInject(css_248z$a);
|
|
20051
20286
|
|
|
20052
|
-
var _path$7;
|
|
20053
|
-
function _extends$9() { return _extends$9 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$9.apply(null, arguments); }
|
|
20054
|
-
var SvgSelect = function SvgSelect(props) {
|
|
20055
|
-
return /*#__PURE__*/React.createElement("svg", _extends$9({
|
|
20056
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20057
|
-
width: 14,
|
|
20058
|
-
height: 12,
|
|
20059
|
-
fill: "none"
|
|
20060
|
-
}, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
|
|
20061
|
-
stroke: "#6EDCCF",
|
|
20062
|
-
strokeWidth: 2,
|
|
20063
|
-
d: "m1 7.5 4 3L12.5 1"
|
|
20064
|
-
})));
|
|
20065
|
-
};
|
|
20066
|
-
|
|
20067
20287
|
const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
|
|
20068
20288
|
const { editMapInfo, setEditMapInfo, onHandleEnterRecord } = useMapEditContext();
|
|
20069
20289
|
const [selectedDoodle, setSelectedDoodle] = useState(null);
|
|
@@ -20081,7 +20301,7 @@ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
|
|
|
20081
20301
|
const svg = selectedDoodle?.svgStr;
|
|
20082
20302
|
const minLength = selectedDoodle.minLength;
|
|
20083
20303
|
const parseSvg = SvgParserNative.parseSvg(svg);
|
|
20084
|
-
const svgMinLength =
|
|
20304
|
+
const svgMinLength = parseSvg.height / SCALE_FACTOR;
|
|
20085
20305
|
// 使用获取到的 SVG 内容,如果没有获取到则使用 URL
|
|
20086
20306
|
newDoodle.svg = svg;
|
|
20087
20307
|
newDoodle.scale = minLength / svgMinLength;
|
|
@@ -20111,12 +20331,12 @@ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
|
|
|
20111
20331
|
});
|
|
20112
20332
|
}
|
|
20113
20333
|
}, [selectedDoodle, setEditMapInfo, editMapInfo, setOpen, onSelect, centerPoint]);
|
|
20114
|
-
return (jsx(CustomModal, { width: 560, title: "
|
|
20334
|
+
return (jsx(CustomModal, { width: 560, title: "Create doodle", titleCenter: true, open: open, onOk: handleConfirm, onCancel: () => setOpen(false), okButtonProps: { disabled: !selectedDoodle }, afterClose: () => setSelectedDoodle(null), okText: "Create", cancelText: "Cancel", children: jsxs("div", { className: styles$a.doodleModal, children: [jsx("div", { className: styles$a.title, children: "Select the doodle that you want to create" }), jsx("div", { className: styles$a.content, children: doodleList
|
|
20115
20335
|
?.filter((item) => !noNeed.includes(item.name))
|
|
20116
20336
|
.map((item) => {
|
|
20117
|
-
return (
|
|
20337
|
+
return (jsx("div", { className: classNames(styles$a.item, {
|
|
20118
20338
|
[styles$a.active]: selectedDoodle?.svg === item.svg,
|
|
20119
|
-
}), onClick: () => handleSelectDoodle(item), children:
|
|
20339
|
+
}), onClick: () => handleSelectDoodle(item), children: jsx("div", { className: styles$a.svgImage, dangerouslySetInnerHTML: { __html: item?.svgStr } }) }, item.id));
|
|
20120
20340
|
}) })] }) }));
|
|
20121
20341
|
};
|
|
20122
20342
|
|
|
@@ -20212,11 +20432,11 @@ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
|
|
|
20212
20432
|
}), children: jsx("div", { className: styles$c.icon, children: jsx(SvgAddEntry, {}) }) }), jsx(DoodleModal, { centerPoint: centerPoint, doodleList: doodleList, open: doodleOpen, onOk: () => setDoodleOpen(false), setOpen: setDoodleOpen })] }));
|
|
20213
20433
|
};
|
|
20214
20434
|
|
|
20215
|
-
var css_248z$9 = ".index-module_handleElementInfo__vWIaf {\n position: absolute;\n right: 0;\n top: 0;\n border-radius: 8px;\n padding:
|
|
20216
|
-
var styles$9 = {"handleElementInfo":"index-module_handleElementInfo__vWIaf","undoAndRedo":"index-module_undoAndRedo__EKeA8","undo":"index-module_undo__lPY1X","redo":"index-module_redo__EU5u-","disabled":"index-module_disabled__w6gCJ","nameEdit":"index-module_nameEdit__eVzQ-","handle":"index-module_handle__4mIxr","doodleInfo":"index-module_doodleInfo__bd2ua","time":"index-module_time__1bUFf","exist":"index-module_exist__gWtNo","tip":"index-module_tip__1HNmj","
|
|
20435
|
+
var css_248z$9 = ".index-module_handleElementInfo__vWIaf {\n position: absolute;\n right: 0;\n top: 0;\n border-radius: 8px;\n padding: 8px;\n background: #fff;\n width: 265px;\n user-select: none;\n}\n.index-module_handleElementInfo__vWIaf .index-module_border__iPL-- {\n margin: 8px 0;\n border-top: 1px solid #c5c5c5;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 {\n position: absolute;\n left: -96px;\n top: 0;\n display: flex;\n gap: 12px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u- {\n background: #fff;\n border-radius: 8px;\n padding: 6px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X:not(.index-module_disabled__w6gCJ):hover,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-:not(.index-module_disabled__w6gCJ):hover {\n opacity: 0.8;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X.index-module_disabled__w6gCJ,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-.index-module_disabled__w6gCJ {\n color: #d8d8d8;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- input {\n padding: 2px 0;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- .index-module_edit__b0r9I {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_boundaryOther__FyJvt {\n padding-top: 4px;\n border-top: 1px solid rgb(197, 197, 197);\n}\n.index-module_handleElementInfo__vWIaf .index-module_handle__4mIxr {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n padding: 0px 0 4px 0;\n}\n\n.index-module_doodleInfo__bd2ua .index-module_time__1bUFf {\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_exist__gWtNo {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_tip__1HNmj {\n color: #ff3f33;\n margin-top: 10px;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px;\n}\n\n.index-module_areaInfo__-WJPL {\n color: #9e9e9e;\n width: 100%;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px; /* 114.286% */\n}\n.index-module_areaInfo__-WJPL .index-module_areaItem__fk-i2 {\n display: flex;\n justify-content: space-between;\n padding: 6px 0;\n}\n.index-module_areaInfo__-WJPL .index-module_areaItem__fk-i2:not(:last-child) {\n margin-bottom: 4px;\n}\n\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM {\n color: #1f1f1f;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_value__x3-se {\n margin-left: auto;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_icon__167WB {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}";
|
|
20436
|
+
var styles$9 = {"handleElementInfo":"index-module_handleElementInfo__vWIaf","border":"index-module_border__iPL--","undoAndRedo":"index-module_undoAndRedo__EKeA8","undo":"index-module_undo__lPY1X","redo":"index-module_redo__EU5u-","disabled":"index-module_disabled__w6gCJ","nameEdit":"index-module_nameEdit__eVzQ-","handle":"index-module_handle__4mIxr","doodleInfo":"index-module_doodleInfo__bd2ua","time":"index-module_time__1bUFf","exist":"index-module_exist__gWtNo","tip":"index-module_tip__1HNmj","areaInfo":"index-module_areaInfo__-WJPL","areaItem":"index-module_areaItem__fk-i2","boundaryInfo":"index-module_boundaryInfo__VfR-N","otherEdit":"index-module_otherEdit__17SuM","otherItem":"index-module_otherItem__ATLFZ","value":"index-module_value__x3-se","icon":"index-module_icon__167WB"};
|
|
20217
20437
|
styleInject(css_248z$9);
|
|
20218
20438
|
|
|
20219
|
-
var css_248z$8 = ".index-module_infoHeader__l9F6q {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding:
|
|
20439
|
+
var css_248z$8 = ".index-module_infoHeader__l9F6q {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 6px 0;\n}\n.index-module_infoHeader__l9F6q .index-module_headerIcon__sK1hg {\n width: 16px;\n height: 16px;\n}\n.index-module_infoHeader__l9F6q .index-module_headerName__UGnrH {\n margin-left: 4px;\n color: rgb(158, 158, 158);\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n pointer-events: none;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f {\n margin-left: auto;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f .index-module_focus__llcox {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f .index-module_delete__hD4-Q {\n width: 16px;\n height: 16px;\n margin-left: 8px;\n cursor: pointer;\n}";
|
|
20220
20440
|
var styles$8 = {"infoHeader":"index-module_infoHeader__l9F6q","headerIcon":"index-module_headerIcon__sK1hg","headerName":"index-module_headerName__UGnrH","headerHandle":"index-module_headerHandle__ymh7f","focus":"index-module_focus__llcox","delete":"index-module_delete__hD4-Q"};
|
|
20221
20441
|
styleInject(css_248z$8);
|
|
20222
20442
|
|
|
@@ -20285,7 +20505,7 @@ const NameModal = ({ title, name, open, setOpen, onOk }) => {
|
|
|
20285
20505
|
setOpen(false);
|
|
20286
20506
|
}, onCancel: () => setOpen(false), okText: "Confirm", afterClose: () => {
|
|
20287
20507
|
setNameValue('');
|
|
20288
|
-
}, children: jsx(Input, { maxLength:
|
|
20508
|
+
}, children: jsx(Input, { maxLength: 12, showCount: true, placeholder: "Please enter boundary name", value: nameValue, onChange: (e) => setNameValue(e.target.value) }) }));
|
|
20289
20509
|
};
|
|
20290
20510
|
|
|
20291
20511
|
const NameEdit = ({ title, name, onChange }) => {
|
|
@@ -20302,12 +20522,12 @@ var SvgArrow = function SvgArrow(props) {
|
|
|
20302
20522
|
height: 16,
|
|
20303
20523
|
fill: "none"
|
|
20304
20524
|
}, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
|
|
20305
|
-
fill: "#
|
|
20525
|
+
fill: "#1F1F1F",
|
|
20306
20526
|
d: "M11.523 7.704c.005.014.015.026.02.04.049.125.065.268.046.406a.73.73 0 0 1-.152.363l-3.88 4.638a.47.47 0 0 1-.377.182.49.49 0 0 1-.369-.208.77.77 0 0 1-.144-.477.76.76 0 0 1 .164-.466l3.483-4.162-3.468-4.224a.77.77 0 0 1-.15-.462c0-.172.053-.338.148-.463a.49.49 0 0 1 .36-.204.47.47 0 0 1 .371.17l3.845 4.682q.007.017.017.032.008.01.018.019c.032.04.046.09.067.134"
|
|
20307
20527
|
})));
|
|
20308
20528
|
};
|
|
20309
20529
|
|
|
20310
|
-
var css_248z$6 = ".index-module_item__wwHEt {\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n display: flex;\n align-items: center;\n padding:
|
|
20530
|
+
var css_248z$6 = ".index-module_item__wwHEt {\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n display: flex;\n align-items: center;\n padding: 6px 0;\n}\n.index-module_item__wwHEt:not(:last-child) {\n margin-bottom: 4px;\n}";
|
|
20311
20531
|
var styles$6 = {"item":"index-module_item__wwHEt"};
|
|
20312
20532
|
styleInject(css_248z$6);
|
|
20313
20533
|
|
|
@@ -20651,43 +20871,81 @@ function convertDirectionToParams(value) {
|
|
|
20651
20871
|
return directions;
|
|
20652
20872
|
}
|
|
20653
20873
|
|
|
20874
|
+
const DEFAULT_LIST = [
|
|
20875
|
+
{
|
|
20876
|
+
value: 1 << 0,
|
|
20877
|
+
text: 'A',
|
|
20878
|
+
selected: false,
|
|
20879
|
+
},
|
|
20880
|
+
{
|
|
20881
|
+
value: 1 << 1,
|
|
20882
|
+
text: 'B',
|
|
20883
|
+
selected: false,
|
|
20884
|
+
},
|
|
20885
|
+
{
|
|
20886
|
+
value: 1 << 2,
|
|
20887
|
+
text: 'C',
|
|
20888
|
+
selected: false,
|
|
20889
|
+
},
|
|
20890
|
+
{
|
|
20891
|
+
value: 1 << 3,
|
|
20892
|
+
text: 'D',
|
|
20893
|
+
selected: false,
|
|
20894
|
+
},
|
|
20895
|
+
{
|
|
20896
|
+
value: 1 << 4,
|
|
20897
|
+
text: 'E',
|
|
20898
|
+
selected: false,
|
|
20899
|
+
},
|
|
20900
|
+
{
|
|
20901
|
+
value: 1 << 5,
|
|
20902
|
+
text: 'F',
|
|
20903
|
+
selected: false,
|
|
20904
|
+
},
|
|
20905
|
+
];
|
|
20654
20906
|
const MowDirection_L = (props) => {
|
|
20655
20907
|
const { value, angleValue, optionAngle = 45, zIndex = 10000, onChange,
|
|
20656
20908
|
// children,
|
|
20657
20909
|
} = props;
|
|
20658
20910
|
const [angle, setAngle] = useState(0);
|
|
20659
|
-
const
|
|
20660
|
-
{
|
|
20661
|
-
|
|
20662
|
-
|
|
20663
|
-
|
|
20664
|
-
|
|
20665
|
-
|
|
20666
|
-
|
|
20667
|
-
|
|
20668
|
-
|
|
20669
|
-
|
|
20670
|
-
|
|
20671
|
-
|
|
20672
|
-
|
|
20673
|
-
|
|
20674
|
-
|
|
20675
|
-
|
|
20676
|
-
|
|
20677
|
-
|
|
20678
|
-
|
|
20679
|
-
|
|
20680
|
-
|
|
20681
|
-
|
|
20682
|
-
|
|
20683
|
-
|
|
20684
|
-
|
|
20685
|
-
|
|
20686
|
-
|
|
20687
|
-
|
|
20688
|
-
|
|
20689
|
-
|
|
20690
|
-
|
|
20911
|
+
const lineList = useMemo(() => {
|
|
20912
|
+
return DEFAULT_LIST.map((item) => ({
|
|
20913
|
+
...item,
|
|
20914
|
+
selected: convertDirectionToParams(value).includes(item.value),
|
|
20915
|
+
}));
|
|
20916
|
+
}, [value]);
|
|
20917
|
+
// const [lineList, setLineList] = useState<LineItem[]>([
|
|
20918
|
+
// {
|
|
20919
|
+
// value: 1 << 0,
|
|
20920
|
+
// text: 'A',
|
|
20921
|
+
// selected: false,
|
|
20922
|
+
// },
|
|
20923
|
+
// {
|
|
20924
|
+
// value: 1 << 1,
|
|
20925
|
+
// text: 'B',
|
|
20926
|
+
// selected: false,
|
|
20927
|
+
// },
|
|
20928
|
+
// {
|
|
20929
|
+
// value: 1 << 2,
|
|
20930
|
+
// text: 'C',
|
|
20931
|
+
// selected: false,
|
|
20932
|
+
// },
|
|
20933
|
+
// {
|
|
20934
|
+
// value: 1 << 3,
|
|
20935
|
+
// text: 'D',
|
|
20936
|
+
// selected: false,
|
|
20937
|
+
// },
|
|
20938
|
+
// {
|
|
20939
|
+
// value: 1 << 4,
|
|
20940
|
+
// text: 'E',
|
|
20941
|
+
// selected: false,
|
|
20942
|
+
// },
|
|
20943
|
+
// {
|
|
20944
|
+
// value: 1 << 5,
|
|
20945
|
+
// text: 'F',
|
|
20946
|
+
// selected: false,
|
|
20947
|
+
// },
|
|
20948
|
+
// ]);
|
|
20691
20949
|
const hitRectAngle = useMemo(() => {
|
|
20692
20950
|
const direction = lineList
|
|
20693
20951
|
?.filter((item) => item?.selected)
|
|
@@ -20700,12 +20958,6 @@ const MowDirection_L = (props) => {
|
|
|
20700
20958
|
const allSelect = useMemo(() => {
|
|
20701
20959
|
return lineList?.every((item) => item?.selected);
|
|
20702
20960
|
}, [lineList]);
|
|
20703
|
-
useEffect(() => {
|
|
20704
|
-
setLineList(lineList.map((line) => ({
|
|
20705
|
-
...line,
|
|
20706
|
-
selected: convertDirectionToParams(value).includes(line.value),
|
|
20707
|
-
})));
|
|
20708
|
-
}, [value]);
|
|
20709
20961
|
useEffect(() => {
|
|
20710
20962
|
setAngle(angleValue);
|
|
20711
20963
|
}, [angleValue]);
|
|
@@ -20720,7 +20972,6 @@ const MowDirection_L = (props) => {
|
|
|
20720
20972
|
}
|
|
20721
20973
|
return { ...line };
|
|
20722
20974
|
});
|
|
20723
|
-
setLineList(newLine);
|
|
20724
20975
|
onChange?.(newLine
|
|
20725
20976
|
?.filter((item) => item?.selected)
|
|
20726
20977
|
.reduce((pre, line) => {
|
|
@@ -20833,10 +21084,25 @@ const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, o
|
|
|
20833
21084
|
setAngle(defaultAngle);
|
|
20834
21085
|
}
|
|
20835
21086
|
};
|
|
20836
|
-
|
|
20837
|
-
|
|
21087
|
+
const handleCancel = useCallback(() => {
|
|
21088
|
+
if (!canSave) {
|
|
20838
21089
|
setOpen(false);
|
|
20839
|
-
|
|
21090
|
+
return;
|
|
21091
|
+
}
|
|
21092
|
+
Modal.confirm({
|
|
21093
|
+
icon: null,
|
|
21094
|
+
centered: true,
|
|
21095
|
+
title: 'Exit editing',
|
|
21096
|
+
content: 'Changes you made will not be saved. Are you sure you want to exit editing the mowing direction?',
|
|
21097
|
+
onOk: () => {
|
|
21098
|
+
setOpen(false);
|
|
21099
|
+
},
|
|
21100
|
+
okText: 'Exit',
|
|
21101
|
+
cancelText: 'Continue editing',
|
|
21102
|
+
});
|
|
21103
|
+
}, [canSave, setOpen]);
|
|
21104
|
+
console.log('directionInfo=>', directionInfo, mapJson);
|
|
21105
|
+
return (jsx(CustomModal, { maskClosable: false, titleCenter: true, title: `${zoneName} mowing direction`, open: open, width: 600, onCancel: handleCancel, onOk: () => {
|
|
20840
21106
|
onChange?.(directions, angle);
|
|
20841
21107
|
setOpen(false);
|
|
20842
21108
|
}, okText: "Confirm", cancelText: "Cancel", okButtonProps: { disabled: !canSave }, afterClose: () => {
|
|
@@ -20844,6 +21110,8 @@ const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, o
|
|
|
20844
21110
|
setAngle(MIN_DIRECTION_ANGLE);
|
|
20845
21111
|
}, children: jsxs("div", { className: styles$3.directions, children: [jsx("div", { className: styles$3.default, children: jsx(Button, { disabled: !canSetDefault, variant: "link", color: "primary", onClick: resetDirection, children: "Default" }) }), jsx("div", { className: styles$3.tips, children: "\u4E00\u4E2A\u7B80\u77ED\u7684\u8BF4\u660E\uFF0C\u5E0C\u671B\u80FD\u5145\u5F53\u7B80\u5355\u7684\u6559\u7A0B\uFF0C\u9700\u8981\u53EF\u5FC3\u6839\u636EC\u7AEF\u5DF2\u6709\u7684\u6574\u5408\u4E00\u4E0B" }), jsxs("div", { className: styles$3.optimal, children: [jsx("div", { children: "*" }), jsx(SvgOption, {}), jsx("div", { className: styles$3.text, children: "Optimal direction" })] }), jsxs("div", { className: styles$3.content, children: [jsx("div", { className: styles$3.background, children: jsx(BoundarySvgRender, { mapJson: mapJson, id: editMapInfo.selectElement.id }) }), jsx("div", { className: styles$3.luppan, children: jsx(MowDirection_L, { value: directions, angleValue: angle, optionAngle: optionAngle, onChange: (value) => {
|
|
20846
21112
|
console.log('valie=>', value);
|
|
21113
|
+
if (!value)
|
|
21114
|
+
return message.warning('Choose at least one mowing direction');
|
|
20847
21115
|
setDirections(value);
|
|
20848
21116
|
} }) })] }), jsx("div", { className: styles$3.slideTip, children: "\u7528\u6237\u8FD8\u53EF\u4EE5\u901A\u8FC7\u6ED1\u8F68\u5FAE\u8C03\u5272\u8349\u65B9\u5411\uFF08\u975E\u5FC5\u987B\uFF09" }), jsx("div", { className: styles$3.slider, children: jsx(Slider, { tooltip: {
|
|
20849
21117
|
formatter: (value) => `${value}°`,
|
|
@@ -20902,13 +21170,13 @@ const BoundaryInfo = ({ onHandleDelete }) => {
|
|
|
20902
21170
|
name: name,
|
|
20903
21171
|
},
|
|
20904
21172
|
});
|
|
20905
|
-
} }) }), jsxs("div", { className: styles$9.otherEdit, children: [jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "
|
|
21173
|
+
} }) }), jsx("div", { className: styles$9.border }), jsxs("div", { className: styles$9.otherEdit, children: [jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Cutting height" }), jsx("div", { className: styles$9.value, children: generateHeightStr(heightValue?.cuttingHeight, unitType, true) }), jsx("div", { className: styles$9.icon, onClick: () => {
|
|
20906
21174
|
setHeightOpen(true);
|
|
20907
|
-
}, children: jsx(SvgArrow, {}) })] }) }), jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "
|
|
21175
|
+
}, children: jsx(SvgArrow, {}) })] }) }), jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Mowing direction" }), jsx("div", { className: styles$9.value }), jsx("div", { className: styles$9.icon, onClick: () => {
|
|
20908
21176
|
setDirectionOpen(true);
|
|
20909
|
-
}, children: jsx(SvgArrow, {}) })] }) }), jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "
|
|
21177
|
+
}, children: jsx(SvgArrow, {}) })] }) }), jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Edge mowing" }), jsx("div", { className: styles$9.value }), jsx("div", { className: styles$9.icon, onClick: () => {
|
|
20910
21178
|
setOpen(true);
|
|
20911
|
-
}, children: jsx(SvgArrow, {}) })] }) })] }), jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Area:" }), jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] }), jsx(MowingEdgeModal, { value: edgeMowingValue, onChange: (value) => {
|
|
21179
|
+
}, children: jsx(SvgArrow, {}) })] }) })] }), jsx("div", { className: styles$9.border }), jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Area:" }), jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] }), jsx(MowingEdgeModal, { value: edgeMowingValue, onChange: (value) => {
|
|
20912
21180
|
setEditMapInfo({
|
|
20913
21181
|
...editMapInfo,
|
|
20914
21182
|
selectElement: {
|
|
@@ -20938,7 +21206,7 @@ const BoundaryInfo = ({ onHandleDelete }) => {
|
|
|
20938
21206
|
} })] }));
|
|
20939
21207
|
};
|
|
20940
21208
|
|
|
20941
|
-
var css_248z$1 = ".index-module_timePeriod__EkVZl {\n display: flex;\n flex-direction: column;\n
|
|
21209
|
+
var css_248z$1 = ".index-module_timePeriod__EkVZl {\n display: flex;\n flex-direction: column;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 4px 0;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW .index-module_timePeriodTitle__lnYno {\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n color: rgb(0, 0, 0);\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW .index-module_timePeriodHandle__pjDTA {\n margin-left: auto;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodContent__pTqdW {\n margin-top: 4px;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodContent__pTqdW .index-module_timePeriodRadioItem__3rd-r {\n line-height: 28px;\n}";
|
|
20942
21210
|
var styles$1 = {"timePeriod":"index-module_timePeriod__EkVZl","timePeriodHeader":"index-module_timePeriodHeader__CgJGW","timePeriodTitle":"index-module_timePeriodTitle__lnYno","timePeriodHandle":"index-module_timePeriodHandle__pjDTA","timePeriodContent":"index-module_timePeriodContent__pTqdW","timePeriodRadioItem":"index-module_timePeriodRadioItem__3rd-r"};
|
|
20943
21211
|
styleInject(css_248z$1);
|
|
20944
21212
|
|
|
@@ -20969,8 +21237,8 @@ const TimePeriod = ({ value, onChange }) => {
|
|
|
20969
21237
|
setDate(null);
|
|
20970
21238
|
onChange({
|
|
20971
21239
|
...value,
|
|
20972
|
-
|
|
20973
|
-
|
|
21240
|
+
start_timestamp: 0,
|
|
21241
|
+
end_timestamp: 0,
|
|
20974
21242
|
});
|
|
20975
21243
|
}
|
|
20976
21244
|
else if (e.target.value === RadioValue.SHORT_TIME) {
|
|
@@ -20981,15 +21249,15 @@ const TimePeriod = ({ value, onChange }) => {
|
|
|
20981
21249
|
// endTimestamp: dayjs().add(1, 'hour').unix(),
|
|
20982
21250
|
// });
|
|
20983
21251
|
}
|
|
20984
|
-
}, style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsx(Radio, { value: RadioValue.LONG_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: "
|
|
21252
|
+
}, style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsx(Radio, { value: RadioValue.LONG_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: "Always" }) }), jsx(Radio, { value: RadioValue.SHORT_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: jsx(DatePicker.RangePicker, { open: open, value: date ? date : undefined, disabled: radioValue === RadioValue.LONG_TIME, showTime: { format: 'HH:mm' }, format: "MM/DD/YYYY HH:mm", preserveInvalidOnBlur: true, onOpenChange: (open) => {
|
|
20985
21253
|
setOpen(open);
|
|
20986
21254
|
}, onChange: (dateValue, dateString) => {
|
|
20987
21255
|
setDate(dateValue);
|
|
20988
21256
|
if (dateValue?.length === 2) {
|
|
20989
21257
|
onChange({
|
|
20990
21258
|
status: RadioValue.SHORT_TIME,
|
|
20991
|
-
|
|
20992
|
-
|
|
21259
|
+
start_timestamp: dateValue[0].unix(),
|
|
21260
|
+
end_timestamp: dateValue[1].unix(),
|
|
20993
21261
|
});
|
|
20994
21262
|
}
|
|
20995
21263
|
} }) }) })] }) })] }));
|
|
@@ -21003,12 +21271,12 @@ const ObstacleInfo = ({ onHandleDelete }) => {
|
|
|
21003
21271
|
if (!editMapInfo.selectElement)
|
|
21004
21272
|
return null;
|
|
21005
21273
|
const status = editMapInfo.selectElement?.status;
|
|
21006
|
-
const
|
|
21007
|
-
const
|
|
21274
|
+
const start_timestamp = editMapInfo.selectElement?.start_timestamp;
|
|
21275
|
+
const end_timestamp = editMapInfo.selectElement?.end_timestamp;
|
|
21008
21276
|
return {
|
|
21009
21277
|
status,
|
|
21010
|
-
|
|
21011
|
-
|
|
21278
|
+
start_timestamp,
|
|
21279
|
+
end_timestamp,
|
|
21012
21280
|
};
|
|
21013
21281
|
}, [editMapInfo.selectElement]);
|
|
21014
21282
|
const sizeValue = useMemo(() => {
|
|
@@ -21035,18 +21303,18 @@ const ObstacleInfo = ({ onHandleDelete }) => {
|
|
|
21035
21303
|
name: name,
|
|
21036
21304
|
},
|
|
21037
21305
|
});
|
|
21038
|
-
} }) }), jsx("div", { className: styles$9.timePeriod, children: jsx(TimePeriod, { value: timePeriodValue, onChange: (value) => {
|
|
21306
|
+
} }) }), jsx("div", { className: styles$9.border }), jsx("div", { className: styles$9.timePeriod, children: jsx(TimePeriod, { value: timePeriodValue, onChange: (value) => {
|
|
21039
21307
|
setEditMapInfo({
|
|
21040
21308
|
...editMapInfo,
|
|
21041
21309
|
isShowDrag: editMapInfo?.isShowDrag || false,
|
|
21042
21310
|
selectElement: {
|
|
21043
21311
|
...editMapInfo.selectElement,
|
|
21044
21312
|
status: value.status,
|
|
21045
|
-
start_timestamp: value.
|
|
21046
|
-
end_timestamp: value.
|
|
21313
|
+
start_timestamp: value.start_timestamp,
|
|
21314
|
+
end_timestamp: value.end_timestamp,
|
|
21047
21315
|
},
|
|
21048
21316
|
});
|
|
21049
|
-
} }) }), jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Area:" }), jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] })] }));
|
|
21317
|
+
} }) }), jsx("div", { className: styles$9.border }), jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Area:" }), jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] })] }));
|
|
21050
21318
|
};
|
|
21051
21319
|
|
|
21052
21320
|
const DoodleInfo = ({ onHandleDelete }) => {
|
|
@@ -21068,31 +21336,37 @@ const DoodleInfo = ({ onHandleDelete }) => {
|
|
|
21068
21336
|
const create_ts = editMapInfo?.selectElement?.create_ts;
|
|
21069
21337
|
const expiration_ts = editMapInfo.selectElement.expiration_ts;
|
|
21070
21338
|
const diff = expiration_ts - create_ts;
|
|
21071
|
-
const day = Math.floor(diff / (60 * 60 * 24
|
|
21072
|
-
console.log('create_ts->', create_ts, expiration_ts, day);
|
|
21339
|
+
const day = Math.floor(diff / (60 * 60 * 24));
|
|
21073
21340
|
return {
|
|
21074
21341
|
day: day,
|
|
21075
21342
|
};
|
|
21076
21343
|
}, [editMapInfo?.selectElement]);
|
|
21344
|
+
const remainDay = useMemo(() => {
|
|
21345
|
+
if (!editMapInfo.selectElement)
|
|
21346
|
+
return null;
|
|
21347
|
+
const expiration_ts = editMapInfo.selectElement.expiration_ts;
|
|
21348
|
+
const diff = expiration_ts - Date.now() / 1000;
|
|
21349
|
+
return Math.floor(diff / (60 * 60 * 24));
|
|
21350
|
+
}, [editMapInfo?.selectElement]);
|
|
21077
21351
|
const sizeValue = useMemo(() => {
|
|
21078
21352
|
if (!editMapInfo.selectElement || !editMapInfo.selectElement.svg)
|
|
21079
21353
|
return '';
|
|
21080
21354
|
const svg = editMapInfo.selectElement?.svg;
|
|
21355
|
+
const scale = editMapInfo.selectElement.scale;
|
|
21081
21356
|
const parseSvg = SvgParserNative.parseSvg(svg);
|
|
21082
|
-
const width = parseSvg.width / SCALE_FACTOR;
|
|
21083
|
-
const height = parseSvg.height / SCALE_FACTOR;
|
|
21084
|
-
console.log('parseSvg->', parseSvg);
|
|
21085
|
-
return `${width} m x ${height} m`;
|
|
21357
|
+
const width = (parseSvg.width * scale) / SCALE_FACTOR;
|
|
21358
|
+
const height = (parseSvg.height * scale) / SCALE_FACTOR;
|
|
21359
|
+
console.log('parseSvg->', editMapInfo, parseSvg);
|
|
21360
|
+
return `${width.toFixed(1)} m x ${height.toFixed(1)} m`;
|
|
21086
21361
|
}, [editMapInfo.selectElement]);
|
|
21087
21362
|
const handleChange = useCallback((day) => {
|
|
21088
|
-
const lastTime = Date.now() - editMapInfo.selectElement.create_ts;
|
|
21089
21363
|
setEditMapInfo((pre) => {
|
|
21090
|
-
console.log('expiration_ts->', lastTime, day, lastTime + day * 24 * 60 * 60 * 1000);
|
|
21091
21364
|
return {
|
|
21092
21365
|
...pre,
|
|
21093
21366
|
selectElement: {
|
|
21094
21367
|
...pre.selectElement,
|
|
21095
|
-
|
|
21368
|
+
create_ts: Date.now() / 1000,
|
|
21369
|
+
expiration_ts: Date.now() / 1000 + day * 24 * 60 * 60,
|
|
21096
21370
|
},
|
|
21097
21371
|
};
|
|
21098
21372
|
});
|
|
@@ -21100,7 +21374,7 @@ const DoodleInfo = ({ onHandleDelete }) => {
|
|
|
21100
21374
|
console.log('doodleInfo->', doodleInfo);
|
|
21101
21375
|
return (jsxs("div", { className: styles$9.doodleInfo, children: [jsx(Header, { handleDelete: () => {
|
|
21102
21376
|
onHandleDelete();
|
|
21103
|
-
}, handleFocus: () => { }, type: editMapInfo.elementType }), isCreate ? (jsx(Item, { children: jsxs("div", { className: styles$9.time, children: [jsxs("div", { className: styles$9.exist, children: [jsx("div", { className: styles$9.label, children: "
|
|
21377
|
+
}, handleFocus: () => { }, type: editMapInfo.elementType }), jsx("div", { className: styles$9.border }), isCreate ? (jsxs(Fragment, { children: [jsx(Item, { children: jsxs("div", { className: styles$9.time, children: [jsxs("div", { className: styles$9.exist, children: [jsx("div", { className: styles$9.label, children: "Preserve doodle for" }), jsx("div", { className: styles$9.value, children: jsx(Select, { defaultValue: doodleInfo?.day, style: { width: 80 }, onChange: (value) => handleChange(value), options: options }) })] }), doodleInfo?.day >= 14 && (jsx("div", { className: styles$9.tip, children: "* If the doodle lasts over 14 days, the grass may grow too tall for the mower to mow later." }))] }) }), jsx("div", { className: styles$9.border }), jsx("div", { className: styles$9.areaInfo, children: jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Size:" }), jsx("div", { className: styles$9.value, children: sizeValue })] }) })] })) : (jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Remaining time:" }), jsxs("div", { className: styles$9.value, children: [remainDay, " day"] })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Size:" }), jsx("div", { className: styles$9.value, children: sizeValue })] })] }))] }));
|
|
21104
21378
|
};
|
|
21105
21379
|
|
|
21106
21380
|
const VisionOffInfo = ({ onHandleDelete }) => {
|
|
@@ -21116,7 +21390,7 @@ const VisionOffInfo = ({ onHandleDelete }) => {
|
|
|
21116
21390
|
}, [editMapInfo.selectElement]);
|
|
21117
21391
|
return (jsxs("div", { className: "visionOffInfo", children: [jsx(Header, { handleDelete: () => {
|
|
21118
21392
|
onHandleDelete?.();
|
|
21119
|
-
}, handleFocus: () => { }, type: DataType.VISION_OFF }), jsx("div", { className: styles$9.areaInfo, children: jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Size:" }), jsx("div", { className: styles$9.value, children: sizeValue })] }) })] }));
|
|
21393
|
+
}, handleFocus: () => { }, type: DataType.VISION_OFF }), jsx("div", { className: styles$9.border }), jsx("div", { className: styles$9.areaInfo, children: jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Size:" }), jsx("div", { className: styles$9.value, children: sizeValue })] }) })] }));
|
|
21120
21394
|
};
|
|
21121
21395
|
|
|
21122
21396
|
var _path$2, _path2$1;
|
|
@@ -21258,8 +21532,8 @@ const HandleElementInfo = () => {
|
|
|
21258
21532
|
data.obstacle = {
|
|
21259
21533
|
name: element?.name,
|
|
21260
21534
|
status: element?.status || 1,
|
|
21261
|
-
end_timestamp: element?.end_timestamp
|
|
21262
|
-
start_timestamp: element?.start_timestamp
|
|
21535
|
+
end_timestamp: element?.end_timestamp,
|
|
21536
|
+
start_timestamp: element?.start_timestamp,
|
|
21263
21537
|
points: restorePointsFormat(element.points),
|
|
21264
21538
|
};
|
|
21265
21539
|
if (element?.id) {
|
|
@@ -21287,6 +21561,12 @@ const HandleElementInfo = () => {
|
|
|
21287
21561
|
const params = renderElementData(editMapInfo?.selectElement);
|
|
21288
21562
|
const isObstacle = editMapInfo?.selectElement?.type === DataType.OBSTACLE;
|
|
21289
21563
|
const hasNotEnoughPoints = params?.obstacle?.points?.length < 3;
|
|
21564
|
+
const isDoodle = editMapInfo?.selectElement?.type === DataType.DOODLE;
|
|
21565
|
+
const doodleResult = checkDoodle();
|
|
21566
|
+
if (isDoodle && !doodleResult?.isValid) {
|
|
21567
|
+
message.error('Keep more distance from boundaries, off-limit island and other doodles');
|
|
21568
|
+
return;
|
|
21569
|
+
}
|
|
21290
21570
|
if (isObstacle && hasNotEnoughPoints) {
|
|
21291
21571
|
message.error('Save failed, please draw a closed shape');
|
|
21292
21572
|
return;
|
|
@@ -21318,16 +21598,27 @@ const HandleElementInfo = () => {
|
|
|
21318
21598
|
message.error('Save failed, please try again');
|
|
21319
21599
|
});
|
|
21320
21600
|
}
|
|
21321
|
-
}, [editMapInfo.selectElement]);
|
|
21601
|
+
}, [editMapInfo.selectElement, onUpdateBoundary, onHandleCompleteRecord]);
|
|
21322
21602
|
const handleCancel = useCallback(() => {
|
|
21323
|
-
|
|
21324
|
-
|
|
21325
|
-
|
|
21326
|
-
|
|
21327
|
-
|
|
21328
|
-
|
|
21329
|
-
|
|
21330
|
-
|
|
21603
|
+
const name = DATE_TYPE_MAP.find((item) => item.type === editMapInfo.elementType)?.label;
|
|
21604
|
+
Modal.confirm({
|
|
21605
|
+
icon: null,
|
|
21606
|
+
centered: true,
|
|
21607
|
+
title: 'Quit editing',
|
|
21608
|
+
content: `Changes you made will not be saved. Are you sure you want to quit editing the ${name}?`,
|
|
21609
|
+
okText: 'Quit',
|
|
21610
|
+
cancelText: 'Keep editing',
|
|
21611
|
+
onOk: () => {
|
|
21612
|
+
onHandleStopRecord?.()?.then(() => {
|
|
21613
|
+
setEditMapInfo({
|
|
21614
|
+
...editMapInfo,
|
|
21615
|
+
createMode: null,
|
|
21616
|
+
elementType: null,
|
|
21617
|
+
selectElement: null,
|
|
21618
|
+
isShowDrag: false,
|
|
21619
|
+
});
|
|
21620
|
+
});
|
|
21621
|
+
},
|
|
21331
21622
|
});
|
|
21332
21623
|
}, [editMapInfo]);
|
|
21333
21624
|
const handleDelete = useCallback(() => {
|
|
@@ -21372,26 +21663,12 @@ const HandleElementInfo = () => {
|
|
|
21372
21663
|
},
|
|
21373
21664
|
});
|
|
21374
21665
|
}, [editMapInfo?.selectElement, onHandleDeleteElement, onHandleStopRecord]);
|
|
21375
|
-
const checkDisabled = useCallback(() => {
|
|
21376
|
-
if (editMapInfo.elementType === DataType.DOODLE) {
|
|
21377
|
-
const result = checkDoodle();
|
|
21378
|
-
return !result?.isValid;
|
|
21379
|
-
}
|
|
21380
|
-
return false;
|
|
21381
|
-
}, [checkDoodle, editMapInfo]);
|
|
21382
21666
|
if (!editMapInfo.selectElement)
|
|
21383
21667
|
return null;
|
|
21384
21668
|
console.log('handleElementInfo->', editMapInfo, currentType);
|
|
21385
|
-
return (jsxs("div", { className: styles$9.handleElementInfo, children: [editMapInfo?.elementType !== DataType.BOUNDARY ? (jsxs("div", { className: styles$9.undoAndRedo, children: [jsx("div", { className: classNames(styles$9.undo, { [styles$9.disabled]: isUndoDisabled }), onClick: handleUndo, children: jsx(SvgUndo, {}) }), jsx("div", { className: classNames(styles$9.redo, { [styles$9.disabled]: idRedoDisabled }), onClick: handleRedo, children: jsx(SvgRedo, {}) })] })) : null, editMapInfo?.elementType === DataType.BOUNDARY && (jsx(BoundaryInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.OBSTACLE && (jsx(ObstacleInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.DOODLE && jsx(DoodleInfo, { onHandleDelete: handleDelete }), editMapInfo?.elementType === DataType.VISION_OFF && (jsx(VisionOffInfo, { onHandleDelete: handleDelete })),
|
|
21386
|
-
|
|
21387
|
-
|
|
21388
|
-
createMode: null,
|
|
21389
|
-
editMap: false,
|
|
21390
|
-
elementType: undefined,
|
|
21391
|
-
selectElement: null,
|
|
21392
|
-
isShowDrag: false,
|
|
21393
|
-
});
|
|
21394
|
-
}, children: "Cancel" })] })] }));
|
|
21669
|
+
return (jsxs("div", { className: styles$9.handleElementInfo, children: [editMapInfo?.elementType !== DataType.BOUNDARY ? (jsxs("div", { className: styles$9.undoAndRedo, children: [jsx("div", { className: classNames(styles$9.undo, { [styles$9.disabled]: isUndoDisabled }), onClick: handleUndo, children: jsx(SvgUndo, {}) }), jsx("div", { className: classNames(styles$9.redo, { [styles$9.disabled]: idRedoDisabled }), onClick: handleRedo, children: jsx(SvgRedo, {}) })] })) : null, editMapInfo?.elementType === DataType.BOUNDARY && (jsx(BoundaryInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.OBSTACLE && (jsx(ObstacleInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.DOODLE && jsx(DoodleInfo, { onHandleDelete: handleDelete }), editMapInfo?.elementType === DataType.VISION_OFF && (jsx(VisionOffInfo, { onHandleDelete: handleDelete })), jsx("div", { className: styles$9.border }), jsx("div", { className: styles$9.handle, children: jsxs(Space, { size: 12, children: [jsx(Button, { variant: "outlined", color: "default", onClick: () => {
|
|
21670
|
+
handleCancel();
|
|
21671
|
+
}, children: "Cancel" }), jsx(Button, { variant: "solid", color: "primary", onClick: handleSave, children: "Save" })] }) })] }));
|
|
21395
21672
|
};
|
|
21396
21673
|
|
|
21397
21674
|
var _path;
|
|
@@ -21517,7 +21794,7 @@ const defaultMapConfig = DEFAULT_STYLES;
|
|
|
21517
21794
|
// 地图渲染器组件
|
|
21518
21795
|
const MowerMapRenderer = forwardRef(({ sn, platform = PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, mapConfig,
|
|
21519
21796
|
// pathConfig,
|
|
21520
|
-
modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, onPathLoad, onError, className, style, googleMapInstance: _googleMapInstance, dragMap = false, dragCallbacks, defaultTransform, debug: _debug = false, doodleList = [], editMap = false, unStructMapData, disabledObstacles = false, onHandleEnterRecord, onHandleCompleteRecord, onHandleStopRecord, onHandleDeleteElement, onSaveBoundaryData, onSaveMap, onEditInfoMapChange, onUpdateBoundary, heightOptions, globalHeight,
|
|
21797
|
+
modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, onPathLoad, onError, className, style, googleMapInstance: _googleMapInstance, dragMap = false, dragCallbacks, defaultTransform, debug: _debug = false, doodleList = [], editMap = false, unStructMapData, disabledObstacles = false, onHandleEnterRecord, onHandleCompleteRecord, onHandleStopRecord, onHandleDeleteElement, onSaveBoundaryData, onSaveMap, onEditInfoMapChange, onUpdateBoundary, heightOptions, globalHeight, onHandleEvent, }, ref) => {
|
|
21521
21798
|
const [currentError, setCurrentError] = useState(null);
|
|
21522
21799
|
const overlayRef = useRef(null);
|
|
21523
21800
|
// const mapRef = useMap();
|
|
@@ -21573,7 +21850,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21573
21850
|
onSaveMap,
|
|
21574
21851
|
onHandleDeleteElement,
|
|
21575
21852
|
onUpdateBoundary,
|
|
21576
|
-
|
|
21853
|
+
onHandleEvent,
|
|
21577
21854
|
};
|
|
21578
21855
|
}, [
|
|
21579
21856
|
minDistance,
|
|
@@ -21585,7 +21862,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21585
21862
|
onSaveBoundaryData,
|
|
21586
21863
|
onSaveMap,
|
|
21587
21864
|
onUpdateBoundary,
|
|
21588
|
-
|
|
21865
|
+
onHandleEvent,
|
|
21589
21866
|
]);
|
|
21590
21867
|
// 合并配置
|
|
21591
21868
|
const mergedMapConfig = useMemo(() => {
|
|
@@ -21619,6 +21896,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21619
21896
|
drag: defaultTransform,
|
|
21620
21897
|
mapRef,
|
|
21621
21898
|
overlayScale,
|
|
21899
|
+
doodleList,
|
|
21622
21900
|
};
|
|
21623
21901
|
}, [
|
|
21624
21902
|
sn,
|
|
@@ -21633,6 +21911,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21633
21911
|
defaultTransform,
|
|
21634
21912
|
mapRef,
|
|
21635
21913
|
overlayScale,
|
|
21914
|
+
doodleList,
|
|
21636
21915
|
]);
|
|
21637
21916
|
// console.log('svgElementDatas->', svgElementDatas, unStructMapData, commonValue);
|
|
21638
21917
|
// 处理地图分区边界
|
|
@@ -21874,7 +22153,15 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21874
22153
|
// 基于固定的参考zoom级别计算overlayScale
|
|
21875
22154
|
const zoomDiff = currentZoom - REFERENCE_ZOOM;
|
|
21876
22155
|
const scale = Math.pow(2, -zoomDiff); // 负数实现反向缩放
|
|
21877
|
-
|
|
22156
|
+
if (scale < 1) {
|
|
22157
|
+
setOverlayScale(1);
|
|
22158
|
+
}
|
|
22159
|
+
else if (scale > 4) {
|
|
22160
|
+
setOverlayScale(4);
|
|
22161
|
+
}
|
|
22162
|
+
else {
|
|
22163
|
+
setOverlayScale(scale);
|
|
22164
|
+
}
|
|
21878
22165
|
};
|
|
21879
22166
|
// 使用lodash throttle进行节流处理: 100ms内只执行一次
|
|
21880
22167
|
const handleZoomChanged = throttle$2(updateScale, 50);
|
|
@@ -21967,6 +22254,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21967
22254
|
addHistory: (history) => svgEditMapRef.current?.addHistory(history),
|
|
21968
22255
|
// 添加doodle
|
|
21969
22256
|
addDoodle: (doodle) => svgEditMapRef.current?.addDoodle(doodle),
|
|
22257
|
+
// 检查doodle
|
|
22258
|
+
checkDoodle: () => svgEditMapRef.current?.checkDoodle?.(),
|
|
21970
22259
|
}));
|
|
21971
22260
|
/**
|
|
21972
22261
|
* 根据割草机的位置更新路径
|