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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/index.esm.js +995 -316
  2. package/dist/index.js +994 -314
  3. package/dist/src/context/common.d.ts +5 -0
  4. package/dist/src/context/common.d.ts.map +1 -1
  5. package/dist/src/context/mapEdit.d.ts +4 -4
  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/processor/unified/BaseData.d.ts +3 -4
  10. package/dist/src/processor/unified/BaseData.d.ts.map +1 -1
  11. package/dist/src/processor/unified/UnifiedMapDataProcessor.d.ts.map +1 -1
  12. package/dist/src/render/BoundarySvgRender.d.ts +10 -0
  13. package/dist/src/render/BoundarySvgRender.d.ts.map +1 -0
  14. package/dist/src/render/MowerMapRenderer.d.ts.map +1 -1
  15. package/dist/src/render/layers/ObstacleLayer.d.ts +16 -0
  16. package/dist/src/render/layers/ObstacleLayer.d.ts.map +1 -1
  17. package/dist/src/render/svgEditMap/components/AddEntry/components/DoodleModal/index.d.ts.map +1 -1
  18. package/dist/src/render/svgEditMap/components/AddEntry/index.d.ts.map +1 -1
  19. package/dist/src/render/svgEditMap/components/HandleElementInfo/boundary.d.ts.map +1 -1
  20. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/index.d.ts.map +1 -1
  21. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/index.d.ts.map +1 -1
  22. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/Header/index.d.ts +1 -1
  23. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/Header/index.d.ts.map +1 -1
  24. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts +2 -1
  25. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts.map +1 -1
  26. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts +2 -1
  27. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts.map +1 -1
  28. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/TimePeriod/index.d.ts +4 -4
  29. package/dist/src/render/svgEditMap/components/HandleElementInfo/components/TimePeriod/index.d.ts.map +1 -1
  30. package/dist/src/render/svgEditMap/components/HandleElementInfo/doodle.d.ts.map +1 -1
  31. package/dist/src/render/svgEditMap/components/HandleElementInfo/index.d.ts.map +1 -1
  32. package/dist/src/render/svgEditMap/components/HandleElementInfo/obstacle.d.ts.map +1 -1
  33. package/dist/src/render/svgEditMap/components/HandleElementInfo/visionOff.d.ts.map +1 -1
  34. package/dist/src/render/svgEditMap/index.d.ts +8 -1
  35. package/dist/src/render/svgEditMap/index.d.ts.map +1 -1
  36. package/dist/src/render/svgElement/ChannelClipPath/index.d.ts.map +1 -1
  37. package/dist/src/render/svgElement/DoodleElement/index.d.ts.map +1 -1
  38. package/dist/src/render/svgElement/Mobile/CreateObstacleElement/index.d.ts +4 -1
  39. package/dist/src/render/svgElement/Mobile/CreateObstacleElement/index.d.ts.map +1 -1
  40. package/dist/src/render/svgElement/ObstacleElement/index.d.ts.map +1 -1
  41. package/dist/src/render/svgElement/PolygonELement/components/DistanceLabels.d.ts.map +1 -1
  42. package/dist/src/render/svgElement/PolygonELement/dashPath/index.d.ts.map +1 -1
  43. package/dist/src/render/svgElement/PolygonELement/index.d.ts +1 -1
  44. package/dist/src/render/svgElement/PolygonELement/index.d.ts.map +1 -1
  45. package/dist/src/render/svgElement/PolygonELement/vertex/index.d.ts.map +1 -1
  46. package/dist/src/render/svgElement/TransformWrapper/DoodleTransformWrapper/DoodleTransformWrapper.d.ts.map +1 -1
  47. package/dist/src/render/svgElement/TransformWrapper/VisionOffTransformWrapper/VisionOffTransformWrapper.d.ts.map +1 -1
  48. package/dist/src/render/svgElement/VisionOffElement/index.d.ts.map +1 -1
  49. package/dist/src/types/renderer.d.ts +10 -2
  50. package/dist/src/types/renderer.d.ts.map +1 -1
  51. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { memo, useMemo, useEffect, useState, useRef, useCallback, createContext, useContext, forwardRef, useImperativeHandle, useLayoutEffect } from 'react';
4
4
  import ReactDOM from 'react-dom';
5
- import { Modal, message, Popover, Input, Switch, Slider, Radio, Button, DatePicker, Select } from 'antd';
5
+ import { Modal, message, Popover, Input, Switch, Slider, Radio, Button, DatePicker, Select, Space } from 'antd';
6
6
 
7
7
  /**
8
8
  * 常量和枚举类型定义
@@ -190,14 +190,13 @@ class ChannelData extends BaseData {
190
190
  * 障碍物数据类
191
191
  */
192
192
  class ObstacleData extends BaseData {
193
- constructor(originalData, level, isTimeLimit, style) {
193
+ constructor(originalData, level, style) {
194
194
  const convertedPoints = convertPointsFormat(originalData?.points) || [];
195
195
  super(originalData?.id, DataType.OBSTACLE, level, RenderType.POLYGON, convertedPoints, originalData);
196
196
  this.area = originalData?.area;
197
197
  this.status = originalData?.status || 1;
198
- this.startTimestamp = originalData?.start_timestamp;
199
- this.endTimestamp = originalData?.end_timestamp;
200
- this.isTimeLimit = isTimeLimit;
198
+ this.start_timestamp = originalData?.start_timestamp;
199
+ this.end_timestamp = originalData?.end_timestamp;
201
200
  this.name = originalData?.name || 'Obstacle';
202
201
  this.style = style;
203
202
  }
@@ -329,8 +328,8 @@ function initDoodle() {
329
328
  svg: '',
330
329
  scale: 1,
331
330
  direction: 0,
332
- create_ts: Date.now(),
333
- expiration_ts: Date.now() + 3600000 * 24 * 7, // 1小时后过期
331
+ create_ts: Math.floor(Date.now() / 1000),
332
+ expiration_ts: Math.floor(Date.now() / 1000) + 3600 * 24 * 7, // 1小时后过期
334
333
  type: 'TIME_LIMIT_OBSTACLE',
335
334
  };
336
335
  return new DoodleData(doodle, 100);
@@ -616,7 +615,7 @@ class UnifiedMapDataProcessor {
616
615
  continue;
617
616
  }
618
617
  const obstacleData = new ObstacleData(element, 150, // 高层级
619
- false, this.mapConfig.obstacle || {});
618
+ this.mapConfig.obstacle || {});
620
619
  obstacleDataList.push(obstacleData);
621
620
  }
622
621
  catch (error) {
@@ -746,7 +745,7 @@ class UnifiedMapDataProcessor {
746
745
  continue;
747
746
  }
748
747
  const obstacleData = new ObstacleData(element, 150, // 高层级
749
- true, this.mapConfig.obstacle || {});
748
+ this.mapConfig.obstacle || {});
750
749
  obstacleDataList.push(obstacleData);
751
750
  }
752
751
  }
@@ -3051,7 +3050,7 @@ function copyObject(source, props, object, customizer) {
3051
3050
  }
3052
3051
 
3053
3052
  /* Built-in method references for those with the same name as other `lodash` methods. */
3054
- var nativeMax$1 = Math.max;
3053
+ var nativeMax$2 = Math.max;
3055
3054
 
3056
3055
  /**
3057
3056
  * A specialized version of `baseRest` which transforms the rest array.
@@ -3063,11 +3062,11 @@ var nativeMax$1 = Math.max;
3063
3062
  * @returns {Function} Returns the new function.
3064
3063
  */
3065
3064
  function overRest(func, start, transform) {
3066
- start = nativeMax$1(start === undefined ? (func.length - 1) : start, 0);
3065
+ start = nativeMax$2(start === undefined ? (func.length - 1) : start, 0);
3067
3066
  return function() {
3068
3067
  var args = arguments,
3069
3068
  index = -1,
3070
- length = nativeMax$1(args.length - start, 0),
3069
+ length = nativeMax$2(args.length - start, 0),
3071
3070
  array = Array(length);
3072
3071
 
3073
3072
  while (++index < length) {
@@ -4069,7 +4068,7 @@ function isPlainObject(value) {
4069
4068
 
4070
4069
  /* Built-in method references for those with the same name as other `lodash` methods. */
4071
4070
  var nativeIsFinite = root$3.isFinite,
4072
- nativeMin$1 = Math.min;
4071
+ nativeMin$2 = Math.min;
4073
4072
 
4074
4073
  /**
4075
4074
  * Creates a function like `_.round`.
@@ -4082,7 +4081,7 @@ function createRound(methodName) {
4082
4081
  var func = Math[methodName];
4083
4082
  return function(number, precision) {
4084
4083
  number = toNumber$2(number);
4085
- precision = precision == null ? 0 : nativeMin$1(toInteger(precision), 292);
4084
+ precision = precision == null ? 0 : nativeMin$2(toInteger(precision), 292);
4086
4085
  if (precision && nativeIsFinite(number)) {
4087
4086
  // Shift with exponential notation to avoid floating-point issues.
4088
4087
  // See [MDN](https://mdn.io/round#Examples) for more details.
@@ -4305,6 +4304,212 @@ function createBaseFor(fromRight) {
4305
4304
  */
4306
4305
  var baseFor = createBaseFor();
4307
4306
 
4307
+ /**
4308
+ * Gets the timestamp of the number of milliseconds that have elapsed since
4309
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
4310
+ *
4311
+ * @static
4312
+ * @memberOf _
4313
+ * @since 2.4.0
4314
+ * @category Date
4315
+ * @returns {number} Returns the timestamp.
4316
+ * @example
4317
+ *
4318
+ * _.defer(function(stamp) {
4319
+ * console.log(_.now() - stamp);
4320
+ * }, _.now());
4321
+ * // => Logs the number of milliseconds it took for the deferred invocation.
4322
+ */
4323
+ var now$2 = function() {
4324
+ return root$3.Date.now();
4325
+ };
4326
+
4327
+ /** Error message constants. */
4328
+ var FUNC_ERROR_TEXT$3 = 'Expected a function';
4329
+
4330
+ /* Built-in method references for those with the same name as other `lodash` methods. */
4331
+ var nativeMax$1 = Math.max,
4332
+ nativeMin$1 = Math.min;
4333
+
4334
+ /**
4335
+ * Creates a debounced function that delays invoking `func` until after `wait`
4336
+ * milliseconds have elapsed since the last time the debounced function was
4337
+ * invoked. The debounced function comes with a `cancel` method to cancel
4338
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
4339
+ * Provide `options` to indicate whether `func` should be invoked on the
4340
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
4341
+ * with the last arguments provided to the debounced function. Subsequent
4342
+ * calls to the debounced function return the result of the last `func`
4343
+ * invocation.
4344
+ *
4345
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
4346
+ * invoked on the trailing edge of the timeout only if the debounced function
4347
+ * is invoked more than once during the `wait` timeout.
4348
+ *
4349
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
4350
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
4351
+ *
4352
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
4353
+ * for details over the differences between `_.debounce` and `_.throttle`.
4354
+ *
4355
+ * @static
4356
+ * @memberOf _
4357
+ * @since 0.1.0
4358
+ * @category Function
4359
+ * @param {Function} func The function to debounce.
4360
+ * @param {number} [wait=0] The number of milliseconds to delay.
4361
+ * @param {Object} [options={}] The options object.
4362
+ * @param {boolean} [options.leading=false]
4363
+ * Specify invoking on the leading edge of the timeout.
4364
+ * @param {number} [options.maxWait]
4365
+ * The maximum time `func` is allowed to be delayed before it's invoked.
4366
+ * @param {boolean} [options.trailing=true]
4367
+ * Specify invoking on the trailing edge of the timeout.
4368
+ * @returns {Function} Returns the new debounced function.
4369
+ * @example
4370
+ *
4371
+ * // Avoid costly calculations while the window size is in flux.
4372
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
4373
+ *
4374
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
4375
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
4376
+ * 'leading': true,
4377
+ * 'trailing': false
4378
+ * }));
4379
+ *
4380
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
4381
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
4382
+ * var source = new EventSource('/stream');
4383
+ * jQuery(source).on('message', debounced);
4384
+ *
4385
+ * // Cancel the trailing debounced invocation.
4386
+ * jQuery(window).on('popstate', debounced.cancel);
4387
+ */
4388
+ function debounce$2(func, wait, options) {
4389
+ var lastArgs,
4390
+ lastThis,
4391
+ maxWait,
4392
+ result,
4393
+ timerId,
4394
+ lastCallTime,
4395
+ lastInvokeTime = 0,
4396
+ leading = false,
4397
+ maxing = false,
4398
+ trailing = true;
4399
+
4400
+ if (typeof func != 'function') {
4401
+ throw new TypeError(FUNC_ERROR_TEXT$3);
4402
+ }
4403
+ wait = toNumber$2(wait) || 0;
4404
+ if (isObject$4(options)) {
4405
+ leading = !!options.leading;
4406
+ maxing = 'maxWait' in options;
4407
+ maxWait = maxing ? nativeMax$1(toNumber$2(options.maxWait) || 0, wait) : maxWait;
4408
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
4409
+ }
4410
+
4411
+ function invokeFunc(time) {
4412
+ var args = lastArgs,
4413
+ thisArg = lastThis;
4414
+
4415
+ lastArgs = lastThis = undefined;
4416
+ lastInvokeTime = time;
4417
+ result = func.apply(thisArg, args);
4418
+ return result;
4419
+ }
4420
+
4421
+ function leadingEdge(time) {
4422
+ // Reset any `maxWait` timer.
4423
+ lastInvokeTime = time;
4424
+ // Start the timer for the trailing edge.
4425
+ timerId = setTimeout(timerExpired, wait);
4426
+ // Invoke the leading edge.
4427
+ return leading ? invokeFunc(time) : result;
4428
+ }
4429
+
4430
+ function remainingWait(time) {
4431
+ var timeSinceLastCall = time - lastCallTime,
4432
+ timeSinceLastInvoke = time - lastInvokeTime,
4433
+ timeWaiting = wait - timeSinceLastCall;
4434
+
4435
+ return maxing
4436
+ ? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke)
4437
+ : timeWaiting;
4438
+ }
4439
+
4440
+ function shouldInvoke(time) {
4441
+ var timeSinceLastCall = time - lastCallTime,
4442
+ timeSinceLastInvoke = time - lastInvokeTime;
4443
+
4444
+ // Either this is the first call, activity has stopped and we're at the
4445
+ // trailing edge, the system time has gone backwards and we're treating
4446
+ // it as the trailing edge, or we've hit the `maxWait` limit.
4447
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
4448
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
4449
+ }
4450
+
4451
+ function timerExpired() {
4452
+ var time = now$2();
4453
+ if (shouldInvoke(time)) {
4454
+ return trailingEdge(time);
4455
+ }
4456
+ // Restart the timer.
4457
+ timerId = setTimeout(timerExpired, remainingWait(time));
4458
+ }
4459
+
4460
+ function trailingEdge(time) {
4461
+ timerId = undefined;
4462
+
4463
+ // Only invoke if we have `lastArgs` which means `func` has been
4464
+ // debounced at least once.
4465
+ if (trailing && lastArgs) {
4466
+ return invokeFunc(time);
4467
+ }
4468
+ lastArgs = lastThis = undefined;
4469
+ return result;
4470
+ }
4471
+
4472
+ function cancel() {
4473
+ if (timerId !== undefined) {
4474
+ clearTimeout(timerId);
4475
+ }
4476
+ lastInvokeTime = 0;
4477
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
4478
+ }
4479
+
4480
+ function flush() {
4481
+ return timerId === undefined ? result : trailingEdge(now$2());
4482
+ }
4483
+
4484
+ function debounced() {
4485
+ var time = now$2(),
4486
+ isInvoking = shouldInvoke(time);
4487
+
4488
+ lastArgs = arguments;
4489
+ lastThis = this;
4490
+ lastCallTime = time;
4491
+
4492
+ if (isInvoking) {
4493
+ if (timerId === undefined) {
4494
+ return leadingEdge(lastCallTime);
4495
+ }
4496
+ if (maxing) {
4497
+ // Handle invocations in a tight loop.
4498
+ clearTimeout(timerId);
4499
+ timerId = setTimeout(timerExpired, wait);
4500
+ return invokeFunc(lastCallTime);
4501
+ }
4502
+ }
4503
+ if (timerId === undefined) {
4504
+ timerId = setTimeout(timerExpired, wait);
4505
+ }
4506
+ return result;
4507
+ }
4508
+ debounced.cancel = cancel;
4509
+ debounced.flush = flush;
4510
+ return debounced;
4511
+ }
4512
+
4308
4513
  /**
4309
4514
  * This function is like `assignValue` except that it doesn't assign
4310
4515
  * `undefined` values.
@@ -4589,6 +4794,71 @@ var merge$1 = createAssigner(function(object, source, srcIndex) {
4589
4794
  */
4590
4795
  var round = createRound('round');
4591
4796
 
4797
+ /** Error message constants. */
4798
+ var FUNC_ERROR_TEXT$2 = 'Expected a function';
4799
+
4800
+ /**
4801
+ * Creates a throttled function that only invokes `func` at most once per
4802
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
4803
+ * method to cancel delayed `func` invocations and a `flush` method to
4804
+ * immediately invoke them. Provide `options` to indicate whether `func`
4805
+ * should be invoked on the leading and/or trailing edge of the `wait`
4806
+ * timeout. The `func` is invoked with the last arguments provided to the
4807
+ * throttled function. Subsequent calls to the throttled function return the
4808
+ * result of the last `func` invocation.
4809
+ *
4810
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
4811
+ * invoked on the trailing edge of the timeout only if the throttled function
4812
+ * is invoked more than once during the `wait` timeout.
4813
+ *
4814
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
4815
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
4816
+ *
4817
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
4818
+ * for details over the differences between `_.throttle` and `_.debounce`.
4819
+ *
4820
+ * @static
4821
+ * @memberOf _
4822
+ * @since 0.1.0
4823
+ * @category Function
4824
+ * @param {Function} func The function to throttle.
4825
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
4826
+ * @param {Object} [options={}] The options object.
4827
+ * @param {boolean} [options.leading=true]
4828
+ * Specify invoking on the leading edge of the timeout.
4829
+ * @param {boolean} [options.trailing=true]
4830
+ * Specify invoking on the trailing edge of the timeout.
4831
+ * @returns {Function} Returns the new throttled function.
4832
+ * @example
4833
+ *
4834
+ * // Avoid excessively updating the position while scrolling.
4835
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
4836
+ *
4837
+ * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
4838
+ * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
4839
+ * jQuery(element).on('click', throttled);
4840
+ *
4841
+ * // Cancel the trailing throttled invocation.
4842
+ * jQuery(window).on('popstate', throttled.cancel);
4843
+ */
4844
+ function throttle$2(func, wait, options) {
4845
+ var leading = true,
4846
+ trailing = true;
4847
+
4848
+ if (typeof func != 'function') {
4849
+ throw new TypeError(FUNC_ERROR_TEXT$2);
4850
+ }
4851
+ if (isObject$4(options)) {
4852
+ leading = 'leading' in options ? !!options.leading : leading;
4853
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
4854
+ }
4855
+ return debounce$2(func, wait, {
4856
+ 'leading': leading,
4857
+ 'maxWait': wait,
4858
+ 'trailing': trailing
4859
+ });
4860
+ }
4861
+
4592
4862
  /**
4593
4863
  * 工具模块类型定义
4594
4864
  */
@@ -8422,7 +8692,7 @@ function styleInject(css, ref) {
8422
8692
  }
8423
8693
  }
8424
8694
 
8425
- var css_248z$i = ".index-module_edit__-5VvX {\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n pointer-events: auto;\n z-index: 1000;\n cursor: move;\n touch-action: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n.index-module_edit__-5VvX .index-module_border__JdNLM {\n position: absolute;\n inset: -10px;\n border: 2px dashed rgb(241, 102, 41);\n border-radius: 2px;\n pointer-events: none;\n}\n.index-module_edit__-5VvX .index-module_drag__uvdPG {\n position: absolute;\n inset: -10px;\n border-radius: 2px;\n}\n.index-module_edit__-5VvX .index-module_rotate__H-KIZ {\n position: absolute;\n top: -20px;\n right: -20px;\n width: 20px;\n height: 20px;\n cursor: grab;\n z-index: 1001;\n pointer-events: auto;\n}\n.index-module_edit__-5VvX .index-module_move__mZF8s {\n position: absolute;\n bottom: -20px;\n left: -20px;\n width: 20px;\n height: 20px;\n cursor: move;\n z-index: 1001;\n pointer-events: auto;\n display: none;\n}";
8695
+ var css_248z$i = ".index-module_edit__-5VvX {\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n pointer-events: auto;\n z-index: 1000;\n cursor: move;\n touch-action: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n.index-module_edit__-5VvX .index-module_border__JdNLM {\n position: absolute;\n inset: -10px;\n border: 2px dashed rgb(241, 102, 41);\n border-radius: 2px;\n pointer-events: none;\n}\n.index-module_edit__-5VvX .index-module_drag__uvdPG {\n position: absolute;\n inset: -10px;\n border-radius: 2px;\n}\n.index-module_edit__-5VvX .index-module_rotate__H-KIZ {\n position: absolute;\n top: -20px;\n right: -20px;\n width: 20px;\n height: 20px;\n cursor: grab;\n z-index: 1001;\n pointer-events: auto;\n}\n.index-module_edit__-5VvX .index-module_move__mZF8s {\n position: absolute;\n bottom: -20px;\n left: -20px;\n width: 20px;\n height: 20px;\n cursor: move;\n z-index: 1001;\n pointer-events: auto;\n}";
8426
8696
  var styles$i = {"edit":"index-module_edit__-5VvX","border":"index-module_border__JdNLM","drag":"index-module_drag__uvdPG","rotate":"index-module_rotate__H-KIZ","move":"index-module_move__mZF8s"};
8427
8697
  styleInject(css_248z$i);
8428
8698
 
@@ -8504,8 +8774,10 @@ const DragHandle = ({ onDragStart, isDragging }) => {
8504
8774
  onDragStart(e);
8505
8775
  }, onTouchStart: (e) => onDragStart(e), onMouseUp: (e) => {
8506
8776
  console.log('drag up');
8507
- onDragEnd(e);
8508
- }, onTouchEnd: (e) => onDragEnd(e), style: { cursor: isDragging ? 'grabbing' : 'move' }, dangerouslySetInnerHTML: { __html: DEFAULT_DRAG_ICON } }));
8777
+ // onDragEnd(e);
8778
+ },
8779
+ // onTouchEnd={(e) => onDragEnd(e)}
8780
+ style: { cursor: isDragging ? 'grabbing' : 'move' }, dangerouslySetInnerHTML: { __html: DEFAULT_DRAG_ICON } }));
8509
8781
  };
8510
8782
 
8511
8783
  const MapDrag = ({ map: _map, dragCallbacks, onBoundaryLabelsCollapse, onTransformChange, isDragMap = false, }) => {
@@ -12243,10 +12515,73 @@ class ObstacleLayer extends BaseLayer {
12243
12515
  }
12244
12516
  }
12245
12517
  /**
12246
- * 渲染障碍物元素
12518
+ * 将坐标点按type分组
12519
+ */
12520
+ groupCoordinatesByType(coordinates) {
12521
+ const segments = [];
12522
+ let currentSegment = null;
12523
+ for (let i = 0; i < coordinates.length; i++) {
12524
+ const coord = coordinates[i];
12525
+ const type = coord[2] || 2; // 默认type为2
12526
+ if (!currentSegment || currentSegment.type !== type) {
12527
+ // 开始新的段
12528
+ if (currentSegment && currentSegment.points.length > 0) {
12529
+ // 为了连接线段,将当前点也加入上一段的结尾
12530
+ currentSegment.points.push(coord);
12531
+ }
12532
+ currentSegment = {
12533
+ type: type,
12534
+ points: [coord],
12535
+ };
12536
+ segments.push(currentSegment);
12537
+ }
12538
+ else {
12539
+ // 继续当前段
12540
+ currentSegment.points.push(coord);
12541
+ }
12542
+ }
12543
+ // 处理封闭边界:如果第一段和最后一段type相同,需要连接起来
12544
+ if (segments.length > 1 && segments[0].type === segments[segments.length - 1].type) {
12545
+ const firstSegment = segments[0];
12546
+ const lastSegment = segments[segments.length - 1];
12547
+ // 将第一个点添加到最后一段,形成封闭
12548
+ lastSegment.points.push(firstSegment.points[0]);
12549
+ }
12550
+ else if (segments.length === 1) {
12551
+ // 只有一段的情况,添加第一个点到末尾形成封闭
12552
+ segments[0].points.push(coordinates[0]);
12553
+ }
12554
+ return segments;
12555
+ }
12556
+ /**
12557
+ * 渲染障碍物元素
12247
12558
  */
12248
12559
  renderObstacle(svgGroup, element) {
12249
- const { coordinates, style } = element;
12560
+ const { coordinates, style, originalData } = element;
12561
+ const { status, start_timestamp, end_timestamp } = originalData || {};
12562
+ if (coordinates.length < 2 || status === 0) {
12563
+ return;
12564
+ }
12565
+ if (status === 1 &&
12566
+ (start_timestamp > Date.now() / 1000 || end_timestamp < Date.now() / 1000)) {
12567
+ return;
12568
+ }
12569
+ // 1. 先遍历所有的coordinates,把所有点分为若干段的path
12570
+ const pathSegments = this.groupCoordinatesByType(coordinates);
12571
+ // 2&3. 根据type处理每个path段
12572
+ pathSegments.forEach((segment) => {
12573
+ if (segment.points.length < 2)
12574
+ return;
12575
+ if (segment.type === 2) {
12576
+ // type=2: 直接添加到svgGroup中
12577
+ this.createDirectPath(svgGroup, segment.points, style);
12578
+ }
12579
+ else if (segment.type === 1) {
12580
+ // type=1: 使用PathMeasure逻辑生成平行路径
12581
+ // this.createDirectPath(svgGroup, segment.points, style);
12582
+ this.createParallelPathsWithMeasure(svgGroup, segment.points, style);
12583
+ }
12584
+ });
12250
12585
  if (coordinates.length < 3)
12251
12586
  return;
12252
12587
  const polygon = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');
@@ -12254,7 +12589,7 @@ class ObstacleLayer extends BaseLayer {
12254
12589
  const points = coordinates.map((coord) => `${coord[0]},${coord[1]}`).join(' ');
12255
12590
  polygon.setAttribute('points', points);
12256
12591
  polygon.setAttribute('fill', style.fillColor || 'rgba(220, 53, 69, 0.2)');
12257
- polygon.setAttribute('stroke', style.lineColor || '#dc3545');
12592
+ polygon.setAttribute('stroke', 'transparent');
12258
12593
  // 确保最小线条宽度
12259
12594
  const lineWidth = Math.max(style.lineWidth || 2, 0.5);
12260
12595
  polygon.setAttribute('stroke-width', lineWidth.toString());
@@ -12265,6 +12600,113 @@ class ObstacleLayer extends BaseLayer {
12265
12600
  polygon.classList.add('vector-obstacle');
12266
12601
  svgGroup.appendChild(polygon);
12267
12602
  }
12603
+ /**
12604
+ * 创建直接路径(type=2)
12605
+ */
12606
+ createDirectPath(svgGroup, points, style) {
12607
+ const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
12608
+ const strokeColor = style.lineColor;
12609
+ // 构建路径数据
12610
+ let pathData = '';
12611
+ for (let i = 0; i < points.length; i++) {
12612
+ const [x, y] = points[i];
12613
+ if (i === 0) {
12614
+ pathData += `M ${x} ${y}`;
12615
+ }
12616
+ else {
12617
+ pathData += ` L ${x} ${y}`;
12618
+ }
12619
+ }
12620
+ path.setAttribute('d', pathData);
12621
+ path.setAttribute('stroke', strokeColor);
12622
+ path.setAttribute('fill', 'none');
12623
+ // 确保最小线条宽度
12624
+ const lineWidth = dp2px(style.lineWidth || 3);
12625
+ path.setAttribute('stroke-width', lineWidth.toString());
12626
+ path.setAttribute('stroke-linecap', 'round');
12627
+ path.setAttribute('stroke-linejoin', 'round');
12628
+ path.setAttribute('opacity', (style.opacity || 1).toString());
12629
+ path.setAttribute('vector-effect', 'non-scaling-stroke');
12630
+ path.classList.add('vector-obstacle');
12631
+ svgGroup.appendChild(path);
12632
+ }
12633
+ /**
12634
+ * 使用PathMeasure逻辑创建平行路径(type=1)
12635
+ */
12636
+ createParallelPathsWithMeasure(svgGroup, points, style) {
12637
+ const strokeColor = style.lineColor;
12638
+ const lineWidth = dp2px(style.lineWidth || 3);
12639
+ // 获取当前SVG的缩放级别,计算固定屏幕像素间距
12640
+ const fixedScreenDistance = lineWidth; // 固定的屏幕像素距离
12641
+ const offsetDistance = fixedScreenDistance; // 转换为SVG坐标系距离
12642
+ // 直接对每个线段生成平行直线段
12643
+ const parallelPaths = this.generateStraightParallelPaths(points, offsetDistance);
12644
+ // 渲染两条平行虚线
12645
+ parallelPaths.forEach((pathData, index) => {
12646
+ if (!pathData)
12647
+ return;
12648
+ const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
12649
+ path.setAttribute('d', pathData);
12650
+ path.setAttribute('fill', 'none');
12651
+ path.setAttribute('stroke', strokeColor);
12652
+ path.setAttribute('stroke-width', lineWidth.toString());
12653
+ path.setAttribute('stroke-linecap', 'round');
12654
+ path.setAttribute('stroke-linejoin', 'round');
12655
+ path.setAttribute('opacity', (style.opacity || 1).toString());
12656
+ // 使用CSS样式设置虚线,避免随SVG缩放变化
12657
+ // 或者可以根据当前缩放级别动态计算dash array
12658
+ path.style.strokeDasharray = `${lineWidth}px ${lineWidth * 2}px`;
12659
+ path.classList.add(`vector-boundary-parallel-${index + 1}`);
12660
+ svgGroup.appendChild(path);
12661
+ });
12662
+ }
12663
+ /**
12664
+ * 生成直线平行路径(每个线段分别处理)
12665
+ */
12666
+ generateStraightParallelPaths(points, offsetDistance) {
12667
+ if (points.length < 2)
12668
+ return ['', ''];
12669
+ let parallelPath1Data = '';
12670
+ let parallelPath2Data = '';
12671
+ // 对每个线段分别计算平行线
12672
+ for (let i = 0; i < points.length - 1; i++) {
12673
+ const startPoint = points[i];
12674
+ const endPoint = points[i + 1];
12675
+ // 计算线段的方向向量
12676
+ const dx = endPoint[0] - startPoint[0];
12677
+ const dy = endPoint[1] - startPoint[1];
12678
+ const length = Math.sqrt(dx * dx + dy * dy);
12679
+ if (length === 0)
12680
+ continue; // 跳过零长度线段
12681
+ // 标准化方向向量
12682
+ const unitX = dx / length;
12683
+ const unitY = dy / length;
12684
+ // 计算垂直向量
12685
+ const perpendicularX = -unitY;
12686
+ const perpendicularY = unitX;
12687
+ // 计算平行线的起点和终点
12688
+ const start1X = startPoint[0] + perpendicularX * offsetDistance;
12689
+ const start1Y = startPoint[1] + perpendicularY * offsetDistance;
12690
+ const end1X = endPoint[0] + perpendicularX * offsetDistance;
12691
+ const end1Y = endPoint[1] + perpendicularY * offsetDistance;
12692
+ const start2X = startPoint[0] - perpendicularX * offsetDistance;
12693
+ const start2Y = startPoint[1] - perpendicularY * offsetDistance;
12694
+ const end2X = endPoint[0] - perpendicularX * offsetDistance;
12695
+ const end2Y = endPoint[1] - perpendicularY * offsetDistance;
12696
+ // 构建路径数据
12697
+ if (i === 0) {
12698
+ parallelPath1Data = `M ${start1X} ${start1Y}`;
12699
+ parallelPath2Data = `M ${start2X} ${start2Y}`;
12700
+ }
12701
+ else {
12702
+ parallelPath1Data += ` M ${start1X} ${start1Y}`;
12703
+ parallelPath2Data += ` M ${start2X} ${start2Y}`;
12704
+ }
12705
+ parallelPath1Data += ` L ${end1X} ${end1Y}`;
12706
+ parallelPath2Data += ` L ${end2X} ${end2Y}`;
12707
+ }
12708
+ return [parallelPath2Data, parallelPath1Data];
12709
+ }
12268
12710
  }
12269
12711
 
12270
12712
  var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHHSURBVHgBtVtdjF3VdV7rnHPHtLbUkRrALwmDidSSgD1JqWQ3UMaNMaFq63FIKyoVZFRF6kMkbCmVcP9mrBARoJUnLRL9c+3WSVsqIkwrtRBKfaGmQFuFazBpK0wYnmLSF6MYx557zt5Zv3vvO/Z4bDPZ9pl97rlnztnfXmt969s/g/AjKrN7nxwf634wBTFMYIQNAWASAcYjxAmI+T5EnAeIdFQnYwxHqwr6Z5s1g9ld20/Cj6AgrGBhkKva0/d1MUxBiFMxEjw7gGv5RyUWL+cfiCD/0I4KoULs04ensKkP7d716/OwQmVFAD/4yMGpLsJM7MJUiIGMGiDQwUBDYHR8DgocFG/54gQ0HRVUFQPnuoK6qvp0ec/u3767Dx+wfCDAXyKg2MWZELopBth1BJQAB6ujgY5RANNpRIbLuPnFETAaxgSUawYpVhawtdQV1XWN81hXu37ni3cfgssslwX4wQf/bqLD4f6uY6AdAaWDagYqdRi18qhrn/vmc61bRbIwZqAKmms9rw/Usbdn9+5Ld/VLBvzlhw/e17XtLIEcbzsG2SpgOQQkYe0wu7SDZqgRvS7Bcisq/oFVRAZqVlaQXDeRgKIDFtBNPd9Aved3d99zAC6hXDTg2dknx6sr3psJbbezZZBtB14TWApfAqmgyYPpnF07ZMIKeqLviymMoxIWY0VEJ6/zWNgsG5uGgTdANXBNwOf+4P4duy4Wx0UBnp3dP45jcJgsO6kgWxi2BLIdYtcGBisWDqHFji3qMbzIlY2jLZgRyxaUbl1hJiwBzLWBdqBNo0fNR90MxhC279597/xyWJYFPPvgfsqj8XA7HE60BLQVsAqazzt3aY5ZqmPU2A1s0sgunPwZFbVzNQNW+hLTsvnRrCwujbFCAYoa0xVbNjbs2g0DHxNrO/Cm15sfQ9y8HGhcDiyZ6nDbLkwMhwRwOCSQw2RdsjbVHK8pfg0wowoC1lwak9ZIgN3E4tYjgCuJa2XsujISkxiuKJYbVEsz0B6BbrDX6yXQMKw+MTt775KipboQYELx5HBIYBcI5MJZoHNYWFjgc1wYcr2AQ+4A6YgF7ozIHaKuLl6gtcQ2dw51mhCdxXvo5LN5Cco9nXmOPifa85Hfze/xmtuxQO1IbZLvhhPQdIc5BJeC1Cz1xcwD+/bSyybTixYYVEsNWGAQ0RpI1zqxprKzKSohqeAGdctiIbBScmIHds5G9W9TYJyjydb0UHZnsjF7EIbgIdM4P0S+Xui4STL6DNXnJbL6fBdnv7xvR9cNv1KAjXSOZEXqUbZiixrPnaQgIayOXZgaFDtmZAMeFKgpDW+gsLVf52aGWES3pC6rY3FNnhdNxPjvmpgxipAOAw6JjZu3bHvv+X/7p5eXBTw7+9jEMIb97cJwvATL4NldGay6YGv5lkFTj0PAUCorbYyTVdz2y1twxz13wurVP47/+39vgRmabzGTRjusaxQ1jjC9EV/RMU4DCM5HzvZQbfyF2+98vP/cUyPxfI5LdxXOdAvDCY6dVkCqVYcal2JdlZGtuRe/OIAZw+0ovukWvPqqD8Hnf/Muef6NN/wUPPvckXj69GmMOSnxbwl1BX0IKla9qJVbuELP7zG6G0elQLRKY2OcImI/fbm5xDdCWrNf+rNpYt0d4q5sXSGM1iyrhMTMLMQkedcPAYxmWXfXRMybNn1ypFOvvuon0QVJthikfK2AUh63DpXczuHDnqXkJhzCxmjVOKnNnZAdfTf1e7OPTS0JeNiFvfILchAwe0CrbIvGsIuAhiK2zI3Vrd3ywO5cvmfdug+P3KugneQCmETB4hlCiFHynYSOpcJWGL/z9opXtuKVFn78nJnzAuaeoAeYuOCUsICtCwxNG8rMppOFld0KkEgEIZaje4Atn/6UuHRZrr32IwrOTCzPgXL46NaH3DGgXiSSNXbgbN0an3CIubEIdHTNQO0fsXKKYUouM22hoIZay4MkDYlWbgWoKSjUhmkDmSZiOZVhp7d9+mZYXNas/jFwFgYoSStlLIYoaiQYq2HqCJRRZcDEaNjx162KVVZnLQVvVRNttbUML0mpsJX7ycLMzARmitOMqicXCcrImnocrLpZSC4cbHCgn9X/NBjXXfvhuP7Gnz4H8Pobr1d4RkVQpDGbKECzrt5jgw/1gqCf1cMk/1tcS7i1KbbZ8sI5EMjKs7N7xxPg0103LaMelosSqwa04w7o0hhXjiLuIMZRaaqfJSvwHdO/cvt5pSu7uJOWGCop7cy6zsDae8bcMefrTGoE2sbhLQOXdrun6kiOQZ8Jzc4EmLppm/aMsp8N90DjNYGNBVuKWAj22WPOcy/3PTFx3LrlFliq0PdZiKhaKghMPcRd3t25AGpvs7awBlAyxS64VC0HODSo6eKtAphNTU4xpfEpluVewpx2gtT2Ik8nGjwIiWyiiwZLh5s2/swFByYfXXeN83mRj8HJCkeEB7has2vmXcbe0QlU5W1wY4GB97AUt27OtM1k152FPKYNMqYtwapxhSmdSFHjVpgFS3kcLSQ/u+32C+GFK6/6EFqMgjGfaSy7wbsg5nOPJO5Wl58a4vSDqIRaTpam04p1d6eE2zWeXeBsu2qqaUM7ZdMzrotdMo6QFLtNzptmTn1bzGMBbdrWLT8PV1995QUBX7fuI1lX6xPjmtWrcf3662HDjR+D6667BtZSrB99/X/g4Ne/ASfe/f8MPWUv9zGeFw3UC5URGePh8bMYzIkNh1U70RCYDT5oX6SeojOiuXKMmaTS7ONo/+spA16uXLfuGtiw/nr8KAFbd+01MLnh47g4X8uzqOP4+hfvfyC5vbO3Tv9ius4Y+HIel5dhKfG+oSFc4zY941/YICD4wABVSekUK/eDzVCATUkVwGOk2MQN6z92UYD/6KHfh4spa9asLj0LER2052a9rgaqPJZtyKpTTzacnGQLT4SYeiDRvQn0ZFlnUI3ZLDBCSN0tv/fZ6Ttgpcvxt+bB5aa+x94dnT2iyhAZsHCDKsxTTXkMTallnGFPxGDa10CzZUdjdvHYsyiY8iOsXXslbL3tVljp8s1/7ctr9VV5sgiUt93j8lAyhNJgKX3RtYkmpAt+s2nj4II+jsRxmpbwREQOIRPJ9OHnNv7sspOCl1qIrGBw9NtmymCT2jafaxkhJQn5vsKsvXVgk8EHaGJyYx/16Beue4IpHVND6DkYHLekiCAvvHP7L8JKl2eePexxmtjK+l2vmjiV9ohNCtAqSQt8EZpCylosRNfG7sLoAhcgpUXU20OahNp62xSsXSYVXU55+pv9CGV2sGSQQMpVc/PocjfmpJ0GOZoCK7L2vHWfCXiLW5s+idnCPDSz4YoNBQGS+P/M1ilY6TJ47Q1y6e9lfe2aLo4eRtTWNhlvxlKR239krKSl48k0IDPvyI8oZV7B0FkDg8f45PqPXxSI4995m6x2+KLufYbvK0ZOkEgopk7w0IMsOTO7FZ5v7Z5n0jpKnybtHWlSzEBjemiMpuPAHypJwllz8NoxAn0DnGulY3D8+DwMXn8DBoNjcOr99+OaNWvwM1s3w3JlcPQNcGM4Sxdas5jc1wTF07oelrlDcuaiT+811OZX6co9NtWXHmEuWypb792YJSWkz1955NH4ue2/hCwSvn/qFLz40n8R0Lf5XNOGORefn6Lvl+qgDPYYfPfdd8HfY2Nne98o8qKNYP0TE8842fLkAMQBLVDg/NBWtoo5Tx8QIGS+WuTio/V3T7yLf/LYvvz2bH0s+S55BFnvQoCffvawd3pSdUZU6bnFuzR7eN/4hL7nT0jrs31atWmftyV4zbG+YAvZJ/QdwcW+U6I1Ini8x/JXbCqovO6xKDe8evT1JcGeOvU+/PMzz6EtyAFkokJIU0PZw6KaNPtomvy13tC1WEpJ3aCam5tl0urr8mzF7kLcDUZQOnehaV4tHmMxCB/paRufRmPGklSiNzGIO/Lvvzp4XYCdr/z7f7wCnn5MNxcBlIgS7XngnRyLZ6BxjGKS5j/PWGXGg6a5+rqnIvVGzIYGZ+Qynq32ZgR3BLVktLiB0v1SWLhnwptvvQ3nK//yzHN6r69kFOTp70nMbCyuvm9ayGbjbUeQCEG6IPtCBPCZpvqqrMX67pmRbQgpwA2gu1eaWk0uLtztgEy8pOZleWq8EOKRF89Z+oETJ74n1ndl57nFnx8t4/pzvZeVEG1CLdW69MrLrdhUTyXAB8jUWFd9XnVXF6j4nzQ/OYgAQ4zp1eiZQlKVu7KJsmhGNqUGDgAiZKH6rfPEcYrtEXFRMIdxgs6MauP0BxYk5sbjhfSa8Tz/p3Oz8wmw3bVHtgjZijuKf0sHGO9V3tHeHm1MnvUpk1pa+UvElXVMavyblLYWx/E/fOMfE8g0wRFN75kCzPnX/lusS3urtPWJwDa8ZYJW1XGP/0oC/JePPsAW7uu+qHSwpcFmXSO4yaNPrrk/lcQU083pnugjsFCwj/544cWXElh25zePfydTU4w5k1pXh0XZR7ulcj/WbRJl+6tqnrGdA5hLjU1h5TrqBjE5hMz04SOp0eIWPD61U2Is8Gvjoik9sx66m75w5D+Twfb99d9Ccb88IRSurV6cck4SJCAb3NSN0cHqNidebBxZGC+VipQdn7//8NnhmVsXzvK2hrO8rYEXqbDtujTn5eb0qDTNY+MXG74tHtGAseeIL+qXt9y8iecd8YUjr4CZ3wb1xX1JW6HtBRHLyhanuq6waXrQ8O6e3hisGhuDsVVXwKreqgMH/uKhe0t85255qOHeJjSvdnX3EzXP/tWBhlQBqqibzNjqstqfmuZaFbDowWRevr/w45EO1t9GAvpS0RMj6ay4NT0/ywpLnznD1LGRTS8EvK7ny9jN8BaVwX8fOfnJm245QwjuCGlOi6d/krIDGJm9dMloXOwNM+Fibo7ZTooJk6ozjYEWHpD81nleJ6tcSIBauNK9mChxWqetS7KjZ6y3ijes7fqbP3+4vyxgAf2tF1+ZvOnmcXrRxpj3Wpm6yc4rig5HARYdAflcW+uunr92PwFLeTEWFkQYDYfoik9sahvX2I1r3cIEPXLnXsPHqrmD+x556HzYlty2VLftHnrYQGKj6SE9lPdIcV5jYrCUlZky5hSc3DHn0Jg1UiyZPX3GzMhYXs/SSsxNIA2skhOlHQZc98iVJYZj04wNDv7Vw0tuRVwS8IEDcyd7sdtMrjLfU9ACXLb76b5HIQzfAetSzjvA03NKXSEx92gHFHXM6c6x2pBHdb6wcd5DLVsQ+ZD29XiTWu8d+rkdLlDqC305GLx85obJjU8RuGl62bhJRxihk5H4zB6LpsoKNsYiRLH0eZGFkAY34KoYc25VyL5/WkipQXVjjtkxZud3yHybv3bgD+fhcgFzOTZ4+eQNnyDQWE/R69dGI5xCCY2knRKOc1JeqQBMX2aBlsavWbTr7AWakEAhJrEoMzBK+mnGUGK2NxYJ7NGFCjY9cWDuxHJ4EC6h/Nrd9+2l9dadbdpumDeX+ipjKDajmaKE0iVC1kkptUqnuFtoLbvvJNOyC4tUtG3ETWOxynssx3gf9R8Pm2r2EIXgxWC4JMBcfvXunTu6djhDi80TQ90aga2uv4Ivs0bfSZtHSQbLyMwSUekfruB0PF6ppMW8UVwAE9gebywlN66b3klilD2Pf31uDi6hLOvSi8u3X3t5sOGmT9FQqxqndk2iyZ50QKXjahPxqFrchL3WlQPS0Rkd9QgwG8DovujaUw4dlCnIqkiA+2NjzR2PH5x7Gi6xXLKFy3Lnb3xhOrRhL60tT3TFnwKIe/sejGDL6DpJgAXn+YSMx7iTk28O1z3SaUe8ZIc+hfCeJ772aB8us3wgwF4+d9cXplqIM6Hrprrgm9fSimSMaasE5JhGSG494iFMVKKgKvk7B94JT7D7NL2654m/v3ygXlYEsJfpu35rArCejm23jex7q/05D+qYOYHOORZcQSmFVYgpfunoY419ODP21UOH5lbsr9RWFHBZpqd3jsMVZybJyJTO4gbCPk6YJgjrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
@@ -13726,6 +14168,7 @@ const CommonContext = createContext({
13726
14168
  mapRef: null,
13727
14169
  globalHeight: 0,
13728
14170
  heightOptions: [],
14171
+ overlayScale: 1,
13729
14172
  });
13730
14173
  const CommonContextProvider = CommonContext.Provider;
13731
14174
  const useCommonContext = () => useContext(CommonContext);
@@ -14735,24 +15178,26 @@ function generateStraightParallelPaths(points, offsetDistance) {
14735
15178
  }
14736
15179
  return [parallelPath2Data, parallelPath1Data];
14737
15180
  }
14738
- const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className }) => {
15181
+ const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className, }) => {
14739
15182
  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' } })] }));
15183
+ 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
15184
  };
14742
15185
 
14743
15186
  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 }));
15187
+ const { overlayScale } = useCommonContext();
15188
+ const radius = typeof r === 'number' ? r : 12;
15189
+ return (jsx("circle", { r: radius * overlayScale, stroke: stroke || '#fff', fill: '#fff', strokeWidth: 2 * overlayScale, ...props }));
14745
15190
  });
14746
15191
 
14747
- var _path$c;
14748
- function _extends$k() { return _extends$k = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$k.apply(null, arguments); }
15192
+ var _path$b;
15193
+ function _extends$j() { return _extends$j = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$j.apply(null, arguments); }
14749
15194
  var SvgDelete$1 = function SvgDelete(props) {
14750
- return /*#__PURE__*/React.createElement("svg", _extends$k({
15195
+ return /*#__PURE__*/React.createElement("svg", _extends$j({
14751
15196
  xmlns: "http://www.w3.org/2000/svg",
14752
15197
  width: 16,
14753
15198
  height: 16,
14754
15199
  fill: "none"
14755
- }, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
15200
+ }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
14756
15201
  fill: "#FD494D",
14757
15202
  d: "M6.667 12a.667.667 0 0 0 .666-.667v-4a.667.667 0 1 0-1.333 0v4a.667.667 0 0 0 .667.667m6.666-8h-2.666v-.667a2 2 0 0 0-2-2H7.333a2 2 0 0 0-2 2V4H2.667a.667.667 0 0 0 0 1.333h.666v7.334a2 2 0 0 0 2 2h5.334a2 2 0 0 0 2-2V5.333h.666a.667.667 0 1 0 0-1.333m-6.666-.667a.667.667 0 0 1 .666-.666h1.334a.667.667 0 0 1 .666.666V4H6.667zm4.666 9.334a.667.667 0 0 1-.666.666H5.333a.667.667 0 0 1-.666-.666V5.333h6.666zm-2-.667a.667.667 0 0 0 .667-.667v-4a.667.667 0 0 0-1.333 0v4a.667.667 0 0 0 .666.667"
14758
15203
  })));
@@ -14873,14 +15318,12 @@ const calculatePhysicalDistance$1 = (point1, point2) => {
14873
15318
  * @returns 中点坐标 [x, y]
14874
15319
  */
14875
15320
  const calculateMidpoint$1 = (point1, point2) => {
14876
- return [
14877
- (point1[0] + point2[0]) / 2,
14878
- (point1[1] + point2[1]) / 2
14879
- ];
15321
+ return [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
14880
15322
  };
14881
15323
  const DistanceLabels = ({ coordinates, createMode = false, editMode = false, completed = false, showPoints = false, mousePos: _mousePos = null, ghostLastDistance = null, ghostLastMidpoint = null, ghostFirstDistance = null, ghostFirstMidpoint = null, }) => {
14882
15324
  // 只在显示可操作顶点时显示距离
14883
- if (!(createMode && showPoints || editMode || (createMode && completed)) || coordinates.length < 2) {
15325
+ if (!((createMode && showPoints) || editMode || (createMode && completed)) ||
15326
+ coordinates.length < 1) {
14884
15327
  return null;
14885
15328
  }
14886
15329
  return (jsxs(Fragment, { children: [coordinates.map((coord, idx) => {
@@ -14927,12 +15370,13 @@ var MobileEditMode;
14927
15370
  })(MobileEditMode || (MobileEditMode = {}));
14928
15371
  var ClickEventType;
14929
15372
  (function (ClickEventType) {
15373
+ // 点击doodle的active time的时候触发
14930
15374
  ClickEventType["DOODLE_ACTIVE_TIME"] = "doodleActiveTime";
14931
15375
  })(ClickEventType || (ClickEventType = {}));
14932
15376
  const INIT_EDIT_MAP_INFO = {
14933
15377
  editMap: false,
14934
15378
  selectElement: null,
14935
- createMode: CreateStatus.CREATING,
15379
+ createMode: null,
14936
15380
  elementType: undefined,
14937
15381
  isShowDrag: false,
14938
15382
  mobileMode: MobileEditMode.START,
@@ -15289,7 +15733,7 @@ const useCheckElement = () => {
15289
15733
  return { isValid: true };
15290
15734
  }, [editMapInfo, svgElementDatas, minDistance]);
15291
15735
  const checkCanNotCreateAtPosition = useCallback((checkPoint) => {
15292
- // console.log('editMapInfo.elementType--->', editMapInfo.elementType);
15736
+ console.log('editMapInfo.elementType--->', editMapInfo.elementType);
15293
15737
  if (!editMapInfo.elementType)
15294
15738
  return false;
15295
15739
  const points = editMapInfo?.selectElement?.points || [];
@@ -15456,8 +15900,9 @@ const createPathData = (points) => {
15456
15900
  }
15457
15901
  return pathData;
15458
15902
  };
15459
- const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity = 1, strokeColor = '#000', strokeWidth = 2, strokeOpacity = 1, createMode = false, showPoints = false, onPointClick, completed = false, mousePos = null, editMode = false, onCoordinatesChange, onPathClick, onPolygonClick, onVertexDelete, draggable = true, // 新增参数,如果未指定则根据createMode和editMode自动判断
15903
+ const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity = 1, strokeColor = '#000', strokeWidth = 2, strokeOpacity = 1, createMode = false, showPoints = false, onPointClick, completed = false, mousePos = null, editMode = false, onCoordinatesChange, onPathClick, onPolygonClick, onVertexDelete, draggable = true, // 新增参数,如果未指定则根据createMode和editMode自动判断
15460
15904
  }) => {
15905
+ const { overlayScale } = useCommonContext();
15461
15906
  const { svgRef } = useSvgEditContext();
15462
15907
  const [dragState, setDragState] = useState({
15463
15908
  isDragging: false,
@@ -15473,6 +15918,10 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15473
15918
  const { checkCanNotCreateAtPosition } = useCheckElement();
15474
15919
  const { editMapInfo } = useMapEditContext();
15475
15920
  const { platform } = useCommonContext();
15921
+ // delete icon可能被上一个点遮挡,因为delete在右上方,所以手动处理点让点按照顺时针渲染,这样delete icon层级就会高一些
15922
+ const coordinates = useMemo(() => {
15923
+ return editMapInfo?.createMode === CreateStatus.CREATING ? points : [...points].reverse();
15924
+ }, [points, editMapInfo?.createMode]);
15476
15925
  // 计算点到线段的垂足坐标(使用通用工具函数)
15477
15926
  const calculatePerpendicularFoot$1 = useCallback((point, lineStart, lineEnd) => {
15478
15927
  return calculatePerpendicularFoot(point, lineStart, lineEnd);
@@ -15681,8 +16130,6 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15681
16130
  else {
15682
16131
  // mouseUp 时才真正插入新顶点
15683
16132
  newCoordinates.splice(dragState.newVertexIndex, 0, dragState.currentPosition);
15684
- // 通知外部坐标变化
15685
- onCoordinatesChange?.(newCoordinates);
15686
16133
  }
15687
16134
  }
15688
16135
  else {
@@ -15693,9 +16140,11 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15693
16140
  else {
15694
16141
  newCoordinates[dragState.dragIndex] = dragState.currentPosition;
15695
16142
  }
15696
- // 通知外部坐标变化
15697
- onCoordinatesChange?.(newCoordinates);
15698
16143
  }
16144
+ const result = editMapInfo?.createMode === CreateStatus.CREATING
16145
+ ? newCoordinates
16146
+ : newCoordinates.reverse();
16147
+ onCoordinatesChange?.(result);
15699
16148
  }
15700
16149
  setDragState({
15701
16150
  isDragging: false,
@@ -15706,7 +16155,7 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15706
16155
  edgeInfo: null,
15707
16156
  dragType: null,
15708
16157
  });
15709
- }, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor]);
16158
+ }, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor, editMapInfo?.createMode]);
15710
16159
  // 添加全局事件监听(支持触摸和鼠标事件)
15711
16160
  useEffect(() => {
15712
16161
  if (dragState.isDragging) {
@@ -15778,22 +16227,14 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15778
16227
  mousePos.y,
15779
16228
  ])
15780
16229
  : null;
15781
- const ghostFirstDistance = createMode &&
15782
- mousePos &&
15783
- renderCoordinates.length > 0 &&
15784
- !completed &&
15785
- renderCoordinates.length >= 3
16230
+ const ghostFirstDistance = createMode && mousePos && !completed && renderCoordinates.length >= 1
15786
16231
  ? calculatePhysicalDistance(renderCoordinates[0], [mousePos.x, mousePos.y])
15787
16232
  : null;
15788
16233
  // 虚拟连线的中点坐标
15789
16234
  const ghostLastMidpoint = createMode && mousePos && renderCoordinates.length > 0 && !completed
15790
16235
  ? calculateMidpoint(renderCoordinates[renderCoordinates.length - 1], [mousePos.x, mousePos.y])
15791
16236
  : null;
15792
- const ghostFirstMidpoint = createMode &&
15793
- mousePos &&
15794
- renderCoordinates.length > 0 &&
15795
- !completed &&
15796
- renderCoordinates.length >= 3
16237
+ const ghostFirstMidpoint = createMode && mousePos && !completed && renderCoordinates.length >= 1
15797
16238
  ? calculateMidpoint(renderCoordinates[0], [mousePos.x, mousePos.y])
15798
16239
  : null;
15799
16240
  return (jsxs(Fragment, { children: [(editMode || (createMode && completed)) &&
@@ -15847,14 +16288,14 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15847
16288
  setHoverVertex(null);
15848
16289
  },
15849
16290
  }) }, `edge-${index}`));
15850
- }), ghostLastPath && (jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >= 3 && (jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed }), jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint }), hoverVertex && !dragState.isDragging && (jsx(VertexElement, { cx: hoverVertex.position.x, cy: hoverVertex.position.y, stroke: strokeColor, strokeOpacity: 0.6, fill: "white", fillOpacity: 0.8, pointerEvents: "none" })), ((createMode && showPoints) || editMode || (createMode && completed)) &&
16291
+ }), ghostLastPath && (jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >= 2 && (jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed }), jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint }), hoverVertex && !dragState.isDragging && (jsx(VertexElement, { cx: hoverVertex.position.x, cy: hoverVertex.position.y, stroke: strokeColor, strokeOpacity: 0.6, fill: "white", fillOpacity: 0.8, pointerEvents: "none" })), ((createMode && showPoints) || editMode || (createMode && completed)) &&
15851
16292
  renderCoordinates.map((coord, idx) => {
15852
16293
  // 判断当前顶点的状态
15853
16294
  const isLastPoint = idx === renderCoordinates.length - 1;
15854
16295
  const canComplete = createMode && !completed && renderCoordinates.length >= 3 && isLastPoint;
15855
16296
  const isCreatedAndCanDrag = createMode && completed; // 创建完成后可拖拽
15856
16297
  const isInEditMode = editMode;
15857
- return (jsxs("g", { children: [jsx(VertexElement, { className: generateVertexClassName, stroke: strokeColor, cx: coord[0], cy: coord[1], onClick: (e) => handleVertexClick(e, idx), onDoubleClick: (e) => {
16298
+ return (jsxs("g", { children: [jsx(VertexElement, { className: generateVertexClassName, stroke: strokeColor, cx: coord[0], cy: coord[1], r: canComplete ? 16 : 12, onClick: (e) => handleVertexClick(e, idx), onDoubleClick: (e) => {
15858
16299
  // 阻止双击事件冒泡到Google Maps
15859
16300
  e.preventDefault();
15860
16301
  e.stopPropagation();
@@ -15902,16 +16343,40 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
15902
16343
  }
15903
16344
  }
15904
16345
  },
15905
- }) }), tooltipIndex === idx && (jsxs("g", { transform: `translate(${coord[0] + 4}, ${coord[1] - 4})`, onClick: (e) => {
16346
+ onMouseUp: (e) => {
16347
+ // 拖拽逻辑:编辑模式或创建完成后
16348
+ if (isInEditMode || isCreatedAndCanDrag) {
16349
+ if (draggable) {
16350
+ // 延迟执行mouseDown,等待可能的doubleClick
16351
+ if (mouseDownTimerRef.current !== null) {
16352
+ window.clearTimeout(mouseDownTimerRef.current);
16353
+ }
16354
+ }
16355
+ }
16356
+ },
16357
+ }) }), tooltipIndex === idx && (jsxs("g", { transform: `translate(${coord[0] + 4 * overlayScale * 2}, ${coord[1] - 4 * overlayScale * 2}) scale(${overlayScale * 2})`, onClick: (e) => {
15906
16358
  e.preventDefault();
15907
16359
  e.stopPropagation();
15908
16360
  if (onVertexDelete &&
15909
16361
  (editMode || (createMode && completed)) &&
15910
16362
  coordinates.length > 3) {
15911
- onVertexDelete(idx);
16363
+ // 当前是逆时针展示的,但是外部数据是顺时针的,所以idx需要转换一下
16364
+ onVertexDelete(renderCoordinates?.length - 1 - idx);
15912
16365
  }
15913
16366
  setTooltipIndex(null);
15914
- }, style: { cursor: 'pointer' }, children: [jsx("rect", { x: 0, y: -24, width: 20, height: 20, rx: 2, ry: 2, fill: "#fff", strokeWidth: 1, filter: "url(#vertex-tooltip-shadow)" }), jsx("g", { transform: `translate(2, -22)`, children: jsx(SvgDelete$1, {}) })] })), canComplete && (jsx("text", { x: coord[0], y: coord[1], textAnchor: "middle", alignmentBaseline: "middle", fontSize: 20, fill: strokeColor, style: { pointerEvents: 'none' }, children: "\u2713" }))] }, `vertex-${idx}`));
16367
+ }, style: { cursor: 'pointer' }, children: [jsx("rect", { x: 0, y: -24, width: 20, height: 20, rx: 2, ry: 2, fill: "#fff", strokeWidth: 1, filter: "url(#vertex-tooltip-shadow)" }), jsx("g", { transform: `translate(2, -22)`, children: jsx(SvgDelete$1, {}) })] })), canComplete && (jsx("g", { style: { pointerEvents: 'none' }, transform: `translate(${coord[0] - 5 * overlayScale * 3}, ${coord[1] - 2.5 * overlayScale * 3}) scale(${overlayScale * 3})`, children: jsx("svg", { width: "10", height: "5", viewBox: "0 0 6 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M0.5 2.5L1.3452 3.3452C1.71469 3.71469 2.30636 3.73741 2.7031 3.39735L5.5 1", stroke: "#FF7A33", "stroke-linecap": "round" }) }) })
16368
+ // <rect
16369
+ // x={coord[0]}
16370
+ // y={coord[1]}
16371
+ // width={20}
16372
+ // height={20}
16373
+ // rx={2}
16374
+ // ry={2}
16375
+ // fill="transparent"
16376
+ // style={{ pointerEvents: 'none' }}
16377
+ // >
16378
+ // </rect>
16379
+ )] }, `vertex-${idx}`));
15915
16380
  })] }));
15916
16381
  };
15917
16382
 
@@ -15963,7 +16428,7 @@ const BoundaryElement = ({ data }) => {
15963
16428
  }));
15964
16429
  }
15965
16430
  }, [platform, data, editMapInfo]);
15966
- return (jsx(PolygonElement, { coordinates: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: onPathClick, onCoordinatesChange: (coordinates) => {
16431
+ return (jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: onPathClick, onCoordinatesChange: (coordinates) => {
15967
16432
  console.log('onCoordinatesChange', coordinates);
15968
16433
  setEditMapInfo((prev) => ({
15969
16434
  ...prev,
@@ -16098,6 +16563,7 @@ const ObstacleElement = ({ data }) => {
16098
16563
  }
16099
16564
  }, [editMapInfo]);
16100
16565
  const currentPoints = useMemo(() => {
16566
+ // 为了方便解决删除顶点的时候,delete icon被遮挡的问题,所以逆序一下
16101
16567
  if (editMapInfo?.selectElement?.id === data.id) {
16102
16568
  return editMapInfo.selectElement.points;
16103
16569
  }
@@ -16141,7 +16607,11 @@ const ObstacleElement = ({ data }) => {
16141
16607
  setEditMapInfo((prev) => ({
16142
16608
  ...prev,
16143
16609
  selectElement: data,
16144
- historyList: [data],
16610
+ historyList: [
16611
+ {
16612
+ selectElement: data,
16613
+ },
16614
+ ],
16145
16615
  currentHistoryIndex: 0,
16146
16616
  elementType: DataType.OBSTACLE,
16147
16617
  editMap: true,
@@ -16155,7 +16625,7 @@ const ObstacleElement = ({ data }) => {
16155
16625
  }
16156
16626
  return editMapInfo?.selectElement?.id === data.id;
16157
16627
  }, [editMapInfo, data, platform]);
16158
- return (jsx(PolygonElement, { coordinates: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: editMode, showPoints: editMapInfo?.selectElement?.id === data.id, onPathClick: onPathClick, onPolygonClick: () => {
16628
+ return (jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: editMode, showPoints: editMapInfo?.selectElement?.id === data.id, onPathClick: onPathClick, onPolygonClick: () => {
16159
16629
  if (platform === PlatformType.H5) {
16160
16630
  onPathClick();
16161
16631
  }
@@ -16583,9 +17053,9 @@ const useVisionOffTransform = (data, scaleConstraints
16583
17053
  };
16584
17054
 
16585
17055
  var _g$7, _defs$7;
16586
- function _extends$j() { return _extends$j = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$j.apply(null, arguments); }
17056
+ function _extends$i() { return _extends$i = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$i.apply(null, arguments); }
16587
17057
  var SvgTransformDelete = function SvgTransformDelete(props) {
16588
- return /*#__PURE__*/React.createElement("svg", _extends$j({
17058
+ return /*#__PURE__*/React.createElement("svg", _extends$i({
16589
17059
  xmlns: "http://www.w3.org/2000/svg",
16590
17060
  width: 20,
16591
17061
  height: 20,
@@ -16634,9 +17104,9 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
16634
17104
  };
16635
17105
 
16636
17106
  var _g$6, _defs$6;
16637
- function _extends$i() { return _extends$i = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$i.apply(null, arguments); }
17107
+ function _extends$h() { return _extends$h = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$h.apply(null, arguments); }
16638
17108
  var SvgTransformRotate = function SvgTransformRotate(props) {
16639
- return /*#__PURE__*/React.createElement("svg", _extends$i({
17109
+ return /*#__PURE__*/React.createElement("svg", _extends$h({
16640
17110
  xmlns: "http://www.w3.org/2000/svg",
16641
17111
  width: 21,
16642
17112
  height: 20,
@@ -16670,9 +17140,9 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
16670
17140
  };
16671
17141
 
16672
17142
  var _g$5, _defs$5;
16673
- function _extends$h() { return _extends$h = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$h.apply(null, arguments); }
17143
+ function _extends$g() { return _extends$g = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$g.apply(null, arguments); }
16674
17144
  var SvgTransformScale = function SvgTransformScale(props) {
16675
- return /*#__PURE__*/React.createElement("svg", _extends$h({
17145
+ return /*#__PURE__*/React.createElement("svg", _extends$g({
16676
17146
  xmlns: "http://www.w3.org/2000/svg",
16677
17147
  width: 21,
16678
17148
  height: 20,
@@ -16706,9 +17176,9 @@ var SvgTransformScale = function SvgTransformScale(props) {
16706
17176
  };
16707
17177
 
16708
17178
  var _g$4, _defs$4;
16709
- function _extends$g() { return _extends$g = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$g.apply(null, arguments); }
17179
+ function _extends$f() { return _extends$f = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$f.apply(null, arguments); }
16710
17180
  var SvgTransformTranslate = function SvgTransformTranslate(props) {
16711
- return /*#__PURE__*/React.createElement("svg", _extends$g({
17181
+ return /*#__PURE__*/React.createElement("svg", _extends$f({
16712
17182
  xmlns: "http://www.w3.org/2000/svg",
16713
17183
  width: 20,
16714
17184
  height: 20,
@@ -16744,6 +17214,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
16744
17214
  };
16745
17215
 
16746
17216
  const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCancel, onDragEnd, onDragMove, disabled = false, className = '', scaleConstraints = { minEdgeLength: 0.5, maxEdgeLength: 10000 }, showInfo = true, }) => {
17217
+ const { overlayScale } = useCommonContext();
16747
17218
  const { platform } = useCommonContext();
16748
17219
  const { editMapInfo } = useMapEditContext();
16749
17220
  const dataPoints = useMemo(() => {
@@ -16859,7 +17330,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
16859
17330
  return;
16860
17331
  onDragMove?.(currentPoints.map((point) => [point.x, point.y]));
16861
17332
  }, [currentPoints, isSelected, isDragging, isRotating, isScaling]);
16862
- return (jsxs("g", { ref: containerRef, className: `vision-off-transform-wrapper ${className} ${isSelected ? 'selected' : ''}`, "data-transform-wrapper": "true", children: [jsx(PolygonElement, { coordinates: visionOffData?.points, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: () => {
17333
+ return (jsxs("g", { ref: containerRef, className: `vision-off-transform-wrapper ${className} ${isSelected ? 'selected' : ''}`, "data-transform-wrapper": "true", children: [jsx(PolygonElement, { points: visionOffData?.points, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: () => {
16863
17334
  onSelect?.();
16864
17335
  }, onPolygonClick: () => {
16865
17336
  if (platform === PlatformType.H5) {
@@ -16885,12 +17356,12 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
16885
17356
  const centerX = (minX + maxX) / 2;
16886
17357
  // 计算尺寸显示框的位置(选择框下方)
16887
17358
  const infoBoxY = maxY + 20; // 选择框下方20像素
16888
- const infoBoxWidth = 140; // 信息框宽度
16889
- const infoBoxHeight = 30; // 信息框高度
17359
+ const infoBoxWidth = 140 * overlayScale; // 信息框宽度
17360
+ const infoBoxHeight = 30 * overlayScale; // 信息框高度
16890
17361
  const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
16891
- const scale = isWeb ? 2 : 1;
17362
+ const scale = (isWeb ? 2 : 1) * overlayScale;
16892
17363
  const offsetLeft = 10 * scale;
16893
- return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#9EA6BA", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
17364
+ return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#f16629", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
16894
17365
  ? {
16895
17366
  onTouchStart: createReactEventHandler((e) => {
16896
17367
  handleMouseDownWithDisabled(e);
@@ -16940,6 +17411,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
16940
17411
  fontSize: '12px',
16941
17412
  color: 'white',
16942
17413
  fontWeight: '400',
17414
+ // transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
16943
17415
  }, children: [dimensions.height, "m \u00D7 ", dimensions.width, "m"] }) }))] }));
16944
17416
  })()] }));
16945
17417
  };
@@ -16997,7 +17469,11 @@ const VisionOffElement = ({ data, onSelect }) => {
16997
17469
  ...prev,
16998
17470
  selectElement: data,
16999
17471
  elementType: DataType.VISION_OFF,
17000
- historyList: [data],
17472
+ historyList: [
17473
+ {
17474
+ selectElement: data,
17475
+ },
17476
+ ],
17001
17477
  currentHistoryIndex: 0,
17002
17478
  editMap: true,
17003
17479
  isShowDrag: true,
@@ -17359,8 +17835,8 @@ const useDoodleTransform = (data, onTransformChange, options) => {
17359
17835
  const scaledHeight = height * currentScale;
17360
17836
  // 转换为米单位(假设SVG坐标单位是米)
17361
17837
  // 这里可以根据实际的地图比例尺进行调整
17362
- const widthInMeters = scaledWidth;
17363
- const heightInMeters = scaledHeight;
17838
+ const widthInMeters = scaledWidth / SCALE_FACTOR;
17839
+ const heightInMeters = scaledHeight / SCALE_FACTOR;
17364
17840
  return {
17365
17841
  width: Math.round(widthInMeters * 100) / 100, // 保留2位小数
17366
17842
  height: Math.round(heightInMeters * 100) / 100, // 保留2位小数
@@ -17392,15 +17868,15 @@ const useDoodleTransform = (data, onTransformChange, options) => {
17392
17868
  };
17393
17869
  };
17394
17870
 
17395
- var _path$b;
17396
- function _extends$f() { return _extends$f = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$f.apply(null, arguments); }
17871
+ var _path$a;
17872
+ function _extends$e() { return _extends$e = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$e.apply(null, arguments); }
17397
17873
  var SvgTransformArrow = function SvgTransformArrow(props) {
17398
- return /*#__PURE__*/React.createElement("svg", _extends$f({
17874
+ return /*#__PURE__*/React.createElement("svg", _extends$e({
17399
17875
  xmlns: "http://www.w3.org/2000/svg",
17400
17876
  width: 7,
17401
17877
  height: 11,
17402
17878
  fill: "none"
17403
- }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
17879
+ }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
17404
17880
  fill: "#fff",
17405
17881
  d: "M2.156 1.032a.777.777 0 0 0-1.061 0 .69.69 0 0 0-.062.943l.062.068 3.97 3.78-3.97 3.78a.69.69 0 0 0-.062.944l.062.067c.27.257.696.277.99.06l.07-.06 4.5-4.286a.69.69 0 0 0 .063-.943l-.062-.067z",
17406
17882
  opacity: 0.5
@@ -17462,7 +17938,7 @@ const DoodleTransform = ({ data, isSelected: _isSelected, onSelect }) => {
17462
17938
  };
17463
17939
 
17464
17940
  const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOperation = false, onSelect, onCancel, onTransformChange, disabled = false, className = '', minScale, onMinScaleReached, onDragMove, onDragEnd, showInfo = true, onClickInfo, }) => {
17465
- const { platform } = useCommonContext();
17941
+ const { platform, overlayScale } = useCommonContext();
17466
17942
  // 使用自定义hook管理所有变换逻辑
17467
17943
  const { currentCenter, currentScale, currentDirection, isDragging, isRotating, isScaling, initializeTransform, calculateSelectionBoxPoints, handleMouseDown, handleRotateStart, handleScaleStart, handleMouseMove, handleMouseUp, containerRef, dimensions, } = useDoodleTransform(data, onTransformChange, {
17468
17944
  minScale,
@@ -17484,16 +17960,20 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
17484
17960
  }, [data?.svg, currentCenter, currentScale, currentDirection]);
17485
17961
  const isWeb = useMemo(() => platform === 'web', [platform]);
17486
17962
  const activeTime = useMemo(() => {
17487
- // 如果当前时间在有效期范围,则显示有效期,否则显示0
17488
- const now = Date.now();
17489
- console.log('now------->', now);
17490
- console.log('data.create_ts------->', data.create_ts);
17491
- console.log('data.expiration_ts------->', data.expiration_ts);
17492
- if (data.create_ts <= now && data.expiration_ts >= now) {
17493
- return Math.floor((data.expiration_ts - now) / (60 * 60 * 24 * 1000));
17963
+ if (data.create_ts && data.expiration_ts) {
17964
+ return Math.floor((data.expiration_ts - data.create_ts) / (60 * 60 * 24));
17494
17965
  }
17495
17966
  return 0;
17496
17967
  }, [data]);
17968
+ const remainingTime = useMemo(() => {
17969
+ const currentTime = Math.floor(Date.now() / 1000);
17970
+ console.log('data.expiration_ts--', data.expiration_ts);
17971
+ if (data.expiration_ts <= currentTime) {
17972
+ return 0;
17973
+ }
17974
+ // 保留一位小数
17975
+ return ((currentTime - data.expiration_ts) / (24 * 60 * 60)).toFixed(1);
17976
+ }, [data]);
17497
17977
  // 初始化变换状态
17498
17978
  useEffect(() => {
17499
17979
  initializeTransform();
@@ -17574,7 +18054,18 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
17574
18054
  };
17575
18055
  const selectionBoxWithoutOperation = () => {
17576
18056
  const selectionBoxPoints = calculateSelectionBoxPoints();
17577
- 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
18057
+ // 计算选择框的边界
18058
+ const minX = Math.min(...selectionBoxPoints.map((p) => p.x));
18059
+ const maxX = Math.max(...selectionBoxPoints.map((p) => p.x));
18060
+ const maxY = Math.max(...selectionBoxPoints.map((p) => p.y));
18061
+ // 计算选择框的中心
18062
+ const centerX = (minX + maxX) / 2;
18063
+ // 计算尺寸显示框的位置(选择框下方)
18064
+ const infoBoxY = maxY + 20; // 选择框下方20像素
18065
+ const infoBoxWidth = 140 * overlayScale; // 信息框宽度
18066
+ const infoBoxHeight = 100 * overlayScale; // 信息框高度
18067
+ const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
18068
+ return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#B2B4B9", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
17578
18069
  ? {
17579
18070
  onTouchStart: createReactEventHandler((e) => {
17580
18071
  handleMouseDownWithDisabled(e);
@@ -17582,7 +18073,26 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
17582
18073
  }
17583
18074
  : {
17584
18075
  onMouseDown: handleMouseDownWithDisabled,
17585
- }) }), jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r: "6", fill: "#9EA6BA", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[3].x, cy: selectionBoxPoints[3].y, r: "6", fill: "#9EA6BA", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[1].x, cy: selectionBoxPoints[1].y, r: "6", fill: "#9EA6BA", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[2].x, cy: selectionBoxPoints[2].y, r: "6", fill: "#9EA6BA", stroke: "none" })] }));
18076
+ }) }), jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[3].x, cy: selectionBoxPoints[3].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[1].x, cy: selectionBoxPoints[1].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[2].x, cy: selectionBoxPoints[2].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
18077
+ onClickInfo?.();
18078
+ }, children: jsx("div", { style: {
18079
+ padding: '5px 6px',
18080
+ background: 'rgba(201, 209, 218, 1)',
18081
+ borderRadius: '10px',
18082
+ display: 'inline-flex',
18083
+ flexDirection: 'column',
18084
+ alignItems: 'flex-start',
18085
+ justifyContent: 'center',
18086
+ fontSize: '12px',
18087
+ color: 'white',
18088
+ fontWeight: '400',
18089
+ // transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
18090
+ }, children: jsx("div", { style: {
18091
+ display: 'flex',
18092
+ alignItems: 'center',
18093
+ justifyContent: 'center',
18094
+ gap: '10px',
18095
+ }, children: jsxs("div", { children: ["Remaining Time: ", remainingTime] }) }) }) })] }));
17586
18096
  };
17587
18097
  useEffect(() => {
17588
18098
  const isMove = isDragging || isRotating || isScaling;
@@ -17630,10 +18140,10 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
17630
18140
  const centerX = (minX + maxX) / 2;
17631
18141
  // 计算尺寸显示框的位置(选择框下方)
17632
18142
  const infoBoxY = maxY + 20; // 选择框下方20像素
17633
- const infoBoxWidth = 140; // 信息框宽度
17634
- const infoBoxHeight = 50; // 信息框高度
18143
+ const infoBoxWidth = 140 * overlayScale; // 信息框宽度
18144
+ const infoBoxHeight = 100 * overlayScale; // 信息框高度
17635
18145
  const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
17636
- const scale = isWeb ? 2 : 1;
18146
+ const scale = (isWeb ? 2 : 1) * overlayScale;
17637
18147
  const offsetLeft = 10 * scale;
17638
18148
  return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#9EA6BA", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
17639
18149
  ? {
@@ -17688,6 +18198,7 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
17688
18198
  fontSize: '12px',
17689
18199
  color: 'white',
17690
18200
  fontWeight: '400',
18201
+ // transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
17691
18202
  }, children: [jsxs("div", { children: [dimensions.height, "m \u00D7 ", dimensions.width, "m"] }), jsxs("div", { style: {
17692
18203
  display: 'flex',
17693
18204
  alignItems: 'center',
@@ -17698,9 +18209,9 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
17698
18209
  };
17699
18210
 
17700
18211
  const DoodleElement = ({ data }) => {
17701
- const { editMapInfo, setEditMapInfo, onHandleEnterRecord, onClickEvent } = useMapEditContext();
18212
+ const { editMapInfo, setEditMapInfo, onHandleEnterRecord, onHandleEvent } = useMapEditContext();
17702
18213
  const { addHistory } = useHistoryHandle();
17703
- const { platform } = useCommonContext();
18214
+ const { platform, doodleList } = useCommonContext();
17704
18215
  const isSelected = useMemo(() => {
17705
18216
  if (platform === PlatformType.H5) {
17706
18217
  if (editMapInfo.mobileMode !== MobileEditMode.START &&
@@ -17717,6 +18228,23 @@ const DoodleElement = ({ data }) => {
17717
18228
  }
17718
18229
  return data;
17719
18230
  }, [data, editMapInfo?.selectElement]);
18231
+ const minScale = useMemo(() => {
18232
+ const doodleInfo = doodleList.find((item) => {
18233
+ // 移除所有空白字符(包括\n、\r、\t等)进行比较
18234
+ const normalizedItemSvg = item.svgStr?.replace(/[\s\n\r\t]+/g, '').replace(/\\n/g, '');
18235
+ const normalizedOriginSvg = originData.svg?.replace(/[\s\n\r\t]+/g, '').replace(/\\n/g, '');
18236
+ // console.log('normalizedItemSvg--->', normalizedItemSvg, normalizedOriginSvg);
18237
+ return normalizedItemSvg === normalizedOriginSvg;
18238
+ });
18239
+ console.log('doodleList--->', doodleList, originData, doodleInfo);
18240
+ if (!doodleInfo) {
18241
+ return 1;
18242
+ }
18243
+ const minLength = doodleInfo?.minLength;
18244
+ const parseSvg = SvgParserNative.parseSvg(originData.svg);
18245
+ const svgMinLength = parseSvg.height / SCALE_FACTOR;
18246
+ return minLength / svgMinLength;
18247
+ }, [doodleList, originData]);
17720
18248
  const isSelectedWithoutOperation = useMemo(() => {
17721
18249
  if (platform === PlatformType.H5) {
17722
18250
  if (editMapInfo.mobileMode === MobileEditMode.START &&
@@ -17756,7 +18284,14 @@ const DoodleElement = ({ data }) => {
17756
18284
  })?.then(() => {
17757
18285
  setEditMapInfo((prev) => ({
17758
18286
  ...prev,
17759
- historyList: [data],
18287
+ historyList: [
18288
+ {
18289
+ selectElement: {
18290
+ ...data,
18291
+ transformedPoints: transformedElements,
18292
+ },
18293
+ },
18294
+ ],
17760
18295
  currentHistoryIndex: 0,
17761
18296
  selectElement: {
17762
18297
  ...data,
@@ -17788,8 +18323,8 @@ const DoodleElement = ({ data }) => {
17788
18323
  }));
17789
18324
  }, []);
17790
18325
  const handleClickInfo = useCallback(() => {
17791
- onClickEvent?.(ClickEventType.DOODLE_ACTIVE_TIME);
17792
- }, [onClickEvent]);
18326
+ onHandleEvent?.(ClickEventType.DOODLE_ACTIVE_TIME);
18327
+ }, [onHandleEvent]);
17793
18328
  // const handleDragMove = useCallback(
17794
18329
  // (data: DoodleData) => {
17795
18330
  // setEditMapInfo((prev: EditMapInfo) => ({
@@ -17817,7 +18352,8 @@ const DoodleElement = ({ data }) => {
17817
18352
  },
17818
18353
  });
17819
18354
  }, [transformedElements]);
17820
- return (jsx(DoodleTransformWrapper, { data: originData, onTransformChange: handleTransformChange, isSelected: isSelected, isSelectedWithoutOperation: isSelectedWithoutOperation, onSelect: handleSelect, onCancel: handleCancel, onDragEnd: handleDragEnd, showInfo: platform === PlatformType.H5, onClickInfo: handleClickInfo }));
18355
+ console.log('originData--->', originData, minScale);
18356
+ return (jsx(DoodleTransformWrapper, { data: originData, onTransformChange: handleTransformChange, isSelected: isSelected, isSelectedWithoutOperation: isSelectedWithoutOperation, onSelect: handleSelect, onCancel: handleCancel, onDragEnd: handleDragEnd, showInfo: platform === PlatformType.H5, onClickInfo: handleClickInfo, minScale: minScale }));
17821
18357
  };
17822
18358
 
17823
18359
  const SvgElement = React__default.memo(({ type, data, interactive = false }) => {
@@ -17963,6 +18499,7 @@ const ChannelClipPath = React__default.memo(() => {
17963
18499
  svgRef?.viewBox.baseVal?.width,
17964
18500
  svgRef?.viewBox.baseVal?.height,
17965
18501
  ]);
18502
+ console.log('boundaryData---->', svgRef?.viewBox.baseVal);
17966
18503
  /**
17967
18504
  * 判断多边形是否为逆时针方向
17968
18505
  * 使用叉积法计算多边形的有向面积
@@ -19050,27 +19587,37 @@ const getScreenCenterSvgPoint = (svgElement, mapInstance) => {
19050
19587
  */
19051
19588
  const CreateObstacleElement = forwardRef(({ enabled = false, svgElement, onPointsChange, styles, points }, ref) => {
19052
19589
  const { mapRef } = useCommonContext();
19590
+ const { checkCanNotCreateAtPosition } = useCheckElement();
19053
19591
  // 使用固定的样式,确保能正常渲染
19054
19592
  // 在十字准心位置添加点
19055
19593
  const addPoint = useCallback(() => {
19056
19594
  if (!enabled || !svgElement) {
19057
19595
  console.warn('未启用创建模式或SVG元素不存在');
19058
- return false;
19596
+ return { isValid: false, reason: '未启用创建模式或SVG元素不存在' };
19059
19597
  }
19060
19598
  if (!mapRef) {
19061
19599
  console.warn('地图实例不存在');
19062
- return false;
19600
+ return { isValid: false, reason: '地图实例不存在' };
19063
19601
  }
19064
19602
  const centerPoint = getScreenCenterSvgPoint(svgElement, mapRef);
19065
19603
  if (!centerPoint) {
19066
19604
  console.warn('无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内');
19067
- // 可以在这里添加用户友好的提示,比如显示toast消息
19068
- // window.alert('十字准心位置不在地图可见区域内,请调整地图位置后再试');
19069
- return false;
19605
+ return { isValid: false, reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内' };
19606
+ }
19607
+ console.error('centerPoint--->', centerPoint);
19608
+ console.error('checkCanNotCreateAtPosition--->', checkCanNotCreateAtPosition(centerPoint));
19609
+ // 校验是否能打点
19610
+ if (checkCanNotCreateAtPosition(centerPoint)) {
19611
+ return {
19612
+ isValid: false,
19613
+ reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内',
19614
+ };
19070
19615
  }
19071
19616
  const newPoints = [...points, centerPoint];
19072
19617
  onPointsChange?.(newPoints);
19073
- return true;
19618
+ return {
19619
+ isValid: true,
19620
+ };
19074
19621
  }, [enabled, svgElement, mapRef, points, onPointsChange]);
19075
19622
  // 撤销最后一个点
19076
19623
  const undoLastPoint = useCallback(() => {
@@ -19104,7 +19651,7 @@ const CreateObstacleElement = forwardRef(({ enabled = false, svgElement, onPoint
19104
19651
  if (!enabled || points.length === 0) {
19105
19652
  return null;
19106
19653
  }
19107
- return (jsx(PolygonElement, { coordinates: points.map((p) => [p.x, p.y, 2]), fillColor: styles.fillColor, fillOpacity: 0.3, strokeColor: styles.strokeColor, strokeWidth: 2, strokeOpacity: 1, createMode: true, showPoints: true, editMode: false, completed: true, draggable: false }));
19654
+ return (jsx(PolygonElement, { points: points.map((p) => [p.x, p.y, 2]), fillColor: styles.fillColor, fillOpacity: 0.3, strokeColor: styles.strokeColor, strokeWidth: 2, strokeOpacity: 1, createMode: true, showPoints: true, editMode: false, completed: true, draggable: false }));
19108
19655
  });
19109
19656
  CreateObstacleElement.displayName = 'CreateObstacleElement';
19110
19657
 
@@ -19160,7 +19707,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19160
19707
  const { editMapInfo, setEditMapInfo } = useMapEditContext();
19161
19708
  const { getVisionOffPoints, centerPoint } = useCreateVisionOffElement();
19162
19709
  const { svgElementDatas } = useSvgEditContext();
19163
- const { checkCanNotCreateAtPosition } = useCheckElement();
19710
+ const { checkCanNotCreateAtPosition, checkDoodle } = useCheckElement();
19164
19711
  const svgRef = useRef(null);
19165
19712
  const containerRef = useRef(null);
19166
19713
  const { platform } = useCommonContext();
@@ -19294,7 +19841,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19294
19841
  getEditMapInfo,
19295
19842
  // 十字准心点管理器方法
19296
19843
  addCreateObstaclePoint: () => {
19297
- return pointManagerRef.current?.addPoint();
19844
+ return pointManagerRef.current?.addPoint?.();
19298
19845
  },
19299
19846
  undoCreateObstaclePoint: () => {
19300
19847
  pointManagerRef.current?.undoLastPoint();
@@ -19316,6 +19863,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19316
19863
  clearHistory,
19317
19864
  addHistory,
19318
19865
  addDoodle,
19866
+ checkDoodle: () => checkDoodle?.(),
19319
19867
  }));
19320
19868
  // 初始化多边形绘制 Hook
19321
19869
  const { onSvgClick, onSvgMouseMove, onPointClick, points, completed, mousePos, updatePoints } = usePolygonDrawing({ createMode: isCreating });
@@ -19345,6 +19893,9 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19345
19893
  // pointerEvents: 'auto', // 关键:允许接收鼠标事件
19346
19894
  }, xmlns: "http://www.w3.org/2000/svg", "shape-rendering": "geometricPrecision", "text-rendering": "geometricPrecision", "image-rendering": "optimizeQuality", ref: svgRef, onClick: editMapInfo.createMode && platform !== PlatformType.H5 ? onSvgClick : undefined, onMouseMove: editMapInfo.createMode && platform !== PlatformType.H5 ? onSvgMouseMove : undefined, children: [jsxs("defs", { children: [jsx("filter", { id: "vertex-tooltip-shadow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: jsx("feDropShadow", { dx: "2", dy: "2", stdDeviation: "2", floodColor: "#000", floodOpacity: "0.12" }) }), jsxs("filter", { id: `path-hover-${DataType.BOUNDARY}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: BOUNDARY_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxs("filter", { id: `path-hover-${DataType.VISION_OFF}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: VISION_OFF_AREA_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxs("filter", { id: `path-hover-${DataType.OBSTACLE}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: OBSTACLE_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] })] }), Object.keys(svgElementDatas)
19347
19895
  ?.sort?.((a, b) => {
19896
+ if (a === DataType.BOUNDARY || b === DataType.BOUNDARY) {
19897
+ return 0;
19898
+ }
19348
19899
  const aVal = a === editMapInfo.elementType ? 1 : 0;
19349
19900
  const bVal = b === editMapInfo.elementType ? 1 : 0;
19350
19901
  return aVal - bVal;
@@ -19356,7 +19907,7 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
19356
19907
  editMapInfo.createMode &&
19357
19908
  editMapInfo.elementType !== DataType.DOODLE &&
19358
19909
  editMapInfo.elementType !== DataType.VISION_OFF &&
19359
- (points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsx(PolygonElement, { coordinates: points?.length > 0
19910
+ (points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsx(PolygonElement, { points: points?.length > 0
19360
19911
  ? points.map((p) => [p.x, p.y, 2])
19361
19912
  : editMapInfo?.selectElement?.points, fillColor: createElementStyle.fillColor, strokeColor: createElementStyle.lineColor, strokeWidth: createElementStyle.lineWidth, createMode: editMapInfo.elementType !== DataType.VISION_OFF, showPoints: editMapInfo.elementType !== DataType.VISION_OFF, onPointClick: onPointClick, completed: completed, mousePos: mousePos, onVertexDelete: (vertexIndex) => handleCreateVertexDelete(vertexIndex), onCoordinatesChange: (newCoords) => {
19362
19913
  // 创建模式下的坐标变化(拖拽时)
@@ -19432,10 +19983,10 @@ var css_248z$c = ".index-module_addEntry__QsQHD {\n position: absolute;\n righ
19432
19983
  var styles$c = {"addEntry":"index-module_addEntry__QsQHD","icon":"index-module_icon__qIgA4","addItem":"index-module_addItem__mglwZ","label":"index-module_label__QqZ-9"};
19433
19984
  styleInject(css_248z$c);
19434
19985
 
19435
- var _rect$2, _path$a, _defs$3;
19436
- function _extends$e() { return _extends$e = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$e.apply(null, arguments); }
19986
+ var _rect$2, _path$9, _defs$3;
19987
+ function _extends$d() { return _extends$d = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$d.apply(null, arguments); }
19437
19988
  var SvgAddEntry = function SvgAddEntry(props) {
19438
- return /*#__PURE__*/React.createElement("svg", _extends$e({
19989
+ return /*#__PURE__*/React.createElement("svg", _extends$d({
19439
19990
  xmlns: "http://www.w3.org/2000/svg",
19440
19991
  width: 24,
19441
19992
  height: 24,
@@ -19463,7 +20014,7 @@ var SvgAddEntry = function SvgAddEntry(props) {
19463
20014
  height: "100%",
19464
20015
  width: "100%"
19465
20016
  }
19466
- })), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
20017
+ })), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
19467
20018
  fill: "#1F1F1F",
19468
20019
  stroke: "url(#add-entry_svg__c)",
19469
20020
  strokeWidth: 0.3,
@@ -19503,15 +20054,15 @@ var SvgAddEntry = function SvgAddEntry(props) {
19503
20054
  })))));
19504
20055
  };
19505
20056
 
19506
- var _path$9, _path2$3, _path3;
19507
- function _extends$d() { return _extends$d = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$d.apply(null, arguments); }
20057
+ var _path$8, _path2$3, _path3;
20058
+ function _extends$c() { return _extends$c = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$c.apply(null, arguments); }
19508
20059
  var SvgBoundary = function SvgBoundary(props) {
19509
- return /*#__PURE__*/React.createElement("svg", _extends$d({
20060
+ return /*#__PURE__*/React.createElement("svg", _extends$c({
19510
20061
  xmlns: "http://www.w3.org/2000/svg",
19511
20062
  width: 16,
19512
20063
  height: 16,
19513
20064
  fill: "none"
19514
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
20065
+ }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
19515
20066
  fill: "#1DBEAC",
19516
20067
  fillRule: "evenodd",
19517
20068
  d: "M3.385 2h9.23C13.38 2 14 2.62 14 3.385v9.23C14 13.38 13.38 14 12.615 14h-9.23C2.62 14 2 13.38 2 12.615v-9.23C2 2.62 2.62 2 3.385 2m9.692 1.385a.46.46 0 0 0-.462-.462h-9.23a.46.46 0 0 0-.462.462v9.23c0 .255.207.462.462.462h9.23a.46.46 0 0 0 .462-.462z",
@@ -19529,15 +20080,15 @@ var SvgBoundary = function SvgBoundary(props) {
19529
20080
  })));
19530
20081
  };
19531
20082
 
19532
- var _path$8, _path2$2, _rect$1, _rect2$1;
19533
- function _extends$c() { return _extends$c = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$c.apply(null, arguments); }
20083
+ var _path$7, _path2$2, _rect$1, _rect2$1;
20084
+ function _extends$b() { return _extends$b = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$b.apply(null, arguments); }
19534
20085
  var SvgLimitIsland = function SvgLimitIsland(props) {
19535
- return /*#__PURE__*/React.createElement("svg", _extends$c({
20086
+ return /*#__PURE__*/React.createElement("svg", _extends$b({
19536
20087
  xmlns: "http://www.w3.org/2000/svg",
19537
20088
  width: 16,
19538
20089
  height: 16,
19539
20090
  fill: "none"
19540
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
20091
+ }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
19541
20092
  fill: "#FFA077",
19542
20093
  d: "M11.725 6.714c-1.019-.137-2.516-1.488-1.9-2.14.588-.621 1.91.344 1.9 2.14"
19543
20094
  })), _path2$2 || (_path2$2 = /*#__PURE__*/React.createElement("path", {
@@ -19563,9 +20114,9 @@ var SvgLimitIsland = function SvgLimitIsland(props) {
19563
20114
  };
19564
20115
 
19565
20116
  var _rect, _rect2, _rect3, _rect4, _g$3;
19566
- function _extends$b() { return _extends$b = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$b.apply(null, arguments); }
20117
+ function _extends$a() { return _extends$a = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$a.apply(null, arguments); }
19567
20118
  var SvgVisionFence = function SvgVisionFence(props) {
19568
- return /*#__PURE__*/React.createElement("svg", _extends$b({
20119
+ return /*#__PURE__*/React.createElement("svg", _extends$a({
19569
20120
  xmlns: "http://www.w3.org/2000/svg",
19570
20121
  width: 16,
19571
20122
  height: 16,
@@ -19618,9 +20169,9 @@ var SvgVisionFence = function SvgVisionFence(props) {
19618
20169
  };
19619
20170
 
19620
20171
  var _g$2, _defs$2;
19621
- function _extends$a() { return _extends$a = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$a.apply(null, arguments); }
20172
+ function _extends$9() { return _extends$9 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$9.apply(null, arguments); }
19622
20173
  var SvgDoodle = function SvgDoodle(props) {
19623
- return /*#__PURE__*/React.createElement("svg", _extends$a({
20174
+ return /*#__PURE__*/React.createElement("svg", _extends$9({
19624
20175
  xmlns: "http://www.w3.org/2000/svg",
19625
20176
  width: 16,
19626
20177
  height: 16,
@@ -19729,25 +20280,10 @@ const CustomModal = ({ children, titleCenter, hasMinHeight, height, ...props })
19729
20280
  }), cancelButtonProps: { color: 'primary', variant: 'outlined' }, cancelText: 'Cancel', ...props, children: children }));
19730
20281
  };
19731
20282
 
19732
- var css_248z$a = ".index-module_doodleModal__EGNPW .index-module_title__ViZuB {\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: rgb(29, 29, 29);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n max-height: 230px;\n overflow-y: auto;\n width: 470px;\n margin: 20px auto 0;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 {\n width: 70px;\n height: 70px;\n padding: 10px;\n border-radius: 8px;\n cursor: pointer;\n border: 2px solid transparent;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ease;\n position: relative;\n background: rgb(233, 242, 241);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7.index-module_active__1OHfd {\n border: 2px solid rgb(110, 220, 207);\n background-color: rgba(110, 220, 207, 0.1);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7.index-module_active__1OHfd .index-module_selectIcon__EFQF- {\n display: block;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_svgImage__2OT8- {\n width: 100%;\n height: 100%;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_svgImage__2OT8- svg {\n width: 100%;\n height: 100%;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_selectIcon__EFQF- {\n position: absolute;\n bottom: 4px;\n right: 4px;\n display: none;\n}";
19733
- var styles$a = {"doodleModal":"index-module_doodleModal__EGNPW","title":"index-module_title__ViZuB","content":"index-module_content__h-60T","item":"index-module_item__dvoq7","active":"index-module_active__1OHfd","selectIcon":"index-module_selectIcon__EFQF-","svgImage":"index-module_svgImage__2OT8-"};
20283
+ var css_248z$a = ".index-module_doodleModal__EGNPW .index-module_title__ViZuB {\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: rgb(29, 29, 29);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n max-height: 230px;\n overflow-y: auto;\n width: 470px;\n margin: 20px auto 0;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 {\n width: 70px;\n height: 70px;\n padding: 10px;\n border-radius: 8px;\n cursor: pointer;\n border: 2px solid transparent;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ease;\n position: relative;\n background: rgb(233, 242, 241);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7.index-module_active__1OHfd {\n border: 2px solid #ff5a00;\n background-color: rgba(110, 220, 207, 0.1);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7.index-module_active__1OHfd .index-module_selectIcon__EFQF- {\n display: block;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_svgImage__2OT8- {\n width: 100%;\n height: 100%;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_svgImage__2OT8- svg {\n width: 100%;\n height: 100%;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_selectIcon__EFQF- {\n position: absolute;\n bottom: 4px;\n right: 4px;\n display: none;\n}";
20284
+ var styles$a = {"doodleModal":"index-module_doodleModal__EGNPW","title":"index-module_title__ViZuB","content":"index-module_content__h-60T","item":"index-module_item__dvoq7","active":"index-module_active__1OHfd","svgImage":"index-module_svgImage__2OT8-"};
19734
20285
  styleInject(css_248z$a);
19735
20286
 
19736
- var _path$7;
19737
- function _extends$9() { return _extends$9 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$9.apply(null, arguments); }
19738
- var SvgSelect = function SvgSelect(props) {
19739
- return /*#__PURE__*/React.createElement("svg", _extends$9({
19740
- xmlns: "http://www.w3.org/2000/svg",
19741
- width: 14,
19742
- height: 12,
19743
- fill: "none"
19744
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
19745
- stroke: "#6EDCCF",
19746
- strokeWidth: 2,
19747
- d: "m1 7.5 4 3L12.5 1"
19748
- })));
19749
- };
19750
-
19751
20287
  const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
19752
20288
  const { editMapInfo, setEditMapInfo, onHandleEnterRecord } = useMapEditContext();
19753
20289
  const [selectedDoodle, setSelectedDoodle] = useState(null);
@@ -19765,7 +20301,7 @@ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
19765
20301
  const svg = selectedDoodle?.svgStr;
19766
20302
  const minLength = selectedDoodle.minLength;
19767
20303
  const parseSvg = SvgParserNative.parseSvg(svg);
19768
- const svgMinLength = Math.min(parseSvg.width, parseSvg.height) / SCALE_FACTOR;
20304
+ const svgMinLength = parseSvg.height / SCALE_FACTOR;
19769
20305
  // 使用获取到的 SVG 内容,如果没有获取到则使用 URL
19770
20306
  newDoodle.svg = svg;
19771
20307
  newDoodle.scale = minLength / svgMinLength;
@@ -19777,7 +20313,11 @@ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
19777
20313
  })?.then(() => {
19778
20314
  setEditMapInfo({
19779
20315
  ...editMapInfo,
19780
- historyList: [newDoodle],
20316
+ historyList: [
20317
+ {
20318
+ selectElement: newDoodle,
20319
+ },
20320
+ ],
19781
20321
  currentHistoryIndex: 0,
19782
20322
  createMode: CreateStatus.COMPLETED,
19783
20323
  elementType: DataType.DOODLE,
@@ -19791,12 +20331,12 @@ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
19791
20331
  });
19792
20332
  }
19793
20333
  }, [selectedDoodle, setEditMapInfo, editMapInfo, setOpen, onSelect, centerPoint]);
19794
- return (jsx(CustomModal, { width: 560, title: "Creative logos", titleCenter: true, open: open, onOk: handleConfirm, onCancel: () => setOpen(false), okButtonProps: { disabled: !selectedDoodle }, afterClose: () => setSelectedDoodle(null), okText: "Confirm", cancelText: "Cancel", children: jsxs("div", { className: styles$a.doodleModal, children: [jsx("div", { className: styles$a.title, children: "Please select a doodle" }), jsx("div", { className: styles$a.content, children: doodleList
20334
+ return (jsx(CustomModal, { width: 560, title: "Create doodle", titleCenter: true, open: open, onOk: handleConfirm, onCancel: () => setOpen(false), okButtonProps: { disabled: !selectedDoodle }, afterClose: () => setSelectedDoodle(null), okText: "Create", cancelText: "Cancel", children: jsxs("div", { className: styles$a.doodleModal, children: [jsx("div", { className: styles$a.title, children: "Select the doodle that you want to create" }), jsx("div", { className: styles$a.content, children: doodleList
19795
20335
  ?.filter((item) => !noNeed.includes(item.name))
19796
20336
  .map((item) => {
19797
- return (jsxs("div", { className: classNames(styles$a.item, {
20337
+ return (jsx("div", { className: classNames(styles$a.item, {
19798
20338
  [styles$a.active]: selectedDoodle?.svg === item.svg,
19799
- }), onClick: () => handleSelectDoodle(item), children: [jsx("div", { className: styles$a.svgImage, dangerouslySetInnerHTML: { __html: item?.svgStr } }), jsx("div", { className: styles$a.selectIcon, children: jsx(SvgSelect, {}) })] }, item.id));
20339
+ }), onClick: () => handleSelectDoodle(item), children: jsx("div", { className: styles$a.svgImage, dangerouslySetInnerHTML: { __html: item?.svgStr } }) }, item.id));
19800
20340
  }) })] }) }));
19801
20341
  };
19802
20342
 
@@ -19859,7 +20399,11 @@ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
19859
20399
  })?.then(() => {
19860
20400
  setEditMapInfo({
19861
20401
  ...editMapInfo,
19862
- historyList: [newElement],
20402
+ historyList: [
20403
+ {
20404
+ selectElement: newElement,
20405
+ },
20406
+ ],
19863
20407
  currentHistoryIndex: 0,
19864
20408
  createMode: type === DataType.VISION_OFF ? CreateStatus.COMPLETED : CreateStatus.CREATING,
19865
20409
  elementType: type,
@@ -19888,11 +20432,11 @@ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
19888
20432
  }), children: jsx("div", { className: styles$c.icon, children: jsx(SvgAddEntry, {}) }) }), jsx(DoodleModal, { centerPoint: centerPoint, doodleList: doodleList, open: doodleOpen, onOk: () => setDoodleOpen(false), setOpen: setDoodleOpen })] }));
19889
20433
  };
19890
20434
 
19891
- var css_248z$9 = ".index-module_handleElementInfo__vWIaf {\n position: absolute;\n right: 0;\n top: 0;\n border-radius: 8px;\n padding: 4px 8px;\n background: #fff;\n width: 265px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 {\n position: absolute;\n left: -96px;\n top: 0;\n display: flex;\n gap: 12px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u- {\n background: #fff;\n border-radius: 8px;\n padding: 6px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X:not(.index-module_disabled__w6gCJ):hover,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-:not(.index-module_disabled__w6gCJ):hover {\n opacity: 0.8;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X.index-module_disabled__w6gCJ,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-.index-module_disabled__w6gCJ {\n color: #d8d8d8;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 0 0 4px 0;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- input {\n padding: 2px 0;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- .index-module_edit__b0r9I {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_boundaryOther__FyJvt {\n padding-top: 4px;\n border-top: 1px solid rgb(197, 197, 197);\n}\n.index-module_handleElementInfo__vWIaf .index-module_handle__4mIxr {\n border-top: 1px solid rgb(197, 197, 197);\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 0;\n}\n\n.index-module_doodleInfo__bd2ua .index-module_time__1bUFf {\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_exist__gWtNo {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_tip__1HNmj {\n color: #ff3f33;\n margin-top: 10px;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px;\n}\n\n.index-module_obstacleInfo__w6Sod .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\n}\n\n.index-module_areaInfo__-WJPL {\n color: #9e9e9e;\n width: 100%;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px; /* 114.286% */\n}\n.index-module_areaInfo__-WJPL .index-module_areaItem__fk-i2 {\n display: flex;\n justify-content: space-between;\n padding: 6px 0;\n}\n\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM {\n color: #1f1f1f;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_value__x3-se {\n margin-left: auto;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_icon__167WB {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_boundaryInfo__VfR-N .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\n}";
19892
- 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"};
20435
+ var css_248z$9 = ".index-module_handleElementInfo__vWIaf {\n position: absolute;\n right: 0;\n top: 0;\n border-radius: 8px;\n padding: 8px;\n background: #fff;\n width: 265px;\n user-select: none;\n}\n.index-module_handleElementInfo__vWIaf .index-module_border__iPL-- {\n margin: 8px 0;\n border-top: 1px solid #c5c5c5;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 {\n position: absolute;\n left: -96px;\n top: 0;\n display: flex;\n gap: 12px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u- {\n background: #fff;\n border-radius: 8px;\n padding: 6px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X:not(.index-module_disabled__w6gCJ):hover,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-:not(.index-module_disabled__w6gCJ):hover {\n opacity: 0.8;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X.index-module_disabled__w6gCJ,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-.index-module_disabled__w6gCJ {\n color: #d8d8d8;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- input {\n padding: 2px 0;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- .index-module_edit__b0r9I {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_boundaryOther__FyJvt {\n padding-top: 4px;\n border-top: 1px solid rgb(197, 197, 197);\n}\n.index-module_handleElementInfo__vWIaf .index-module_handle__4mIxr {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n padding: 0px 0 4px 0;\n}\n\n.index-module_doodleInfo__bd2ua .index-module_time__1bUFf {\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_exist__gWtNo {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_tip__1HNmj {\n color: #ff3f33;\n margin-top: 10px;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px;\n}\n\n.index-module_areaInfo__-WJPL {\n color: #9e9e9e;\n width: 100%;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px; /* 114.286% */\n}\n.index-module_areaInfo__-WJPL .index-module_areaItem__fk-i2 {\n display: flex;\n justify-content: space-between;\n padding: 6px 0;\n}\n.index-module_areaInfo__-WJPL .index-module_areaItem__fk-i2:not(:last-child) {\n margin-bottom: 4px;\n}\n\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM {\n color: #1f1f1f;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_value__x3-se {\n margin-left: auto;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_icon__167WB {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}";
20436
+ var styles$9 = {"handleElementInfo":"index-module_handleElementInfo__vWIaf","border":"index-module_border__iPL--","undoAndRedo":"index-module_undoAndRedo__EKeA8","undo":"index-module_undo__lPY1X","redo":"index-module_redo__EU5u-","disabled":"index-module_disabled__w6gCJ","nameEdit":"index-module_nameEdit__eVzQ-","handle":"index-module_handle__4mIxr","doodleInfo":"index-module_doodleInfo__bd2ua","time":"index-module_time__1bUFf","exist":"index-module_exist__gWtNo","tip":"index-module_tip__1HNmj","areaInfo":"index-module_areaInfo__-WJPL","areaItem":"index-module_areaItem__fk-i2","boundaryInfo":"index-module_boundaryInfo__VfR-N","otherEdit":"index-module_otherEdit__17SuM","otherItem":"index-module_otherItem__ATLFZ","value":"index-module_value__x3-se","icon":"index-module_icon__167WB"};
19893
20437
  styleInject(css_248z$9);
19894
20438
 
19895
- var css_248z$8 = ".index-module_infoHeader__l9F6q {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 8px 0;\n border-bottom: 1px solid rgb(197, 197, 197);\n}\n.index-module_infoHeader__l9F6q .index-module_headerIcon__sK1hg {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_infoHeader__l9F6q .index-module_headerName__UGnrH {\n margin-left: 4px;\n color: rgb(158, 158, 158);\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f {\n margin-left: auto;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f .index-module_focus__llcox {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f .index-module_delete__hD4-Q {\n width: 16px;\n height: 16px;\n margin-left: 8px;\n cursor: pointer;\n}";
20439
+ var css_248z$8 = ".index-module_infoHeader__l9F6q {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 6px 0;\n}\n.index-module_infoHeader__l9F6q .index-module_headerIcon__sK1hg {\n width: 16px;\n height: 16px;\n}\n.index-module_infoHeader__l9F6q .index-module_headerName__UGnrH {\n margin-left: 4px;\n color: rgb(158, 158, 158);\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n pointer-events: none;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f {\n margin-left: auto;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f .index-module_focus__llcox {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f .index-module_delete__hD4-Q {\n width: 16px;\n height: 16px;\n margin-left: 8px;\n cursor: pointer;\n}";
19896
20440
  var styles$8 = {"infoHeader":"index-module_infoHeader__l9F6q","headerIcon":"index-module_headerIcon__sK1hg","headerName":"index-module_headerName__UGnrH","headerHandle":"index-module_headerHandle__ymh7f","focus":"index-module_focus__llcox","delete":"index-module_delete__hD4-Q"};
19897
20441
  styleInject(css_248z$8);
19898
20442
 
@@ -19924,7 +20468,7 @@ var SvgDelete = function SvgDelete(props) {
19924
20468
  })));
19925
20469
  };
19926
20470
 
19927
- const Header = ({ handleDelete, handleFocus, showFocus = false, showDelete = true, type }) => {
20471
+ const Header = ({ handleDelete, handleFocus, showFocus = false, showDelete = true, type, }) => {
19928
20472
  const currentType = useMemo(() => {
19929
20473
  return DATE_TYPE_MAP.find((item) => item.type === type);
19930
20474
  }, [type]);
@@ -19949,24 +20493,24 @@ var SvgEdit = function SvgEdit(props) {
19949
20493
  })));
19950
20494
  };
19951
20495
 
19952
- const NameModal = ({ name, open, setOpen, onOk }) => {
20496
+ const NameModal = ({ title, name, open, setOpen, onOk }) => {
19953
20497
  const [nameValue, setNameValue] = useState('');
19954
20498
  useEffect(() => {
19955
20499
  if (open) {
19956
20500
  setNameValue(name || '');
19957
20501
  }
19958
20502
  }, [name, open]);
19959
- return (jsx(CustomModal, { title: `${name}`, titleCenter: true, open: open, onOk: () => {
20503
+ return (jsx(CustomModal, { title: `${title}`, titleCenter: true, open: open, onOk: () => {
19960
20504
  onOk?.(nameValue);
19961
20505
  setOpen(false);
19962
20506
  }, onCancel: () => setOpen(false), okText: "Confirm", afterClose: () => {
19963
20507
  setNameValue('');
19964
- }, children: jsx(Input, { maxLength: 120, showCount: true, placeholder: "Please enter boundary name", value: nameValue, onChange: (e) => setNameValue(e.target.value) }) }));
20508
+ }, children: jsx(Input, { maxLength: 12, showCount: true, placeholder: "Please enter boundary name", value: nameValue, onChange: (e) => setNameValue(e.target.value) }) }));
19965
20509
  };
19966
20510
 
19967
- const NameEdit = ({ name, onChange }) => {
20511
+ const NameEdit = ({ title, name, onChange }) => {
19968
20512
  const [open, setOpen] = React__default.useState(false);
19969
- return (jsxs(Fragment, { children: [jsxs("div", { className: styles$7.nameEdit, children: [jsx("div", { className: styles$7.content, children: name }), jsx("div", { className: styles$7.edit, onClick: () => setOpen(true), children: jsx(SvgEdit, {}) })] }), jsx(NameModal, { name: name, open: open, setOpen: setOpen, onOk: onChange })] }));
20513
+ return (jsxs(Fragment, { children: [jsxs("div", { className: styles$7.nameEdit, children: [jsx("div", { className: styles$7.content, children: name }), jsx("div", { className: styles$7.edit, onClick: () => setOpen(true), children: jsx(SvgEdit, {}) })] }), jsx(NameModal, { title: title, name: name, open: open, setOpen: setOpen, onOk: onChange })] }));
19970
20514
  };
19971
20515
 
19972
20516
  var _path$3;
@@ -19978,12 +20522,12 @@ var SvgArrow = function SvgArrow(props) {
19978
20522
  height: 16,
19979
20523
  fill: "none"
19980
20524
  }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
19981
- fill: "#FF5A00",
20525
+ fill: "#1F1F1F",
19982
20526
  d: "M11.523 7.704c.005.014.015.026.02.04.049.125.065.268.046.406a.73.73 0 0 1-.152.363l-3.88 4.638a.47.47 0 0 1-.377.182.49.49 0 0 1-.369-.208.77.77 0 0 1-.144-.477.76.76 0 0 1 .164-.466l3.483-4.162-3.468-4.224a.77.77 0 0 1-.15-.462c0-.172.053-.338.148-.463a.49.49 0 0 1 .36-.204.47.47 0 0 1 .371.17l3.845 4.682q.007.017.017.032.008.01.018.019c.032.04.046.09.067.134"
19983
20527
  })));
19984
20528
  };
19985
20529
 
19986
- var css_248z$6 = ".index-module_item__wwHEt {\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n display: flex;\n align-items: center;\n padding: 8px 0;\n}";
20530
+ var css_248z$6 = ".index-module_item__wwHEt {\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n display: flex;\n align-items: center;\n padding: 6px 0;\n}\n.index-module_item__wwHEt:not(:last-child) {\n margin-bottom: 4px;\n}";
19987
20531
  var styles$6 = {"item":"index-module_item__wwHEt"};
19988
20532
  styleInject(css_248z$6);
19989
20533
 
@@ -20087,7 +20631,7 @@ const HeightModal = ({ zoneName, open, setOpen, onChange, value, heightOptions,
20087
20631
  }), children: [jsx("div", { className: styles$4.left, children: jsxs(Radio, { value: ZoneHeightModalTypeEnum.RADIO, children: ["Customize zone height (", getHeightUnit(unitType), ")"] }) }), jsx("div", { className: styles$4.right, children: jsx(CutHeightSlider, { units: unitType, value: currentValue?.cuttingHeight, heightOptions: heightOptions, onChange: onHeightChange }) })] })] }) }) }));
20088
20632
  };
20089
20633
 
20090
- var css_248z$3 = ".index-module_directions__Hv0zx {\n color: #1d1d1d;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n}\n.index-module_directions__Hv0zx .index-module_default__sSWp4 {\n position: absolute;\n bottom: 20px;\n left: 9px;\n}\n.index-module_directions__Hv0zx .index-module_tips__VVEuO {\n line-height: 16px;\n}\n.index-module_directions__Hv0zx .index-module_optimal__07le4 {\n color: rgb(255, 113, 51);\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 6px;\n margin: 4px 0 12px;\n}\n.index-module_directions__Hv0zx .index-module_content__PiCFf {\n position: relative;\n width: 100%;\n margin-bottom: 12px;\n}\n.index-module_directions__Hv0zx .index-module_background__WM4u- {\n position: absolute;\n width: 100%;\n height: 300px;\n background: #f5f5f5;\n border-radius: 8px;\n z-index: 0;\n}\n.index-module_directions__Hv0zx .index-module_luppan__nGfH2 {\n inset: 0;\n z-index: 1;\n}\n.index-module_directions__Hv0zx .index-module_slideTip__RGnd1 {\n margin: 20px 0;\n}\n.index-module_directions__Hv0zx .index-module_slider__VDKnB {\n padding: 0 24px;\n}";
20634
+ var css_248z$3 = ".index-module_directions__Hv0zx {\n color: #1d1d1d;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n}\n.index-module_directions__Hv0zx .index-module_default__sSWp4 {\n position: absolute;\n bottom: 20px;\n left: 9px;\n}\n.index-module_directions__Hv0zx .index-module_tips__VVEuO {\n line-height: 16px;\n}\n.index-module_directions__Hv0zx .index-module_optimal__07le4 {\n color: rgb(255, 113, 51);\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 6px;\n margin: 4px 0 12px;\n}\n.index-module_directions__Hv0zx .index-module_content__PiCFf {\n position: relative;\n width: 100%;\n margin-bottom: 12px;\n}\n.index-module_directions__Hv0zx .index-module_background__WM4u- {\n position: absolute;\n width: 100%;\n height: 300px;\n background: #f5f5f5;\n border-radius: 8px;\n z-index: 0;\n overflow: hidden;\n}\n.index-module_directions__Hv0zx .index-module_luppan__nGfH2 {\n inset: 0;\n z-index: 1;\n}\n.index-module_directions__Hv0zx .index-module_slideTip__RGnd1 {\n margin: 20px 0;\n}\n.index-module_directions__Hv0zx .index-module_slider__VDKnB {\n padding: 0 24px;\n}";
20091
20635
  var styles$3 = {"directions":"index-module_directions__Hv0zx","default":"index-module_default__sSWp4","tips":"index-module_tips__VVEuO","optimal":"index-module_optimal__07le4","content":"index-module_content__PiCFf","background":"index-module_background__WM4u-","luppan":"index-module_luppan__nGfH2","slideTip":"index-module_slideTip__RGnd1","slider":"index-module_slider__VDKnB"};
20092
20636
  styleInject(css_248z$3);
20093
20637
 
@@ -20327,43 +20871,81 @@ function convertDirectionToParams(value) {
20327
20871
  return directions;
20328
20872
  }
20329
20873
 
20874
+ const DEFAULT_LIST = [
20875
+ {
20876
+ value: 1 << 0,
20877
+ text: 'A',
20878
+ selected: false,
20879
+ },
20880
+ {
20881
+ value: 1 << 1,
20882
+ text: 'B',
20883
+ selected: false,
20884
+ },
20885
+ {
20886
+ value: 1 << 2,
20887
+ text: 'C',
20888
+ selected: false,
20889
+ },
20890
+ {
20891
+ value: 1 << 3,
20892
+ text: 'D',
20893
+ selected: false,
20894
+ },
20895
+ {
20896
+ value: 1 << 4,
20897
+ text: 'E',
20898
+ selected: false,
20899
+ },
20900
+ {
20901
+ value: 1 << 5,
20902
+ text: 'F',
20903
+ selected: false,
20904
+ },
20905
+ ];
20330
20906
  const MowDirection_L = (props) => {
20331
20907
  const { value, angleValue, optionAngle = 45, zIndex = 10000, onChange,
20332
20908
  // children,
20333
20909
  } = props;
20334
20910
  const [angle, setAngle] = useState(0);
20335
- const [lineList, setLineList] = useState([
20336
- {
20337
- value: 1 << 0,
20338
- text: 'A',
20339
- selected: false,
20340
- },
20341
- {
20342
- value: 1 << 1,
20343
- text: 'B',
20344
- selected: false,
20345
- },
20346
- {
20347
- value: 1 << 2,
20348
- text: 'C',
20349
- selected: false,
20350
- },
20351
- {
20352
- value: 1 << 3,
20353
- text: 'D',
20354
- selected: false,
20355
- },
20356
- {
20357
- value: 1 << 4,
20358
- text: 'E',
20359
- selected: false,
20360
- },
20361
- {
20362
- value: 1 << 5,
20363
- text: 'F',
20364
- selected: false,
20365
- },
20366
- ]);
20911
+ const lineList = useMemo(() => {
20912
+ return DEFAULT_LIST.map((item) => ({
20913
+ ...item,
20914
+ selected: convertDirectionToParams(value).includes(item.value),
20915
+ }));
20916
+ }, [value]);
20917
+ // const [lineList, setLineList] = useState<LineItem[]>([
20918
+ // {
20919
+ // value: 1 << 0,
20920
+ // text: 'A',
20921
+ // selected: false,
20922
+ // },
20923
+ // {
20924
+ // value: 1 << 1,
20925
+ // text: 'B',
20926
+ // selected: false,
20927
+ // },
20928
+ // {
20929
+ // value: 1 << 2,
20930
+ // text: 'C',
20931
+ // selected: false,
20932
+ // },
20933
+ // {
20934
+ // value: 1 << 3,
20935
+ // text: 'D',
20936
+ // selected: false,
20937
+ // },
20938
+ // {
20939
+ // value: 1 << 4,
20940
+ // text: 'E',
20941
+ // selected: false,
20942
+ // },
20943
+ // {
20944
+ // value: 1 << 5,
20945
+ // text: 'F',
20946
+ // selected: false,
20947
+ // },
20948
+ // ]);
20367
20949
  const hitRectAngle = useMemo(() => {
20368
20950
  const direction = lineList
20369
20951
  ?.filter((item) => item?.selected)
@@ -20376,12 +20958,6 @@ const MowDirection_L = (props) => {
20376
20958
  const allSelect = useMemo(() => {
20377
20959
  return lineList?.every((item) => item?.selected);
20378
20960
  }, [lineList]);
20379
- useEffect(() => {
20380
- setLineList(lineList.map((line) => ({
20381
- ...line,
20382
- selected: convertDirectionToParams(value).includes(line.value),
20383
- })));
20384
- }, [value]);
20385
20961
  useEffect(() => {
20386
20962
  setAngle(angleValue);
20387
20963
  }, [angleValue]);
@@ -20396,7 +20972,6 @@ const MowDirection_L = (props) => {
20396
20972
  }
20397
20973
  return { ...line };
20398
20974
  });
20399
- setLineList(newLine);
20400
20975
  onChange?.(newLine
20401
20976
  ?.filter((item) => item?.selected)
20402
20977
  .reduce((pre, line) => {
@@ -20420,10 +20995,71 @@ const MowDirection_L = (props) => {
20420
20995
  }, children: [jsx("div", { className: styles$2.leftTop, children: jsx(SvgOption, {}) }), jsx("div", { className: styles$2.rightBottom, children: jsx(SvgOption, {}) })] })] }) }) }));
20421
20996
  };
20422
20997
 
20998
+ const BoundarySvgRender = React__default.memo(({ mapJson, id, maxWidth = 300 }) => {
20999
+ const svgElementData = useMemo(() => {
21000
+ const data = UnifiedMapDataProcessor.processMapData(mapJson, DEFAULT_STYLES) || {};
21001
+ return data;
21002
+ }, [mapJson, DEFAULT_STYLES]);
21003
+ const boundaryInfo = useMemo(() => {
21004
+ const boundary = svgElementData.boundary.find((item) => item.id === id);
21005
+ return boundary;
21006
+ }, [id, svgElementData]);
21007
+ // 计算当前boundary的viewBox
21008
+ const boundaryViewBox = useMemo(() => {
21009
+ if (!boundaryInfo?.points || boundaryInfo.points.length === 0) {
21010
+ return null;
21011
+ }
21012
+ // 计算边界
21013
+ let minX = Infinity;
21014
+ let minY = Infinity;
21015
+ let maxX = -Infinity;
21016
+ let maxY = -Infinity;
21017
+ boundaryInfo.points.forEach((point) => {
21018
+ minX = Math.min(minX, point[0]);
21019
+ minY = Math.min(minY, point[1]);
21020
+ maxX = Math.max(maxX, point[0]);
21021
+ maxY = Math.max(maxY, point[1]);
21022
+ });
21023
+ // 添加边距
21024
+ const padding = 50;
21025
+ const width = maxX - minX + padding * 2;
21026
+ const height = maxY - minY + padding * 2;
21027
+ return {
21028
+ x: minX - padding,
21029
+ y: minY - padding,
21030
+ width,
21031
+ height,
21032
+ };
21033
+ }, [boundaryInfo]);
21034
+ const style = useMemo(() => {
21035
+ if (boundaryViewBox?.width > boundaryViewBox?.height) {
21036
+ return {
21037
+ width: maxWidth,
21038
+ height: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
21039
+ };
21040
+ }
21041
+ return {
21042
+ width: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
21043
+ height: maxWidth,
21044
+ };
21045
+ }, [boundaryViewBox, maxWidth]);
21046
+ return (jsxs("div", { style: {
21047
+ position: 'relative',
21048
+ width: style.width,
21049
+ height: style.height,
21050
+ margin: '0 auto',
21051
+ }, 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) => {
21052
+ return svgElementData[key]?.map((element) => {
21053
+ if (key === DataType.VISION_OFF)
21054
+ return null;
21055
+ return (jsx(GElement, { type: key, data: svgElementData[key], children: jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
21056
+ });
21057
+ }) }), jsx(CharginPile, { mapData: mapJson, mapConfig: DEFAULT_STYLES, viewBox: boundaryViewBox || null, rotation: 0 })] }));
21058
+ });
21059
+
20423
21060
  const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, onChange, }) => {
20424
- const { mapJson, mapConfig, drag } = useCommonContext();
21061
+ const { mapJson, mapConfig } = useCommonContext();
20425
21062
  const { editMapInfo } = useMapEditContext();
20426
- const { svgElementDatas } = useSvgEditContext();
20427
21063
  const [directions, setDirections] = useState(ALL_DIRECTION_SELECTED);
20428
21064
  const [angle, setAngle] = useState(MIN_DIRECTION_ANGLE);
20429
21065
  const canSetDefault = useMemo(() => {
@@ -20448,56 +21084,34 @@ const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, o
20448
21084
  setAngle(defaultAngle);
20449
21085
  }
20450
21086
  };
20451
- // 计算当前boundary的viewBox
20452
- const boundaryViewBox = useMemo(() => {
20453
- const currentBoundary = editMapInfo.selectElement;
20454
- if (!currentBoundary?.points || currentBoundary.points.length === 0) {
20455
- return null;
21087
+ const handleCancel = useCallback(() => {
21088
+ if (!canSave) {
21089
+ setOpen(false);
21090
+ return;
20456
21091
  }
20457
- // 计算边界
20458
- let minX = Infinity;
20459
- let minY = Infinity;
20460
- let maxX = -Infinity;
20461
- let maxY = -Infinity;
20462
- currentBoundary.points.forEach((point) => {
20463
- minX = Math.min(minX, point[0]);
20464
- minY = Math.min(minY, point[1]);
20465
- maxX = Math.max(maxX, point[0]);
20466
- maxY = Math.max(maxY, point[1]);
21092
+ Modal.confirm({
21093
+ icon: null,
21094
+ centered: true,
21095
+ title: 'Exit editing',
21096
+ content: 'Changes you made will not be saved. Are you sure you want to exit editing the mowing direction?',
21097
+ onOk: () => {
21098
+ setOpen(false);
21099
+ },
21100
+ okText: 'Exit',
21101
+ cancelText: 'Continue editing',
20467
21102
  });
20468
- // 添加边距
20469
- const padding = 50;
20470
- const width = maxX - minX + padding * 2;
20471
- const height = maxY - minY + padding * 2;
20472
- return {
20473
- x: minX - padding,
20474
- y: minY - padding,
20475
- width,
20476
- height,
20477
- };
20478
- }, [editMapInfo.selectElement]);
21103
+ }, [canSave, setOpen]);
20479
21104
  console.log('directionInfo=>', directionInfo, mapJson);
20480
- return (jsx(CustomModal, { maskClosable: false, titleCenter: true, title: `${zoneName} mowing direction`, open: open, width: 600, onCancel: () => {
20481
- setOpen(false);
20482
- }, onOk: () => {
21105
+ return (jsx(CustomModal, { maskClosable: false, titleCenter: true, title: `${zoneName} mowing direction`, open: open, width: 600, onCancel: handleCancel, onOk: () => {
20483
21106
  onChange?.(directions, angle);
20484
21107
  setOpen(false);
20485
21108
  }, okText: "Confirm", cancelText: "Cancel", okButtonProps: { disabled: !canSave }, afterClose: () => {
20486
21109
  setDirections(ALL_DIRECTION_SELECTED);
20487
21110
  setAngle(MIN_DIRECTION_ANGLE);
20488
- }, children: jsxs("div", { className: styles$3.directions, children: [jsx("div", { className: styles$3.default, children: jsx(Button, { disabled: !canSetDefault, variant: "link", color: "primary", onClick: resetDirection, children: "Default" }) }), jsx("div", { className: styles$3.tips, children: "\u4E00\u4E2A\u7B80\u77ED\u7684\u8BF4\u660E\uFF0C\u5E0C\u671B\u80FD\u5145\u5F53\u7B80\u5355\u7684\u6559\u7A0B\uFF0C\u9700\u8981\u53EF\u5FC3\u6839\u636EC\u7AEF\u5DF2\u6709\u7684\u6574\u5408\u4E00\u4E0B" }), jsxs("div", { className: styles$3.optimal, children: [jsx("div", { children: "*" }), jsx(SvgOption, {}), jsx("div", { className: styles$3.text, children: "Optimal direction" })] }), jsxs("div", { className: styles$3.content, children: [jsx("div", { className: styles$3.background, children: jsxs("div", { style: {
20489
- position: 'relative',
20490
- width: `${300 * (boundaryViewBox.width / boundaryViewBox.height)}px`,
20491
- height: '300px',
20492
- margin: '0 auto',
20493
- }, children: [boundaryViewBox && (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `${boundaryViewBox.x} ${boundaryViewBox.y} ${boundaryViewBox.width} ${boundaryViewBox.height}`, width: `${300 * (boundaryViewBox.width / boundaryViewBox.height)}px`, height: "300px", style: { position: 'absolute', inset: 0, pointerEvents: 'none' }, children: Object.keys(svgElementDatas)?.map((key) => {
20494
- return svgElementDatas[key]?.map((element) => {
20495
- if (key === DataType.VISION_OFF)
20496
- return null;
20497
- return (jsx(GElement, { type: key, data: svgElementDatas[key], children: jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
20498
- });
20499
- }) })), jsx(CharginPile, { mapData: mapJson, mapConfig: mapConfig, viewBox: boundaryViewBox || null, rotation: drag?.rotation })] }) }), jsx("div", { className: styles$3.luppan, children: jsx(MowDirection_L, { value: directions, angleValue: angle, optionAngle: optionAngle, onChange: (value) => {
21111
+ }, children: jsxs("div", { className: styles$3.directions, children: [jsx("div", { className: styles$3.default, children: jsx(Button, { disabled: !canSetDefault, variant: "link", color: "primary", onClick: resetDirection, children: "Default" }) }), jsx("div", { className: styles$3.tips, children: "\u4E00\u4E2A\u7B80\u77ED\u7684\u8BF4\u660E\uFF0C\u5E0C\u671B\u80FD\u5145\u5F53\u7B80\u5355\u7684\u6559\u7A0B\uFF0C\u9700\u8981\u53EF\u5FC3\u6839\u636EC\u7AEF\u5DF2\u6709\u7684\u6574\u5408\u4E00\u4E0B" }), jsxs("div", { className: styles$3.optimal, children: [jsx("div", { children: "*" }), jsx(SvgOption, {}), jsx("div", { className: styles$3.text, children: "Optimal direction" })] }), jsxs("div", { className: styles$3.content, children: [jsx("div", { className: styles$3.background, children: jsx(BoundarySvgRender, { mapJson: mapJson, id: editMapInfo.selectElement.id }) }), jsx("div", { className: styles$3.luppan, children: jsx(MowDirection_L, { value: directions, angleValue: angle, optionAngle: optionAngle, onChange: (value) => {
20500
21112
  console.log('valie=>', value);
21113
+ if (!value)
21114
+ return message.warning('Choose at least one mowing direction');
20501
21115
  setDirections(value);
20502
21116
  } }) })] }), jsx("div", { className: styles$3.slideTip, children: "\u7528\u6237\u8FD8\u53EF\u4EE5\u901A\u8FC7\u6ED1\u8F68\u5FAE\u8C03\u5272\u8349\u65B9\u5411\uFF08\u975E\u5FC5\u987B\uFF09" }), jsx("div", { className: styles$3.slider, children: jsx(Slider, { tooltip: {
20503
21117
  formatter: (value) => `${value}°`,
@@ -20547,7 +21161,7 @@ const BoundaryInfo = ({ onHandleDelete }) => {
20547
21161
  return editMapInfo?.selectElement?.recBaseAngle;
20548
21162
  }, [editMapInfo.selectElement?.recBaseAngle]);
20549
21163
  console.log('height---->', editMapInfo?.selectElement, heightValue, edgeMowingValue);
20550
- return (jsxs("div", { className: styles$9.boundaryInfo, children: [jsx(Header, { handleDelete: onHandleDelete, handleFocus: onHandleFocus, type: editMapInfo.elementType }), jsx("div", { className: styles$9.nameEdit, children: jsx(NameEdit, { name: nameValue, onChange: (name) => {
21164
+ return (jsxs("div", { className: styles$9.boundaryInfo, children: [jsx(Header, { handleDelete: onHandleDelete, handleFocus: onHandleFocus, type: editMapInfo.elementType }), jsx("div", { className: styles$9.nameEdit, children: jsx(NameEdit, { title: "Boundary name", name: nameValue, onChange: (name) => {
20551
21165
  setEditMapInfo({
20552
21166
  ...editMapInfo,
20553
21167
  isShowDrag: false,
@@ -20556,13 +21170,13 @@ const BoundaryInfo = ({ onHandleDelete }) => {
20556
21170
  name: name,
20557
21171
  },
20558
21172
  });
20559
- } }) }), jsxs("div", { className: styles$9.otherEdit, children: [jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Height" }), jsx("div", { className: styles$9.value, children: generateHeightStr(heightValue?.cuttingHeight, unitType, true) }), jsx("div", { className: styles$9.icon, onClick: () => {
21173
+ } }) }), jsx("div", { className: styles$9.border }), jsxs("div", { className: styles$9.otherEdit, children: [jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Cutting height" }), jsx("div", { className: styles$9.value, children: generateHeightStr(heightValue?.cuttingHeight, unitType, true) }), jsx("div", { className: styles$9.icon, onClick: () => {
20560
21174
  setHeightOpen(true);
20561
- }, children: jsx(SvgArrow, {}) })] }) }), jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Direction" }), jsx("div", { className: styles$9.value }), jsx("div", { className: styles$9.icon, onClick: () => {
21175
+ }, children: jsx(SvgArrow, {}) })] }) }), jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Mowing direction" }), jsx("div", { className: styles$9.value }), jsx("div", { className: styles$9.icon, onClick: () => {
20562
21176
  setDirectionOpen(true);
20563
- }, children: jsx(SvgArrow, {}) })] }) }), jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Mowing Edge" }), jsx("div", { className: styles$9.value }), jsx("div", { className: styles$9.icon, onClick: () => {
21177
+ }, children: jsx(SvgArrow, {}) })] }) }), jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Edge mowing" }), jsx("div", { className: styles$9.value }), jsx("div", { className: styles$9.icon, onClick: () => {
20564
21178
  setOpen(true);
20565
- }, children: jsx(SvgArrow, {}) })] }) })] }), jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Area:" }), jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] }), jsx(MowingEdgeModal, { value: edgeMowingValue, onChange: (value) => {
21179
+ }, children: jsx(SvgArrow, {}) })] }) })] }), jsx("div", { className: styles$9.border }), jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Area:" }), jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] }), jsx(MowingEdgeModal, { value: edgeMowingValue, onChange: (value) => {
20566
21180
  setEditMapInfo({
20567
21181
  ...editMapInfo,
20568
21182
  selectElement: {
@@ -20592,7 +21206,7 @@ const BoundaryInfo = ({ onHandleDelete }) => {
20592
21206
  } })] }));
20593
21207
  };
20594
21208
 
20595
- var css_248z$1 = ".index-module_timePeriod__EkVZl {\n display: flex;\n flex-direction: column;\n padding: 8px 0;\n border-top: 1px solid rgb(197, 197, 197);\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 0px 0 4px 0;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW .index-module_timePeriodTitle__lnYno {\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n color: rgb(0, 0, 0);\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW .index-module_timePeriodHandle__pjDTA {\n margin-left: auto;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodContent__pTqdW .index-module_timePeriodRadioItem__3rd-r {\n line-height: 28px;\n}";
21209
+ var css_248z$1 = ".index-module_timePeriod__EkVZl {\n display: flex;\n flex-direction: column;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 4px 0;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW .index-module_timePeriodTitle__lnYno {\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n color: rgb(0, 0, 0);\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW .index-module_timePeriodHandle__pjDTA {\n margin-left: auto;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodContent__pTqdW {\n margin-top: 4px;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodContent__pTqdW .index-module_timePeriodRadioItem__3rd-r {\n line-height: 28px;\n}";
20596
21210
  var styles$1 = {"timePeriod":"index-module_timePeriod__EkVZl","timePeriodHeader":"index-module_timePeriodHeader__CgJGW","timePeriodTitle":"index-module_timePeriodTitle__lnYno","timePeriodHandle":"index-module_timePeriodHandle__pjDTA","timePeriodContent":"index-module_timePeriodContent__pTqdW","timePeriodRadioItem":"index-module_timePeriodRadioItem__3rd-r"};
20597
21211
  styleInject(css_248z$1);
20598
21212
 
@@ -20607,6 +21221,11 @@ const TimePeriod = ({ value, onChange }) => {
20607
21221
  const [open, setOpen] = useState(false);
20608
21222
  const [radioValue, setRadioValue] = useState(RadioValue.LONG_TIME);
20609
21223
  console.log('time period->', date, radioValue);
21224
+ useEffect(() => {
21225
+ if (!open && date?.length !== 2) {
21226
+ setRadioValue(RadioValue.LONG_TIME);
21227
+ }
21228
+ }, [open]);
20610
21229
  return (jsxs("div", { className: styles$1.timePeriod, children: [jsxs("div", { className: styles$1.timePeriodHeader, children: [jsx("div", { className: styles$1.timePeriodTitle, children: "Enabled" }), jsx("div", { className: styles$1.timePeriodHandle, children: jsx(Switch, { checked: value.status === 1, onChange: (checked) => {
20611
21230
  onChange({
20612
21231
  ...value,
@@ -20618,8 +21237,8 @@ const TimePeriod = ({ value, onChange }) => {
20618
21237
  setDate(null);
20619
21238
  onChange({
20620
21239
  ...value,
20621
- startTimestamp: 0,
20622
- endTimestamp: 0,
21240
+ start_timestamp: 0,
21241
+ end_timestamp: 0,
20623
21242
  });
20624
21243
  }
20625
21244
  else if (e.target.value === RadioValue.SHORT_TIME) {
@@ -20630,19 +21249,15 @@ const TimePeriod = ({ value, onChange }) => {
20630
21249
  // endTimestamp: dayjs().add(1, 'hour').unix(),
20631
21250
  // });
20632
21251
  }
20633
- }, style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsx(Radio, { value: RadioValue.LONG_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: "\u957F\u65F6\u95F4\u5F00\u542F" }) }), jsx(Radio, { value: RadioValue.SHORT_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: jsx(DatePicker.RangePicker, { open: open, onOpenChange: (open) => {
20634
- if (!open) {
20635
- setRadioValue(RadioValue.LONG_TIME);
20636
- }
21252
+ }, style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsx(Radio, { value: RadioValue.LONG_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: "Always" }) }), jsx(Radio, { value: RadioValue.SHORT_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: jsx(DatePicker.RangePicker, { open: open, value: date ? date : undefined, disabled: radioValue === RadioValue.LONG_TIME, showTime: { format: 'HH:mm' }, format: "MM/DD/YYYY HH:mm", preserveInvalidOnBlur: true, onOpenChange: (open) => {
20637
21253
  setOpen(open);
20638
- }, value: date ? date : undefined, disabled: radioValue === RadioValue.LONG_TIME, showTime: { format: 'HH:mm' }, format: "MM/DD/YYYY HH:mm", preserveInvalidOnBlur: true, onChange: (dateValue, dateString) => {
20639
- console.log('change->', dateValue);
21254
+ }, onChange: (dateValue, dateString) => {
21255
+ setDate(dateValue);
20640
21256
  if (dateValue?.length === 2) {
20641
- setDate(dateValue);
20642
21257
  onChange({
20643
21258
  status: RadioValue.SHORT_TIME,
20644
- startTimestamp: dateValue[0].unix(),
20645
- endTimestamp: dateValue[1].unix(),
21259
+ start_timestamp: dateValue[0].unix(),
21260
+ end_timestamp: dateValue[1].unix(),
20646
21261
  });
20647
21262
  }
20648
21263
  } }) }) })] }) })] }));
@@ -20656,12 +21271,12 @@ const ObstacleInfo = ({ onHandleDelete }) => {
20656
21271
  if (!editMapInfo.selectElement)
20657
21272
  return null;
20658
21273
  const status = editMapInfo.selectElement?.status;
20659
- const startTimestamp = editMapInfo.selectElement?.start_timestamp;
20660
- const endTimestamp = editMapInfo.selectElement?.end_timestamp;
21274
+ const start_timestamp = editMapInfo.selectElement?.start_timestamp;
21275
+ const end_timestamp = editMapInfo.selectElement?.end_timestamp;
20661
21276
  return {
20662
21277
  status,
20663
- startTimestamp,
20664
- endTimestamp,
21278
+ start_timestamp,
21279
+ end_timestamp,
20665
21280
  };
20666
21281
  }, [editMapInfo.selectElement]);
20667
21282
  const sizeValue = useMemo(() => {
@@ -20679,7 +21294,7 @@ const ObstacleInfo = ({ onHandleDelete }) => {
20679
21294
  }, [editMapInfo.selectElement]);
20680
21295
  return (jsxs("div", { className: styles$9.obstacleInfo, children: [jsx(Header, { handleDelete: () => {
20681
21296
  onHandleDelete();
20682
- }, handleFocus: () => { }, type: editMapInfo.elementType }), jsx("div", { className: styles$9.nameEdit, children: jsx(NameEdit, { name: nameValue, onChange: (name) => {
21297
+ }, handleFocus: () => { }, type: editMapInfo.elementType }), jsx("div", { className: styles$9.nameEdit, children: jsx(NameEdit, { title: "Obstacle name", name: nameValue, onChange: (name) => {
20683
21298
  setEditMapInfo({
20684
21299
  ...editMapInfo,
20685
21300
  isShowDrag: false,
@@ -20688,18 +21303,18 @@ const ObstacleInfo = ({ onHandleDelete }) => {
20688
21303
  name: name,
20689
21304
  },
20690
21305
  });
20691
- } }) }), jsx("div", { className: styles$9.timePeriod, children: jsx(TimePeriod, { value: timePeriodValue, onChange: (value) => {
21306
+ } }) }), jsx("div", { className: styles$9.border }), jsx("div", { className: styles$9.timePeriod, children: jsx(TimePeriod, { value: timePeriodValue, onChange: (value) => {
20692
21307
  setEditMapInfo({
20693
21308
  ...editMapInfo,
20694
21309
  isShowDrag: editMapInfo?.isShowDrag || false,
20695
21310
  selectElement: {
20696
21311
  ...editMapInfo.selectElement,
20697
21312
  status: value.status,
20698
- start_timestamp: value.startTimestamp,
20699
- end_timestamp: value.endTimestamp,
21313
+ start_timestamp: value.start_timestamp,
21314
+ end_timestamp: value.end_timestamp,
20700
21315
  },
20701
21316
  });
20702
- } }) }), jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Area:" }), jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] })] }));
21317
+ } }) }), jsx("div", { className: styles$9.border }), jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Area:" }), jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] })] }));
20703
21318
  };
20704
21319
 
20705
21320
  const DoodleInfo = ({ onHandleDelete }) => {
@@ -20721,31 +21336,37 @@ const DoodleInfo = ({ onHandleDelete }) => {
20721
21336
  const create_ts = editMapInfo?.selectElement?.create_ts;
20722
21337
  const expiration_ts = editMapInfo.selectElement.expiration_ts;
20723
21338
  const diff = expiration_ts - create_ts;
20724
- const day = Math.floor(diff / (60 * 60 * 24 * 1000));
20725
- console.log('create_ts->', create_ts, expiration_ts, day);
21339
+ const day = Math.floor(diff / (60 * 60 * 24));
20726
21340
  return {
20727
21341
  day: day,
20728
21342
  };
20729
21343
  }, [editMapInfo?.selectElement]);
21344
+ const remainDay = useMemo(() => {
21345
+ if (!editMapInfo.selectElement)
21346
+ return null;
21347
+ const expiration_ts = editMapInfo.selectElement.expiration_ts;
21348
+ const diff = expiration_ts - Date.now() / 1000;
21349
+ return Math.floor(diff / (60 * 60 * 24));
21350
+ }, [editMapInfo?.selectElement]);
20730
21351
  const sizeValue = useMemo(() => {
20731
21352
  if (!editMapInfo.selectElement || !editMapInfo.selectElement.svg)
20732
21353
  return '';
20733
21354
  const svg = editMapInfo.selectElement?.svg;
21355
+ const scale = editMapInfo.selectElement.scale;
20734
21356
  const parseSvg = SvgParserNative.parseSvg(svg);
20735
- const width = parseSvg.width / SCALE_FACTOR;
20736
- const height = parseSvg.height / SCALE_FACTOR;
20737
- console.log('parseSvg->', parseSvg);
20738
- return `${width} m x ${height} m`;
21357
+ const width = (parseSvg.width * scale) / SCALE_FACTOR;
21358
+ const height = (parseSvg.height * scale) / SCALE_FACTOR;
21359
+ console.log('parseSvg->', editMapInfo, parseSvg);
21360
+ return `${width.toFixed(1)} m x ${height.toFixed(1)} m`;
20739
21361
  }, [editMapInfo.selectElement]);
20740
21362
  const handleChange = useCallback((day) => {
20741
- const lastTime = Date.now() - editMapInfo.selectElement.create_ts;
20742
21363
  setEditMapInfo((pre) => {
20743
- console.log('expiration_ts->', lastTime, day, lastTime + day * 24 * 60 * 60 * 1000);
20744
21364
  return {
20745
21365
  ...pre,
20746
21366
  selectElement: {
20747
21367
  ...pre.selectElement,
20748
- expiration_ts: Date.now() + lastTime + day * 24 * 60 * 60 * 1000,
21368
+ create_ts: Date.now() / 1000,
21369
+ expiration_ts: Date.now() / 1000 + day * 24 * 60 * 60,
20749
21370
  },
20750
21371
  };
20751
21372
  });
@@ -20753,7 +21374,7 @@ const DoodleInfo = ({ onHandleDelete }) => {
20753
21374
  console.log('doodleInfo->', doodleInfo);
20754
21375
  return (jsxs("div", { className: styles$9.doodleInfo, children: [jsx(Header, { handleDelete: () => {
20755
21376
  onHandleDelete();
20756
- }, handleFocus: () => { }, type: editMapInfo.elementType }), isCreate ? (jsx(Item, { children: jsxs("div", { className: styles$9.time, children: [jsxs("div", { className: styles$9.exist, children: [jsx("div", { className: styles$9.label, children: "Graph maintenance time" }), jsx("div", { className: styles$9.value, children: jsx(Select, { defaultValue: doodleInfo?.day, style: { width: 80 }, onChange: (value) => handleChange(value), options: options }) })] }), doodleInfo?.day >= 14 && (jsx("div", { className: styles$9.tip, children: "* If the doodle lasts over 14 days, the grass may grow too tall for the mower to mow later." }))] }) })) : (jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Graph maintenance time:" }), jsxs("div", { className: styles$9.value, children: [doodleInfo?.day, " day"] })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Size:" }), jsx("div", { className: styles$9.value, children: sizeValue })] })] }))] }));
21377
+ }, handleFocus: () => { }, type: editMapInfo.elementType }), jsx("div", { className: styles$9.border }), isCreate ? (jsxs(Fragment, { children: [jsx(Item, { children: jsxs("div", { className: styles$9.time, children: [jsxs("div", { className: styles$9.exist, children: [jsx("div", { className: styles$9.label, children: "Preserve doodle for" }), jsx("div", { className: styles$9.value, children: jsx(Select, { defaultValue: doodleInfo?.day, style: { width: 80 }, onChange: (value) => handleChange(value), options: options }) })] }), doodleInfo?.day >= 14 && (jsx("div", { className: styles$9.tip, children: "* If the doodle lasts over 14 days, the grass may grow too tall for the mower to mow later." }))] }) }), jsx("div", { className: styles$9.border }), jsx("div", { className: styles$9.areaInfo, children: jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Size:" }), jsx("div", { className: styles$9.value, children: sizeValue })] }) })] })) : (jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Remaining time:" }), jsxs("div", { className: styles$9.value, children: [remainDay, " day"] })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Size:" }), jsx("div", { className: styles$9.value, children: sizeValue })] })] }))] }));
20757
21378
  };
20758
21379
 
20759
21380
  const VisionOffInfo = ({ onHandleDelete }) => {
@@ -20769,7 +21390,7 @@ const VisionOffInfo = ({ onHandleDelete }) => {
20769
21390
  }, [editMapInfo.selectElement]);
20770
21391
  return (jsxs("div", { className: "visionOffInfo", children: [jsx(Header, { handleDelete: () => {
20771
21392
  onHandleDelete?.();
20772
- }, handleFocus: () => { }, type: DataType.VISION_OFF }), jsx("div", { className: styles$9.areaInfo, children: jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Size:" }), jsx("div", { className: styles$9.value, children: sizeValue })] }) })] }));
21393
+ }, handleFocus: () => { }, type: DataType.VISION_OFF }), jsx("div", { className: styles$9.border }), jsx("div", { className: styles$9.areaInfo, children: jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Size:" }), jsx("div", { className: styles$9.value, children: sizeValue })] }) })] }));
20773
21394
  };
20774
21395
 
20775
21396
  var _path$2, _path2$1;
@@ -20829,7 +21450,7 @@ const HandleElementInfo = () => {
20829
21450
  const isUndoDisabled = useMemo(() => {
20830
21451
  if (editMapInfo?.elementType === DataType.OBSTACLE &&
20831
21452
  editMapInfo?.createMode === CreateStatus.CREATING) {
20832
- return !(editMapInfo?.currentHistoryIndex >= 0 && editMapInfo?.historyList?.length);
21453
+ return !(editMapInfo?.currentHistoryIndex > 0 && editMapInfo?.historyList?.length);
20833
21454
  }
20834
21455
  else {
20835
21456
  return !(editMapInfo?.currentHistoryIndex > 0 && editMapInfo?.historyList?.length);
@@ -20844,12 +21465,20 @@ const HandleElementInfo = () => {
20844
21465
  return !(editMapInfo?.currentHistoryIndex < editMapInfo?.historyList?.length - 1 &&
20845
21466
  editMapInfo?.historyList?.length);
20846
21467
  }, [editMapInfo?.currentHistoryIndex, editMapInfo?.historyList]);
20847
- const handleUndo = useCallback(() => {
21468
+ const handleUndo = useCallback((e) => {
21469
+ e.stopPropagation();
21470
+ e.preventDefault();
21471
+ if (isUndoDisabled)
21472
+ return;
20848
21473
  undo();
20849
- }, [undo]);
20850
- const handleRedo = useCallback(() => {
21474
+ }, [undo, isUndoDisabled]);
21475
+ const handleRedo = useCallback((e) => {
21476
+ e.stopPropagation();
21477
+ e.preventDefault();
21478
+ if (idRedoDisabled)
21479
+ return;
20851
21480
  redo();
20852
- }, [redo]);
21481
+ }, [redo, idRedoDisabled]);
20853
21482
  const renderElementData = useCallback((element) => {
20854
21483
  if (!editMapInfo.selectElement)
20855
21484
  return null;
@@ -20903,8 +21532,8 @@ const HandleElementInfo = () => {
20903
21532
  data.obstacle = {
20904
21533
  name: element?.name,
20905
21534
  status: element?.status || 1,
20906
- end_timestamp: element?.end_timestamp || 1758870283,
20907
- start_timestamp: element?.start_timestamp || 1768870283,
21535
+ end_timestamp: element?.end_timestamp,
21536
+ start_timestamp: element?.start_timestamp,
20908
21537
  points: restorePointsFormat(element.points),
20909
21538
  };
20910
21539
  if (element?.id) {
@@ -20932,6 +21561,12 @@ const HandleElementInfo = () => {
20932
21561
  const params = renderElementData(editMapInfo?.selectElement);
20933
21562
  const isObstacle = editMapInfo?.selectElement?.type === DataType.OBSTACLE;
20934
21563
  const hasNotEnoughPoints = params?.obstacle?.points?.length < 3;
21564
+ const isDoodle = editMapInfo?.selectElement?.type === DataType.DOODLE;
21565
+ const doodleResult = checkDoodle();
21566
+ if (isDoodle && !doodleResult?.isValid) {
21567
+ message.error('Keep more distance from boundaries, off-limit island and other doodles');
21568
+ return;
21569
+ }
20935
21570
  if (isObstacle && hasNotEnoughPoints) {
20936
21571
  message.error('Save failed, please draw a closed shape');
20937
21572
  return;
@@ -20963,16 +21598,27 @@ const HandleElementInfo = () => {
20963
21598
  message.error('Save failed, please try again');
20964
21599
  });
20965
21600
  }
20966
- }, [editMapInfo.selectElement]);
21601
+ }, [editMapInfo.selectElement, onUpdateBoundary, onHandleCompleteRecord]);
20967
21602
  const handleCancel = useCallback(() => {
20968
- onHandleStopRecord?.()?.then(() => {
20969
- setEditMapInfo({
20970
- ...editMapInfo,
20971
- createMode: null,
20972
- elementType: null,
20973
- selectElement: null,
20974
- isShowDrag: false,
20975
- });
21603
+ const name = DATE_TYPE_MAP.find((item) => item.type === editMapInfo.elementType)?.label;
21604
+ Modal.confirm({
21605
+ icon: null,
21606
+ centered: true,
21607
+ title: 'Quit editing',
21608
+ content: `Changes you made will not be saved. Are you sure you want to quit editing the ${name}?`,
21609
+ okText: 'Quit',
21610
+ cancelText: 'Keep editing',
21611
+ onOk: () => {
21612
+ onHandleStopRecord?.()?.then(() => {
21613
+ setEditMapInfo({
21614
+ ...editMapInfo,
21615
+ createMode: null,
21616
+ elementType: null,
21617
+ selectElement: null,
21618
+ isShowDrag: false,
21619
+ });
21620
+ });
21621
+ },
20976
21622
  });
20977
21623
  }, [editMapInfo]);
20978
21624
  const handleDelete = useCallback(() => {
@@ -21017,26 +21663,12 @@ const HandleElementInfo = () => {
21017
21663
  },
21018
21664
  });
21019
21665
  }, [editMapInfo?.selectElement, onHandleDeleteElement, onHandleStopRecord]);
21020
- const checkDisabled = useCallback(() => {
21021
- if (editMapInfo.elementType === DataType.DOODLE) {
21022
- const result = checkDoodle();
21023
- return !result?.isValid;
21024
- }
21025
- return false;
21026
- }, [checkDoodle, editMapInfo]);
21027
21666
  if (!editMapInfo.selectElement)
21028
21667
  return null;
21029
21668
  console.log('handleElementInfo->', editMapInfo, currentType);
21030
- return (jsxs("div", { className: styles$9.handleElementInfo, children: [editMapInfo?.elementType !== DataType.BOUNDARY ? (jsxs("div", { className: styles$9.undoAndRedo, children: [jsx("div", { className: classNames(styles$9.undo, { [styles$9.disabled]: isUndoDisabled }), onClick: handleUndo, children: jsx(SvgUndo, {}) }), jsx("div", { className: classNames(styles$9.redo, { [styles$9.disabled]: idRedoDisabled }), onClick: handleRedo, children: jsx(SvgRedo, {}) })] })) : null, editMapInfo?.elementType === DataType.BOUNDARY && (jsx(BoundaryInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.OBSTACLE && (jsx(ObstacleInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.DOODLE && jsx(DoodleInfo, { onHandleDelete: handleDelete }), editMapInfo?.elementType === DataType.VISION_OFF && (jsx(VisionOffInfo, { onHandleDelete: handleDelete })), jsxs("div", { className: styles$9.handle, children: [jsx(Button, { disabled: checkDisabled(), variant: "solid", color: "primary", onClick: handleSave, children: "Save & Done" }), jsx(Button, { variant: "outlined", color: "default", onClick: () => {
21031
- handleCancel();
21032
- setEditMapInfo({
21033
- createMode: null,
21034
- editMap: false,
21035
- elementType: undefined,
21036
- selectElement: null,
21037
- isShowDrag: false,
21038
- });
21039
- }, children: "Cancel" })] })] }));
21669
+ return (jsxs("div", { className: styles$9.handleElementInfo, children: [editMapInfo?.elementType !== DataType.BOUNDARY ? (jsxs("div", { className: styles$9.undoAndRedo, children: [jsx("div", { className: classNames(styles$9.undo, { [styles$9.disabled]: isUndoDisabled }), onClick: handleUndo, children: jsx(SvgUndo, {}) }), jsx("div", { className: classNames(styles$9.redo, { [styles$9.disabled]: idRedoDisabled }), onClick: handleRedo, children: jsx(SvgRedo, {}) })] })) : null, editMapInfo?.elementType === DataType.BOUNDARY && (jsx(BoundaryInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.OBSTACLE && (jsx(ObstacleInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.DOODLE && jsx(DoodleInfo, { onHandleDelete: handleDelete }), editMapInfo?.elementType === DataType.VISION_OFF && (jsx(VisionOffInfo, { onHandleDelete: handleDelete })), jsx("div", { className: styles$9.border }), jsx("div", { className: styles$9.handle, children: jsxs(Space, { size: 12, children: [jsx(Button, { variant: "outlined", color: "default", onClick: () => {
21670
+ handleCancel();
21671
+ }, children: "Cancel" }), jsx(Button, { variant: "solid", color: "primary", onClick: handleSave, children: "Save" })] }) })] }));
21040
21672
  };
21041
21673
 
21042
21674
  var _path;
@@ -21162,7 +21794,7 @@ const defaultMapConfig = DEFAULT_STYLES;
21162
21794
  // 地图渲染器组件
21163
21795
  const MowerMapRenderer = forwardRef(({ sn, platform = PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, mapConfig,
21164
21796
  // pathConfig,
21165
- 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) => {
21797
+ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, onPathLoad, onError, className, style, googleMapInstance: _googleMapInstance, dragMap = false, dragCallbacks, defaultTransform, debug: _debug = false, doodleList = [], editMap = false, unStructMapData, disabledObstacles = false, onHandleEnterRecord, onHandleCompleteRecord, onHandleStopRecord, onHandleDeleteElement, onSaveBoundaryData, onSaveMap, onEditInfoMapChange, onUpdateBoundary, heightOptions, globalHeight, onHandleEvent, }, ref) => {
21166
21798
  const [currentError, setCurrentError] = useState(null);
21167
21799
  const overlayRef = useRef(null);
21168
21800
  // const mapRef = useMap();
@@ -21177,6 +21809,9 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21177
21809
  });
21178
21810
  const [overlay, setOverlay] = useState(null);
21179
21811
  const [overlayLayout, setOverlayLayout] = useState(null);
21812
+ const [overlayScale, setOverlayScale] = useState(1);
21813
+ // 参考zoom级别,在此级别时overlayScale=1,元素显示原始大小
21814
+ const REFERENCE_ZOOM = 19;
21180
21815
  const svgMapRef = useRef(null);
21181
21816
  const svgEditMapRef = useRef(null);
21182
21817
  const [editMapInfo, setEditMapInfo] = useState({
@@ -21215,7 +21850,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21215
21850
  onSaveMap,
21216
21851
  onHandleDeleteElement,
21217
21852
  onUpdateBoundary,
21218
- onClickEvent,
21853
+ onHandleEvent,
21219
21854
  };
21220
21855
  }, [
21221
21856
  minDistance,
@@ -21227,7 +21862,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21227
21862
  onSaveBoundaryData,
21228
21863
  onSaveMap,
21229
21864
  onUpdateBoundary,
21230
- onClickEvent,
21865
+ onHandleEvent,
21231
21866
  ]);
21232
21867
  // 合并配置
21233
21868
  const mergedMapConfig = useMemo(() => {
@@ -21260,6 +21895,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21260
21895
  mapJson,
21261
21896
  drag: defaultTransform,
21262
21897
  mapRef,
21898
+ overlayScale,
21899
+ doodleList,
21263
21900
  };
21264
21901
  }, [
21265
21902
  sn,
@@ -21273,6 +21910,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21273
21910
  mapJson,
21274
21911
  defaultTransform,
21275
21912
  mapRef,
21913
+ overlayScale,
21914
+ doodleList,
21276
21915
  ]);
21277
21916
  // console.log('svgElementDatas->', svgElementDatas, unStructMapData, commonValue);
21278
21917
  // 处理地图分区边界
@@ -21291,7 +21930,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21291
21930
  // }
21292
21931
  // return allBoundaryElements;
21293
21932
  // }, [mapJson]);
21294
- useMemo(() => antennaConfig, [antennaConfig]);
21295
21933
  const mowerPositionData = useMemo(() => {
21296
21934
  // realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
21297
21935
  if (!realTimeData || realTimeData.length === 0)
@@ -21504,6 +22142,46 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21504
22142
  useEffect(() => {
21505
22143
  setDrag(defaultTransform ?? { x: 0, y: 0, rotation: 0 });
21506
22144
  }, [defaultTransform]);
22145
+ // 监听地图zoom变化,计算缩放比例
22146
+ useEffect(() => {
22147
+ if (!mapRef)
22148
+ return;
22149
+ const updateScale = () => {
22150
+ const currentZoom = mapRef.getZoom();
22151
+ if (currentZoom === undefined)
22152
+ return;
22153
+ // 基于固定的参考zoom级别计算overlayScale
22154
+ const zoomDiff = currentZoom - REFERENCE_ZOOM;
22155
+ const scale = Math.pow(2, -zoomDiff); // 负数实现反向缩放
22156
+ if (scale < 1) {
22157
+ setOverlayScale(1);
22158
+ }
22159
+ else if (scale > 4) {
22160
+ setOverlayScale(4);
22161
+ }
22162
+ else {
22163
+ setOverlayScale(scale);
22164
+ }
22165
+ };
22166
+ // 使用lodash throttle进行节流处理: 100ms内只执行一次
22167
+ const handleZoomChanged = throttle$2(updateScale, 50);
22168
+ // 添加zoom监听
22169
+ const listener = mapRef.addListener('zoom_changed', handleZoomChanged);
22170
+ // 初始化时获取当前zoom
22171
+ updateScale();
22172
+ return () => {
22173
+ if (listener) {
22174
+ window.google.maps.event.removeListener(listener);
22175
+ }
22176
+ // 取消未执行的节流函数
22177
+ handleZoomChanged.cancel();
22178
+ };
22179
+ }, [mapRef]);
22180
+ useEffect(() => {
22181
+ if (!editMap) {
22182
+ setEditMapInfo(INIT_EDIT_MAP_INFO);
22183
+ }
22184
+ }, [editMap]);
21507
22185
  useEffect(() => {
21508
22186
  if (!mapJson)
21509
22187
  return;
@@ -21576,6 +22254,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21576
22254
  addHistory: (history) => svgEditMapRef.current?.addHistory(history),
21577
22255
  // 添加doodle
21578
22256
  addDoodle: (doodle) => svgEditMapRef.current?.addDoodle(doodle),
22257
+ // 检查doodle
22258
+ checkDoodle: () => svgEditMapRef.current?.checkDoodle?.(),
21579
22259
  }));
21580
22260
  /**
21581
22261
  * 根据割草机的位置更新路径
@@ -21600,7 +22280,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21600
22280
  pre[cur] = parseFloat(curLayout);
21601
22281
  return pre;
21602
22282
  }, {});
21603
- // console.log('setedit svg ------------->', layout);
21604
22283
  if (layout?.width && layout?.height) {
21605
22284
  svgEditMapRef?.current?.adjustSvgSize?.(layout);
21606
22285
  setOverlayLayout(layout);
@@ -21609,4 +22288,4 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
21609
22288
  });
21610
22289
  MowerMapRenderer.displayName = 'MowerMapRenderer';
21611
22290
 
21612
- export { MapDataProcessor, MowerMapRenderer, PathDataProcessor, calculateMapGpsCenter, estimateGpsFromMapBounds };
22291
+ export { BoundarySvgRender, MapDataProcessor, MowerMapRenderer, PathDataProcessor, calculateMapGpsCenter, estimateGpsFromMapBounds };