@fleet-frontend/mower-maps 0.2.0-beta.1 → 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 (42) hide show
  1. package/dist/index.esm.js +578 -139
  2. package/dist/index.js +578 -138
  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 +21 -54
  6. package/dist/src/context/mapEdit.d.ts.map +1 -1
  7. package/dist/src/index.d.ts +1 -0
  8. package/dist/src/index.d.ts.map +1 -1
  9. package/dist/src/render/BoundarySvgRender.d.ts +10 -0
  10. package/dist/src/render/BoundarySvgRender.d.ts.map +1 -0
  11. package/dist/src/render/MowerMapRenderer.d.ts.map +1 -1
  12. package/dist/src/render/svgEditMap/components/AddEntry/components/DoodleModal/index.d.ts +1 -1
  13. package/dist/src/render/svgEditMap/components/AddEntry/components/DoodleModal/index.d.ts.map +1 -1
  14. package/dist/src/render/svgEditMap/components/AddEntry/index.d.ts.map +1 -1
  15. package/dist/src/render/svgEditMap/components/HandleElementInfo/boundary.d.ts.map +1 -1
  16. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/index.d.ts.map +1 -1
  17. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/Header/index.d.ts +1 -1
  18. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/Header/index.d.ts.map +1 -1
  19. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts +2 -1
  20. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts.map +1 -1
  21. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts +2 -1
  22. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts.map +1 -1
  23. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/TimePeriod/index.d.ts.map +1 -1
  24. package/dist/src/render/svgEditMap/components/HandleElementInfo/index.d.ts.map +1 -1
  25. package/dist/src/render/svgEditMap/components/HandleElementInfo/obstacle.d.ts.map +1 -1
  26. package/dist/src/render/svgEditMap/index.d.ts +2 -0
  27. package/dist/src/render/svgEditMap/index.d.ts.map +1 -1
  28. package/dist/src/render/svgElement/ChannelClipPath/index.d.ts.map +1 -1
  29. package/dist/src/render/svgElement/DoodleElement/index.d.ts.map +1 -1
  30. package/dist/src/render/svgElement/ObstacleElement/index.d.ts.map +1 -1
  31. package/dist/src/render/svgElement/PolygonELement/components/DistanceLabels.d.ts.map +1 -1
  32. package/dist/src/render/svgElement/PolygonELement/dashPath/index.d.ts.map +1 -1
  33. package/dist/src/render/svgElement/PolygonELement/index.d.ts +1 -1
  34. package/dist/src/render/svgElement/PolygonELement/index.d.ts.map +1 -1
  35. package/dist/src/render/svgElement/PolygonELement/vertex/index.d.ts.map +1 -1
  36. package/dist/src/render/svgElement/TransformWrapper/DoodleTransformWrapper/DoodleTransformWrapper.d.ts +1 -0
  37. package/dist/src/render/svgElement/TransformWrapper/DoodleTransformWrapper/DoodleTransformWrapper.d.ts.map +1 -1
  38. package/dist/src/render/svgElement/TransformWrapper/VisionOffTransformWrapper/VisionOffTransformWrapper.d.ts.map +1 -1
  39. package/dist/src/render/svgElement/VisionOffElement/index.d.ts.map +1 -1
  40. package/dist/src/types/renderer.d.ts +4 -1
  41. package/dist/src/types/renderer.d.ts.map +1 -1
  42. 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) => {
@@ -14925,23 +15197,20 @@ var MobileEditMode;
14925
15197
  MobileEditMode[MobileEditMode["EDIT"] = 1] = "EDIT";
14926
15198
  MobileEditMode[MobileEditMode["CREATE"] = 2] = "CREATE";
14927
15199
  })(MobileEditMode || (MobileEditMode = {}));
15200
+ var ClickEventType;
15201
+ (function (ClickEventType) {
15202
+ ClickEventType["DOODLE_ACTIVE_TIME"] = "doodleActiveTime";
15203
+ })(ClickEventType || (ClickEventType = {}));
14928
15204
  const INIT_EDIT_MAP_INFO = {
14929
- minDistance: 0,
14930
15205
  editMap: false,
14931
15206
  selectElement: null,
14932
- createMode: CreateStatus.CREATING,
15207
+ createMode: null,
14933
15208
  elementType: undefined,
14934
15209
  isShowDrag: false,
14935
15210
  mobileMode: MobileEditMode.START,
14936
15211
  allVisionOffPoints: [],
14937
15212
  historyList: [],
14938
15213
  currentHistoryIndex: 0,
14939
- onHandleEnterRecord: () => Promise.resolve(),
14940
- onHandleCompleteRecord: () => Promise.resolve(),
14941
- onHandleStopRecord: () => Promise.resolve(),
14942
- onSaveBoundaryData: () => Promise.resolve(),
14943
- onSaveMap: () => Promise.resolve(),
14944
- onHandleDeleteElement: () => Promise.resolve(),
14945
15214
  };
14946
15215
  const MapEditContext = createContext({
14947
15216
  editMapInfo: { ...INIT_EDIT_MAP_INFO },
@@ -15459,8 +15728,9 @@ const createPathData = (points) => {
15459
15728
  }
15460
15729
  return pathData;
15461
15730
  };
15462
- 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自动判断
15463
15732
  }) => {
15733
+ const { overlayScale } = useCommonContext();
15464
15734
  const { svgRef } = useSvgEditContext();
15465
15735
  const [dragState, setDragState] = useState({
15466
15736
  isDragging: false,
@@ -15476,6 +15746,10 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15476
15746
  const { checkCanNotCreateAtPosition } = useCheckElement();
15477
15747
  const { editMapInfo } = useMapEditContext();
15478
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]);
15479
15753
  // 计算点到线段的垂足坐标(使用通用工具函数)
15480
15754
  const calculatePerpendicularFoot$1 = useCallback((point, lineStart, lineEnd) => {
15481
15755
  return calculatePerpendicularFoot(point, lineStart, lineEnd);
@@ -15677,7 +15951,9 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15677
15951
  console.log('handleMouseUp', JSON.stringify(dragState));
15678
15952
  if (dragState.isDragging && dragState.currentPosition) {
15679
15953
  // 构建新的坐标数组
15680
- const newCoordinates = [...coordinates];
15954
+ const newCoordinates = editMapInfo?.createMode === CreateStatus.CREATING
15955
+ ? [...coordinates]
15956
+ : [...coordinates].reverse();
15681
15957
  // 如果是新创建的顶点,需要确保它已经被插入
15682
15958
  if (dragState.dragType === 'new' && dragState.newVertexIndex !== -1) {
15683
15959
  if (showNotCreateCursor) ;
@@ -15709,7 +15985,7 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15709
15985
  edgeInfo: null,
15710
15986
  dragType: null,
15711
15987
  });
15712
- }, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor]);
15988
+ }, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor, editMapInfo?.createMode]);
15713
15989
  // 添加全局事件监听(支持触摸和鼠标事件)
15714
15990
  useEffect(() => {
15715
15991
  if (dragState.isDragging) {
@@ -15781,24 +16057,17 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15781
16057
  mousePos.y,
15782
16058
  ])
15783
16059
  : null;
15784
- const ghostFirstDistance = createMode &&
15785
- mousePos &&
15786
- renderCoordinates.length > 0 &&
15787
- !completed &&
15788
- renderCoordinates.length >= 3
16060
+ const ghostFirstDistance = createMode && mousePos && !completed && renderCoordinates.length >= 1
15789
16061
  ? calculatePhysicalDistance(renderCoordinates[0], [mousePos.x, mousePos.y])
15790
16062
  : null;
15791
16063
  // 虚拟连线的中点坐标
15792
16064
  const ghostLastMidpoint = createMode && mousePos && renderCoordinates.length > 0 && !completed
15793
16065
  ? calculateMidpoint(renderCoordinates[renderCoordinates.length - 1], [mousePos.x, mousePos.y])
15794
16066
  : null;
15795
- const ghostFirstMidpoint = createMode &&
15796
- mousePos &&
15797
- renderCoordinates.length > 0 &&
15798
- !completed &&
15799
- renderCoordinates.length >= 3
16067
+ const ghostFirstMidpoint = createMode && mousePos && !completed && renderCoordinates.length >= 1
15800
16068
  ? calculateMidpoint(renderCoordinates[0], [mousePos.x, mousePos.y])
15801
16069
  : null;
16070
+ console.log('ghostFirstMidpoint', ghostFirstMidpoint, ghostFirstDistance);
15802
16071
  return (jsxs(Fragment, { children: [(editMode || (createMode && completed)) &&
15803
16072
  dragState.isDragging &&
15804
16073
  dragState.dragType !== 'new' &&
@@ -15850,14 +16119,14 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15850
16119
  setHoverVertex(null);
15851
16120
  },
15852
16121
  }) }, `edge-${index}`));
15853
- }), 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)) &&
15854
16123
  renderCoordinates.map((coord, idx) => {
15855
16124
  // 判断当前顶点的状态
15856
16125
  const isLastPoint = idx === renderCoordinates.length - 1;
15857
16126
  const canComplete = createMode && !completed && renderCoordinates.length >= 3 && isLastPoint;
15858
16127
  const isCreatedAndCanDrag = createMode && completed; // 创建完成后可拖拽
15859
16128
  const isInEditMode = editMode;
15860
- 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) => {
15861
16130
  // 阻止双击事件冒泡到Google Maps
15862
16131
  e.preventDefault();
15863
16132
  e.stopPropagation();
@@ -15905,7 +16174,18 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15905
16174
  }
15906
16175
  }
15907
16176
  },
15908
- }) }), 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) => {
15909
16189
  e.preventDefault();
15910
16190
  e.stopPropagation();
15911
16191
  if (onVertexDelete &&
@@ -15914,7 +16194,19 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15914
16194
  onVertexDelete(idx);
15915
16195
  }
15916
16196
  setTooltipIndex(null);
15917
- }, 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}`));
15918
16210
  })] }));
15919
16211
  };
15920
16212
 
@@ -15966,7 +16258,7 @@ const BoundaryElement = ({ data }) => {
15966
16258
  }));
15967
16259
  }
15968
16260
  }, [platform, data, editMapInfo]);
15969
- 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) => {
15970
16262
  console.log('onCoordinatesChange', coordinates);
15971
16263
  setEditMapInfo((prev) => ({
15972
16264
  ...prev,
@@ -16101,6 +16393,7 @@ const ObstacleElement = ({ data }) => {
16101
16393
  }
16102
16394
  }, [editMapInfo]);
16103
16395
  const currentPoints = useMemo(() => {
16396
+ // 为了方便解决删除顶点的时候,delete icon被遮挡的问题,所以逆序一下
16104
16397
  if (editMapInfo?.selectElement?.id === data.id) {
16105
16398
  return editMapInfo.selectElement.points;
16106
16399
  }
@@ -16144,7 +16437,11 @@ const ObstacleElement = ({ data }) => {
16144
16437
  setEditMapInfo((prev) => ({
16145
16438
  ...prev,
16146
16439
  selectElement: data,
16147
- historyList: [data],
16440
+ historyList: [
16441
+ {
16442
+ selectElement: data,
16443
+ },
16444
+ ],
16148
16445
  currentHistoryIndex: 0,
16149
16446
  elementType: DataType.OBSTACLE,
16150
16447
  editMap: true,
@@ -16158,7 +16455,7 @@ const ObstacleElement = ({ data }) => {
16158
16455
  }
16159
16456
  return editMapInfo?.selectElement?.id === data.id;
16160
16457
  }, [editMapInfo, data, platform]);
16161
- 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: () => {
16162
16459
  if (platform === PlatformType.H5) {
16163
16460
  onPathClick();
16164
16461
  }
@@ -16747,6 +17044,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
16747
17044
  };
16748
17045
 
16749
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();
16750
17048
  const { platform } = useCommonContext();
16751
17049
  const { editMapInfo } = useMapEditContext();
16752
17050
  const dataPoints = useMemo(() => {
@@ -16862,7 +17160,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
16862
17160
  return;
16863
17161
  onDragMove?.(currentPoints.map((point) => [point.x, point.y]));
16864
17162
  }, [currentPoints, isSelected, isDragging, isRotating, isScaling]);
16865
- 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: () => {
16866
17164
  onSelect?.();
16867
17165
  }, onPolygonClick: () => {
16868
17166
  if (platform === PlatformType.H5) {
@@ -16891,9 +17189,9 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
16891
17189
  const infoBoxWidth = 140; // 信息框宽度
16892
17190
  const infoBoxHeight = 30; // 信息框高度
16893
17191
  const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
16894
- const scale = isWeb ? 2 : 1;
17192
+ const scale = (isWeb ? 2 : 1) * overlayScale;
16895
17193
  const offsetLeft = 10 * scale;
16896
- 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
16897
17195
  ? {
16898
17196
  onTouchStart: createReactEventHandler((e) => {
16899
17197
  handleMouseDownWithDisabled(e);
@@ -17000,7 +17298,11 @@ const VisionOffElement = ({ data, onSelect }) => {
17000
17298
  ...prev,
17001
17299
  selectElement: data,
17002
17300
  elementType: DataType.VISION_OFF,
17003
- historyList: [data],
17301
+ historyList: [
17302
+ {
17303
+ selectElement: data,
17304
+ },
17305
+ ],
17004
17306
  currentHistoryIndex: 0,
17005
17307
  editMap: true,
17006
17308
  isShowDrag: true,
@@ -17464,7 +17766,7 @@ const DoodleTransform = ({ data, isSelected: _isSelected, onSelect }) => {
17464
17766
  }
17465
17767
  };
17466
17768
 
17467
- const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOperation = false, onSelect, onCancel, onTransformChange, disabled = false, className = '', minScale, onMinScaleReached, onDragMove, onDragEnd, showInfo = true, }) => {
17769
+ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOperation = false, onSelect, onCancel, onTransformChange, disabled = false, className = '', minScale, onMinScaleReached, onDragMove, onDragEnd, showInfo = true, onClickInfo, }) => {
17468
17770
  const { platform } = useCommonContext();
17469
17771
  // 使用自定义hook管理所有变换逻辑
17470
17772
  const { currentCenter, currentScale, currentDirection, isDragging, isRotating, isScaling, initializeTransform, calculateSelectionBoxPoints, handleMouseDown, handleRotateStart, handleScaleStart, handleMouseMove, handleMouseUp, containerRef, dimensions, } = useDoodleTransform(data, onTransformChange, {
@@ -17486,6 +17788,17 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
17486
17788
  };
17487
17789
  }, [data?.svg, currentCenter, currentScale, currentDirection]);
17488
17790
  const isWeb = useMemo(() => platform === 'web', [platform]);
17791
+ const activeTime = useMemo(() => {
17792
+ // 如果当前时间在有效期范围,则显示有效期,否则显示0
17793
+ const now = Date.now();
17794
+ console.log('now------->', now);
17795
+ console.log('data.create_ts------->', data.create_ts);
17796
+ console.log('data.expiration_ts------->', data.expiration_ts);
17797
+ if (data.create_ts <= now && data.expiration_ts >= now) {
17798
+ return Math.floor((data.expiration_ts - now) / (60 * 60 * 24 * 1000));
17799
+ }
17800
+ return 0;
17801
+ }, [data]);
17489
17802
  // 初始化变换状态
17490
17803
  useEffect(() => {
17491
17804
  initializeTransform();
@@ -17503,6 +17816,7 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
17503
17816
  onEnd: (event) => {
17504
17817
  event.preventDefault();
17505
17818
  handleMouseUp();
17819
+ onDragEnd?.(transformedData);
17506
17820
  },
17507
17821
  }, platform);
17508
17822
  document.body.style.userSelect = 'none';
@@ -17666,7 +17980,9 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
17666
17980
  }
17667
17981
  : {
17668
17982
  onMouseDown: handleScaleStartWithDisabled,
17669
- }), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsx(SvgTransformScale, {}) }) }), showInfo && (jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, children: jsxs("div", { style: {
17983
+ }), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsx(SvgTransformScale, {}) }) }), showInfo && (jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
17984
+ onClickInfo?.();
17985
+ }, children: jsxs("div", { style: {
17670
17986
  padding: '5px 6px',
17671
17987
  background: 'linear-gradient(266.64deg, #F26A2A 4.1%, #F2942A 86.42%)',
17672
17988
  borderRadius: '10px',
@@ -17682,12 +17998,12 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
17682
17998
  alignItems: 'center',
17683
17999
  justifyContent: 'center',
17684
18000
  gap: '10px',
17685
- }, children: [jsx("div", { children: "Active Time:3" }), jsx(SvgTransformArrow, {})] })] }) }))] }));
18001
+ }, children: [jsxs("div", { children: ["Active Time: ", activeTime] }), jsx(SvgTransformArrow, {})] })] }) }))] }));
17686
18002
  })()] }));
17687
18003
  };
17688
18004
 
17689
18005
  const DoodleElement = ({ data }) => {
17690
- const { editMapInfo, setEditMapInfo, onHandleEnterRecord } = useMapEditContext();
18006
+ const { editMapInfo, setEditMapInfo, onHandleEnterRecord, onClickEvent } = useMapEditContext();
17691
18007
  const { addHistory } = useHistoryHandle();
17692
18008
  const { platform } = useCommonContext();
17693
18009
  const isSelected = useMemo(() => {
@@ -17723,9 +18039,8 @@ const DoodleElement = ({ data }) => {
17723
18039
  if (platform === PlatformType.H5) {
17724
18040
  // h5编辑模式下,
17725
18041
  // 如果是创建,只能选择新建的doodle
17726
- if ((editMapInfo.mobileMode === MobileEditMode.CREATE ||
17727
- editMapInfo.mobileMode === MobileEditMode.EDIT) &&
17728
- editMapInfo.elementType !== DataType.DOODLE) {
18042
+ if (editMapInfo.mobileMode === MobileEditMode.CREATE ||
18043
+ editMapInfo.mobileMode === MobileEditMode.EDIT) {
17729
18044
  return;
17730
18045
  }
17731
18046
  // 如果是编辑的话
@@ -17746,7 +18061,14 @@ const DoodleElement = ({ data }) => {
17746
18061
  })?.then(() => {
17747
18062
  setEditMapInfo((prev) => ({
17748
18063
  ...prev,
17749
- historyList: [data],
18064
+ historyList: [
18065
+ {
18066
+ selectElement: {
18067
+ ...data,
18068
+ transformedPoints: transformedElements,
18069
+ },
18070
+ },
18071
+ ],
17750
18072
  currentHistoryIndex: 0,
17751
18073
  selectElement: {
17752
18074
  ...data,
@@ -17759,6 +18081,16 @@ const DoodleElement = ({ data }) => {
17759
18081
  });
17760
18082
  }, [data, onHandleEnterRecord, platform, editMapInfo]);
17761
18083
  const handleCancel = useCallback(() => {
18084
+ if (platform === PlatformType.H5) {
18085
+ setEditMapInfo((prev) => ({
18086
+ ...prev,
18087
+ selectElement: null,
18088
+ }));
18089
+ addHistory({
18090
+ selectElement: null,
18091
+ });
18092
+ return;
18093
+ }
17762
18094
  setEditMapInfo((prev) => ({
17763
18095
  ...prev,
17764
18096
  editMap: false,
@@ -17767,6 +18099,9 @@ const DoodleElement = ({ data }) => {
17767
18099
  isShowDrag: false,
17768
18100
  }));
17769
18101
  }, []);
18102
+ const handleClickInfo = useCallback(() => {
18103
+ onClickEvent?.(ClickEventType.DOODLE_ACTIVE_TIME);
18104
+ }, [onClickEvent]);
17770
18105
  // const handleDragMove = useCallback(
17771
18106
  // (data: DoodleData) => {
17772
18107
  // setEditMapInfo((prev: EditMapInfo) => ({
@@ -17794,7 +18129,7 @@ const DoodleElement = ({ data }) => {
17794
18129
  },
17795
18130
  });
17796
18131
  }, [transformedElements]);
17797
- return (jsx(DoodleTransformWrapper, { data: originData, onTransformChange: handleTransformChange, isSelected: isSelected, isSelectedWithoutOperation: isSelectedWithoutOperation, onSelect: handleSelect, onCancel: handleCancel, onDragEnd: handleDragEnd, showInfo: platform === PlatformType.H5 }));
18132
+ return (jsx(DoodleTransformWrapper, { data: originData, onTransformChange: handleTransformChange, isSelected: isSelected, isSelectedWithoutOperation: isSelectedWithoutOperation, onSelect: handleSelect, onCancel: handleCancel, onDragEnd: handleDragEnd, showInfo: platform === PlatformType.H5, onClickInfo: handleClickInfo }));
17798
18133
  };
17799
18134
 
17800
18135
  const SvgElement = React__default.memo(({ type, data, interactive = false }) => {
@@ -17925,12 +18260,7 @@ var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
17925
18260
 
17926
18261
  const ChannelClipPath = React__default.memo(() => {
17927
18262
  const { svgElementDatas, svgRef } = useSvgEditContext();
17928
- const { editMapInfo } = useMapEditContext();
17929
18263
  const boundaryData = svgElementDatas?.[DataType.BOUNDARY] || [];
17930
- useEffect(() => {
17931
- console.log('ChannelClipPath', svgElementDatas);
17932
- }, [svgElementDatas]);
17933
- // console.log('ChannelClipPath refresh', svgElementDatas, editMapInfo);
17934
18264
  const [minX, minY, maxX, maxY] = useMemo(() => {
17935
18265
  const baseVal = svgRef?.viewBox.baseVal;
17936
18266
  return [
@@ -17939,7 +18269,13 @@ const ChannelClipPath = React__default.memo(() => {
17939
18269
  baseVal?.x + (baseVal?.width || 0),
17940
18270
  baseVal?.y + (baseVal?.height || 0),
17941
18271
  ];
17942
- }, [svgRef?.viewBox.baseVal?.x]);
18272
+ }, [
18273
+ svgRef?.viewBox.baseVal?.x,
18274
+ svgRef?.viewBox.baseVal?.y,
18275
+ svgRef?.viewBox.baseVal?.width,
18276
+ svgRef?.viewBox.baseVal?.height,
18277
+ ]);
18278
+ console.log('boundaryData---->', svgRef?.viewBox.baseVal);
17943
18279
  /**
17944
18280
  * 判断多边形是否为逆时针方向
17945
18281
  * 使用叉积法计算多边形的有向面积
@@ -19081,7 +19417,7 @@ const CreateObstacleElement = forwardRef(({ enabled = false, svgElement, onPoint
19081
19417
  if (!enabled || points.length === 0) {
19082
19418
  return null;
19083
19419
  }
19084
- 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 }));
19085
19421
  });
19086
19422
  CreateObstacleElement.displayName = 'CreateObstacleElement';
19087
19423
 
@@ -19135,7 +19471,7 @@ const useCreateVisionOffElement = () => {
19135
19471
  const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChange }, ref) => {
19136
19472
  const pointManagerRef = useRef(null);
19137
19473
  const { editMapInfo, setEditMapInfo } = useMapEditContext();
19138
- const { getVisionOffPoints } = useCreateVisionOffElement();
19474
+ const { getVisionOffPoints, centerPoint } = useCreateVisionOffElement();
19139
19475
  const { svgElementDatas } = useSvgEditContext();
19140
19476
  const { checkCanNotCreateAtPosition } = useCheckElement();
19141
19477
  const svgRef = useRef(null);
@@ -19236,6 +19572,28 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19236
19572
  allVisionOffPoints,
19237
19573
  });
19238
19574
  };
19575
+ const addDoodle = (selectedDoodle) => {
19576
+ const newDoodle = initDoodle();
19577
+ const svg = selectedDoodle?.svgStr;
19578
+ const minLength = selectedDoodle.minLength;
19579
+ const parseSvg = SvgParserNative.parseSvg(svg);
19580
+ const svgMinLength = Math.min(parseSvg.width, parseSvg.height) / SCALE_FACTOR;
19581
+ // 使用获取到的 SVG 内容,如果没有获取到则使用 URL
19582
+ newDoodle.svg = svg;
19583
+ newDoodle.scale = minLength / svgMinLength;
19584
+ newDoodle.direction = 0;
19585
+ newDoodle.center = restorePoint(centerPoint);
19586
+ setEditMapInfo((prev) => ({
19587
+ ...prev,
19588
+ currentHistoryIndex: 0,
19589
+ mobileMode: MobileEditMode.CREATE,
19590
+ elementType: DataType.DOODLE,
19591
+ selectElement: newDoodle,
19592
+ }));
19593
+ addHistory({
19594
+ selectElement: newDoodle,
19595
+ });
19596
+ };
19239
19597
  useEffect(() => {
19240
19598
  onEditInfoMapChange?.(editMapInfo);
19241
19599
  }, [editMapInfo]);
@@ -19270,6 +19628,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19270
19628
  // 清空历史记录
19271
19629
  clearHistory,
19272
19630
  addHistory,
19631
+ addDoodle,
19273
19632
  }));
19274
19633
  // 初始化多边形绘制 Hook
19275
19634
  const { onSvgClick, onSvgMouseMove, onPointClick, points, completed, mousePos, updatePoints } = usePolygonDrawing({ createMode: isCreating });
@@ -19299,6 +19658,9 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19299
19658
  // pointerEvents: 'auto', // 关键:允许接收鼠标事件
19300
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)
19301
19660
  ?.sort?.((a, b) => {
19661
+ if (a === DataType.BOUNDARY || b === DataType.BOUNDARY) {
19662
+ return 0;
19663
+ }
19302
19664
  const aVal = a === editMapInfo.elementType ? 1 : 0;
19303
19665
  const bVal = b === editMapInfo.elementType ? 1 : 0;
19304
19666
  return aVal - bVal;
@@ -19310,7 +19672,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19310
19672
  editMapInfo.createMode &&
19311
19673
  editMapInfo.elementType !== DataType.DOODLE &&
19312
19674
  editMapInfo.elementType !== DataType.VISION_OFF &&
19313
- (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
19314
19676
  ? points.map((p) => [p.x, p.y, 2])
19315
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) => {
19316
19678
  // 创建模式下的坐标变化(拖拽时)
@@ -19375,7 +19737,10 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19375
19737
  },
19376
19738
  points: item.points,
19377
19739
  id: item.id,
19378
- } })))] }) }));
19740
+ } }))), platform === PlatformType.H5 &&
19741
+ editMapInfo.elementType === DataType.DOODLE &&
19742
+ editMapInfo.mobileMode === MobileEditMode.CREATE &&
19743
+ editMapInfo?.selectElement?.svg && (jsx(DoodleElement, { data: { ...editMapInfo?.selectElement } }))] }) }));
19379
19744
  });
19380
19745
  SvgEditMap.displayName = 'SvgEditMap';
19381
19746
 
@@ -19728,7 +20093,11 @@ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
19728
20093
  })?.then(() => {
19729
20094
  setEditMapInfo({
19730
20095
  ...editMapInfo,
19731
- historyList: [newDoodle],
20096
+ historyList: [
20097
+ {
20098
+ selectElement: newDoodle,
20099
+ },
20100
+ ],
19732
20101
  currentHistoryIndex: 0,
19733
20102
  createMode: CreateStatus.COMPLETED,
19734
20103
  elementType: DataType.DOODLE,
@@ -19810,7 +20179,11 @@ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
19810
20179
  })?.then(() => {
19811
20180
  setEditMapInfo({
19812
20181
  ...editMapInfo,
19813
- historyList: [newElement],
20182
+ historyList: [
20183
+ {
20184
+ selectElement: newElement,
20185
+ },
20186
+ ],
19814
20187
  currentHistoryIndex: 0,
19815
20188
  createMode: type === DataType.VISION_OFF ? CreateStatus.COMPLETED : CreateStatus.CREATING,
19816
20189
  elementType: type,
@@ -19839,11 +20212,11 @@ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
19839
20212
  }), children: jsx("div", { className: styles$c.icon, children: jsx(SvgAddEntry, {}) }) }), jsx(DoodleModal, { centerPoint: centerPoint, doodleList: doodleList, open: doodleOpen, onOk: () => setDoodleOpen(false), setOpen: setDoodleOpen })] }));
19840
20213
  };
19841
20214
 
19842
- 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}";
19843
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"};
19844
20217
  styleInject(css_248z$9);
19845
20218
 
19846
- 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}";
19847
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"};
19848
20221
  styleInject(css_248z$8);
19849
20222
 
@@ -19875,7 +20248,7 @@ var SvgDelete = function SvgDelete(props) {
19875
20248
  })));
19876
20249
  };
19877
20250
 
19878
- const Header = ({ handleDelete, handleFocus, showFocus = false, showDelete = true, type }) => {
20251
+ const Header = ({ handleDelete, handleFocus, showFocus = false, showDelete = true, type, }) => {
19879
20252
  const currentType = useMemo(() => {
19880
20253
  return DATE_TYPE_MAP.find((item) => item.type === type);
19881
20254
  }, [type]);
@@ -19900,14 +20273,14 @@ var SvgEdit = function SvgEdit(props) {
19900
20273
  })));
19901
20274
  };
19902
20275
 
19903
- const NameModal = ({ name, open, setOpen, onOk }) => {
20276
+ const NameModal = ({ title, name, open, setOpen, onOk }) => {
19904
20277
  const [nameValue, setNameValue] = useState('');
19905
20278
  useEffect(() => {
19906
20279
  if (open) {
19907
20280
  setNameValue(name || '');
19908
20281
  }
19909
20282
  }, [name, open]);
19910
- return (jsx(CustomModal, { title: `${name}`, titleCenter: true, open: open, onOk: () => {
20283
+ return (jsx(CustomModal, { title: `${title}`, titleCenter: true, open: open, onOk: () => {
19911
20284
  onOk?.(nameValue);
19912
20285
  setOpen(false);
19913
20286
  }, onCancel: () => setOpen(false), okText: "Confirm", afterClose: () => {
@@ -19915,9 +20288,9 @@ const NameModal = ({ name, open, setOpen, onOk }) => {
19915
20288
  }, children: jsx(Input, { maxLength: 120, showCount: true, placeholder: "Please enter boundary name", value: nameValue, onChange: (e) => setNameValue(e.target.value) }) }));
19916
20289
  };
19917
20290
 
19918
- const NameEdit = ({ name, onChange }) => {
20291
+ const NameEdit = ({ title, name, onChange }) => {
19919
20292
  const [open, setOpen] = React__default.useState(false);
19920
- 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 })] }));
19921
20294
  };
19922
20295
 
19923
20296
  var _path$3;
@@ -20038,7 +20411,7 @@ const HeightModal = ({ zoneName, open, setOpen, onChange, value, heightOptions,
20038
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 }) })] })] }) }) }));
20039
20412
  };
20040
20413
 
20041
- 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}";
20042
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"};
20043
20416
  styleInject(css_248z$3);
20044
20417
 
@@ -20371,10 +20744,71 @@ const MowDirection_L = (props) => {
20371
20744
  }, children: [jsx("div", { className: styles$2.leftTop, children: jsx(SvgOption, {}) }), jsx("div", { className: styles$2.rightBottom, children: jsx(SvgOption, {}) })] })] }) }) }));
20372
20745
  };
20373
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
+
20374
20809
  const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, onChange, }) => {
20375
- const { mapJson, mapConfig, drag } = useCommonContext();
20810
+ const { mapJson, mapConfig } = useCommonContext();
20376
20811
  const { editMapInfo } = useMapEditContext();
20377
- const { svgElementDatas } = useSvgEditContext();
20378
20812
  const [directions, setDirections] = useState(ALL_DIRECTION_SELECTED);
20379
20813
  const [angle, setAngle] = useState(MIN_DIRECTION_ANGLE);
20380
20814
  const canSetDefault = useMemo(() => {
@@ -20399,34 +20833,6 @@ const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, o
20399
20833
  setAngle(defaultAngle);
20400
20834
  }
20401
20835
  };
20402
- // 计算当前boundary的viewBox
20403
- const boundaryViewBox = useMemo(() => {
20404
- const currentBoundary = editMapInfo.selectElement;
20405
- if (!currentBoundary?.points || currentBoundary.points.length === 0) {
20406
- return null;
20407
- }
20408
- // 计算边界
20409
- let minX = Infinity;
20410
- let minY = Infinity;
20411
- let maxX = -Infinity;
20412
- let maxY = -Infinity;
20413
- currentBoundary.points.forEach((point) => {
20414
- minX = Math.min(minX, point[0]);
20415
- minY = Math.min(minY, point[1]);
20416
- maxX = Math.max(maxX, point[0]);
20417
- maxY = Math.max(maxY, point[1]);
20418
- });
20419
- // 添加边距
20420
- const padding = 50;
20421
- const width = maxX - minX + padding * 2;
20422
- const height = maxY - minY + padding * 2;
20423
- return {
20424
- x: minX - padding,
20425
- y: minY - padding,
20426
- width,
20427
- height,
20428
- };
20429
- }, [editMapInfo.selectElement]);
20430
20836
  console.log('directionInfo=>', directionInfo, mapJson);
20431
20837
  return (jsx(CustomModal, { maskClosable: false, titleCenter: true, title: `${zoneName} mowing direction`, open: open, width: 600, onCancel: () => {
20432
20838
  setOpen(false);
@@ -20436,18 +20842,7 @@ const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, o
20436
20842
  }, okText: "Confirm", cancelText: "Cancel", okButtonProps: { disabled: !canSave }, afterClose: () => {
20437
20843
  setDirections(ALL_DIRECTION_SELECTED);
20438
20844
  setAngle(MIN_DIRECTION_ANGLE);
20439
- }, 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: {
20440
- position: 'relative',
20441
- width: `${300 * (boundaryViewBox.width / boundaryViewBox.height)}px`,
20442
- height: '300px',
20443
- margin: '0 auto',
20444
- }, 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) => {
20445
- return svgElementDatas[key]?.map((element) => {
20446
- if (key === DataType.VISION_OFF)
20447
- return null;
20448
- return (jsx(GElement, { type: key, data: svgElementDatas[key], children: jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
20449
- });
20450
- }) })), 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) => {
20451
20846
  console.log('valie=>', value);
20452
20847
  setDirections(value);
20453
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: {
@@ -20498,7 +20893,7 @@ const BoundaryInfo = ({ onHandleDelete }) => {
20498
20893
  return editMapInfo?.selectElement?.recBaseAngle;
20499
20894
  }, [editMapInfo.selectElement?.recBaseAngle]);
20500
20895
  console.log('height---->', editMapInfo?.selectElement, heightValue, edgeMowingValue);
20501
- 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) => {
20502
20897
  setEditMapInfo({
20503
20898
  ...editMapInfo,
20504
20899
  isShowDrag: false,
@@ -20558,6 +20953,11 @@ const TimePeriod = ({ value, onChange }) => {
20558
20953
  const [open, setOpen] = useState(false);
20559
20954
  const [radioValue, setRadioValue] = useState(RadioValue.LONG_TIME);
20560
20955
  console.log('time period->', date, radioValue);
20956
+ useEffect(() => {
20957
+ if (!open && date?.length !== 2) {
20958
+ setRadioValue(RadioValue.LONG_TIME);
20959
+ }
20960
+ }, [open]);
20561
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) => {
20562
20962
  onChange({
20563
20963
  ...value,
@@ -20581,15 +20981,11 @@ const TimePeriod = ({ value, onChange }) => {
20581
20981
  // endTimestamp: dayjs().add(1, 'hour').unix(),
20582
20982
  // });
20583
20983
  }
20584
- }, 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) => {
20585
- if (!open) {
20586
- setRadioValue(RadioValue.LONG_TIME);
20587
- }
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) => {
20588
20985
  setOpen(open);
20589
- }, value: date ? date : undefined, disabled: radioValue === RadioValue.LONG_TIME, showTime: { format: 'HH:mm' }, format: "MM/DD/YYYY HH:mm", preserveInvalidOnBlur: true, onChange: (dateValue, dateString) => {
20590
- console.log('change->', dateValue);
20986
+ }, onChange: (dateValue, dateString) => {
20987
+ setDate(dateValue);
20591
20988
  if (dateValue?.length === 2) {
20592
- setDate(dateValue);
20593
20989
  onChange({
20594
20990
  status: RadioValue.SHORT_TIME,
20595
20991
  startTimestamp: dateValue[0].unix(),
@@ -20630,7 +21026,7 @@ const ObstacleInfo = ({ onHandleDelete }) => {
20630
21026
  }, [editMapInfo.selectElement]);
20631
21027
  return (jsxs("div", { className: styles$9.obstacleInfo, children: [jsx(Header, { handleDelete: () => {
20632
21028
  onHandleDelete();
20633
- }, 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) => {
20634
21030
  setEditMapInfo({
20635
21031
  ...editMapInfo,
20636
21032
  isShowDrag: false,
@@ -20780,7 +21176,7 @@ const HandleElementInfo = () => {
20780
21176
  const isUndoDisabled = useMemo(() => {
20781
21177
  if (editMapInfo?.elementType === DataType.OBSTACLE &&
20782
21178
  editMapInfo?.createMode === CreateStatus.CREATING) {
20783
- return !(editMapInfo?.currentHistoryIndex >= 0 && editMapInfo?.historyList?.length);
21179
+ return !(editMapInfo?.currentHistoryIndex > 0 && editMapInfo?.historyList?.length);
20784
21180
  }
20785
21181
  else {
20786
21182
  return !(editMapInfo?.currentHistoryIndex > 0 && editMapInfo?.historyList?.length);
@@ -20795,12 +21191,20 @@ const HandleElementInfo = () => {
20795
21191
  return !(editMapInfo?.currentHistoryIndex < editMapInfo?.historyList?.length - 1 &&
20796
21192
  editMapInfo?.historyList?.length);
20797
21193
  }, [editMapInfo?.currentHistoryIndex, editMapInfo?.historyList]);
20798
- const handleUndo = useCallback(() => {
21194
+ const handleUndo = useCallback((e) => {
21195
+ e.stopPropagation();
21196
+ e.preventDefault();
21197
+ if (isUndoDisabled)
21198
+ return;
20799
21199
  undo();
20800
- }, [undo]);
20801
- const handleRedo = useCallback(() => {
21200
+ }, [undo, isUndoDisabled]);
21201
+ const handleRedo = useCallback((e) => {
21202
+ e.stopPropagation();
21203
+ e.preventDefault();
21204
+ if (idRedoDisabled)
21205
+ return;
20802
21206
  redo();
20803
- }, [redo]);
21207
+ }, [redo, idRedoDisabled]);
20804
21208
  const renderElementData = useCallback((element) => {
20805
21209
  if (!editMapInfo.selectElement)
20806
21210
  return null;
@@ -21113,7 +21517,7 @@ const defaultMapConfig = DEFAULT_STYLES;
21113
21517
  // 地图渲染器组件
21114
21518
  const MowerMapRenderer = forwardRef(({ sn, platform = PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, mapConfig,
21115
21519
  // pathConfig,
21116
- modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, onPathLoad, onError, className, style, googleMapInstance: _googleMapInstance, dragMap = false, dragCallbacks, defaultTransform, debug: _debug = false, doodleList = [], editMap = false, unStructMapData, disabledObstacles = false, onHandleEnterRecord, onHandleCompleteRecord, onHandleStopRecord, onHandleDeleteElement, onSaveBoundaryData, onSaveMap, onEditInfoMapChange, onUpdateBoundary, heightOptions, globalHeight, }, ref) => {
21520
+ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, onPathLoad, onError, className, style, googleMapInstance: _googleMapInstance, dragMap = false, dragCallbacks, defaultTransform, debug: _debug = false, doodleList = [], editMap = false, unStructMapData, disabledObstacles = false, onHandleEnterRecord, onHandleCompleteRecord, onHandleStopRecord, onHandleDeleteElement, onSaveBoundaryData, onSaveMap, onEditInfoMapChange, onUpdateBoundary, heightOptions, globalHeight, onClickEvent, }, ref) => {
21117
21521
  const [currentError, setCurrentError] = useState(null);
21118
21522
  const overlayRef = useRef(null);
21119
21523
  // const mapRef = useMap();
@@ -21128,14 +21532,13 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21128
21532
  });
21129
21533
  const [overlay, setOverlay] = useState(null);
21130
21534
  const [overlayLayout, setOverlayLayout] = useState(null);
21535
+ const [overlayScale, setOverlayScale] = useState(1);
21536
+ // 参考zoom级别,在此级别时overlayScale=1,元素显示原始大小
21537
+ const REFERENCE_ZOOM = 19;
21131
21538
  const svgMapRef = useRef(null);
21132
21539
  const svgEditMapRef = useRef(null);
21133
21540
  const [editMapInfo, setEditMapInfo] = useState({
21134
- editMap: false,
21135
- selectElement: null,
21136
- createMode: null,
21137
- elementType: null,
21138
- isShowDrag: false,
21541
+ ...INIT_EDIT_MAP_INFO,
21139
21542
  });
21140
21543
  const minDistance = useMemo(() => {
21141
21544
  return getMinSvgDistanceByModel(modelType);
@@ -21170,6 +21573,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21170
21573
  onSaveMap,
21171
21574
  onHandleDeleteElement,
21172
21575
  onUpdateBoundary,
21576
+ onClickEvent,
21173
21577
  };
21174
21578
  }, [
21175
21579
  minDistance,
@@ -21181,6 +21585,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21181
21585
  onSaveBoundaryData,
21182
21586
  onSaveMap,
21183
21587
  onUpdateBoundary,
21588
+ onClickEvent,
21184
21589
  ]);
21185
21590
  // 合并配置
21186
21591
  const mergedMapConfig = useMemo(() => {
@@ -21213,6 +21618,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21213
21618
  mapJson,
21214
21619
  drag: defaultTransform,
21215
21620
  mapRef,
21621
+ overlayScale,
21216
21622
  };
21217
21623
  }, [
21218
21624
  sn,
@@ -21226,6 +21632,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21226
21632
  mapJson,
21227
21633
  defaultTransform,
21228
21634
  mapRef,
21635
+ overlayScale,
21229
21636
  ]);
21230
21637
  // console.log('svgElementDatas->', svgElementDatas, unStructMapData, commonValue);
21231
21638
  // 处理地图分区边界
@@ -21244,7 +21651,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21244
21651
  // }
21245
21652
  // return allBoundaryElements;
21246
21653
  // }, [mapJson]);
21247
- useMemo(() => antennaConfig, [antennaConfig]);
21248
21654
  const mowerPositionData = useMemo(() => {
21249
21655
  // realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
21250
21656
  if (!realTimeData || realTimeData.length === 0)
@@ -21457,6 +21863,38 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21457
21863
  useEffect(() => {
21458
21864
  setDrag(defaultTransform ?? { x: 0, y: 0, rotation: 0 });
21459
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]);
21460
21898
  useEffect(() => {
21461
21899
  if (!mapJson)
21462
21900
  return;
@@ -21527,6 +21965,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21527
21965
  clearHistory: () => svgEditMapRef.current?.clearHistory(),
21528
21966
  // 添加历史记录
21529
21967
  addHistory: (history) => svgEditMapRef.current?.addHistory(history),
21968
+ // 添加doodle
21969
+ addDoodle: (doodle) => svgEditMapRef.current?.addDoodle(doodle),
21530
21970
  }));
21531
21971
  /**
21532
21972
  * 根据割草机的位置更新路径
@@ -21551,7 +21991,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21551
21991
  pre[cur] = parseFloat(curLayout);
21552
21992
  return pre;
21553
21993
  }, {});
21554
- // console.log('setedit svg ------------->', layout);
21555
21994
  if (layout?.width && layout?.height) {
21556
21995
  svgEditMapRef?.current?.adjustSvgSize?.(layout);
21557
21996
  setOverlayLayout(layout);
@@ -21560,4 +21999,4 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21560
21999
  });
21561
22000
  MowerMapRenderer.displayName = 'MowerMapRenderer';
21562
22001
 
21563
- export { MapDataProcessor, MowerMapRenderer, PathDataProcessor, calculateMapGpsCenter, estimateGpsFromMapBounds };
22002
+ export { BoundarySvgRender, MapDataProcessor, MowerMapRenderer, PathDataProcessor, calculateMapGpsCenter, estimateGpsFromMapBounds };