@fleet-frontend/mower-maps 0.2.0-beta.19 → 0.2.0-beta.20
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
|
@@ -202,7 +202,7 @@ class ObstacleData extends BaseData {
|
|
|
202
202
|
this.status = originalData?.status ?? 1;
|
|
203
203
|
this.start_timestamp = originalData?.start_timestamp;
|
|
204
204
|
this.end_timestamp = originalData?.end_timestamp;
|
|
205
|
-
this.name = originalData?.name || '';
|
|
205
|
+
this.name = originalData?.name || 'Obstacle';
|
|
206
206
|
this.style = style;
|
|
207
207
|
}
|
|
208
208
|
}
|
|
@@ -15982,7 +15982,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
15982
15982
|
if (!editMode && !(createMode && completed))
|
|
15983
15983
|
return;
|
|
15984
15984
|
// H5模式下,只有选中的顶点才能拖拽
|
|
15985
|
-
if (platform === PlatformType.H5 && selectedVertexIndex !== index) {
|
|
15985
|
+
if (platform === PlatformType.H5 && (selectedVertexIndex !== index || !draggable)) {
|
|
15986
15986
|
return;
|
|
15987
15987
|
}
|
|
15988
15988
|
e.preventDefault();
|
|
@@ -16059,7 +16059,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16059
16059
|
]);
|
|
16060
16060
|
// H5平台长按边线创建新顶点
|
|
16061
16061
|
const handleEdgeLongPressStart = useCallback((e, edgeStartIndex) => {
|
|
16062
|
-
if ((!editMode && !(createMode && completed)) || dragState.isDragging)
|
|
16062
|
+
if ((!editMode && !(createMode && completed)) || dragState.isDragging || !draggable)
|
|
16063
16063
|
return;
|
|
16064
16064
|
e.preventDefault();
|
|
16065
16065
|
e.stopPropagation();
|
|
@@ -16074,9 +16074,20 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16074
16074
|
handleEdgeClick(e, longPressEdgeIndexRef.current);
|
|
16075
16075
|
}
|
|
16076
16076
|
}, 500);
|
|
16077
|
-
}, [
|
|
16077
|
+
}, [
|
|
16078
|
+
editMode,
|
|
16079
|
+
createMode,
|
|
16080
|
+
completed,
|
|
16081
|
+
dragState.isDragging,
|
|
16082
|
+
getSVGCoordinates,
|
|
16083
|
+
handleEdgeClick,
|
|
16084
|
+
draggable,
|
|
16085
|
+
]);
|
|
16078
16086
|
// 长按结束或取消
|
|
16079
16087
|
const handleEdgeLongPressEnd = useCallback(() => {
|
|
16088
|
+
if (!draggable) {
|
|
16089
|
+
return;
|
|
16090
|
+
}
|
|
16080
16091
|
if (longPressTimerRef.current !== null) {
|
|
16081
16092
|
window.clearTimeout(longPressTimerRef.current);
|
|
16082
16093
|
longPressTimerRef.current = null;
|
|
@@ -16084,7 +16095,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16084
16095
|
isLongPressedRef.current = false;
|
|
16085
16096
|
longPressStartPosRef.current = null;
|
|
16086
16097
|
longPressEdgeIndexRef.current = -1;
|
|
16087
|
-
}, []);
|
|
16098
|
+
}, [draggable]);
|
|
16088
16099
|
// H5平台长按顶点选中
|
|
16089
16100
|
const vertexLongPressTimerRef = useRef(null);
|
|
16090
16101
|
const isVertexLongPressedRef = useRef(false);
|
|
@@ -16206,7 +16217,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16206
16217
|
}, [dragState.isDragging, dragState.dragIndex, getSVGCoordinates]);
|
|
16207
16218
|
// 处理 H5 顶点长按后的触摸移动以进入拖拽
|
|
16208
16219
|
const handleVertexTouchMoveMaybeStartDrag = useCallback((e, idx) => {
|
|
16209
|
-
if (platform !== PlatformType.H5)
|
|
16220
|
+
if (platform !== PlatformType.H5 || !draggable)
|
|
16210
16221
|
return;
|
|
16211
16222
|
if (dragState.isDragging)
|
|
16212
16223
|
return; // 已在拖拽
|
|
@@ -16237,7 +16248,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16237
16248
|
});
|
|
16238
16249
|
}
|
|
16239
16250
|
}
|
|
16240
|
-
}, [platform, dragState.isDragging, coordinates, selectedVertexIndex]);
|
|
16251
|
+
}, [platform, dragState.isDragging, coordinates, selectedVertexIndex, draggable]);
|
|
16241
16252
|
// 结束拖拽
|
|
16242
16253
|
const handleMouseUp = useCallback(() => {
|
|
16243
16254
|
console.log('handleMouseUp', JSON.stringify(dragState));
|
|
@@ -16375,6 +16386,9 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16375
16386
|
: null;
|
|
16376
16387
|
// H5平台处理触摸双击
|
|
16377
16388
|
const handleVertexDoubleTap = useCallback((index) => {
|
|
16389
|
+
if (!draggable) {
|
|
16390
|
+
return;
|
|
16391
|
+
}
|
|
16378
16392
|
const now = Date.now();
|
|
16379
16393
|
const timeDelta = now - lastTapRef.current;
|
|
16380
16394
|
// 检查是否为双击(300ms内,且是同一个点)
|
|
@@ -16411,6 +16425,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16411
16425
|
coordinates?.length,
|
|
16412
16426
|
editMapInfo?.createMode,
|
|
16413
16427
|
renderCoordinates?.length,
|
|
16428
|
+
draggable,
|
|
16414
16429
|
]);
|
|
16415
16430
|
return (jsxs(Fragment, { children: [(editMode || (createMode && completed)) &&
|
|
16416
16431
|
dragState.isDragging &&
|
|
@@ -16508,7 +16523,6 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16508
16523
|
WebkitTouchCallout: 'none',
|
|
16509
16524
|
touchAction: 'none',
|
|
16510
16525
|
}, stroke: strokeColor, fill: vertexFill, cx: coord[0], cy: coord[1], r: vertexRadius, onClick: (e) => handleVertexClick(e, idx), onDoubleClick: (e) => {
|
|
16511
|
-
console.log('双击事件', selectedVertexIndex, idx);
|
|
16512
16526
|
if (platform === PlatformType.H5) {
|
|
16513
16527
|
return;
|
|
16514
16528
|
}
|
|
@@ -16579,6 +16593,9 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16579
16593
|
hasStartedDragViaLongPressRef.current = false;
|
|
16580
16594
|
}),
|
|
16581
16595
|
onTouchCancel: createReactEventHandler(() => {
|
|
16596
|
+
if (!draggable) {
|
|
16597
|
+
return;
|
|
16598
|
+
}
|
|
16582
16599
|
handleVertexLongPressEnd();
|
|
16583
16600
|
hasStartedDragViaLongPressRef.current = false;
|
|
16584
16601
|
}),
|
package/dist/index.js
CHANGED
|
@@ -222,7 +222,7 @@ class ObstacleData extends BaseData {
|
|
|
222
222
|
this.status = originalData?.status ?? 1;
|
|
223
223
|
this.start_timestamp = originalData?.start_timestamp;
|
|
224
224
|
this.end_timestamp = originalData?.end_timestamp;
|
|
225
|
-
this.name = originalData?.name || '';
|
|
225
|
+
this.name = originalData?.name || 'Obstacle';
|
|
226
226
|
this.style = style;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
@@ -16002,7 +16002,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16002
16002
|
if (!editMode && !(createMode && completed))
|
|
16003
16003
|
return;
|
|
16004
16004
|
// H5模式下,只有选中的顶点才能拖拽
|
|
16005
|
-
if (platform === exports.PlatformType.H5 && selectedVertexIndex !== index) {
|
|
16005
|
+
if (platform === exports.PlatformType.H5 && (selectedVertexIndex !== index || !draggable)) {
|
|
16006
16006
|
return;
|
|
16007
16007
|
}
|
|
16008
16008
|
e.preventDefault();
|
|
@@ -16079,7 +16079,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16079
16079
|
]);
|
|
16080
16080
|
// H5平台长按边线创建新顶点
|
|
16081
16081
|
const handleEdgeLongPressStart = React.useCallback((e, edgeStartIndex) => {
|
|
16082
|
-
if ((!editMode && !(createMode && completed)) || dragState.isDragging)
|
|
16082
|
+
if ((!editMode && !(createMode && completed)) || dragState.isDragging || !draggable)
|
|
16083
16083
|
return;
|
|
16084
16084
|
e.preventDefault();
|
|
16085
16085
|
e.stopPropagation();
|
|
@@ -16094,9 +16094,20 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16094
16094
|
handleEdgeClick(e, longPressEdgeIndexRef.current);
|
|
16095
16095
|
}
|
|
16096
16096
|
}, 500);
|
|
16097
|
-
}, [
|
|
16097
|
+
}, [
|
|
16098
|
+
editMode,
|
|
16099
|
+
createMode,
|
|
16100
|
+
completed,
|
|
16101
|
+
dragState.isDragging,
|
|
16102
|
+
getSVGCoordinates,
|
|
16103
|
+
handleEdgeClick,
|
|
16104
|
+
draggable,
|
|
16105
|
+
]);
|
|
16098
16106
|
// 长按结束或取消
|
|
16099
16107
|
const handleEdgeLongPressEnd = React.useCallback(() => {
|
|
16108
|
+
if (!draggable) {
|
|
16109
|
+
return;
|
|
16110
|
+
}
|
|
16100
16111
|
if (longPressTimerRef.current !== null) {
|
|
16101
16112
|
window.clearTimeout(longPressTimerRef.current);
|
|
16102
16113
|
longPressTimerRef.current = null;
|
|
@@ -16104,7 +16115,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16104
16115
|
isLongPressedRef.current = false;
|
|
16105
16116
|
longPressStartPosRef.current = null;
|
|
16106
16117
|
longPressEdgeIndexRef.current = -1;
|
|
16107
|
-
}, []);
|
|
16118
|
+
}, [draggable]);
|
|
16108
16119
|
// H5平台长按顶点选中
|
|
16109
16120
|
const vertexLongPressTimerRef = React.useRef(null);
|
|
16110
16121
|
const isVertexLongPressedRef = React.useRef(false);
|
|
@@ -16226,7 +16237,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16226
16237
|
}, [dragState.isDragging, dragState.dragIndex, getSVGCoordinates]);
|
|
16227
16238
|
// 处理 H5 顶点长按后的触摸移动以进入拖拽
|
|
16228
16239
|
const handleVertexTouchMoveMaybeStartDrag = React.useCallback((e, idx) => {
|
|
16229
|
-
if (platform !== exports.PlatformType.H5)
|
|
16240
|
+
if (platform !== exports.PlatformType.H5 || !draggable)
|
|
16230
16241
|
return;
|
|
16231
16242
|
if (dragState.isDragging)
|
|
16232
16243
|
return; // 已在拖拽
|
|
@@ -16257,7 +16268,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16257
16268
|
});
|
|
16258
16269
|
}
|
|
16259
16270
|
}
|
|
16260
|
-
}, [platform, dragState.isDragging, coordinates, selectedVertexIndex]);
|
|
16271
|
+
}, [platform, dragState.isDragging, coordinates, selectedVertexIndex, draggable]);
|
|
16261
16272
|
// 结束拖拽
|
|
16262
16273
|
const handleMouseUp = React.useCallback(() => {
|
|
16263
16274
|
console.log('handleMouseUp', JSON.stringify(dragState));
|
|
@@ -16395,6 +16406,9 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16395
16406
|
: null;
|
|
16396
16407
|
// H5平台处理触摸双击
|
|
16397
16408
|
const handleVertexDoubleTap = React.useCallback((index) => {
|
|
16409
|
+
if (!draggable) {
|
|
16410
|
+
return;
|
|
16411
|
+
}
|
|
16398
16412
|
const now = Date.now();
|
|
16399
16413
|
const timeDelta = now - lastTapRef.current;
|
|
16400
16414
|
// 检查是否为双击(300ms内,且是同一个点)
|
|
@@ -16431,6 +16445,7 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16431
16445
|
coordinates?.length,
|
|
16432
16446
|
editMapInfo?.createMode,
|
|
16433
16447
|
renderCoordinates?.length,
|
|
16448
|
+
draggable,
|
|
16434
16449
|
]);
|
|
16435
16450
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(editMode || (createMode && completed)) &&
|
|
16436
16451
|
dragState.isDragging &&
|
|
@@ -16528,7 +16543,6 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16528
16543
|
WebkitTouchCallout: 'none',
|
|
16529
16544
|
touchAction: 'none',
|
|
16530
16545
|
}, stroke: strokeColor, fill: vertexFill, cx: coord[0], cy: coord[1], r: vertexRadius, onClick: (e) => handleVertexClick(e, idx), onDoubleClick: (e) => {
|
|
16531
|
-
console.log('双击事件', selectedVertexIndex, idx);
|
|
16532
16546
|
if (platform === exports.PlatformType.H5) {
|
|
16533
16547
|
return;
|
|
16534
16548
|
}
|
|
@@ -16599,6 +16613,9 @@ const PolygonElement = ({ canSelect = false, points, fillColor = 'rgba(0, 0, 0,
|
|
|
16599
16613
|
hasStartedDragViaLongPressRef.current = false;
|
|
16600
16614
|
}),
|
|
16601
16615
|
onTouchCancel: createReactEventHandler(() => {
|
|
16616
|
+
if (!draggable) {
|
|
16617
|
+
return;
|
|
16618
|
+
}
|
|
16602
16619
|
handleVertexLongPressEnd();
|
|
16603
16620
|
hasStartedDragViaLongPressRef.current = false;
|
|
16604
16621
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/render/svgElement/PolygonELement/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAoBjF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,aAAa,MAAM,EAAE,EAAE,KAAG,MAE7D,CAAC;AA+BF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,aAAa,MAAM,EAAE,EAAE,EACvB,YAAW,OAAc,KACxB,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAA;CAAE,CAyC5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,EAAE,EAAE,KAAG,MAUnD,CAAC;AAgBF,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,EAAE,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