@fleet-frontend/mower-maps 0.2.0-beta.2 → 0.2.0-beta.3

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.
Files changed (35) hide show
  1. package/dist/index.esm.js +500 -110
  2. package/dist/index.js +500 -109
  3. package/dist/src/context/common.d.ts +3 -0
  4. package/dist/src/context/common.d.ts.map +1 -1
  5. package/dist/src/context/mapEdit.d.ts +3 -3
  6. package/dist/src/index.d.ts +1 -0
  7. package/dist/src/index.d.ts.map +1 -1
  8. package/dist/src/render/BoundarySvgRender.d.ts +10 -0
  9. package/dist/src/render/BoundarySvgRender.d.ts.map +1 -0
  10. package/dist/src/render/MowerMapRenderer.d.ts.map +1 -1
  11. package/dist/src/render/svgEditMap/components/AddEntry/components/DoodleModal/index.d.ts.map +1 -1
  12. package/dist/src/render/svgEditMap/components/AddEntry/index.d.ts.map +1 -1
  13. package/dist/src/render/svgEditMap/components/HandleElementInfo/boundary.d.ts.map +1 -1
  14. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/index.d.ts.map +1 -1
  15. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/Header/index.d.ts +1 -1
  16. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/Header/index.d.ts.map +1 -1
  17. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts +2 -1
  18. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts.map +1 -1
  19. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts +2 -1
  20. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts.map +1 -1
  21. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/TimePeriod/index.d.ts.map +1 -1
  22. package/dist/src/render/svgEditMap/components/HandleElementInfo/index.d.ts.map +1 -1
  23. package/dist/src/render/svgEditMap/components/HandleElementInfo/obstacle.d.ts.map +1 -1
  24. package/dist/src/render/svgEditMap/index.d.ts.map +1 -1
  25. package/dist/src/render/svgElement/ChannelClipPath/index.d.ts.map +1 -1
  26. package/dist/src/render/svgElement/DoodleElement/index.d.ts.map +1 -1
  27. package/dist/src/render/svgElement/ObstacleElement/index.d.ts.map +1 -1
  28. package/dist/src/render/svgElement/PolygonELement/components/DistanceLabels.d.ts.map +1 -1
  29. package/dist/src/render/svgElement/PolygonELement/dashPath/index.d.ts.map +1 -1
  30. package/dist/src/render/svgElement/PolygonELement/index.d.ts +1 -1
  31. package/dist/src/render/svgElement/PolygonELement/index.d.ts.map +1 -1
  32. package/dist/src/render/svgElement/PolygonELement/vertex/index.d.ts.map +1 -1
  33. package/dist/src/render/svgElement/TransformWrapper/VisionOffTransformWrapper/VisionOffTransformWrapper.d.ts.map +1 -1
  34. package/dist/src/render/svgElement/VisionOffElement/index.d.ts.map +1 -1
  35. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -3051,7 +3051,7 @@ function copyObject(source, props, object, customizer) {
3051
3051
  }
3052
3052
 
3053
3053
  /* Built-in method references for those with the same name as other `lodash` methods. */
3054
- var nativeMax$1 = Math.max;
3054
+ var nativeMax$2 = Math.max;
3055
3055
 
3056
3056
  /**
3057
3057
  * A specialized version of `baseRest` which transforms the rest array.
@@ -3063,11 +3063,11 @@ var nativeMax$1 = Math.max;
3063
3063
  * @returns {Function} Returns the new function.
3064
3064
  */
3065
3065
  function overRest(func, start, transform) {
3066
- start = nativeMax$1(start === undefined ? (func.length - 1) : start, 0);
3066
+ start = nativeMax$2(start === undefined ? (func.length - 1) : start, 0);
3067
3067
  return function() {
3068
3068
  var args = arguments,
3069
3069
  index = -1,
3070
- length = nativeMax$1(args.length - start, 0),
3070
+ length = nativeMax$2(args.length - start, 0),
3071
3071
  array = Array(length);
3072
3072
 
3073
3073
  while (++index < length) {
@@ -4069,7 +4069,7 @@ function isPlainObject(value) {
4069
4069
 
4070
4070
  /* Built-in method references for those with the same name as other `lodash` methods. */
4071
4071
  var nativeIsFinite = root$3.isFinite,
4072
- nativeMin$1 = Math.min;
4072
+ nativeMin$2 = Math.min;
4073
4073
 
4074
4074
  /**
4075
4075
  * Creates a function like `_.round`.
@@ -4082,7 +4082,7 @@ function createRound(methodName) {
4082
4082
  var func = Math[methodName];
4083
4083
  return function(number, precision) {
4084
4084
  number = toNumber$2(number);
4085
- precision = precision == null ? 0 : nativeMin$1(toInteger(precision), 292);
4085
+ precision = precision == null ? 0 : nativeMin$2(toInteger(precision), 292);
4086
4086
  if (precision && nativeIsFinite(number)) {
4087
4087
  // Shift with exponential notation to avoid floating-point issues.
4088
4088
  // See [MDN](https://mdn.io/round#Examples) for more details.
@@ -4305,6 +4305,212 @@ function createBaseFor(fromRight) {
4305
4305
  */
4306
4306
  var baseFor = createBaseFor();
4307
4307
 
4308
+ /**
4309
+ * Gets the timestamp of the number of milliseconds that have elapsed since
4310
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
4311
+ *
4312
+ * @static
4313
+ * @memberOf _
4314
+ * @since 2.4.0
4315
+ * @category Date
4316
+ * @returns {number} Returns the timestamp.
4317
+ * @example
4318
+ *
4319
+ * _.defer(function(stamp) {
4320
+ * console.log(_.now() - stamp);
4321
+ * }, _.now());
4322
+ * // => Logs the number of milliseconds it took for the deferred invocation.
4323
+ */
4324
+ var now$2 = function() {
4325
+ return root$3.Date.now();
4326
+ };
4327
+
4328
+ /** Error message constants. */
4329
+ var FUNC_ERROR_TEXT$3 = 'Expected a function';
4330
+
4331
+ /* Built-in method references for those with the same name as other `lodash` methods. */
4332
+ var nativeMax$1 = Math.max,
4333
+ nativeMin$1 = Math.min;
4334
+
4335
+ /**
4336
+ * Creates a debounced function that delays invoking `func` until after `wait`
4337
+ * milliseconds have elapsed since the last time the debounced function was
4338
+ * invoked. The debounced function comes with a `cancel` method to cancel
4339
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
4340
+ * Provide `options` to indicate whether `func` should be invoked on the
4341
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
4342
+ * with the last arguments provided to the debounced function. Subsequent
4343
+ * calls to the debounced function return the result of the last `func`
4344
+ * invocation.
4345
+ *
4346
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
4347
+ * invoked on the trailing edge of the timeout only if the debounced function
4348
+ * is invoked more than once during the `wait` timeout.
4349
+ *
4350
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
4351
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
4352
+ *
4353
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
4354
+ * for details over the differences between `_.debounce` and `_.throttle`.
4355
+ *
4356
+ * @static
4357
+ * @memberOf _
4358
+ * @since 0.1.0
4359
+ * @category Function
4360
+ * @param {Function} func The function to debounce.
4361
+ * @param {number} [wait=0] The number of milliseconds to delay.
4362
+ * @param {Object} [options={}] The options object.
4363
+ * @param {boolean} [options.leading=false]
4364
+ * Specify invoking on the leading edge of the timeout.
4365
+ * @param {number} [options.maxWait]
4366
+ * The maximum time `func` is allowed to be delayed before it's invoked.
4367
+ * @param {boolean} [options.trailing=true]
4368
+ * Specify invoking on the trailing edge of the timeout.
4369
+ * @returns {Function} Returns the new debounced function.
4370
+ * @example
4371
+ *
4372
+ * // Avoid costly calculations while the window size is in flux.
4373
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
4374
+ *
4375
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
4376
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
4377
+ * 'leading': true,
4378
+ * 'trailing': false
4379
+ * }));
4380
+ *
4381
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
4382
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
4383
+ * var source = new EventSource('/stream');
4384
+ * jQuery(source).on('message', debounced);
4385
+ *
4386
+ * // Cancel the trailing debounced invocation.
4387
+ * jQuery(window).on('popstate', debounced.cancel);
4388
+ */
4389
+ function debounce$2(func, wait, options) {
4390
+ var lastArgs,
4391
+ lastThis,
4392
+ maxWait,
4393
+ result,
4394
+ timerId,
4395
+ lastCallTime,
4396
+ lastInvokeTime = 0,
4397
+ leading = false,
4398
+ maxing = false,
4399
+ trailing = true;
4400
+
4401
+ if (typeof func != 'function') {
4402
+ throw new TypeError(FUNC_ERROR_TEXT$3);
4403
+ }
4404
+ wait = toNumber$2(wait) || 0;
4405
+ if (isObject$4(options)) {
4406
+ leading = !!options.leading;
4407
+ maxing = 'maxWait' in options;
4408
+ maxWait = maxing ? nativeMax$1(toNumber$2(options.maxWait) || 0, wait) : maxWait;
4409
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
4410
+ }
4411
+
4412
+ function invokeFunc(time) {
4413
+ var args = lastArgs,
4414
+ thisArg = lastThis;
4415
+
4416
+ lastArgs = lastThis = undefined;
4417
+ lastInvokeTime = time;
4418
+ result = func.apply(thisArg, args);
4419
+ return result;
4420
+ }
4421
+
4422
+ function leadingEdge(time) {
4423
+ // Reset any `maxWait` timer.
4424
+ lastInvokeTime = time;
4425
+ // Start the timer for the trailing edge.
4426
+ timerId = setTimeout(timerExpired, wait);
4427
+ // Invoke the leading edge.
4428
+ return leading ? invokeFunc(time) : result;
4429
+ }
4430
+
4431
+ function remainingWait(time) {
4432
+ var timeSinceLastCall = time - lastCallTime,
4433
+ timeSinceLastInvoke = time - lastInvokeTime,
4434
+ timeWaiting = wait - timeSinceLastCall;
4435
+
4436
+ return maxing
4437
+ ? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke)
4438
+ : timeWaiting;
4439
+ }
4440
+
4441
+ function shouldInvoke(time) {
4442
+ var timeSinceLastCall = time - lastCallTime,
4443
+ timeSinceLastInvoke = time - lastInvokeTime;
4444
+
4445
+ // Either this is the first call, activity has stopped and we're at the
4446
+ // trailing edge, the system time has gone backwards and we're treating
4447
+ // it as the trailing edge, or we've hit the `maxWait` limit.
4448
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
4449
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
4450
+ }
4451
+
4452
+ function timerExpired() {
4453
+ var time = now$2();
4454
+ if (shouldInvoke(time)) {
4455
+ return trailingEdge(time);
4456
+ }
4457
+ // Restart the timer.
4458
+ timerId = setTimeout(timerExpired, remainingWait(time));
4459
+ }
4460
+
4461
+ function trailingEdge(time) {
4462
+ timerId = undefined;
4463
+
4464
+ // Only invoke if we have `lastArgs` which means `func` has been
4465
+ // debounced at least once.
4466
+ if (trailing && lastArgs) {
4467
+ return invokeFunc(time);
4468
+ }
4469
+ lastArgs = lastThis = undefined;
4470
+ return result;
4471
+ }
4472
+
4473
+ function cancel() {
4474
+ if (timerId !== undefined) {
4475
+ clearTimeout(timerId);
4476
+ }
4477
+ lastInvokeTime = 0;
4478
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
4479
+ }
4480
+
4481
+ function flush() {
4482
+ return timerId === undefined ? result : trailingEdge(now$2());
4483
+ }
4484
+
4485
+ function debounced() {
4486
+ var time = now$2(),
4487
+ isInvoking = shouldInvoke(time);
4488
+
4489
+ lastArgs = arguments;
4490
+ lastThis = this;
4491
+ lastCallTime = time;
4492
+
4493
+ if (isInvoking) {
4494
+ if (timerId === undefined) {
4495
+ return leadingEdge(lastCallTime);
4496
+ }
4497
+ if (maxing) {
4498
+ // Handle invocations in a tight loop.
4499
+ clearTimeout(timerId);
4500
+ timerId = setTimeout(timerExpired, wait);
4501
+ return invokeFunc(lastCallTime);
4502
+ }
4503
+ }
4504
+ if (timerId === undefined) {
4505
+ timerId = setTimeout(timerExpired, wait);
4506
+ }
4507
+ return result;
4508
+ }
4509
+ debounced.cancel = cancel;
4510
+ debounced.flush = flush;
4511
+ return debounced;
4512
+ }
4513
+
4308
4514
  /**
4309
4515
  * This function is like `assignValue` except that it doesn't assign
4310
4516
  * `undefined` values.
@@ -4589,6 +4795,71 @@ var merge$1 = createAssigner(function(object, source, srcIndex) {
4589
4795
  */
4590
4796
  var round = createRound('round');
4591
4797
 
4798
+ /** Error message constants. */
4799
+ var FUNC_ERROR_TEXT$2 = 'Expected a function';
4800
+
4801
+ /**
4802
+ * Creates a throttled function that only invokes `func` at most once per
4803
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
4804
+ * method to cancel delayed `func` invocations and a `flush` method to
4805
+ * immediately invoke them. Provide `options` to indicate whether `func`
4806
+ * should be invoked on the leading and/or trailing edge of the `wait`
4807
+ * timeout. The `func` is invoked with the last arguments provided to the
4808
+ * throttled function. Subsequent calls to the throttled function return the
4809
+ * result of the last `func` invocation.
4810
+ *
4811
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
4812
+ * invoked on the trailing edge of the timeout only if the throttled function
4813
+ * is invoked more than once during the `wait` timeout.
4814
+ *
4815
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
4816
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
4817
+ *
4818
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
4819
+ * for details over the differences between `_.throttle` and `_.debounce`.
4820
+ *
4821
+ * @static
4822
+ * @memberOf _
4823
+ * @since 0.1.0
4824
+ * @category Function
4825
+ * @param {Function} func The function to throttle.
4826
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
4827
+ * @param {Object} [options={}] The options object.
4828
+ * @param {boolean} [options.leading=true]
4829
+ * Specify invoking on the leading edge of the timeout.
4830
+ * @param {boolean} [options.trailing=true]
4831
+ * Specify invoking on the trailing edge of the timeout.
4832
+ * @returns {Function} Returns the new throttled function.
4833
+ * @example
4834
+ *
4835
+ * // Avoid excessively updating the position while scrolling.
4836
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
4837
+ *
4838
+ * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
4839
+ * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
4840
+ * jQuery(element).on('click', throttled);
4841
+ *
4842
+ * // Cancel the trailing throttled invocation.
4843
+ * jQuery(window).on('popstate', throttled.cancel);
4844
+ */
4845
+ function throttle$2(func, wait, options) {
4846
+ var leading = true,
4847
+ trailing = true;
4848
+
4849
+ if (typeof func != 'function') {
4850
+ throw new TypeError(FUNC_ERROR_TEXT$2);
4851
+ }
4852
+ if (isObject$4(options)) {
4853
+ leading = 'leading' in options ? !!options.leading : leading;
4854
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
4855
+ }
4856
+ return debounce$2(func, wait, {
4857
+ 'leading': leading,
4858
+ 'maxWait': wait,
4859
+ 'trailing': trailing
4860
+ });
4861
+ }
4862
+
4592
4863
  /**
4593
4864
  * 工具模块类型定义
4594
4865
  */
@@ -13726,6 +13997,7 @@ const CommonContext = createContext({
13726
13997
  mapRef: null,
13727
13998
  globalHeight: 0,
13728
13999
  heightOptions: [],
14000
+ overlayScale: 1,
13729
14001
  });
13730
14002
  const CommonContextProvider = CommonContext.Provider;
13731
14003
  const useCommonContext = () => useContext(CommonContext);
@@ -14735,13 +15007,15 @@ function generateStraightParallelPaths(points, offsetDistance) {
14735
15007
  }
14736
15008
  return [parallelPath2Data, parallelPath1Data];
14737
15009
  }
14738
- const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className }) => {
15010
+ const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className, }) => {
14739
15011
  const [parallelPath2Data, parallelPath1Data] = generateStraightParallelPaths(points, strokeWidth);
14740
- return (jsxs(Fragment, { children: [jsx("path", { className: className, fill: "none", d: parallelPath2Data, stroke: stroke, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${strokeWidth}px ${strokeWidth * 2}px`, style: { pointerEvents: 'none' } }), jsx("path", { className: className, fill: "none", d: parallelPath1Data, stroke: stroke, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${strokeWidth}px ${strokeWidth * 2}px`, style: { pointerEvents: 'none' } })] }));
15012
+ return (jsxs(Fragment, { children: [jsx("path", { fill: "none", d: parallelPath2Data, stroke: stroke, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${strokeWidth}px ${strokeWidth * 2}px`, style: { pointerEvents: 'none' }, vectorEffect: "non-scaling-stroke" }), jsx("path", { fill: "none", d: parallelPath1Data, stroke: stroke, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${strokeWidth}px ${strokeWidth * 2}px`, style: { pointerEvents: 'none' }, vectorEffect: "non-scaling-stroke" })] }));
14741
15013
  };
14742
15014
 
14743
15015
  const VertexElement = React__default.memo(({ r, stroke, ...props }) => {
14744
- return (jsx("circle", { r: r || 12, stroke: stroke || "#fff", fill: "#fff", strokeWidth: 2, vectorEffect: "non-scaling-stroke", ...props }));
15016
+ const { overlayScale } = useCommonContext();
15017
+ const radius = typeof r === 'number' ? r : 12;
15018
+ return (jsx("circle", { r: radius * overlayScale, stroke: stroke || '#fff', fill: '#fff', strokeWidth: 2 * overlayScale, ...props }));
14745
15019
  });
14746
15020
 
14747
15021
  var _path$c;
@@ -14873,14 +15147,12 @@ const calculatePhysicalDistance$1 = (point1, point2) => {
14873
15147
  * @returns 中点坐标 [x, y]
14874
15148
  */
14875
15149
  const calculateMidpoint$1 = (point1, point2) => {
14876
- return [
14877
- (point1[0] + point2[0]) / 2,
14878
- (point1[1] + point2[1]) / 2
14879
- ];
15150
+ return [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
14880
15151
  };
14881
15152
  const DistanceLabels = ({ coordinates, createMode = false, editMode = false, completed = false, showPoints = false, mousePos: _mousePos = null, ghostLastDistance = null, ghostLastMidpoint = null, ghostFirstDistance = null, ghostFirstMidpoint = null, }) => {
14882
15153
  // 只在显示可操作顶点时显示距离
14883
- if (!(createMode && showPoints || editMode || (createMode && completed)) || coordinates.length < 2) {
15154
+ if (!((createMode && showPoints) || editMode || (createMode && completed)) ||
15155
+ coordinates.length < 1) {
14884
15156
  return null;
14885
15157
  }
14886
15158
  return (jsxs(Fragment, { children: [coordinates.map((coord, idx) => {
@@ -14932,7 +15204,7 @@ var ClickEventType;
14932
15204
  const INIT_EDIT_MAP_INFO = {
14933
15205
  editMap: false,
14934
15206
  selectElement: null,
14935
- createMode: CreateStatus.CREATING,
15207
+ createMode: null,
14936
15208
  elementType: undefined,
14937
15209
  isShowDrag: false,
14938
15210
  mobileMode: MobileEditMode.START,
@@ -15456,8 +15728,9 @@ const createPathData = (points) => {
15456
15728
  }
15457
15729
  return pathData;
15458
15730
  };
15459
- const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity = 1, strokeColor = '#000', strokeWidth = 2, strokeOpacity = 1, createMode = false, showPoints = false, onPointClick, completed = false, mousePos = null, editMode = false, onCoordinatesChange, onPathClick, onPolygonClick, onVertexDelete, draggable = true, // 新增参数,如果未指定则根据createMode和editMode自动判断
15731
+ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity = 1, strokeColor = '#000', strokeWidth = 2, strokeOpacity = 1, createMode = false, showPoints = false, onPointClick, completed = false, mousePos = null, editMode = false, onCoordinatesChange, onPathClick, onPolygonClick, onVertexDelete, draggable = true, // 新增参数,如果未指定则根据createMode和editMode自动判断
15460
15732
  }) => {
15733
+ const { overlayScale } = useCommonContext();
15461
15734
  const { svgRef } = useSvgEditContext();
15462
15735
  const [dragState, setDragState] = useState({
15463
15736
  isDragging: false,
@@ -15473,6 +15746,10 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15473
15746
  const { checkCanNotCreateAtPosition } = useCheckElement();
15474
15747
  const { editMapInfo } = useMapEditContext();
15475
15748
  const { platform } = useCommonContext();
15749
+ // delete icon可能被上一个点遮挡,因为delete在右上方,所以手动处理点让点按照顺时针渲染,这样delete icon层级就会高一些
15750
+ const coordinates = useMemo(() => {
15751
+ return editMapInfo?.createMode === CreateStatus.CREATING ? points : [...points].reverse();
15752
+ }, [points, editMapInfo?.createMode]);
15476
15753
  // 计算点到线段的垂足坐标(使用通用工具函数)
15477
15754
  const calculatePerpendicularFoot$1 = useCallback((point, lineStart, lineEnd) => {
15478
15755
  return calculatePerpendicularFoot(point, lineStart, lineEnd);
@@ -15674,7 +15951,9 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15674
15951
  console.log('handleMouseUp', JSON.stringify(dragState));
15675
15952
  if (dragState.isDragging && dragState.currentPosition) {
15676
15953
  // 构建新的坐标数组
15677
- const newCoordinates = [...coordinates];
15954
+ const newCoordinates = editMapInfo?.createMode === CreateStatus.CREATING
15955
+ ? [...coordinates]
15956
+ : [...coordinates].reverse();
15678
15957
  // 如果是新创建的顶点,需要确保它已经被插入
15679
15958
  if (dragState.dragType === 'new' && dragState.newVertexIndex !== -1) {
15680
15959
  if (showNotCreateCursor) ;
@@ -15706,7 +15985,7 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15706
15985
  edgeInfo: null,
15707
15986
  dragType: null,
15708
15987
  });
15709
- }, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor]);
15988
+ }, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor, editMapInfo?.createMode]);
15710
15989
  // 添加全局事件监听(支持触摸和鼠标事件)
15711
15990
  useEffect(() => {
15712
15991
  if (dragState.isDragging) {
@@ -15778,24 +16057,17 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15778
16057
  mousePos.y,
15779
16058
  ])
15780
16059
  : null;
15781
- const ghostFirstDistance = createMode &&
15782
- mousePos &&
15783
- renderCoordinates.length > 0 &&
15784
- !completed &&
15785
- renderCoordinates.length >= 3
16060
+ const ghostFirstDistance = createMode && mousePos && !completed && renderCoordinates.length >= 1
15786
16061
  ? calculatePhysicalDistance(renderCoordinates[0], [mousePos.x, mousePos.y])
15787
16062
  : null;
15788
16063
  // 虚拟连线的中点坐标
15789
16064
  const ghostLastMidpoint = createMode && mousePos && renderCoordinates.length > 0 && !completed
15790
16065
  ? calculateMidpoint(renderCoordinates[renderCoordinates.length - 1], [mousePos.x, mousePos.y])
15791
16066
  : null;
15792
- const ghostFirstMidpoint = createMode &&
15793
- mousePos &&
15794
- renderCoordinates.length > 0 &&
15795
- !completed &&
15796
- renderCoordinates.length >= 3
16067
+ const ghostFirstMidpoint = createMode && mousePos && !completed && renderCoordinates.length >= 1
15797
16068
  ? calculateMidpoint(renderCoordinates[0], [mousePos.x, mousePos.y])
15798
16069
  : null;
16070
+ console.log('ghostFirstMidpoint', ghostFirstMidpoint, ghostFirstDistance);
15799
16071
  return (jsxs(Fragment, { children: [(editMode || (createMode && completed)) &&
15800
16072
  dragState.isDragging &&
15801
16073
  dragState.dragType !== 'new' &&
@@ -15847,14 +16119,14 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15847
16119
  setHoverVertex(null);
15848
16120
  },
15849
16121
  }) }, `edge-${index}`));
15850
- }), ghostLastPath && (jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >= 3 && (jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed }), jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint }), hoverVertex && !dragState.isDragging && (jsx(VertexElement, { cx: hoverVertex.position.x, cy: hoverVertex.position.y, stroke: strokeColor, strokeOpacity: 0.6, fill: "white", fillOpacity: 0.8, pointerEvents: "none" })), ((createMode && showPoints) || editMode || (createMode && completed)) &&
16122
+ }), ghostLastPath && (jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >= 2 && (jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed }), jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint }), hoverVertex && !dragState.isDragging && (jsx(VertexElement, { cx: hoverVertex.position.x, cy: hoverVertex.position.y, stroke: strokeColor, strokeOpacity: 0.6, fill: "white", fillOpacity: 0.8, pointerEvents: "none" })), ((createMode && showPoints) || editMode || (createMode && completed)) &&
15851
16123
  renderCoordinates.map((coord, idx) => {
15852
16124
  // 判断当前顶点的状态
15853
16125
  const isLastPoint = idx === renderCoordinates.length - 1;
15854
16126
  const canComplete = createMode && !completed && renderCoordinates.length >= 3 && isLastPoint;
15855
16127
  const isCreatedAndCanDrag = createMode && completed; // 创建完成后可拖拽
15856
16128
  const isInEditMode = editMode;
15857
- return (jsxs("g", { children: [jsx(VertexElement, { className: generateVertexClassName, stroke: strokeColor, cx: coord[0], cy: coord[1], onClick: (e) => handleVertexClick(e, idx), onDoubleClick: (e) => {
16129
+ return (jsxs("g", { children: [jsx(VertexElement, { className: generateVertexClassName, stroke: strokeColor, cx: coord[0], cy: coord[1], r: canComplete ? 16 : 12, onClick: (e) => handleVertexClick(e, idx), onDoubleClick: (e) => {
15858
16130
  // 阻止双击事件冒泡到Google Maps
15859
16131
  e.preventDefault();
15860
16132
  e.stopPropagation();
@@ -15902,7 +16174,18 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15902
16174
  }
15903
16175
  }
15904
16176
  },
15905
- }) }), tooltipIndex === idx && (jsxs("g", { transform: `translate(${coord[0] + 4}, ${coord[1] - 4})`, onClick: (e) => {
16177
+ onMouseUp: (e) => {
16178
+ // 拖拽逻辑:编辑模式或创建完成后
16179
+ if (isInEditMode || isCreatedAndCanDrag) {
16180
+ if (draggable) {
16181
+ // 延迟执行mouseDown,等待可能的doubleClick
16182
+ if (mouseDownTimerRef.current !== null) {
16183
+ window.clearTimeout(mouseDownTimerRef.current);
16184
+ }
16185
+ }
16186
+ }
16187
+ },
16188
+ }) }), tooltipIndex === idx && (jsxs("g", { transform: `translate(${coord[0] + 4 * overlayScale * 2}, ${coord[1] - 4 * overlayScale * 2}) scale(${overlayScale * 2})`, onClick: (e) => {
15906
16189
  e.preventDefault();
15907
16190
  e.stopPropagation();
15908
16191
  if (onVertexDelete &&
@@ -15911,7 +16194,19 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15911
16194
  onVertexDelete(idx);
15912
16195
  }
15913
16196
  setTooltipIndex(null);
15914
- }, 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("text", { x: coord[0], y: coord[1], textAnchor: "middle", alignmentBaseline: "middle", fontSize: 20, fill: strokeColor, style: { pointerEvents: 'none' }, children: "\u2713" }))] }, `vertex-${idx}`));
16197
+ }, 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" }) }) })
16198
+ // <rect
16199
+ // x={coord[0]}
16200
+ // y={coord[1]}
16201
+ // width={20}
16202
+ // height={20}
16203
+ // rx={2}
16204
+ // ry={2}
16205
+ // fill="transparent"
16206
+ // style={{ pointerEvents: 'none' }}
16207
+ // >
16208
+ // </rect>
16209
+ )] }, `vertex-${idx}`));
15915
16210
  })] }));
15916
16211
  };
15917
16212
 
@@ -15963,7 +16258,7 @@ const BoundaryElement = ({ data }) => {
15963
16258
  }));
15964
16259
  }
15965
16260
  }, [platform, data, editMapInfo]);
15966
- return (jsx(PolygonElement, { coordinates: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: onPathClick, onCoordinatesChange: (coordinates) => {
16261
+ return (jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: onPathClick, onCoordinatesChange: (coordinates) => {
15967
16262
  console.log('onCoordinatesChange', coordinates);
15968
16263
  setEditMapInfo((prev) => ({
15969
16264
  ...prev,
@@ -16098,6 +16393,7 @@ const ObstacleElement = ({ data }) => {
16098
16393
  }
16099
16394
  }, [editMapInfo]);
16100
16395
  const currentPoints = useMemo(() => {
16396
+ // 为了方便解决删除顶点的时候,delete icon被遮挡的问题,所以逆序一下
16101
16397
  if (editMapInfo?.selectElement?.id === data.id) {
16102
16398
  return editMapInfo.selectElement.points;
16103
16399
  }
@@ -16141,7 +16437,11 @@ const ObstacleElement = ({ data }) => {
16141
16437
  setEditMapInfo((prev) => ({
16142
16438
  ...prev,
16143
16439
  selectElement: data,
16144
- historyList: [data],
16440
+ historyList: [
16441
+ {
16442
+ selectElement: data,
16443
+ },
16444
+ ],
16145
16445
  currentHistoryIndex: 0,
16146
16446
  elementType: DataType.OBSTACLE,
16147
16447
  editMap: true,
@@ -16155,7 +16455,7 @@ const ObstacleElement = ({ data }) => {
16155
16455
  }
16156
16456
  return editMapInfo?.selectElement?.id === data.id;
16157
16457
  }, [editMapInfo, data, platform]);
16158
- return (jsx(PolygonElement, { coordinates: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: editMode, showPoints: editMapInfo?.selectElement?.id === data.id, onPathClick: onPathClick, onPolygonClick: () => {
16458
+ return (jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: editMode, showPoints: editMapInfo?.selectElement?.id === data.id, onPathClick: onPathClick, onPolygonClick: () => {
16159
16459
  if (platform === PlatformType.H5) {
16160
16460
  onPathClick();
16161
16461
  }
@@ -16744,6 +17044,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
16744
17044
  };
16745
17045
 
16746
17046
  const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCancel, onDragEnd, onDragMove, disabled = false, className = '', scaleConstraints = { minEdgeLength: 0.5, maxEdgeLength: 10000 }, showInfo = true, }) => {
17047
+ const { overlayScale } = useCommonContext();
16747
17048
  const { platform } = useCommonContext();
16748
17049
  const { editMapInfo } = useMapEditContext();
16749
17050
  const dataPoints = useMemo(() => {
@@ -16859,7 +17160,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
16859
17160
  return;
16860
17161
  onDragMove?.(currentPoints.map((point) => [point.x, point.y]));
16861
17162
  }, [currentPoints, isSelected, isDragging, isRotating, isScaling]);
16862
- return (jsxs("g", { ref: containerRef, className: `vision-off-transform-wrapper ${className} ${isSelected ? 'selected' : ''}`, "data-transform-wrapper": "true", children: [jsx(PolygonElement, { coordinates: visionOffData?.points, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: () => {
17163
+ return (jsxs("g", { ref: containerRef, className: `vision-off-transform-wrapper ${className} ${isSelected ? 'selected' : ''}`, "data-transform-wrapper": "true", children: [jsx(PolygonElement, { points: visionOffData?.points, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: () => {
16863
17164
  onSelect?.();
16864
17165
  }, onPolygonClick: () => {
16865
17166
  if (platform === PlatformType.H5) {
@@ -16888,9 +17189,9 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
16888
17189
  const infoBoxWidth = 140; // 信息框宽度
16889
17190
  const infoBoxHeight = 30; // 信息框高度
16890
17191
  const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
16891
- const scale = isWeb ? 2 : 1;
17192
+ const scale = (isWeb ? 2 : 1) * overlayScale;
16892
17193
  const offsetLeft = 10 * scale;
16893
- 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
17194
+ return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#f16629", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
16894
17195
  ? {
16895
17196
  onTouchStart: createReactEventHandler((e) => {
16896
17197
  handleMouseDownWithDisabled(e);
@@ -16997,7 +17298,11 @@ const VisionOffElement = ({ data, onSelect }) => {
16997
17298
  ...prev,
16998
17299
  selectElement: data,
16999
17300
  elementType: DataType.VISION_OFF,
17000
- historyList: [data],
17301
+ historyList: [
17302
+ {
17303
+ selectElement: data,
17304
+ },
17305
+ ],
17001
17306
  currentHistoryIndex: 0,
17002
17307
  editMap: true,
17003
17308
  isShowDrag: true,
@@ -17756,7 +18061,14 @@ const DoodleElement = ({ data }) => {
17756
18061
  })?.then(() => {
17757
18062
  setEditMapInfo((prev) => ({
17758
18063
  ...prev,
17759
- historyList: [data],
18064
+ historyList: [
18065
+ {
18066
+ selectElement: {
18067
+ ...data,
18068
+ transformedPoints: transformedElements,
18069
+ },
18070
+ },
18071
+ ],
17760
18072
  currentHistoryIndex: 0,
17761
18073
  selectElement: {
17762
18074
  ...data,
@@ -17963,6 +18275,7 @@ const ChannelClipPath = React__default.memo(() => {
17963
18275
  svgRef?.viewBox.baseVal?.width,
17964
18276
  svgRef?.viewBox.baseVal?.height,
17965
18277
  ]);
18278
+ console.log('boundaryData---->', svgRef?.viewBox.baseVal);
17966
18279
  /**
17967
18280
  * 判断多边形是否为逆时针方向
17968
18281
  * 使用叉积法计算多边形的有向面积
@@ -19104,7 +19417,7 @@ const CreateObstacleElement = forwardRef(({ enabled = false, svgElement, onPoint
19104
19417
  if (!enabled || points.length === 0) {
19105
19418
  return null;
19106
19419
  }
19107
- return (jsx(PolygonElement, { coordinates: points.map((p) => [p.x, p.y, 2]), fillColor: styles.fillColor, fillOpacity: 0.3, strokeColor: styles.strokeColor, strokeWidth: 2, strokeOpacity: 1, createMode: true, showPoints: true, editMode: false, completed: true, draggable: false }));
19420
+ return (jsx(PolygonElement, { points: points.map((p) => [p.x, p.y, 2]), fillColor: styles.fillColor, fillOpacity: 0.3, strokeColor: styles.strokeColor, strokeWidth: 2, strokeOpacity: 1, createMode: true, showPoints: true, editMode: false, completed: true, draggable: false }));
19108
19421
  });
19109
19422
  CreateObstacleElement.displayName = 'CreateObstacleElement';
19110
19423
 
@@ -19345,6 +19658,9 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19345
19658
  // pointerEvents: 'auto', // 关键:允许接收鼠标事件
19346
19659
  }, xmlns: "http://www.w3.org/2000/svg", "shape-rendering": "geometricPrecision", "text-rendering": "geometricPrecision", "image-rendering": "optimizeQuality", ref: svgRef, onClick: editMapInfo.createMode && platform !== PlatformType.H5 ? onSvgClick : undefined, onMouseMove: editMapInfo.createMode && platform !== PlatformType.H5 ? onSvgMouseMove : undefined, children: [jsxs("defs", { children: [jsx("filter", { id: "vertex-tooltip-shadow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: jsx("feDropShadow", { dx: "2", dy: "2", stdDeviation: "2", floodColor: "#000", floodOpacity: "0.12" }) }), jsxs("filter", { id: `path-hover-${DataType.BOUNDARY}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: BOUNDARY_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxs("filter", { id: `path-hover-${DataType.VISION_OFF}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: VISION_OFF_AREA_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxs("filter", { id: `path-hover-${DataType.OBSTACLE}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: OBSTACLE_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] })] }), Object.keys(svgElementDatas)
19347
19660
  ?.sort?.((a, b) => {
19661
+ if (a === DataType.BOUNDARY || b === DataType.BOUNDARY) {
19662
+ return 0;
19663
+ }
19348
19664
  const aVal = a === editMapInfo.elementType ? 1 : 0;
19349
19665
  const bVal = b === editMapInfo.elementType ? 1 : 0;
19350
19666
  return aVal - bVal;
@@ -19356,7 +19672,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19356
19672
  editMapInfo.createMode &&
19357
19673
  editMapInfo.elementType !== DataType.DOODLE &&
19358
19674
  editMapInfo.elementType !== DataType.VISION_OFF &&
19359
- (points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsx(PolygonElement, { coordinates: points?.length > 0
19675
+ (points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsx(PolygonElement, { points: points?.length > 0
19360
19676
  ? points.map((p) => [p.x, p.y, 2])
19361
19677
  : editMapInfo?.selectElement?.points, fillColor: createElementStyle.fillColor, strokeColor: createElementStyle.lineColor, strokeWidth: createElementStyle.lineWidth, createMode: editMapInfo.elementType !== DataType.VISION_OFF, showPoints: editMapInfo.elementType !== DataType.VISION_OFF, onPointClick: onPointClick, completed: completed, mousePos: mousePos, onVertexDelete: (vertexIndex) => handleCreateVertexDelete(vertexIndex), onCoordinatesChange: (newCoords) => {
19362
19678
  // 创建模式下的坐标变化(拖拽时)
@@ -19777,7 +20093,11 @@ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
19777
20093
  })?.then(() => {
19778
20094
  setEditMapInfo({
19779
20095
  ...editMapInfo,
19780
- historyList: [newDoodle],
20096
+ historyList: [
20097
+ {
20098
+ selectElement: newDoodle,
20099
+ },
20100
+ ],
19781
20101
  currentHistoryIndex: 0,
19782
20102
  createMode: CreateStatus.COMPLETED,
19783
20103
  elementType: DataType.DOODLE,
@@ -19859,7 +20179,11 @@ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
19859
20179
  })?.then(() => {
19860
20180
  setEditMapInfo({
19861
20181
  ...editMapInfo,
19862
- historyList: [newElement],
20182
+ historyList: [
20183
+ {
20184
+ selectElement: newElement,
20185
+ },
20186
+ ],
19863
20187
  currentHistoryIndex: 0,
19864
20188
  createMode: type === DataType.VISION_OFF ? CreateStatus.COMPLETED : CreateStatus.CREATING,
19865
20189
  elementType: type,
@@ -19888,11 +20212,11 @@ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
19888
20212
  }), children: jsx("div", { className: styles$c.icon, children: jsx(SvgAddEntry, {}) }) }), jsx(DoodleModal, { centerPoint: centerPoint, doodleList: doodleList, open: doodleOpen, onOk: () => setDoodleOpen(false), setOpen: setDoodleOpen })] }));
19889
20213
  };
19890
20214
 
19891
- var css_248z$9 = ".index-module_handleElementInfo__vWIaf {\n position: absolute;\n right: 0;\n top: 0;\n border-radius: 8px;\n padding: 4px 8px;\n background: #fff;\n width: 265px;\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 padding: 0 0 4px 0;\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 border-top: 1px solid rgb(197, 197, 197);\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 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_obstacleInfo__w6Sod .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\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\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}\n.index-module_boundaryInfo__VfR-N .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\n}";
20215
+ var css_248z$9 = ".index-module_handleElementInfo__vWIaf {\n position: absolute;\n right: 0;\n top: 0;\n border-radius: 8px;\n padding: 4px 8px;\n background: #fff;\n width: 265px;\n user-select: none;\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 padding: 0 0 4px 0;\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 border-top: 1px solid rgb(197, 197, 197);\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 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_obstacleInfo__w6Sod .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\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\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}\n.index-module_boundaryInfo__VfR-N .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\n}";
19892
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","obstacleInfo":"index-module_obstacleInfo__w6Sod","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"};
19893
20217
  styleInject(css_248z$9);
19894
20218
 
19895
- var css_248z$8 = ".index-module_infoHeader__l9F6q {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 8px 0;\n border-bottom: 1px solid rgb(197, 197, 197);\n}\n.index-module_infoHeader__l9F6q .index-module_headerIcon__sK1hg {\n width: 16px;\n height: 16px;\n cursor: pointer;\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}\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}";
20219
+ var css_248z$8 = ".index-module_infoHeader__l9F6q {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 8px 0;\n border-bottom: 1px solid rgb(197, 197, 197);\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}";
19896
20220
  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"};
19897
20221
  styleInject(css_248z$8);
19898
20222
 
@@ -19924,7 +20248,7 @@ var SvgDelete = function SvgDelete(props) {
19924
20248
  })));
19925
20249
  };
19926
20250
 
19927
- const Header = ({ handleDelete, handleFocus, showFocus = false, showDelete = true, type }) => {
20251
+ const Header = ({ handleDelete, handleFocus, showFocus = false, showDelete = true, type, }) => {
19928
20252
  const currentType = useMemo(() => {
19929
20253
  return DATE_TYPE_MAP.find((item) => item.type === type);
19930
20254
  }, [type]);
@@ -19949,14 +20273,14 @@ var SvgEdit = function SvgEdit(props) {
19949
20273
  })));
19950
20274
  };
19951
20275
 
19952
- const NameModal = ({ name, open, setOpen, onOk }) => {
20276
+ const NameModal = ({ title, name, open, setOpen, onOk }) => {
19953
20277
  const [nameValue, setNameValue] = useState('');
19954
20278
  useEffect(() => {
19955
20279
  if (open) {
19956
20280
  setNameValue(name || '');
19957
20281
  }
19958
20282
  }, [name, open]);
19959
- return (jsx(CustomModal, { title: `${name}`, titleCenter: true, open: open, onOk: () => {
20283
+ return (jsx(CustomModal, { title: `${title}`, titleCenter: true, open: open, onOk: () => {
19960
20284
  onOk?.(nameValue);
19961
20285
  setOpen(false);
19962
20286
  }, onCancel: () => setOpen(false), okText: "Confirm", afterClose: () => {
@@ -19964,9 +20288,9 @@ const NameModal = ({ name, open, setOpen, onOk }) => {
19964
20288
  }, children: jsx(Input, { maxLength: 120, showCount: true, placeholder: "Please enter boundary name", value: nameValue, onChange: (e) => setNameValue(e.target.value) }) }));
19965
20289
  };
19966
20290
 
19967
- const NameEdit = ({ name, onChange }) => {
20291
+ const NameEdit = ({ title, name, onChange }) => {
19968
20292
  const [open, setOpen] = React__default.useState(false);
19969
- return (jsxs(Fragment, { children: [jsxs("div", { className: styles$7.nameEdit, children: [jsx("div", { className: styles$7.content, children: name }), jsx("div", { className: styles$7.edit, onClick: () => setOpen(true), children: jsx(SvgEdit, {}) })] }), jsx(NameModal, { name: name, open: open, setOpen: setOpen, onOk: onChange })] }));
20293
+ return (jsxs(Fragment, { children: [jsxs("div", { className: styles$7.nameEdit, children: [jsx("div", { className: styles$7.content, children: name }), jsx("div", { className: styles$7.edit, onClick: () => setOpen(true), children: jsx(SvgEdit, {}) })] }), jsx(NameModal, { title: title, name: name, open: open, setOpen: setOpen, onOk: onChange })] }));
19970
20294
  };
19971
20295
 
19972
20296
  var _path$3;
@@ -20087,7 +20411,7 @@ const HeightModal = ({ zoneName, open, setOpen, onChange, value, heightOptions,
20087
20411
  }), children: [jsx("div", { className: styles$4.left, children: jsxs(Radio, { value: ZoneHeightModalTypeEnum.RADIO, children: ["Customize zone height (", getHeightUnit(unitType), ")"] }) }), jsx("div", { className: styles$4.right, children: jsx(CutHeightSlider, { units: unitType, value: currentValue?.cuttingHeight, heightOptions: heightOptions, onChange: onHeightChange }) })] })] }) }) }));
20088
20412
  };
20089
20413
 
20090
- var css_248z$3 = ".index-module_directions__Hv0zx {\n color: #1d1d1d;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n}\n.index-module_directions__Hv0zx .index-module_default__sSWp4 {\n position: absolute;\n bottom: 20px;\n left: 9px;\n}\n.index-module_directions__Hv0zx .index-module_tips__VVEuO {\n line-height: 16px;\n}\n.index-module_directions__Hv0zx .index-module_optimal__07le4 {\n color: rgb(255, 113, 51);\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 6px;\n margin: 4px 0 12px;\n}\n.index-module_directions__Hv0zx .index-module_content__PiCFf {\n position: relative;\n width: 100%;\n margin-bottom: 12px;\n}\n.index-module_directions__Hv0zx .index-module_background__WM4u- {\n position: absolute;\n width: 100%;\n height: 300px;\n background: #f5f5f5;\n border-radius: 8px;\n z-index: 0;\n}\n.index-module_directions__Hv0zx .index-module_luppan__nGfH2 {\n inset: 0;\n z-index: 1;\n}\n.index-module_directions__Hv0zx .index-module_slideTip__RGnd1 {\n margin: 20px 0;\n}\n.index-module_directions__Hv0zx .index-module_slider__VDKnB {\n padding: 0 24px;\n}";
20414
+ var css_248z$3 = ".index-module_directions__Hv0zx {\n color: #1d1d1d;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n}\n.index-module_directions__Hv0zx .index-module_default__sSWp4 {\n position: absolute;\n bottom: 20px;\n left: 9px;\n}\n.index-module_directions__Hv0zx .index-module_tips__VVEuO {\n line-height: 16px;\n}\n.index-module_directions__Hv0zx .index-module_optimal__07le4 {\n color: rgb(255, 113, 51);\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 6px;\n margin: 4px 0 12px;\n}\n.index-module_directions__Hv0zx .index-module_content__PiCFf {\n position: relative;\n width: 100%;\n margin-bottom: 12px;\n}\n.index-module_directions__Hv0zx .index-module_background__WM4u- {\n position: absolute;\n width: 100%;\n height: 300px;\n background: #f5f5f5;\n border-radius: 8px;\n z-index: 0;\n overflow: hidden;\n}\n.index-module_directions__Hv0zx .index-module_luppan__nGfH2 {\n inset: 0;\n z-index: 1;\n}\n.index-module_directions__Hv0zx .index-module_slideTip__RGnd1 {\n margin: 20px 0;\n}\n.index-module_directions__Hv0zx .index-module_slider__VDKnB {\n padding: 0 24px;\n}";
20091
20415
  var styles$3 = {"directions":"index-module_directions__Hv0zx","default":"index-module_default__sSWp4","tips":"index-module_tips__VVEuO","optimal":"index-module_optimal__07le4","content":"index-module_content__PiCFf","background":"index-module_background__WM4u-","luppan":"index-module_luppan__nGfH2","slideTip":"index-module_slideTip__RGnd1","slider":"index-module_slider__VDKnB"};
20092
20416
  styleInject(css_248z$3);
20093
20417
 
@@ -20420,10 +20744,71 @@ const MowDirection_L = (props) => {
20420
20744
  }, children: [jsx("div", { className: styles$2.leftTop, children: jsx(SvgOption, {}) }), jsx("div", { className: styles$2.rightBottom, children: jsx(SvgOption, {}) })] })] }) }) }));
20421
20745
  };
20422
20746
 
20747
+ const BoundarySvgRender = React__default.memo(({ mapJson, id, maxWidth = 300 }) => {
20748
+ const svgElementData = useMemo(() => {
20749
+ const data = UnifiedMapDataProcessor.processMapData(mapJson, DEFAULT_STYLES) || {};
20750
+ return data;
20751
+ }, [mapJson, DEFAULT_STYLES]);
20752
+ const boundaryInfo = useMemo(() => {
20753
+ const boundary = svgElementData.boundary.find((item) => item.id === id);
20754
+ return boundary;
20755
+ }, [id, svgElementData]);
20756
+ // 计算当前boundary的viewBox
20757
+ const boundaryViewBox = useMemo(() => {
20758
+ if (!boundaryInfo?.points || boundaryInfo.points.length === 0) {
20759
+ return null;
20760
+ }
20761
+ // 计算边界
20762
+ let minX = Infinity;
20763
+ let minY = Infinity;
20764
+ let maxX = -Infinity;
20765
+ let maxY = -Infinity;
20766
+ boundaryInfo.points.forEach((point) => {
20767
+ minX = Math.min(minX, point[0]);
20768
+ minY = Math.min(minY, point[1]);
20769
+ maxX = Math.max(maxX, point[0]);
20770
+ maxY = Math.max(maxY, point[1]);
20771
+ });
20772
+ // 添加边距
20773
+ const padding = 50;
20774
+ const width = maxX - minX + padding * 2;
20775
+ const height = maxY - minY + padding * 2;
20776
+ return {
20777
+ x: minX - padding,
20778
+ y: minY - padding,
20779
+ width,
20780
+ height,
20781
+ };
20782
+ }, [boundaryInfo]);
20783
+ const style = useMemo(() => {
20784
+ if (boundaryViewBox?.width > boundaryViewBox?.height) {
20785
+ return {
20786
+ width: maxWidth,
20787
+ height: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
20788
+ };
20789
+ }
20790
+ return {
20791
+ width: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
20792
+ height: maxWidth,
20793
+ };
20794
+ }, [boundaryViewBox, maxWidth]);
20795
+ return (jsxs("div", { style: {
20796
+ position: 'relative',
20797
+ width: style.width,
20798
+ height: style.height,
20799
+ margin: '0 auto',
20800
+ }, children: [jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `${boundaryViewBox.x} ${boundaryViewBox.y} ${boundaryViewBox.width} ${boundaryViewBox.height}`, width: `${style.width}px`, height: `${style.height}px`, style: { position: 'absolute', inset: 0, pointerEvents: 'none' }, children: Object.keys(svgElementData)?.map((key) => {
20801
+ return svgElementData[key]?.map((element) => {
20802
+ if (key === DataType.VISION_OFF)
20803
+ return null;
20804
+ return (jsx(GElement, { type: key, data: svgElementData[key], children: jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
20805
+ });
20806
+ }) }), jsx(CharginPile, { mapData: mapJson, mapConfig: DEFAULT_STYLES, viewBox: boundaryViewBox || null, rotation: 0 })] }));
20807
+ });
20808
+
20423
20809
  const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, onChange, }) => {
20424
- const { mapJson, mapConfig, drag } = useCommonContext();
20810
+ const { mapJson, mapConfig } = useCommonContext();
20425
20811
  const { editMapInfo } = useMapEditContext();
20426
- const { svgElementDatas } = useSvgEditContext();
20427
20812
  const [directions, setDirections] = useState(ALL_DIRECTION_SELECTED);
20428
20813
  const [angle, setAngle] = useState(MIN_DIRECTION_ANGLE);
20429
20814
  const canSetDefault = useMemo(() => {
@@ -20448,34 +20833,6 @@ const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, o
20448
20833
  setAngle(defaultAngle);
20449
20834
  }
20450
20835
  };
20451
- // 计算当前boundary的viewBox
20452
- const boundaryViewBox = useMemo(() => {
20453
- const currentBoundary = editMapInfo.selectElement;
20454
- if (!currentBoundary?.points || currentBoundary.points.length === 0) {
20455
- return null;
20456
- }
20457
- // 计算边界
20458
- let minX = Infinity;
20459
- let minY = Infinity;
20460
- let maxX = -Infinity;
20461
- let maxY = -Infinity;
20462
- currentBoundary.points.forEach((point) => {
20463
- minX = Math.min(minX, point[0]);
20464
- minY = Math.min(minY, point[1]);
20465
- maxX = Math.max(maxX, point[0]);
20466
- maxY = Math.max(maxY, point[1]);
20467
- });
20468
- // 添加边距
20469
- const padding = 50;
20470
- const width = maxX - minX + padding * 2;
20471
- const height = maxY - minY + padding * 2;
20472
- return {
20473
- x: minX - padding,
20474
- y: minY - padding,
20475
- width,
20476
- height,
20477
- };
20478
- }, [editMapInfo.selectElement]);
20479
20836
  console.log('directionInfo=>', directionInfo, mapJson);
20480
20837
  return (jsx(CustomModal, { maskClosable: false, titleCenter: true, title: `${zoneName} mowing direction`, open: open, width: 600, onCancel: () => {
20481
20838
  setOpen(false);
@@ -20485,18 +20842,7 @@ const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, o
20485
20842
  }, okText: "Confirm", cancelText: "Cancel", okButtonProps: { disabled: !canSave }, afterClose: () => {
20486
20843
  setDirections(ALL_DIRECTION_SELECTED);
20487
20844
  setAngle(MIN_DIRECTION_ANGLE);
20488
- }, 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: jsxs("div", { style: {
20489
- position: 'relative',
20490
- width: `${300 * (boundaryViewBox.width / boundaryViewBox.height)}px`,
20491
- height: '300px',
20492
- margin: '0 auto',
20493
- }, children: [boundaryViewBox && (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `${boundaryViewBox.x} ${boundaryViewBox.y} ${boundaryViewBox.width} ${boundaryViewBox.height}`, width: `${300 * (boundaryViewBox.width / boundaryViewBox.height)}px`, height: "300px", style: { position: 'absolute', inset: 0, pointerEvents: 'none' }, children: Object.keys(svgElementDatas)?.map((key) => {
20494
- return svgElementDatas[key]?.map((element) => {
20495
- if (key === DataType.VISION_OFF)
20496
- return null;
20497
- return (jsx(GElement, { type: key, data: svgElementDatas[key], children: jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
20498
- });
20499
- }) })), jsx(CharginPile, { mapData: mapJson, mapConfig: mapConfig, viewBox: boundaryViewBox || null, rotation: drag?.rotation })] }) }), jsx("div", { className: styles$3.luppan, children: jsx(MowDirection_L, { value: directions, angleValue: angle, optionAngle: optionAngle, onChange: (value) => {
20845
+ }, 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) => {
20500
20846
  console.log('valie=>', value);
20501
20847
  setDirections(value);
20502
20848
  } }) })] }), 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: {
@@ -20547,7 +20893,7 @@ const BoundaryInfo = ({ onHandleDelete }) => {
20547
20893
  return editMapInfo?.selectElement?.recBaseAngle;
20548
20894
  }, [editMapInfo.selectElement?.recBaseAngle]);
20549
20895
  console.log('height---->', editMapInfo?.selectElement, heightValue, edgeMowingValue);
20550
- return (jsxs("div", { className: styles$9.boundaryInfo, children: [jsx(Header, { handleDelete: onHandleDelete, handleFocus: onHandleFocus, type: editMapInfo.elementType }), jsx("div", { className: styles$9.nameEdit, children: jsx(NameEdit, { name: nameValue, onChange: (name) => {
20896
+ return (jsxs("div", { className: styles$9.boundaryInfo, children: [jsx(Header, { handleDelete: onHandleDelete, handleFocus: onHandleFocus, type: editMapInfo.elementType }), jsx("div", { className: styles$9.nameEdit, children: jsx(NameEdit, { title: "Boundary name", name: nameValue, onChange: (name) => {
20551
20897
  setEditMapInfo({
20552
20898
  ...editMapInfo,
20553
20899
  isShowDrag: false,
@@ -20607,6 +20953,11 @@ const TimePeriod = ({ value, onChange }) => {
20607
20953
  const [open, setOpen] = useState(false);
20608
20954
  const [radioValue, setRadioValue] = useState(RadioValue.LONG_TIME);
20609
20955
  console.log('time period->', date, radioValue);
20956
+ useEffect(() => {
20957
+ if (!open && date?.length !== 2) {
20958
+ setRadioValue(RadioValue.LONG_TIME);
20959
+ }
20960
+ }, [open]);
20610
20961
  return (jsxs("div", { className: styles$1.timePeriod, children: [jsxs("div", { className: styles$1.timePeriodHeader, children: [jsx("div", { className: styles$1.timePeriodTitle, children: "Enabled" }), jsx("div", { className: styles$1.timePeriodHandle, children: jsx(Switch, { checked: value.status === 1, onChange: (checked) => {
20611
20962
  onChange({
20612
20963
  ...value,
@@ -20630,15 +20981,11 @@ const TimePeriod = ({ value, onChange }) => {
20630
20981
  // endTimestamp: dayjs().add(1, 'hour').unix(),
20631
20982
  // });
20632
20983
  }
20633
- }, style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsx(Radio, { value: RadioValue.LONG_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: "\u957F\u65F6\u95F4\u5F00\u542F" }) }), jsx(Radio, { value: RadioValue.SHORT_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: jsx(DatePicker.RangePicker, { open: open, onOpenChange: (open) => {
20634
- if (!open) {
20635
- setRadioValue(RadioValue.LONG_TIME);
20636
- }
20984
+ }, style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsx(Radio, { value: RadioValue.LONG_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: "\u957F\u65F6\u95F4\u5F00\u542F" }) }), 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) => {
20637
20985
  setOpen(open);
20638
- }, value: date ? date : undefined, disabled: radioValue === RadioValue.LONG_TIME, showTime: { format: 'HH:mm' }, format: "MM/DD/YYYY HH:mm", preserveInvalidOnBlur: true, onChange: (dateValue, dateString) => {
20639
- console.log('change->', dateValue);
20986
+ }, onChange: (dateValue, dateString) => {
20987
+ setDate(dateValue);
20640
20988
  if (dateValue?.length === 2) {
20641
- setDate(dateValue);
20642
20989
  onChange({
20643
20990
  status: RadioValue.SHORT_TIME,
20644
20991
  startTimestamp: dateValue[0].unix(),
@@ -20679,7 +21026,7 @@ const ObstacleInfo = ({ onHandleDelete }) => {
20679
21026
  }, [editMapInfo.selectElement]);
20680
21027
  return (jsxs("div", { className: styles$9.obstacleInfo, children: [jsx(Header, { handleDelete: () => {
20681
21028
  onHandleDelete();
20682
- }, handleFocus: () => { }, type: editMapInfo.elementType }), jsx("div", { className: styles$9.nameEdit, children: jsx(NameEdit, { name: nameValue, onChange: (name) => {
21029
+ }, handleFocus: () => { }, type: editMapInfo.elementType }), jsx("div", { className: styles$9.nameEdit, children: jsx(NameEdit, { title: "Obstacle name", name: nameValue, onChange: (name) => {
20683
21030
  setEditMapInfo({
20684
21031
  ...editMapInfo,
20685
21032
  isShowDrag: false,
@@ -20829,7 +21176,7 @@ const HandleElementInfo = () => {
20829
21176
  const isUndoDisabled = useMemo(() => {
20830
21177
  if (editMapInfo?.elementType === DataType.OBSTACLE &&
20831
21178
  editMapInfo?.createMode === CreateStatus.CREATING) {
20832
- return !(editMapInfo?.currentHistoryIndex >= 0 && editMapInfo?.historyList?.length);
21179
+ return !(editMapInfo?.currentHistoryIndex > 0 && editMapInfo?.historyList?.length);
20833
21180
  }
20834
21181
  else {
20835
21182
  return !(editMapInfo?.currentHistoryIndex > 0 && editMapInfo?.historyList?.length);
@@ -20844,12 +21191,20 @@ const HandleElementInfo = () => {
20844
21191
  return !(editMapInfo?.currentHistoryIndex < editMapInfo?.historyList?.length - 1 &&
20845
21192
  editMapInfo?.historyList?.length);
20846
21193
  }, [editMapInfo?.currentHistoryIndex, editMapInfo?.historyList]);
20847
- const handleUndo = useCallback(() => {
21194
+ const handleUndo = useCallback((e) => {
21195
+ e.stopPropagation();
21196
+ e.preventDefault();
21197
+ if (isUndoDisabled)
21198
+ return;
20848
21199
  undo();
20849
- }, [undo]);
20850
- const handleRedo = useCallback(() => {
21200
+ }, [undo, isUndoDisabled]);
21201
+ const handleRedo = useCallback((e) => {
21202
+ e.stopPropagation();
21203
+ e.preventDefault();
21204
+ if (idRedoDisabled)
21205
+ return;
20851
21206
  redo();
20852
- }, [redo]);
21207
+ }, [redo, idRedoDisabled]);
20853
21208
  const renderElementData = useCallback((element) => {
20854
21209
  if (!editMapInfo.selectElement)
20855
21210
  return null;
@@ -21177,6 +21532,9 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21177
21532
  });
21178
21533
  const [overlay, setOverlay] = useState(null);
21179
21534
  const [overlayLayout, setOverlayLayout] = useState(null);
21535
+ const [overlayScale, setOverlayScale] = useState(1);
21536
+ // 参考zoom级别,在此级别时overlayScale=1,元素显示原始大小
21537
+ const REFERENCE_ZOOM = 19;
21180
21538
  const svgMapRef = useRef(null);
21181
21539
  const svgEditMapRef = useRef(null);
21182
21540
  const [editMapInfo, setEditMapInfo] = useState({
@@ -21260,6 +21618,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21260
21618
  mapJson,
21261
21619
  drag: defaultTransform,
21262
21620
  mapRef,
21621
+ overlayScale,
21263
21622
  };
21264
21623
  }, [
21265
21624
  sn,
@@ -21273,6 +21632,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21273
21632
  mapJson,
21274
21633
  defaultTransform,
21275
21634
  mapRef,
21635
+ overlayScale,
21276
21636
  ]);
21277
21637
  // console.log('svgElementDatas->', svgElementDatas, unStructMapData, commonValue);
21278
21638
  // 处理地图分区边界
@@ -21291,7 +21651,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21291
21651
  // }
21292
21652
  // return allBoundaryElements;
21293
21653
  // }, [mapJson]);
21294
- useMemo(() => antennaConfig, [antennaConfig]);
21295
21654
  const mowerPositionData = useMemo(() => {
21296
21655
  // realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
21297
21656
  if (!realTimeData || realTimeData.length === 0)
@@ -21504,6 +21863,38 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21504
21863
  useEffect(() => {
21505
21864
  setDrag(defaultTransform ?? { x: 0, y: 0, rotation: 0 });
21506
21865
  }, [defaultTransform]);
21866
+ // 监听地图zoom变化,计算缩放比例
21867
+ useEffect(() => {
21868
+ if (!mapRef)
21869
+ return;
21870
+ const updateScale = () => {
21871
+ const currentZoom = mapRef.getZoom();
21872
+ if (currentZoom === undefined)
21873
+ return;
21874
+ // 基于固定的参考zoom级别计算overlayScale
21875
+ const zoomDiff = currentZoom - REFERENCE_ZOOM;
21876
+ const scale = Math.pow(2, -zoomDiff); // 负数实现反向缩放
21877
+ setOverlayScale(scale);
21878
+ };
21879
+ // 使用lodash throttle进行节流处理: 100ms内只执行一次
21880
+ const handleZoomChanged = throttle$2(updateScale, 50);
21881
+ // 添加zoom监听
21882
+ const listener = mapRef.addListener('zoom_changed', handleZoomChanged);
21883
+ // 初始化时获取当前zoom
21884
+ updateScale();
21885
+ return () => {
21886
+ if (listener) {
21887
+ window.google.maps.event.removeListener(listener);
21888
+ }
21889
+ // 取消未执行的节流函数
21890
+ handleZoomChanged.cancel();
21891
+ };
21892
+ }, [mapRef]);
21893
+ useEffect(() => {
21894
+ if (!editMap) {
21895
+ setEditMapInfo(INIT_EDIT_MAP_INFO);
21896
+ }
21897
+ }, [editMap]);
21507
21898
  useEffect(() => {
21508
21899
  if (!mapJson)
21509
21900
  return;
@@ -21600,7 +21991,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21600
21991
  pre[cur] = parseFloat(curLayout);
21601
21992
  return pre;
21602
21993
  }, {});
21603
- // console.log('setedit svg ------------->', layout);
21604
21994
  if (layout?.width && layout?.height) {
21605
21995
  svgEditMapRef?.current?.adjustSvgSize?.(layout);
21606
21996
  setOverlayLayout(layout);
@@ -21609,4 +21999,4 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21609
21999
  });
21610
22000
  MowerMapRenderer.displayName = 'MowerMapRenderer';
21611
22001
 
21612
- export { MapDataProcessor, MowerMapRenderer, PathDataProcessor, calculateMapGpsCenter, estimateGpsFromMapBounds };
22002
+ export { BoundarySvgRender, MapDataProcessor, MowerMapRenderer, PathDataProcessor, calculateMapGpsCenter, estimateGpsFromMapBounds };