@fleet-frontend/mower-maps 0.2.0-beta.14 → 0.2.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js
CHANGED
|
@@ -15674,10 +15674,6 @@ const useCheckElement = () => {
|
|
|
15674
15674
|
return false;
|
|
15675
15675
|
// 获取当前正在创建的 obstacle 的点
|
|
15676
15676
|
const currentObstaclePoints = coordinatesToPoints$1(points) || [];
|
|
15677
|
-
if (platform !== PlatformType.H5) {
|
|
15678
|
-
if (currentObstaclePoints.length === 0)
|
|
15679
|
-
return false; // 还没有开始绘制
|
|
15680
|
-
}
|
|
15681
15677
|
// 构建当前 obstacle 的多边形(包括检查点位置)
|
|
15682
15678
|
const currentObstaclePolygon = [...currentObstaclePoints, checkPoint];
|
|
15683
15679
|
// 获取当前边界内的所有元素
|
|
@@ -15839,16 +15835,16 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
15839
15835
|
const { editMapInfo } = useMapEditContext();
|
|
15840
15836
|
const { platform } = useCommonContext();
|
|
15841
15837
|
// delete icon可能被上一个点遮挡,因为delete在右上方,所以手动处理点让点按照顺时针渲染,这样delete icon层级就会高一些
|
|
15842
|
-
//
|
|
15838
|
+
// 编辑的场景禁区的点最后一个和第一个相同,会导致一个位置渲染两个点,需要额外处理下
|
|
15843
15839
|
const coordinates = useMemo(() => {
|
|
15844
15840
|
const temp = editMapInfo?.createMode === CreateStatus.CREATING ? points : [...points].reverse();
|
|
15845
15841
|
const firstPoint = temp[0] || [];
|
|
15846
15842
|
const lastPoint = temp[temp.length - 1] || [];
|
|
15847
|
-
if (firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1]) {
|
|
15843
|
+
if (firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1] && editMapInfo?.editMap) {
|
|
15848
15844
|
return temp.slice(0, -1);
|
|
15849
15845
|
}
|
|
15850
15846
|
return temp;
|
|
15851
|
-
}, [points, editMapInfo?.createMode]);
|
|
15847
|
+
}, [points, editMapInfo?.createMode, editMapInfo?.editMap]);
|
|
15852
15848
|
// 计算点到线段的垂足坐标(使用通用工具函数)
|
|
15853
15849
|
const calculatePerpendicularFoot$1 = useCallback((point, lineStart, lineEnd) => {
|
|
15854
15850
|
return calculatePerpendicularFoot(point, lineStart, lineEnd);
|
|
@@ -16361,7 +16357,7 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
16361
16357
|
const prevIndex = (dragState.dragIndex - 1 + coordinates.length) % coordinates.length;
|
|
16362
16358
|
const nextIndex = (dragState.dragIndex + 1) % coordinates.length;
|
|
16363
16359
|
return (jsxs(Fragment, { children: [jsx("line", { x1: coordinates[prevIndex][0], y1: coordinates[prevIndex][1], x2: dragState.originalPosition[0], y2: dragState.originalPosition[1], stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: 0.5, strokeDasharray: "5,5", pointerEvents: "none" }), jsx("line", { x1: dragState.originalPosition[0], y1: dragState.originalPosition[1], x2: coordinates[nextIndex][0], y2: coordinates[nextIndex][1], stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: 0.5, strokeDasharray: "5,5", pointerEvents: "none" })] }));
|
|
16364
|
-
})()] })), renderCoordinates.length >= 3 && (jsx("polygon", { className: styles$2.polygonPathG, points: polygonPoints, fill: fillColor, fillOpacity: fillOpacity, stroke: "none" // 边框透明
|
|
16360
|
+
})()] })), renderCoordinates.length >= 3 && (jsx("polygon", { className: editMapInfo?.editMap ? styles$2.polygonPathG : '', points: polygonPoints, fill: fillColor, fillOpacity: fillOpacity, stroke: "none" // 边框透明
|
|
16365
16361
|
, onClick: onPolygonClick })), jsxs("g", { className: styles$2.polygonPathG, children: [renderCoordinates.length >= 2 &&
|
|
16366
16362
|
pathSegments.map((segment, index) => {
|
|
16367
16363
|
if (segment.points.length < 2)
|
|
@@ -16594,17 +16590,7 @@ const BoundaryElement = ({ data }) => {
|
|
|
16594
16590
|
}));
|
|
16595
16591
|
}
|
|
16596
16592
|
}
|
|
16597
|
-
|
|
16598
|
-
if (editMapInfo?.selectElement)
|
|
16599
|
-
return;
|
|
16600
|
-
setEditMapInfo((prev) => ({
|
|
16601
|
-
...prev,
|
|
16602
|
-
selectElement: data,
|
|
16603
|
-
elementType: DataType.BOUNDARY,
|
|
16604
|
-
editMap: true,
|
|
16605
|
-
}));
|
|
16606
|
-
}
|
|
16607
|
-
}, [platform, data, editMapInfo]);
|
|
16593
|
+
}, [platform, data, editMapInfo, onSelectElement]);
|
|
16608
16594
|
return (jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: onPathClick, onPolygonClick: () => {
|
|
16609
16595
|
onPathClick();
|
|
16610
16596
|
}, onCoordinatesChange: (coordinates) => {
|
package/dist/index.js
CHANGED
|
@@ -15694,10 +15694,6 @@ const useCheckElement = () => {
|
|
|
15694
15694
|
return false;
|
|
15695
15695
|
// 获取当前正在创建的 obstacle 的点
|
|
15696
15696
|
const currentObstaclePoints = coordinatesToPoints$1(points) || [];
|
|
15697
|
-
if (platform !== exports.PlatformType.H5) {
|
|
15698
|
-
if (currentObstaclePoints.length === 0)
|
|
15699
|
-
return false; // 还没有开始绘制
|
|
15700
|
-
}
|
|
15701
15697
|
// 构建当前 obstacle 的多边形(包括检查点位置)
|
|
15702
15698
|
const currentObstaclePolygon = [...currentObstaclePoints, checkPoint];
|
|
15703
15699
|
// 获取当前边界内的所有元素
|
|
@@ -15859,16 +15855,16 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
15859
15855
|
const { editMapInfo } = useMapEditContext();
|
|
15860
15856
|
const { platform } = useCommonContext();
|
|
15861
15857
|
// delete icon可能被上一个点遮挡,因为delete在右上方,所以手动处理点让点按照顺时针渲染,这样delete icon层级就会高一些
|
|
15862
|
-
//
|
|
15858
|
+
// 编辑的场景禁区的点最后一个和第一个相同,会导致一个位置渲染两个点,需要额外处理下
|
|
15863
15859
|
const coordinates = React.useMemo(() => {
|
|
15864
15860
|
const temp = editMapInfo?.createMode === exports.CreateStatus.CREATING ? points : [...points].reverse();
|
|
15865
15861
|
const firstPoint = temp[0] || [];
|
|
15866
15862
|
const lastPoint = temp[temp.length - 1] || [];
|
|
15867
|
-
if (firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1]) {
|
|
15863
|
+
if (firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1] && editMapInfo?.editMap) {
|
|
15868
15864
|
return temp.slice(0, -1);
|
|
15869
15865
|
}
|
|
15870
15866
|
return temp;
|
|
15871
|
-
}, [points, editMapInfo?.createMode]);
|
|
15867
|
+
}, [points, editMapInfo?.createMode, editMapInfo?.editMap]);
|
|
15872
15868
|
// 计算点到线段的垂足坐标(使用通用工具函数)
|
|
15873
15869
|
const calculatePerpendicularFoot$1 = React.useCallback((point, lineStart, lineEnd) => {
|
|
15874
15870
|
return calculatePerpendicularFoot(point, lineStart, lineEnd);
|
|
@@ -16381,7 +16377,7 @@ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity
|
|
|
16381
16377
|
const prevIndex = (dragState.dragIndex - 1 + coordinates.length) % coordinates.length;
|
|
16382
16378
|
const nextIndex = (dragState.dragIndex + 1) % coordinates.length;
|
|
16383
16379
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("line", { x1: coordinates[prevIndex][0], y1: coordinates[prevIndex][1], x2: dragState.originalPosition[0], y2: dragState.originalPosition[1], stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: 0.5, strokeDasharray: "5,5", pointerEvents: "none" }), jsxRuntime.jsx("line", { x1: dragState.originalPosition[0], y1: dragState.originalPosition[1], x2: coordinates[nextIndex][0], y2: coordinates[nextIndex][1], stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: 0.5, strokeDasharray: "5,5", pointerEvents: "none" })] }));
|
|
16384
|
-
})()] })), renderCoordinates.length >= 3 && (jsxRuntime.jsx("polygon", { className: styles$2.polygonPathG, points: polygonPoints, fill: fillColor, fillOpacity: fillOpacity, stroke: "none" // 边框透明
|
|
16380
|
+
})()] })), renderCoordinates.length >= 3 && (jsxRuntime.jsx("polygon", { className: editMapInfo?.editMap ? styles$2.polygonPathG : '', points: polygonPoints, fill: fillColor, fillOpacity: fillOpacity, stroke: "none" // 边框透明
|
|
16385
16381
|
, onClick: onPolygonClick })), jsxRuntime.jsxs("g", { className: styles$2.polygonPathG, children: [renderCoordinates.length >= 2 &&
|
|
16386
16382
|
pathSegments.map((segment, index) => {
|
|
16387
16383
|
if (segment.points.length < 2)
|
|
@@ -16614,17 +16610,7 @@ const BoundaryElement = ({ data }) => {
|
|
|
16614
16610
|
}));
|
|
16615
16611
|
}
|
|
16616
16612
|
}
|
|
16617
|
-
|
|
16618
|
-
if (editMapInfo?.selectElement)
|
|
16619
|
-
return;
|
|
16620
|
-
setEditMapInfo((prev) => ({
|
|
16621
|
-
...prev,
|
|
16622
|
-
selectElement: data,
|
|
16623
|
-
elementType: exports.DataType.BOUNDARY,
|
|
16624
|
-
editMap: true,
|
|
16625
|
-
}));
|
|
16626
|
-
}
|
|
16627
|
-
}, [platform, data, editMapInfo]);
|
|
16613
|
+
}, [platform, data, editMapInfo, onSelectElement]);
|
|
16628
16614
|
return (jsxRuntime.jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: onPathClick, onPolygonClick: () => {
|
|
16629
16615
|
onPathClick();
|
|
16630
16616
|
}, onCoordinatesChange: (coordinates) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MowerMapRenderer.d.ts","sourceRoot":"","sources":["../../src/render/MowerMapRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAcf,OAAO,EAGL,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"MowerMapRenderer.d.ts","sourceRoot":"","sources":["../../src/render/MowerMapRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAcf,OAAO,EAGL,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AA4B3B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,GAAG,CAAC;KACb;CACF;AAgGD,eAAO,MAAM,gBAAgB,mGAqsB5B,CAAC;AAIF,eAAe,gBAAgB,CAAC;AAChC,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCheckElement.d.ts","sourceRoot":"","sources":["../../../../src/render/svgEditMap/hooks/useCheckElement.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,eAAe;;;;;;;;8CA+HX;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,gBAAgB,MAAM,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"useCheckElement.d.ts","sourceRoot":"","sources":["../../../../src/render/svgEditMap/hooks/useCheckElement.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,eAAe;;;;;;;;8CA+HX;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,gBAAgB,MAAM,EAAE,EAAE;CA+FlE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/render/svgElement/BoundaryElement/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAY,MAAM,qBAAqB,CAAC;AAa7D,UAAU,oBAAoB;IAC5B,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED,QAAA,MAAM,eAAe,GAAI,UAAU,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/render/svgElement/BoundaryElement/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAY,MAAM,qBAAqB,CAAC;AAa7D,UAAU,oBAAoB;IAC5B,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED,QAAA,MAAM,eAAe,GAAI,UAAU,oBAAoB,4CA4EtD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|