@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.
- package/dist/index.esm.js +995 -316
- package/dist/index.js +994 -314
- package/dist/src/context/common.d.ts +5 -0
- package/dist/src/context/common.d.ts.map +1 -1
- package/dist/src/context/mapEdit.d.ts +4 -4
- package/dist/src/context/mapEdit.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/processor/unified/BaseData.d.ts +3 -4
- package/dist/src/processor/unified/BaseData.d.ts.map +1 -1
- package/dist/src/processor/unified/UnifiedMapDataProcessor.d.ts.map +1 -1
- package/dist/src/render/BoundarySvgRender.d.ts +10 -0
- package/dist/src/render/BoundarySvgRender.d.ts.map +1 -0
- package/dist/src/render/MowerMapRenderer.d.ts.map +1 -1
- package/dist/src/render/layers/ObstacleLayer.d.ts +16 -0
- package/dist/src/render/layers/ObstacleLayer.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/AddEntry/components/DoodleModal/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/AddEntry/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/boundary.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/Header/index.d.ts +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/Header/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts +2 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts +2 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/TimePeriod/index.d.ts +4 -4
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/TimePeriod/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/doodle.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/index.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/obstacle.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/visionOff.d.ts.map +1 -1
- package/dist/src/render/svgEditMap/index.d.ts +8 -1
- package/dist/src/render/svgEditMap/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/ChannelClipPath/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/DoodleElement/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/Mobile/CreateObstacleElement/index.d.ts +4 -1
- package/dist/src/render/svgElement/Mobile/CreateObstacleElement/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/ObstacleElement/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/PolygonELement/components/DistanceLabels.d.ts.map +1 -1
- package/dist/src/render/svgElement/PolygonELement/dashPath/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/PolygonELement/index.d.ts +1 -1
- package/dist/src/render/svgElement/PolygonELement/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/PolygonELement/vertex/index.d.ts.map +1 -1
- package/dist/src/render/svgElement/TransformWrapper/DoodleTransformWrapper/DoodleTransformWrapper.d.ts.map +1 -1
- package/dist/src/render/svgElement/TransformWrapper/VisionOffTransformWrapper/VisionOffTransformWrapper.d.ts.map +1 -1
- package/dist/src/render/svgElement/VisionOffElement/index.d.ts.map +1 -1
- package/dist/src/types/renderer.d.ts +10 -2
- package/dist/src/types/renderer.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -210,14 +210,13 @@ class ChannelData extends BaseData {
|
|
|
210
210
|
* 障碍物数据类
|
|
211
211
|
*/
|
|
212
212
|
class ObstacleData extends BaseData {
|
|
213
|
-
constructor(originalData, level,
|
|
213
|
+
constructor(originalData, level, style) {
|
|
214
214
|
const convertedPoints = convertPointsFormat(originalData?.points) || [];
|
|
215
215
|
super(originalData?.id, DataType.OBSTACLE, level, RenderType.POLYGON, convertedPoints, originalData);
|
|
216
216
|
this.area = originalData?.area;
|
|
217
217
|
this.status = originalData?.status || 1;
|
|
218
|
-
this.
|
|
219
|
-
this.
|
|
220
|
-
this.isTimeLimit = isTimeLimit;
|
|
218
|
+
this.start_timestamp = originalData?.start_timestamp;
|
|
219
|
+
this.end_timestamp = originalData?.end_timestamp;
|
|
221
220
|
this.name = originalData?.name || 'Obstacle';
|
|
222
221
|
this.style = style;
|
|
223
222
|
}
|
|
@@ -349,8 +348,8 @@ function initDoodle() {
|
|
|
349
348
|
svg: '',
|
|
350
349
|
scale: 1,
|
|
351
350
|
direction: 0,
|
|
352
|
-
create_ts: Date.now(),
|
|
353
|
-
expiration_ts: Date.now() +
|
|
351
|
+
create_ts: Math.floor(Date.now() / 1000),
|
|
352
|
+
expiration_ts: Math.floor(Date.now() / 1000) + 3600 * 24 * 7, // 1小时后过期
|
|
354
353
|
type: 'TIME_LIMIT_OBSTACLE',
|
|
355
354
|
};
|
|
356
355
|
return new DoodleData(doodle, 100);
|
|
@@ -636,7 +635,7 @@ class UnifiedMapDataProcessor {
|
|
|
636
635
|
continue;
|
|
637
636
|
}
|
|
638
637
|
const obstacleData = new ObstacleData(element, 150, // 高层级
|
|
639
|
-
|
|
638
|
+
this.mapConfig.obstacle || {});
|
|
640
639
|
obstacleDataList.push(obstacleData);
|
|
641
640
|
}
|
|
642
641
|
catch (error) {
|
|
@@ -766,7 +765,7 @@ class UnifiedMapDataProcessor {
|
|
|
766
765
|
continue;
|
|
767
766
|
}
|
|
768
767
|
const obstacleData = new ObstacleData(element, 150, // 高层级
|
|
769
|
-
|
|
768
|
+
this.mapConfig.obstacle || {});
|
|
770
769
|
obstacleDataList.push(obstacleData);
|
|
771
770
|
}
|
|
772
771
|
}
|
|
@@ -3071,7 +3070,7 @@ function copyObject(source, props, object, customizer) {
|
|
|
3071
3070
|
}
|
|
3072
3071
|
|
|
3073
3072
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
3074
|
-
var nativeMax$
|
|
3073
|
+
var nativeMax$2 = Math.max;
|
|
3075
3074
|
|
|
3076
3075
|
/**
|
|
3077
3076
|
* A specialized version of `baseRest` which transforms the rest array.
|
|
@@ -3083,11 +3082,11 @@ var nativeMax$1 = Math.max;
|
|
|
3083
3082
|
* @returns {Function} Returns the new function.
|
|
3084
3083
|
*/
|
|
3085
3084
|
function overRest(func, start, transform) {
|
|
3086
|
-
start = nativeMax$
|
|
3085
|
+
start = nativeMax$2(start === undefined ? (func.length - 1) : start, 0);
|
|
3087
3086
|
return function() {
|
|
3088
3087
|
var args = arguments,
|
|
3089
3088
|
index = -1,
|
|
3090
|
-
length = nativeMax$
|
|
3089
|
+
length = nativeMax$2(args.length - start, 0),
|
|
3091
3090
|
array = Array(length);
|
|
3092
3091
|
|
|
3093
3092
|
while (++index < length) {
|
|
@@ -4089,7 +4088,7 @@ function isPlainObject(value) {
|
|
|
4089
4088
|
|
|
4090
4089
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
4091
4090
|
var nativeIsFinite = root$3.isFinite,
|
|
4092
|
-
nativeMin$
|
|
4091
|
+
nativeMin$2 = Math.min;
|
|
4093
4092
|
|
|
4094
4093
|
/**
|
|
4095
4094
|
* Creates a function like `_.round`.
|
|
@@ -4102,7 +4101,7 @@ function createRound(methodName) {
|
|
|
4102
4101
|
var func = Math[methodName];
|
|
4103
4102
|
return function(number, precision) {
|
|
4104
4103
|
number = toNumber$2(number);
|
|
4105
|
-
precision = precision == null ? 0 : nativeMin$
|
|
4104
|
+
precision = precision == null ? 0 : nativeMin$2(toInteger(precision), 292);
|
|
4106
4105
|
if (precision && nativeIsFinite(number)) {
|
|
4107
4106
|
// Shift with exponential notation to avoid floating-point issues.
|
|
4108
4107
|
// See [MDN](https://mdn.io/round#Examples) for more details.
|
|
@@ -4325,6 +4324,212 @@ function createBaseFor(fromRight) {
|
|
|
4325
4324
|
*/
|
|
4326
4325
|
var baseFor = createBaseFor();
|
|
4327
4326
|
|
|
4327
|
+
/**
|
|
4328
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
4329
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
4330
|
+
*
|
|
4331
|
+
* @static
|
|
4332
|
+
* @memberOf _
|
|
4333
|
+
* @since 2.4.0
|
|
4334
|
+
* @category Date
|
|
4335
|
+
* @returns {number} Returns the timestamp.
|
|
4336
|
+
* @example
|
|
4337
|
+
*
|
|
4338
|
+
* _.defer(function(stamp) {
|
|
4339
|
+
* console.log(_.now() - stamp);
|
|
4340
|
+
* }, _.now());
|
|
4341
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
4342
|
+
*/
|
|
4343
|
+
var now$2 = function() {
|
|
4344
|
+
return root$3.Date.now();
|
|
4345
|
+
};
|
|
4346
|
+
|
|
4347
|
+
/** Error message constants. */
|
|
4348
|
+
var FUNC_ERROR_TEXT$3 = 'Expected a function';
|
|
4349
|
+
|
|
4350
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
4351
|
+
var nativeMax$1 = Math.max,
|
|
4352
|
+
nativeMin$1 = Math.min;
|
|
4353
|
+
|
|
4354
|
+
/**
|
|
4355
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
4356
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
4357
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
4358
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
4359
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
4360
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
4361
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
4362
|
+
* calls to the debounced function return the result of the last `func`
|
|
4363
|
+
* invocation.
|
|
4364
|
+
*
|
|
4365
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
4366
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
4367
|
+
* is invoked more than once during the `wait` timeout.
|
|
4368
|
+
*
|
|
4369
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
4370
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
4371
|
+
*
|
|
4372
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
4373
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
4374
|
+
*
|
|
4375
|
+
* @static
|
|
4376
|
+
* @memberOf _
|
|
4377
|
+
* @since 0.1.0
|
|
4378
|
+
* @category Function
|
|
4379
|
+
* @param {Function} func The function to debounce.
|
|
4380
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
4381
|
+
* @param {Object} [options={}] The options object.
|
|
4382
|
+
* @param {boolean} [options.leading=false]
|
|
4383
|
+
* Specify invoking on the leading edge of the timeout.
|
|
4384
|
+
* @param {number} [options.maxWait]
|
|
4385
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
4386
|
+
* @param {boolean} [options.trailing=true]
|
|
4387
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
4388
|
+
* @returns {Function} Returns the new debounced function.
|
|
4389
|
+
* @example
|
|
4390
|
+
*
|
|
4391
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
4392
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
4393
|
+
*
|
|
4394
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
4395
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
4396
|
+
* 'leading': true,
|
|
4397
|
+
* 'trailing': false
|
|
4398
|
+
* }));
|
|
4399
|
+
*
|
|
4400
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
4401
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
4402
|
+
* var source = new EventSource('/stream');
|
|
4403
|
+
* jQuery(source).on('message', debounced);
|
|
4404
|
+
*
|
|
4405
|
+
* // Cancel the trailing debounced invocation.
|
|
4406
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
4407
|
+
*/
|
|
4408
|
+
function debounce$2(func, wait, options) {
|
|
4409
|
+
var lastArgs,
|
|
4410
|
+
lastThis,
|
|
4411
|
+
maxWait,
|
|
4412
|
+
result,
|
|
4413
|
+
timerId,
|
|
4414
|
+
lastCallTime,
|
|
4415
|
+
lastInvokeTime = 0,
|
|
4416
|
+
leading = false,
|
|
4417
|
+
maxing = false,
|
|
4418
|
+
trailing = true;
|
|
4419
|
+
|
|
4420
|
+
if (typeof func != 'function') {
|
|
4421
|
+
throw new TypeError(FUNC_ERROR_TEXT$3);
|
|
4422
|
+
}
|
|
4423
|
+
wait = toNumber$2(wait) || 0;
|
|
4424
|
+
if (isObject$4(options)) {
|
|
4425
|
+
leading = !!options.leading;
|
|
4426
|
+
maxing = 'maxWait' in options;
|
|
4427
|
+
maxWait = maxing ? nativeMax$1(toNumber$2(options.maxWait) || 0, wait) : maxWait;
|
|
4428
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
4429
|
+
}
|
|
4430
|
+
|
|
4431
|
+
function invokeFunc(time) {
|
|
4432
|
+
var args = lastArgs,
|
|
4433
|
+
thisArg = lastThis;
|
|
4434
|
+
|
|
4435
|
+
lastArgs = lastThis = undefined;
|
|
4436
|
+
lastInvokeTime = time;
|
|
4437
|
+
result = func.apply(thisArg, args);
|
|
4438
|
+
return result;
|
|
4439
|
+
}
|
|
4440
|
+
|
|
4441
|
+
function leadingEdge(time) {
|
|
4442
|
+
// Reset any `maxWait` timer.
|
|
4443
|
+
lastInvokeTime = time;
|
|
4444
|
+
// Start the timer for the trailing edge.
|
|
4445
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4446
|
+
// Invoke the leading edge.
|
|
4447
|
+
return leading ? invokeFunc(time) : result;
|
|
4448
|
+
}
|
|
4449
|
+
|
|
4450
|
+
function remainingWait(time) {
|
|
4451
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
4452
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
4453
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
4454
|
+
|
|
4455
|
+
return maxing
|
|
4456
|
+
? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
4457
|
+
: timeWaiting;
|
|
4458
|
+
}
|
|
4459
|
+
|
|
4460
|
+
function shouldInvoke(time) {
|
|
4461
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
4462
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
4463
|
+
|
|
4464
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
4465
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
4466
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
4467
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
4468
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
4469
|
+
}
|
|
4470
|
+
|
|
4471
|
+
function timerExpired() {
|
|
4472
|
+
var time = now$2();
|
|
4473
|
+
if (shouldInvoke(time)) {
|
|
4474
|
+
return trailingEdge(time);
|
|
4475
|
+
}
|
|
4476
|
+
// Restart the timer.
|
|
4477
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
4478
|
+
}
|
|
4479
|
+
|
|
4480
|
+
function trailingEdge(time) {
|
|
4481
|
+
timerId = undefined;
|
|
4482
|
+
|
|
4483
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
4484
|
+
// debounced at least once.
|
|
4485
|
+
if (trailing && lastArgs) {
|
|
4486
|
+
return invokeFunc(time);
|
|
4487
|
+
}
|
|
4488
|
+
lastArgs = lastThis = undefined;
|
|
4489
|
+
return result;
|
|
4490
|
+
}
|
|
4491
|
+
|
|
4492
|
+
function cancel() {
|
|
4493
|
+
if (timerId !== undefined) {
|
|
4494
|
+
clearTimeout(timerId);
|
|
4495
|
+
}
|
|
4496
|
+
lastInvokeTime = 0;
|
|
4497
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
4498
|
+
}
|
|
4499
|
+
|
|
4500
|
+
function flush() {
|
|
4501
|
+
return timerId === undefined ? result : trailingEdge(now$2());
|
|
4502
|
+
}
|
|
4503
|
+
|
|
4504
|
+
function debounced() {
|
|
4505
|
+
var time = now$2(),
|
|
4506
|
+
isInvoking = shouldInvoke(time);
|
|
4507
|
+
|
|
4508
|
+
lastArgs = arguments;
|
|
4509
|
+
lastThis = this;
|
|
4510
|
+
lastCallTime = time;
|
|
4511
|
+
|
|
4512
|
+
if (isInvoking) {
|
|
4513
|
+
if (timerId === undefined) {
|
|
4514
|
+
return leadingEdge(lastCallTime);
|
|
4515
|
+
}
|
|
4516
|
+
if (maxing) {
|
|
4517
|
+
// Handle invocations in a tight loop.
|
|
4518
|
+
clearTimeout(timerId);
|
|
4519
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4520
|
+
return invokeFunc(lastCallTime);
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
if (timerId === undefined) {
|
|
4524
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4525
|
+
}
|
|
4526
|
+
return result;
|
|
4527
|
+
}
|
|
4528
|
+
debounced.cancel = cancel;
|
|
4529
|
+
debounced.flush = flush;
|
|
4530
|
+
return debounced;
|
|
4531
|
+
}
|
|
4532
|
+
|
|
4328
4533
|
/**
|
|
4329
4534
|
* This function is like `assignValue` except that it doesn't assign
|
|
4330
4535
|
* `undefined` values.
|
|
@@ -4609,6 +4814,71 @@ var merge$1 = createAssigner(function(object, source, srcIndex) {
|
|
|
4609
4814
|
*/
|
|
4610
4815
|
var round = createRound('round');
|
|
4611
4816
|
|
|
4817
|
+
/** Error message constants. */
|
|
4818
|
+
var FUNC_ERROR_TEXT$2 = 'Expected a function';
|
|
4819
|
+
|
|
4820
|
+
/**
|
|
4821
|
+
* Creates a throttled function that only invokes `func` at most once per
|
|
4822
|
+
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
4823
|
+
* method to cancel delayed `func` invocations and a `flush` method to
|
|
4824
|
+
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
4825
|
+
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
4826
|
+
* timeout. The `func` is invoked with the last arguments provided to the
|
|
4827
|
+
* throttled function. Subsequent calls to the throttled function return the
|
|
4828
|
+
* result of the last `func` invocation.
|
|
4829
|
+
*
|
|
4830
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
4831
|
+
* invoked on the trailing edge of the timeout only if the throttled function
|
|
4832
|
+
* is invoked more than once during the `wait` timeout.
|
|
4833
|
+
*
|
|
4834
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
4835
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
4836
|
+
*
|
|
4837
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
4838
|
+
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
4839
|
+
*
|
|
4840
|
+
* @static
|
|
4841
|
+
* @memberOf _
|
|
4842
|
+
* @since 0.1.0
|
|
4843
|
+
* @category Function
|
|
4844
|
+
* @param {Function} func The function to throttle.
|
|
4845
|
+
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
4846
|
+
* @param {Object} [options={}] The options object.
|
|
4847
|
+
* @param {boolean} [options.leading=true]
|
|
4848
|
+
* Specify invoking on the leading edge of the timeout.
|
|
4849
|
+
* @param {boolean} [options.trailing=true]
|
|
4850
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
4851
|
+
* @returns {Function} Returns the new throttled function.
|
|
4852
|
+
* @example
|
|
4853
|
+
*
|
|
4854
|
+
* // Avoid excessively updating the position while scrolling.
|
|
4855
|
+
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
4856
|
+
*
|
|
4857
|
+
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
4858
|
+
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
4859
|
+
* jQuery(element).on('click', throttled);
|
|
4860
|
+
*
|
|
4861
|
+
* // Cancel the trailing throttled invocation.
|
|
4862
|
+
* jQuery(window).on('popstate', throttled.cancel);
|
|
4863
|
+
*/
|
|
4864
|
+
function throttle$2(func, wait, options) {
|
|
4865
|
+
var leading = true,
|
|
4866
|
+
trailing = true;
|
|
4867
|
+
|
|
4868
|
+
if (typeof func != 'function') {
|
|
4869
|
+
throw new TypeError(FUNC_ERROR_TEXT$2);
|
|
4870
|
+
}
|
|
4871
|
+
if (isObject$4(options)) {
|
|
4872
|
+
leading = 'leading' in options ? !!options.leading : leading;
|
|
4873
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
4874
|
+
}
|
|
4875
|
+
return debounce$2(func, wait, {
|
|
4876
|
+
'leading': leading,
|
|
4877
|
+
'maxWait': wait,
|
|
4878
|
+
'trailing': trailing
|
|
4879
|
+
});
|
|
4880
|
+
}
|
|
4881
|
+
|
|
4612
4882
|
/**
|
|
4613
4883
|
* 工具模块类型定义
|
|
4614
4884
|
*/
|
|
@@ -8442,7 +8712,7 @@ function styleInject(css, ref) {
|
|
|
8442
8712
|
}
|
|
8443
8713
|
}
|
|
8444
8714
|
|
|
8445
|
-
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
|
|
8715
|
+
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}";
|
|
8446
8716
|
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"};
|
|
8447
8717
|
styleInject(css_248z$i);
|
|
8448
8718
|
|
|
@@ -8524,8 +8794,10 @@ const DragHandle = ({ onDragStart, isDragging }) => {
|
|
|
8524
8794
|
onDragStart(e);
|
|
8525
8795
|
}, onTouchStart: (e) => onDragStart(e), onMouseUp: (e) => {
|
|
8526
8796
|
console.log('drag up');
|
|
8527
|
-
onDragEnd(e);
|
|
8528
|
-
},
|
|
8797
|
+
// onDragEnd(e);
|
|
8798
|
+
},
|
|
8799
|
+
// onTouchEnd={(e) => onDragEnd(e)}
|
|
8800
|
+
style: { cursor: isDragging ? 'grabbing' : 'move' }, dangerouslySetInnerHTML: { __html: DEFAULT_DRAG_ICON } }));
|
|
8529
8801
|
};
|
|
8530
8802
|
|
|
8531
8803
|
const MapDrag = ({ map: _map, dragCallbacks, onBoundaryLabelsCollapse, onTransformChange, isDragMap = false, }) => {
|
|
@@ -12263,10 +12535,73 @@ class ObstacleLayer extends BaseLayer {
|
|
|
12263
12535
|
}
|
|
12264
12536
|
}
|
|
12265
12537
|
/**
|
|
12266
|
-
*
|
|
12538
|
+
* 将坐标点按type分组
|
|
12539
|
+
*/
|
|
12540
|
+
groupCoordinatesByType(coordinates) {
|
|
12541
|
+
const segments = [];
|
|
12542
|
+
let currentSegment = null;
|
|
12543
|
+
for (let i = 0; i < coordinates.length; i++) {
|
|
12544
|
+
const coord = coordinates[i];
|
|
12545
|
+
const type = coord[2] || 2; // 默认type为2
|
|
12546
|
+
if (!currentSegment || currentSegment.type !== type) {
|
|
12547
|
+
// 开始新的段
|
|
12548
|
+
if (currentSegment && currentSegment.points.length > 0) {
|
|
12549
|
+
// 为了连接线段,将当前点也加入上一段的结尾
|
|
12550
|
+
currentSegment.points.push(coord);
|
|
12551
|
+
}
|
|
12552
|
+
currentSegment = {
|
|
12553
|
+
type: type,
|
|
12554
|
+
points: [coord],
|
|
12555
|
+
};
|
|
12556
|
+
segments.push(currentSegment);
|
|
12557
|
+
}
|
|
12558
|
+
else {
|
|
12559
|
+
// 继续当前段
|
|
12560
|
+
currentSegment.points.push(coord);
|
|
12561
|
+
}
|
|
12562
|
+
}
|
|
12563
|
+
// 处理封闭边界:如果第一段和最后一段type相同,需要连接起来
|
|
12564
|
+
if (segments.length > 1 && segments[0].type === segments[segments.length - 1].type) {
|
|
12565
|
+
const firstSegment = segments[0];
|
|
12566
|
+
const lastSegment = segments[segments.length - 1];
|
|
12567
|
+
// 将第一个点添加到最后一段,形成封闭
|
|
12568
|
+
lastSegment.points.push(firstSegment.points[0]);
|
|
12569
|
+
}
|
|
12570
|
+
else if (segments.length === 1) {
|
|
12571
|
+
// 只有一段的情况,添加第一个点到末尾形成封闭
|
|
12572
|
+
segments[0].points.push(coordinates[0]);
|
|
12573
|
+
}
|
|
12574
|
+
return segments;
|
|
12575
|
+
}
|
|
12576
|
+
/**
|
|
12577
|
+
* 渲染障碍物元素
|
|
12267
12578
|
*/
|
|
12268
12579
|
renderObstacle(svgGroup, element) {
|
|
12269
|
-
const { coordinates, style } = element;
|
|
12580
|
+
const { coordinates, style, originalData } = element;
|
|
12581
|
+
const { status, start_timestamp, end_timestamp } = originalData || {};
|
|
12582
|
+
if (coordinates.length < 2 || status === 0) {
|
|
12583
|
+
return;
|
|
12584
|
+
}
|
|
12585
|
+
if (status === 1 &&
|
|
12586
|
+
(start_timestamp > Date.now() / 1000 || end_timestamp < Date.now() / 1000)) {
|
|
12587
|
+
return;
|
|
12588
|
+
}
|
|
12589
|
+
// 1. 先遍历所有的coordinates,把所有点分为若干段的path
|
|
12590
|
+
const pathSegments = this.groupCoordinatesByType(coordinates);
|
|
12591
|
+
// 2&3. 根据type处理每个path段
|
|
12592
|
+
pathSegments.forEach((segment) => {
|
|
12593
|
+
if (segment.points.length < 2)
|
|
12594
|
+
return;
|
|
12595
|
+
if (segment.type === 2) {
|
|
12596
|
+
// type=2: 直接添加到svgGroup中
|
|
12597
|
+
this.createDirectPath(svgGroup, segment.points, style);
|
|
12598
|
+
}
|
|
12599
|
+
else if (segment.type === 1) {
|
|
12600
|
+
// type=1: 使用PathMeasure逻辑生成平行路径
|
|
12601
|
+
// this.createDirectPath(svgGroup, segment.points, style);
|
|
12602
|
+
this.createParallelPathsWithMeasure(svgGroup, segment.points, style);
|
|
12603
|
+
}
|
|
12604
|
+
});
|
|
12270
12605
|
if (coordinates.length < 3)
|
|
12271
12606
|
return;
|
|
12272
12607
|
const polygon = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');
|
|
@@ -12274,7 +12609,7 @@ class ObstacleLayer extends BaseLayer {
|
|
|
12274
12609
|
const points = coordinates.map((coord) => `${coord[0]},${coord[1]}`).join(' ');
|
|
12275
12610
|
polygon.setAttribute('points', points);
|
|
12276
12611
|
polygon.setAttribute('fill', style.fillColor || 'rgba(220, 53, 69, 0.2)');
|
|
12277
|
-
polygon.setAttribute('stroke',
|
|
12612
|
+
polygon.setAttribute('stroke', 'transparent');
|
|
12278
12613
|
// 确保最小线条宽度
|
|
12279
12614
|
const lineWidth = Math.max(style.lineWidth || 2, 0.5);
|
|
12280
12615
|
polygon.setAttribute('stroke-width', lineWidth.toString());
|
|
@@ -12285,6 +12620,113 @@ class ObstacleLayer extends BaseLayer {
|
|
|
12285
12620
|
polygon.classList.add('vector-obstacle');
|
|
12286
12621
|
svgGroup.appendChild(polygon);
|
|
12287
12622
|
}
|
|
12623
|
+
/**
|
|
12624
|
+
* 创建直接路径(type=2)
|
|
12625
|
+
*/
|
|
12626
|
+
createDirectPath(svgGroup, points, style) {
|
|
12627
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
12628
|
+
const strokeColor = style.lineColor;
|
|
12629
|
+
// 构建路径数据
|
|
12630
|
+
let pathData = '';
|
|
12631
|
+
for (let i = 0; i < points.length; i++) {
|
|
12632
|
+
const [x, y] = points[i];
|
|
12633
|
+
if (i === 0) {
|
|
12634
|
+
pathData += `M ${x} ${y}`;
|
|
12635
|
+
}
|
|
12636
|
+
else {
|
|
12637
|
+
pathData += ` L ${x} ${y}`;
|
|
12638
|
+
}
|
|
12639
|
+
}
|
|
12640
|
+
path.setAttribute('d', pathData);
|
|
12641
|
+
path.setAttribute('stroke', strokeColor);
|
|
12642
|
+
path.setAttribute('fill', 'none');
|
|
12643
|
+
// 确保最小线条宽度
|
|
12644
|
+
const lineWidth = dp2px(style.lineWidth || 3);
|
|
12645
|
+
path.setAttribute('stroke-width', lineWidth.toString());
|
|
12646
|
+
path.setAttribute('stroke-linecap', 'round');
|
|
12647
|
+
path.setAttribute('stroke-linejoin', 'round');
|
|
12648
|
+
path.setAttribute('opacity', (style.opacity || 1).toString());
|
|
12649
|
+
path.setAttribute('vector-effect', 'non-scaling-stroke');
|
|
12650
|
+
path.classList.add('vector-obstacle');
|
|
12651
|
+
svgGroup.appendChild(path);
|
|
12652
|
+
}
|
|
12653
|
+
/**
|
|
12654
|
+
* 使用PathMeasure逻辑创建平行路径(type=1)
|
|
12655
|
+
*/
|
|
12656
|
+
createParallelPathsWithMeasure(svgGroup, points, style) {
|
|
12657
|
+
const strokeColor = style.lineColor;
|
|
12658
|
+
const lineWidth = dp2px(style.lineWidth || 3);
|
|
12659
|
+
// 获取当前SVG的缩放级别,计算固定屏幕像素间距
|
|
12660
|
+
const fixedScreenDistance = lineWidth; // 固定的屏幕像素距离
|
|
12661
|
+
const offsetDistance = fixedScreenDistance; // 转换为SVG坐标系距离
|
|
12662
|
+
// 直接对每个线段生成平行直线段
|
|
12663
|
+
const parallelPaths = this.generateStraightParallelPaths(points, offsetDistance);
|
|
12664
|
+
// 渲染两条平行虚线
|
|
12665
|
+
parallelPaths.forEach((pathData, index) => {
|
|
12666
|
+
if (!pathData)
|
|
12667
|
+
return;
|
|
12668
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
12669
|
+
path.setAttribute('d', pathData);
|
|
12670
|
+
path.setAttribute('fill', 'none');
|
|
12671
|
+
path.setAttribute('stroke', strokeColor);
|
|
12672
|
+
path.setAttribute('stroke-width', lineWidth.toString());
|
|
12673
|
+
path.setAttribute('stroke-linecap', 'round');
|
|
12674
|
+
path.setAttribute('stroke-linejoin', 'round');
|
|
12675
|
+
path.setAttribute('opacity', (style.opacity || 1).toString());
|
|
12676
|
+
// 使用CSS样式设置虚线,避免随SVG缩放变化
|
|
12677
|
+
// 或者可以根据当前缩放级别动态计算dash array
|
|
12678
|
+
path.style.strokeDasharray = `${lineWidth}px ${lineWidth * 2}px`;
|
|
12679
|
+
path.classList.add(`vector-boundary-parallel-${index + 1}`);
|
|
12680
|
+
svgGroup.appendChild(path);
|
|
12681
|
+
});
|
|
12682
|
+
}
|
|
12683
|
+
/**
|
|
12684
|
+
* 生成直线平行路径(每个线段分别处理)
|
|
12685
|
+
*/
|
|
12686
|
+
generateStraightParallelPaths(points, offsetDistance) {
|
|
12687
|
+
if (points.length < 2)
|
|
12688
|
+
return ['', ''];
|
|
12689
|
+
let parallelPath1Data = '';
|
|
12690
|
+
let parallelPath2Data = '';
|
|
12691
|
+
// 对每个线段分别计算平行线
|
|
12692
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
12693
|
+
const startPoint = points[i];
|
|
12694
|
+
const endPoint = points[i + 1];
|
|
12695
|
+
// 计算线段的方向向量
|
|
12696
|
+
const dx = endPoint[0] - startPoint[0];
|
|
12697
|
+
const dy = endPoint[1] - startPoint[1];
|
|
12698
|
+
const length = Math.sqrt(dx * dx + dy * dy);
|
|
12699
|
+
if (length === 0)
|
|
12700
|
+
continue; // 跳过零长度线段
|
|
12701
|
+
// 标准化方向向量
|
|
12702
|
+
const unitX = dx / length;
|
|
12703
|
+
const unitY = dy / length;
|
|
12704
|
+
// 计算垂直向量
|
|
12705
|
+
const perpendicularX = -unitY;
|
|
12706
|
+
const perpendicularY = unitX;
|
|
12707
|
+
// 计算平行线的起点和终点
|
|
12708
|
+
const start1X = startPoint[0] + perpendicularX * offsetDistance;
|
|
12709
|
+
const start1Y = startPoint[1] + perpendicularY * offsetDistance;
|
|
12710
|
+
const end1X = endPoint[0] + perpendicularX * offsetDistance;
|
|
12711
|
+
const end1Y = endPoint[1] + perpendicularY * offsetDistance;
|
|
12712
|
+
const start2X = startPoint[0] - perpendicularX * offsetDistance;
|
|
12713
|
+
const start2Y = startPoint[1] - perpendicularY * offsetDistance;
|
|
12714
|
+
const end2X = endPoint[0] - perpendicularX * offsetDistance;
|
|
12715
|
+
const end2Y = endPoint[1] - perpendicularY * offsetDistance;
|
|
12716
|
+
// 构建路径数据
|
|
12717
|
+
if (i === 0) {
|
|
12718
|
+
parallelPath1Data = `M ${start1X} ${start1Y}`;
|
|
12719
|
+
parallelPath2Data = `M ${start2X} ${start2Y}`;
|
|
12720
|
+
}
|
|
12721
|
+
else {
|
|
12722
|
+
parallelPath1Data += ` M ${start1X} ${start1Y}`;
|
|
12723
|
+
parallelPath2Data += ` M ${start2X} ${start2Y}`;
|
|
12724
|
+
}
|
|
12725
|
+
parallelPath1Data += ` L ${end1X} ${end1Y}`;
|
|
12726
|
+
parallelPath2Data += ` L ${end2X} ${end2Y}`;
|
|
12727
|
+
}
|
|
12728
|
+
return [parallelPath2Data, parallelPath1Data];
|
|
12729
|
+
}
|
|
12288
12730
|
}
|
|
12289
12731
|
|
|
12290
12732
|
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=";
|
|
@@ -13746,6 +14188,7 @@ const CommonContext = React.createContext({
|
|
|
13746
14188
|
mapRef: null,
|
|
13747
14189
|
globalHeight: 0,
|
|
13748
14190
|
heightOptions: [],
|
|
14191
|
+
overlayScale: 1,
|
|
13749
14192
|
});
|
|
13750
14193
|
const CommonContextProvider = CommonContext.Provider;
|
|
13751
14194
|
const useCommonContext = () => React.useContext(CommonContext);
|
|
@@ -14755,24 +15198,26 @@ function generateStraightParallelPaths(points, offsetDistance) {
|
|
|
14755
15198
|
}
|
|
14756
15199
|
return [parallelPath2Data, parallelPath1Data];
|
|
14757
15200
|
}
|
|
14758
|
-
const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className }) => {
|
|
15201
|
+
const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className, }) => {
|
|
14759
15202
|
const [parallelPath2Data, parallelPath1Data] = generateStraightParallelPaths(points, strokeWidth);
|
|
14760
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("path", {
|
|
15203
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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" }), jsxRuntime.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" })] }));
|
|
14761
15204
|
};
|
|
14762
15205
|
|
|
14763
15206
|
const VertexElement = React.memo(({ r, stroke, ...props }) => {
|
|
14764
|
-
|
|
15207
|
+
const { overlayScale } = useCommonContext();
|
|
15208
|
+
const radius = typeof r === 'number' ? r : 12;
|
|
15209
|
+
return (jsxRuntime.jsx("circle", { r: radius * overlayScale, stroke: stroke || '#fff', fill: '#fff', strokeWidth: 2 * overlayScale, ...props }));
|
|
14765
15210
|
});
|
|
14766
15211
|
|
|
14767
|
-
var _path$
|
|
14768
|
-
function _extends$
|
|
15212
|
+
var _path$b;
|
|
15213
|
+
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); }
|
|
14769
15214
|
var SvgDelete$1 = function SvgDelete(props) {
|
|
14770
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
15215
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
|
|
14771
15216
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14772
15217
|
width: 16,
|
|
14773
15218
|
height: 16,
|
|
14774
15219
|
fill: "none"
|
|
14775
|
-
}, props), _path$
|
|
15220
|
+
}, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
|
|
14776
15221
|
fill: "#FD494D",
|
|
14777
15222
|
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"
|
|
14778
15223
|
})));
|
|
@@ -14893,14 +15338,12 @@ const calculatePhysicalDistance$1 = (point1, point2) => {
|
|
|
14893
15338
|
* @returns 中点坐标 [x, y]
|
|
14894
15339
|
*/
|
|
14895
15340
|
const calculateMidpoint$1 = (point1, point2) => {
|
|
14896
|
-
return [
|
|
14897
|
-
(point1[0] + point2[0]) / 2,
|
|
14898
|
-
(point1[1] + point2[1]) / 2
|
|
14899
|
-
];
|
|
15341
|
+
return [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
|
|
14900
15342
|
};
|
|
14901
15343
|
const DistanceLabels = ({ coordinates, createMode = false, editMode = false, completed = false, showPoints = false, mousePos: _mousePos = null, ghostLastDistance = null, ghostLastMidpoint = null, ghostFirstDistance = null, ghostFirstMidpoint = null, }) => {
|
|
14902
15344
|
// 只在显示可操作顶点时显示距离
|
|
14903
|
-
if (!(createMode && showPoints || editMode || (createMode && completed)) ||
|
|
15345
|
+
if (!((createMode && showPoints) || editMode || (createMode && completed)) ||
|
|
15346
|
+
coordinates.length < 1) {
|
|
14904
15347
|
return null;
|
|
14905
15348
|
}
|
|
14906
15349
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [coordinates.map((coord, idx) => {
|
|
@@ -14947,12 +15390,13 @@ var MobileEditMode;
|
|
|
14947
15390
|
})(MobileEditMode || (MobileEditMode = {}));
|
|
14948
15391
|
var ClickEventType;
|
|
14949
15392
|
(function (ClickEventType) {
|
|
15393
|
+
// 点击doodle的active time的时候触发
|
|
14950
15394
|
ClickEventType["DOODLE_ACTIVE_TIME"] = "doodleActiveTime";
|
|
14951
15395
|
})(ClickEventType || (ClickEventType = {}));
|
|
14952
15396
|
const INIT_EDIT_MAP_INFO = {
|
|
14953
15397
|
editMap: false,
|
|
14954
15398
|
selectElement: null,
|
|
14955
|
-
createMode:
|
|
15399
|
+
createMode: null,
|
|
14956
15400
|
elementType: undefined,
|
|
14957
15401
|
isShowDrag: false,
|
|
14958
15402
|
mobileMode: MobileEditMode.START,
|
|
@@ -15309,7 +15753,7 @@ const useCheckElement = () => {
|
|
|
15309
15753
|
return { isValid: true };
|
|
15310
15754
|
}, [editMapInfo, svgElementDatas, minDistance]);
|
|
15311
15755
|
const checkCanNotCreateAtPosition = React.useCallback((checkPoint) => {
|
|
15312
|
-
|
|
15756
|
+
console.log('editMapInfo.elementType--->', editMapInfo.elementType);
|
|
15313
15757
|
if (!editMapInfo.elementType)
|
|
15314
15758
|
return false;
|
|
15315
15759
|
const points = editMapInfo?.selectElement?.points || [];
|
|
@@ -15476,8 +15920,9 @@ const createPathData = (points) => {
|
|
|
15476
15920
|
}
|
|
15477
15921
|
return pathData;
|
|
15478
15922
|
};
|
|
15479
|
-
const PolygonElement = ({
|
|
15923
|
+
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自动判断
|
|
15480
15924
|
}) => {
|
|
15925
|
+
const { overlayScale } = useCommonContext();
|
|
15481
15926
|
const { svgRef } = useSvgEditContext();
|
|
15482
15927
|
const [dragState, setDragState] = React.useState({
|
|
15483
15928
|
isDragging: false,
|
|
@@ -15493,6 +15938,10 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15493
15938
|
const { checkCanNotCreateAtPosition } = useCheckElement();
|
|
15494
15939
|
const { editMapInfo } = useMapEditContext();
|
|
15495
15940
|
const { platform } = useCommonContext();
|
|
15941
|
+
// delete icon可能被上一个点遮挡,因为delete在右上方,所以手动处理点让点按照顺时针渲染,这样delete icon层级就会高一些
|
|
15942
|
+
const coordinates = React.useMemo(() => {
|
|
15943
|
+
return editMapInfo?.createMode === CreateStatus.CREATING ? points : [...points].reverse();
|
|
15944
|
+
}, [points, editMapInfo?.createMode]);
|
|
15496
15945
|
// 计算点到线段的垂足坐标(使用通用工具函数)
|
|
15497
15946
|
const calculatePerpendicularFoot$1 = React.useCallback((point, lineStart, lineEnd) => {
|
|
15498
15947
|
return calculatePerpendicularFoot(point, lineStart, lineEnd);
|
|
@@ -15701,8 +16150,6 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15701
16150
|
else {
|
|
15702
16151
|
// mouseUp 时才真正插入新顶点
|
|
15703
16152
|
newCoordinates.splice(dragState.newVertexIndex, 0, dragState.currentPosition);
|
|
15704
|
-
// 通知外部坐标变化
|
|
15705
|
-
onCoordinatesChange?.(newCoordinates);
|
|
15706
16153
|
}
|
|
15707
16154
|
}
|
|
15708
16155
|
else {
|
|
@@ -15713,9 +16160,11 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15713
16160
|
else {
|
|
15714
16161
|
newCoordinates[dragState.dragIndex] = dragState.currentPosition;
|
|
15715
16162
|
}
|
|
15716
|
-
// 通知外部坐标变化
|
|
15717
|
-
onCoordinatesChange?.(newCoordinates);
|
|
15718
16163
|
}
|
|
16164
|
+
const result = editMapInfo?.createMode === CreateStatus.CREATING
|
|
16165
|
+
? newCoordinates
|
|
16166
|
+
: newCoordinates.reverse();
|
|
16167
|
+
onCoordinatesChange?.(result);
|
|
15719
16168
|
}
|
|
15720
16169
|
setDragState({
|
|
15721
16170
|
isDragging: false,
|
|
@@ -15726,7 +16175,7 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15726
16175
|
edgeInfo: null,
|
|
15727
16176
|
dragType: null,
|
|
15728
16177
|
});
|
|
15729
|
-
}, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor]);
|
|
16178
|
+
}, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor, editMapInfo?.createMode]);
|
|
15730
16179
|
// 添加全局事件监听(支持触摸和鼠标事件)
|
|
15731
16180
|
React.useEffect(() => {
|
|
15732
16181
|
if (dragState.isDragging) {
|
|
@@ -15798,22 +16247,14 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15798
16247
|
mousePos.y,
|
|
15799
16248
|
])
|
|
15800
16249
|
: null;
|
|
15801
|
-
const ghostFirstDistance = createMode &&
|
|
15802
|
-
mousePos &&
|
|
15803
|
-
renderCoordinates.length > 0 &&
|
|
15804
|
-
!completed &&
|
|
15805
|
-
renderCoordinates.length >= 3
|
|
16250
|
+
const ghostFirstDistance = createMode && mousePos && !completed && renderCoordinates.length >= 1
|
|
15806
16251
|
? calculatePhysicalDistance(renderCoordinates[0], [mousePos.x, mousePos.y])
|
|
15807
16252
|
: null;
|
|
15808
16253
|
// 虚拟连线的中点坐标
|
|
15809
16254
|
const ghostLastMidpoint = createMode && mousePos && renderCoordinates.length > 0 && !completed
|
|
15810
16255
|
? calculateMidpoint(renderCoordinates[renderCoordinates.length - 1], [mousePos.x, mousePos.y])
|
|
15811
16256
|
: null;
|
|
15812
|
-
const ghostFirstMidpoint = createMode &&
|
|
15813
|
-
mousePos &&
|
|
15814
|
-
renderCoordinates.length > 0 &&
|
|
15815
|
-
!completed &&
|
|
15816
|
-
renderCoordinates.length >= 3
|
|
16257
|
+
const ghostFirstMidpoint = createMode && mousePos && !completed && renderCoordinates.length >= 1
|
|
15817
16258
|
? calculateMidpoint(renderCoordinates[0], [mousePos.x, mousePos.y])
|
|
15818
16259
|
: null;
|
|
15819
16260
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(editMode || (createMode && completed)) &&
|
|
@@ -15867,14 +16308,14 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15867
16308
|
setHoverVertex(null);
|
|
15868
16309
|
},
|
|
15869
16310
|
}) }, `edge-${index}`));
|
|
15870
|
-
}), ghostLastPath && (jsxRuntime.jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >=
|
|
16311
|
+
}), ghostLastPath && (jsxRuntime.jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >= 2 && (jsxRuntime.jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), jsxRuntime.jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed }), jsxRuntime.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 && (jsxRuntime.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)) &&
|
|
15871
16312
|
renderCoordinates.map((coord, idx) => {
|
|
15872
16313
|
// 判断当前顶点的状态
|
|
15873
16314
|
const isLastPoint = idx === renderCoordinates.length - 1;
|
|
15874
16315
|
const canComplete = createMode && !completed && renderCoordinates.length >= 3 && isLastPoint;
|
|
15875
16316
|
const isCreatedAndCanDrag = createMode && completed; // 创建完成后可拖拽
|
|
15876
16317
|
const isInEditMode = editMode;
|
|
15877
|
-
return (jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx(VertexElement, { className: generateVertexClassName, stroke: strokeColor, cx: coord[0], cy: coord[1], onClick: (e) => handleVertexClick(e, idx), onDoubleClick: (e) => {
|
|
16318
|
+
return (jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx(VertexElement, { className: generateVertexClassName, stroke: strokeColor, cx: coord[0], cy: coord[1], r: canComplete ? 16 : 12, onClick: (e) => handleVertexClick(e, idx), onDoubleClick: (e) => {
|
|
15878
16319
|
// 阻止双击事件冒泡到Google Maps
|
|
15879
16320
|
e.preventDefault();
|
|
15880
16321
|
e.stopPropagation();
|
|
@@ -15922,16 +16363,40 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15922
16363
|
}
|
|
15923
16364
|
}
|
|
15924
16365
|
},
|
|
15925
|
-
|
|
16366
|
+
onMouseUp: (e) => {
|
|
16367
|
+
// 拖拽逻辑:编辑模式或创建完成后
|
|
16368
|
+
if (isInEditMode || isCreatedAndCanDrag) {
|
|
16369
|
+
if (draggable) {
|
|
16370
|
+
// 延迟执行mouseDown,等待可能的doubleClick
|
|
16371
|
+
if (mouseDownTimerRef.current !== null) {
|
|
16372
|
+
window.clearTimeout(mouseDownTimerRef.current);
|
|
16373
|
+
}
|
|
16374
|
+
}
|
|
16375
|
+
}
|
|
16376
|
+
},
|
|
16377
|
+
}) }), tooltipIndex === idx && (jsxRuntime.jsxs("g", { transform: `translate(${coord[0] + 4 * overlayScale * 2}, ${coord[1] - 4 * overlayScale * 2}) scale(${overlayScale * 2})`, onClick: (e) => {
|
|
15926
16378
|
e.preventDefault();
|
|
15927
16379
|
e.stopPropagation();
|
|
15928
16380
|
if (onVertexDelete &&
|
|
15929
16381
|
(editMode || (createMode && completed)) &&
|
|
15930
16382
|
coordinates.length > 3) {
|
|
15931
|
-
|
|
16383
|
+
// 当前是逆时针展示的,但是外部数据是顺时针的,所以idx需要转换一下
|
|
16384
|
+
onVertexDelete(renderCoordinates?.length - 1 - idx);
|
|
15932
16385
|
}
|
|
15933
16386
|
setTooltipIndex(null);
|
|
15934
|
-
}, style: { cursor: 'pointer' }, children: [jsxRuntime.jsx("rect", { x: 0, y: -24, width: 20, height: 20, rx: 2, ry: 2, fill: "#fff", strokeWidth: 1, filter: "url(#vertex-tooltip-shadow)" }), jsxRuntime.jsx("g", { transform: `translate(2, -22)`, children: jsxRuntime.jsx(SvgDelete$1, {}) })] })), canComplete && (jsxRuntime.jsx("
|
|
16387
|
+
}, style: { cursor: 'pointer' }, children: [jsxRuntime.jsx("rect", { x: 0, y: -24, width: 20, height: 20, rx: 2, ry: 2, fill: "#fff", strokeWidth: 1, filter: "url(#vertex-tooltip-shadow)" }), jsxRuntime.jsx("g", { transform: `translate(2, -22)`, children: jsxRuntime.jsx(SvgDelete$1, {}) })] })), canComplete && (jsxRuntime.jsx("g", { style: { pointerEvents: 'none' }, transform: `translate(${coord[0] - 5 * overlayScale * 3}, ${coord[1] - 2.5 * overlayScale * 3}) scale(${overlayScale * 3})`, children: jsxRuntime.jsx("svg", { width: "10", height: "5", viewBox: "0 0 6 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.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" }) }) })
|
|
16388
|
+
// <rect
|
|
16389
|
+
// x={coord[0]}
|
|
16390
|
+
// y={coord[1]}
|
|
16391
|
+
// width={20}
|
|
16392
|
+
// height={20}
|
|
16393
|
+
// rx={2}
|
|
16394
|
+
// ry={2}
|
|
16395
|
+
// fill="transparent"
|
|
16396
|
+
// style={{ pointerEvents: 'none' }}
|
|
16397
|
+
// >
|
|
16398
|
+
// </rect>
|
|
16399
|
+
)] }, `vertex-${idx}`));
|
|
15935
16400
|
})] }));
|
|
15936
16401
|
};
|
|
15937
16402
|
|
|
@@ -15983,7 +16448,7 @@ const BoundaryElement = ({ data }) => {
|
|
|
15983
16448
|
}));
|
|
15984
16449
|
}
|
|
15985
16450
|
}, [platform, data, editMapInfo]);
|
|
15986
|
-
return (jsxRuntime.jsx(PolygonElement, {
|
|
16451
|
+
return (jsxRuntime.jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: onPathClick, onCoordinatesChange: (coordinates) => {
|
|
15987
16452
|
console.log('onCoordinatesChange', coordinates);
|
|
15988
16453
|
setEditMapInfo((prev) => ({
|
|
15989
16454
|
...prev,
|
|
@@ -16118,6 +16583,7 @@ const ObstacleElement = ({ data }) => {
|
|
|
16118
16583
|
}
|
|
16119
16584
|
}, [editMapInfo]);
|
|
16120
16585
|
const currentPoints = React.useMemo(() => {
|
|
16586
|
+
// 为了方便解决删除顶点的时候,delete icon被遮挡的问题,所以逆序一下
|
|
16121
16587
|
if (editMapInfo?.selectElement?.id === data.id) {
|
|
16122
16588
|
return editMapInfo.selectElement.points;
|
|
16123
16589
|
}
|
|
@@ -16161,7 +16627,11 @@ const ObstacleElement = ({ data }) => {
|
|
|
16161
16627
|
setEditMapInfo((prev) => ({
|
|
16162
16628
|
...prev,
|
|
16163
16629
|
selectElement: data,
|
|
16164
|
-
historyList: [
|
|
16630
|
+
historyList: [
|
|
16631
|
+
{
|
|
16632
|
+
selectElement: data,
|
|
16633
|
+
},
|
|
16634
|
+
],
|
|
16165
16635
|
currentHistoryIndex: 0,
|
|
16166
16636
|
elementType: DataType.OBSTACLE,
|
|
16167
16637
|
editMap: true,
|
|
@@ -16175,7 +16645,7 @@ const ObstacleElement = ({ data }) => {
|
|
|
16175
16645
|
}
|
|
16176
16646
|
return editMapInfo?.selectElement?.id === data.id;
|
|
16177
16647
|
}, [editMapInfo, data, platform]);
|
|
16178
|
-
return (jsxRuntime.jsx(PolygonElement, {
|
|
16648
|
+
return (jsxRuntime.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: () => {
|
|
16179
16649
|
if (platform === PlatformType.H5) {
|
|
16180
16650
|
onPathClick();
|
|
16181
16651
|
}
|
|
@@ -16603,9 +17073,9 @@ const useVisionOffTransform = (data, scaleConstraints
|
|
|
16603
17073
|
};
|
|
16604
17074
|
|
|
16605
17075
|
var _g$7, _defs$7;
|
|
16606
|
-
function _extends$
|
|
17076
|
+
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); }
|
|
16607
17077
|
var SvgTransformDelete = function SvgTransformDelete(props) {
|
|
16608
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
17078
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
|
|
16609
17079
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16610
17080
|
width: 20,
|
|
16611
17081
|
height: 20,
|
|
@@ -16654,9 +17124,9 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
|
|
|
16654
17124
|
};
|
|
16655
17125
|
|
|
16656
17126
|
var _g$6, _defs$6;
|
|
16657
|
-
function _extends$
|
|
17127
|
+
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); }
|
|
16658
17128
|
var SvgTransformRotate = function SvgTransformRotate(props) {
|
|
16659
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
17129
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
|
|
16660
17130
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16661
17131
|
width: 21,
|
|
16662
17132
|
height: 20,
|
|
@@ -16690,9 +17160,9 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
|
|
|
16690
17160
|
};
|
|
16691
17161
|
|
|
16692
17162
|
var _g$5, _defs$5;
|
|
16693
|
-
function _extends$
|
|
17163
|
+
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); }
|
|
16694
17164
|
var SvgTransformScale = function SvgTransformScale(props) {
|
|
16695
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
17165
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
|
|
16696
17166
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16697
17167
|
width: 21,
|
|
16698
17168
|
height: 20,
|
|
@@ -16726,9 +17196,9 @@ var SvgTransformScale = function SvgTransformScale(props) {
|
|
|
16726
17196
|
};
|
|
16727
17197
|
|
|
16728
17198
|
var _g$4, _defs$4;
|
|
16729
|
-
function _extends$
|
|
17199
|
+
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); }
|
|
16730
17200
|
var SvgTransformTranslate = function SvgTransformTranslate(props) {
|
|
16731
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
17201
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
|
|
16732
17202
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16733
17203
|
width: 20,
|
|
16734
17204
|
height: 20,
|
|
@@ -16764,6 +17234,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
|
|
|
16764
17234
|
};
|
|
16765
17235
|
|
|
16766
17236
|
const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCancel, onDragEnd, onDragMove, disabled = false, className = '', scaleConstraints = { minEdgeLength: 0.5, maxEdgeLength: 10000 }, showInfo = true, }) => {
|
|
17237
|
+
const { overlayScale } = useCommonContext();
|
|
16767
17238
|
const { platform } = useCommonContext();
|
|
16768
17239
|
const { editMapInfo } = useMapEditContext();
|
|
16769
17240
|
const dataPoints = React.useMemo(() => {
|
|
@@ -16879,7 +17350,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
16879
17350
|
return;
|
|
16880
17351
|
onDragMove?.(currentPoints.map((point) => [point.x, point.y]));
|
|
16881
17352
|
}, [currentPoints, isSelected, isDragging, isRotating, isScaling]);
|
|
16882
|
-
return (jsxRuntime.jsxs("g", { ref: containerRef, className: `vision-off-transform-wrapper ${className} ${isSelected ? 'selected' : ''}`, "data-transform-wrapper": "true", children: [jsxRuntime.jsx(PolygonElement, {
|
|
17353
|
+
return (jsxRuntime.jsxs("g", { ref: containerRef, className: `vision-off-transform-wrapper ${className} ${isSelected ? 'selected' : ''}`, "data-transform-wrapper": "true", children: [jsxRuntime.jsx(PolygonElement, { points: visionOffData?.points, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: () => {
|
|
16883
17354
|
onSelect?.();
|
|
16884
17355
|
}, onPolygonClick: () => {
|
|
16885
17356
|
if (platform === PlatformType.H5) {
|
|
@@ -16905,12 +17376,12 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
16905
17376
|
const centerX = (minX + maxX) / 2;
|
|
16906
17377
|
// 计算尺寸显示框的位置(选择框下方)
|
|
16907
17378
|
const infoBoxY = maxY + 20; // 选择框下方20像素
|
|
16908
|
-
const infoBoxWidth = 140; // 信息框宽度
|
|
16909
|
-
const infoBoxHeight = 30; // 信息框高度
|
|
17379
|
+
const infoBoxWidth = 140 * overlayScale; // 信息框宽度
|
|
17380
|
+
const infoBoxHeight = 30 * overlayScale; // 信息框高度
|
|
16910
17381
|
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
16911
|
-
const scale = isWeb ? 2 : 1;
|
|
17382
|
+
const scale = (isWeb ? 2 : 1) * overlayScale;
|
|
16912
17383
|
const offsetLeft = 10 * scale;
|
|
16913
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#
|
|
17384
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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
|
|
16914
17385
|
? {
|
|
16915
17386
|
onTouchStart: createReactEventHandler((e) => {
|
|
16916
17387
|
handleMouseDownWithDisabled(e);
|
|
@@ -16960,6 +17431,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
16960
17431
|
fontSize: '12px',
|
|
16961
17432
|
color: 'white',
|
|
16962
17433
|
fontWeight: '400',
|
|
17434
|
+
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
16963
17435
|
}, children: [dimensions.height, "m \u00D7 ", dimensions.width, "m"] }) }))] }));
|
|
16964
17436
|
})()] }));
|
|
16965
17437
|
};
|
|
@@ -17017,7 +17489,11 @@ const VisionOffElement = ({ data, onSelect }) => {
|
|
|
17017
17489
|
...prev,
|
|
17018
17490
|
selectElement: data,
|
|
17019
17491
|
elementType: DataType.VISION_OFF,
|
|
17020
|
-
historyList: [
|
|
17492
|
+
historyList: [
|
|
17493
|
+
{
|
|
17494
|
+
selectElement: data,
|
|
17495
|
+
},
|
|
17496
|
+
],
|
|
17021
17497
|
currentHistoryIndex: 0,
|
|
17022
17498
|
editMap: true,
|
|
17023
17499
|
isShowDrag: true,
|
|
@@ -17379,8 +17855,8 @@ const useDoodleTransform = (data, onTransformChange, options) => {
|
|
|
17379
17855
|
const scaledHeight = height * currentScale;
|
|
17380
17856
|
// 转换为米单位(假设SVG坐标单位是米)
|
|
17381
17857
|
// 这里可以根据实际的地图比例尺进行调整
|
|
17382
|
-
const widthInMeters = scaledWidth;
|
|
17383
|
-
const heightInMeters = scaledHeight;
|
|
17858
|
+
const widthInMeters = scaledWidth / SCALE_FACTOR;
|
|
17859
|
+
const heightInMeters = scaledHeight / SCALE_FACTOR;
|
|
17384
17860
|
return {
|
|
17385
17861
|
width: Math.round(widthInMeters * 100) / 100, // 保留2位小数
|
|
17386
17862
|
height: Math.round(heightInMeters * 100) / 100, // 保留2位小数
|
|
@@ -17412,15 +17888,15 @@ const useDoodleTransform = (data, onTransformChange, options) => {
|
|
|
17412
17888
|
};
|
|
17413
17889
|
};
|
|
17414
17890
|
|
|
17415
|
-
var _path$
|
|
17416
|
-
function _extends$
|
|
17891
|
+
var _path$a;
|
|
17892
|
+
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); }
|
|
17417
17893
|
var SvgTransformArrow = function SvgTransformArrow(props) {
|
|
17418
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
17894
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
|
|
17419
17895
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17420
17896
|
width: 7,
|
|
17421
17897
|
height: 11,
|
|
17422
17898
|
fill: "none"
|
|
17423
|
-
}, props), _path$
|
|
17899
|
+
}, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
|
|
17424
17900
|
fill: "#fff",
|
|
17425
17901
|
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",
|
|
17426
17902
|
opacity: 0.5
|
|
@@ -17482,7 +17958,7 @@ const DoodleTransform = ({ data, isSelected: _isSelected, onSelect }) => {
|
|
|
17482
17958
|
};
|
|
17483
17959
|
|
|
17484
17960
|
const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOperation = false, onSelect, onCancel, onTransformChange, disabled = false, className = '', minScale, onMinScaleReached, onDragMove, onDragEnd, showInfo = true, onClickInfo, }) => {
|
|
17485
|
-
const { platform } = useCommonContext();
|
|
17961
|
+
const { platform, overlayScale } = useCommonContext();
|
|
17486
17962
|
// 使用自定义hook管理所有变换逻辑
|
|
17487
17963
|
const { currentCenter, currentScale, currentDirection, isDragging, isRotating, isScaling, initializeTransform, calculateSelectionBoxPoints, handleMouseDown, handleRotateStart, handleScaleStart, handleMouseMove, handleMouseUp, containerRef, dimensions, } = useDoodleTransform(data, onTransformChange, {
|
|
17488
17964
|
minScale,
|
|
@@ -17504,16 +17980,20 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17504
17980
|
}, [data?.svg, currentCenter, currentScale, currentDirection]);
|
|
17505
17981
|
const isWeb = React.useMemo(() => platform === 'web', [platform]);
|
|
17506
17982
|
const activeTime = React.useMemo(() => {
|
|
17507
|
-
|
|
17508
|
-
|
|
17509
|
-
console.log('now------->', now);
|
|
17510
|
-
console.log('data.create_ts------->', data.create_ts);
|
|
17511
|
-
console.log('data.expiration_ts------->', data.expiration_ts);
|
|
17512
|
-
if (data.create_ts <= now && data.expiration_ts >= now) {
|
|
17513
|
-
return Math.floor((data.expiration_ts - now) / (60 * 60 * 24 * 1000));
|
|
17983
|
+
if (data.create_ts && data.expiration_ts) {
|
|
17984
|
+
return Math.floor((data.expiration_ts - data.create_ts) / (60 * 60 * 24));
|
|
17514
17985
|
}
|
|
17515
17986
|
return 0;
|
|
17516
17987
|
}, [data]);
|
|
17988
|
+
const remainingTime = React.useMemo(() => {
|
|
17989
|
+
const currentTime = Math.floor(Date.now() / 1000);
|
|
17990
|
+
console.log('data.expiration_ts--', data.expiration_ts);
|
|
17991
|
+
if (data.expiration_ts <= currentTime) {
|
|
17992
|
+
return 0;
|
|
17993
|
+
}
|
|
17994
|
+
// 保留一位小数
|
|
17995
|
+
return ((currentTime - data.expiration_ts) / (24 * 60 * 60)).toFixed(1);
|
|
17996
|
+
}, [data]);
|
|
17517
17997
|
// 初始化变换状态
|
|
17518
17998
|
React.useEffect(() => {
|
|
17519
17999
|
initializeTransform();
|
|
@@ -17594,7 +18074,18 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17594
18074
|
};
|
|
17595
18075
|
const selectionBoxWithoutOperation = () => {
|
|
17596
18076
|
const selectionBoxPoints = calculateSelectionBoxPoints();
|
|
17597
|
-
|
|
18077
|
+
// 计算选择框的边界
|
|
18078
|
+
const minX = Math.min(...selectionBoxPoints.map((p) => p.x));
|
|
18079
|
+
const maxX = Math.max(...selectionBoxPoints.map((p) => p.x));
|
|
18080
|
+
const maxY = Math.max(...selectionBoxPoints.map((p) => p.y));
|
|
18081
|
+
// 计算选择框的中心
|
|
18082
|
+
const centerX = (minX + maxX) / 2;
|
|
18083
|
+
// 计算尺寸显示框的位置(选择框下方)
|
|
18084
|
+
const infoBoxY = maxY + 20; // 选择框下方20像素
|
|
18085
|
+
const infoBoxWidth = 140 * overlayScale; // 信息框宽度
|
|
18086
|
+
const infoBoxHeight = 100 * overlayScale; // 信息框高度
|
|
18087
|
+
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
18088
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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
|
|
17598
18089
|
? {
|
|
17599
18090
|
onTouchStart: createReactEventHandler((e) => {
|
|
17600
18091
|
handleMouseDownWithDisabled(e);
|
|
@@ -17602,7 +18093,26 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17602
18093
|
}
|
|
17603
18094
|
: {
|
|
17604
18095
|
onMouseDown: handleMouseDownWithDisabled,
|
|
17605
|
-
}) }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r:
|
|
18096
|
+
}) }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[3].x, cy: selectionBoxPoints[3].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[1].x, cy: selectionBoxPoints[1].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsxRuntime.jsx("circle", { cx: selectionBoxPoints[2].x, cy: selectionBoxPoints[2].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsxRuntime.jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
|
|
18097
|
+
onClickInfo?.();
|
|
18098
|
+
}, children: jsxRuntime.jsx("div", { style: {
|
|
18099
|
+
padding: '5px 6px',
|
|
18100
|
+
background: 'rgba(201, 209, 218, 1)',
|
|
18101
|
+
borderRadius: '10px',
|
|
18102
|
+
display: 'inline-flex',
|
|
18103
|
+
flexDirection: 'column',
|
|
18104
|
+
alignItems: 'flex-start',
|
|
18105
|
+
justifyContent: 'center',
|
|
18106
|
+
fontSize: '12px',
|
|
18107
|
+
color: 'white',
|
|
18108
|
+
fontWeight: '400',
|
|
18109
|
+
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
18110
|
+
}, children: jsxRuntime.jsx("div", { style: {
|
|
18111
|
+
display: 'flex',
|
|
18112
|
+
alignItems: 'center',
|
|
18113
|
+
justifyContent: 'center',
|
|
18114
|
+
gap: '10px',
|
|
18115
|
+
}, children: jsxRuntime.jsxs("div", { children: ["Remaining Time: ", remainingTime] }) }) }) })] }));
|
|
17606
18116
|
};
|
|
17607
18117
|
React.useEffect(() => {
|
|
17608
18118
|
const isMove = isDragging || isRotating || isScaling;
|
|
@@ -17650,10 +18160,10 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17650
18160
|
const centerX = (minX + maxX) / 2;
|
|
17651
18161
|
// 计算尺寸显示框的位置(选择框下方)
|
|
17652
18162
|
const infoBoxY = maxY + 20; // 选择框下方20像素
|
|
17653
|
-
const infoBoxWidth = 140; // 信息框宽度
|
|
17654
|
-
const infoBoxHeight =
|
|
18163
|
+
const infoBoxWidth = 140 * overlayScale; // 信息框宽度
|
|
18164
|
+
const infoBoxHeight = 100 * overlayScale; // 信息框高度
|
|
17655
18165
|
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
17656
|
-
const scale = isWeb ? 2 : 1;
|
|
18166
|
+
const scale = (isWeb ? 2 : 1) * overlayScale;
|
|
17657
18167
|
const offsetLeft = 10 * scale;
|
|
17658
18168
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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
|
|
17659
18169
|
? {
|
|
@@ -17708,6 +18218,7 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17708
18218
|
fontSize: '12px',
|
|
17709
18219
|
color: 'white',
|
|
17710
18220
|
fontWeight: '400',
|
|
18221
|
+
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
17711
18222
|
}, children: [jsxRuntime.jsxs("div", { children: [dimensions.height, "m \u00D7 ", dimensions.width, "m"] }), jsxRuntime.jsxs("div", { style: {
|
|
17712
18223
|
display: 'flex',
|
|
17713
18224
|
alignItems: 'center',
|
|
@@ -17718,9 +18229,9 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17718
18229
|
};
|
|
17719
18230
|
|
|
17720
18231
|
const DoodleElement = ({ data }) => {
|
|
17721
|
-
const { editMapInfo, setEditMapInfo, onHandleEnterRecord,
|
|
18232
|
+
const { editMapInfo, setEditMapInfo, onHandleEnterRecord, onHandleEvent } = useMapEditContext();
|
|
17722
18233
|
const { addHistory } = useHistoryHandle();
|
|
17723
|
-
const { platform } = useCommonContext();
|
|
18234
|
+
const { platform, doodleList } = useCommonContext();
|
|
17724
18235
|
const isSelected = React.useMemo(() => {
|
|
17725
18236
|
if (platform === PlatformType.H5) {
|
|
17726
18237
|
if (editMapInfo.mobileMode !== MobileEditMode.START &&
|
|
@@ -17737,6 +18248,23 @@ const DoodleElement = ({ data }) => {
|
|
|
17737
18248
|
}
|
|
17738
18249
|
return data;
|
|
17739
18250
|
}, [data, editMapInfo?.selectElement]);
|
|
18251
|
+
const minScale = React.useMemo(() => {
|
|
18252
|
+
const doodleInfo = doodleList.find((item) => {
|
|
18253
|
+
// 移除所有空白字符(包括\n、\r、\t等)进行比较
|
|
18254
|
+
const normalizedItemSvg = item.svgStr?.replace(/[\s\n\r\t]+/g, '').replace(/\\n/g, '');
|
|
18255
|
+
const normalizedOriginSvg = originData.svg?.replace(/[\s\n\r\t]+/g, '').replace(/\\n/g, '');
|
|
18256
|
+
// console.log('normalizedItemSvg--->', normalizedItemSvg, normalizedOriginSvg);
|
|
18257
|
+
return normalizedItemSvg === normalizedOriginSvg;
|
|
18258
|
+
});
|
|
18259
|
+
console.log('doodleList--->', doodleList, originData, doodleInfo);
|
|
18260
|
+
if (!doodleInfo) {
|
|
18261
|
+
return 1;
|
|
18262
|
+
}
|
|
18263
|
+
const minLength = doodleInfo?.minLength;
|
|
18264
|
+
const parseSvg = SvgParserNative.parseSvg(originData.svg);
|
|
18265
|
+
const svgMinLength = parseSvg.height / SCALE_FACTOR;
|
|
18266
|
+
return minLength / svgMinLength;
|
|
18267
|
+
}, [doodleList, originData]);
|
|
17740
18268
|
const isSelectedWithoutOperation = React.useMemo(() => {
|
|
17741
18269
|
if (platform === PlatformType.H5) {
|
|
17742
18270
|
if (editMapInfo.mobileMode === MobileEditMode.START &&
|
|
@@ -17776,7 +18304,14 @@ const DoodleElement = ({ data }) => {
|
|
|
17776
18304
|
})?.then(() => {
|
|
17777
18305
|
setEditMapInfo((prev) => ({
|
|
17778
18306
|
...prev,
|
|
17779
|
-
historyList: [
|
|
18307
|
+
historyList: [
|
|
18308
|
+
{
|
|
18309
|
+
selectElement: {
|
|
18310
|
+
...data,
|
|
18311
|
+
transformedPoints: transformedElements,
|
|
18312
|
+
},
|
|
18313
|
+
},
|
|
18314
|
+
],
|
|
17780
18315
|
currentHistoryIndex: 0,
|
|
17781
18316
|
selectElement: {
|
|
17782
18317
|
...data,
|
|
@@ -17808,8 +18343,8 @@ const DoodleElement = ({ data }) => {
|
|
|
17808
18343
|
}));
|
|
17809
18344
|
}, []);
|
|
17810
18345
|
const handleClickInfo = React.useCallback(() => {
|
|
17811
|
-
|
|
17812
|
-
}, [
|
|
18346
|
+
onHandleEvent?.(ClickEventType.DOODLE_ACTIVE_TIME);
|
|
18347
|
+
}, [onHandleEvent]);
|
|
17813
18348
|
// const handleDragMove = useCallback(
|
|
17814
18349
|
// (data: DoodleData) => {
|
|
17815
18350
|
// setEditMapInfo((prev: EditMapInfo) => ({
|
|
@@ -17837,7 +18372,8 @@ const DoodleElement = ({ data }) => {
|
|
|
17837
18372
|
},
|
|
17838
18373
|
});
|
|
17839
18374
|
}, [transformedElements]);
|
|
17840
|
-
|
|
18375
|
+
console.log('originData--->', originData, minScale);
|
|
18376
|
+
return (jsxRuntime.jsx(DoodleTransformWrapper, { data: originData, onTransformChange: handleTransformChange, isSelected: isSelected, isSelectedWithoutOperation: isSelectedWithoutOperation, onSelect: handleSelect, onCancel: handleCancel, onDragEnd: handleDragEnd, showInfo: platform === PlatformType.H5, onClickInfo: handleClickInfo, minScale: minScale }));
|
|
17841
18377
|
};
|
|
17842
18378
|
|
|
17843
18379
|
const SvgElement = React.memo(({ type, data, interactive = false }) => {
|
|
@@ -17983,6 +18519,7 @@ const ChannelClipPath = React.memo(() => {
|
|
|
17983
18519
|
svgRef?.viewBox.baseVal?.width,
|
|
17984
18520
|
svgRef?.viewBox.baseVal?.height,
|
|
17985
18521
|
]);
|
|
18522
|
+
console.log('boundaryData---->', svgRef?.viewBox.baseVal);
|
|
17986
18523
|
/**
|
|
17987
18524
|
* 判断多边形是否为逆时针方向
|
|
17988
18525
|
* 使用叉积法计算多边形的有向面积
|
|
@@ -19070,27 +19607,37 @@ const getScreenCenterSvgPoint = (svgElement, mapInstance) => {
|
|
|
19070
19607
|
*/
|
|
19071
19608
|
const CreateObstacleElement = React.forwardRef(({ enabled = false, svgElement, onPointsChange, styles, points }, ref) => {
|
|
19072
19609
|
const { mapRef } = useCommonContext();
|
|
19610
|
+
const { checkCanNotCreateAtPosition } = useCheckElement();
|
|
19073
19611
|
// 使用固定的样式,确保能正常渲染
|
|
19074
19612
|
// 在十字准心位置添加点
|
|
19075
19613
|
const addPoint = React.useCallback(() => {
|
|
19076
19614
|
if (!enabled || !svgElement) {
|
|
19077
19615
|
console.warn('未启用创建模式或SVG元素不存在');
|
|
19078
|
-
return false;
|
|
19616
|
+
return { isValid: false, reason: '未启用创建模式或SVG元素不存在' };
|
|
19079
19617
|
}
|
|
19080
19618
|
if (!mapRef) {
|
|
19081
19619
|
console.warn('地图实例不存在');
|
|
19082
|
-
return false;
|
|
19620
|
+
return { isValid: false, reason: '地图实例不存在' };
|
|
19083
19621
|
}
|
|
19084
19622
|
const centerPoint = getScreenCenterSvgPoint(svgElement, mapRef);
|
|
19085
19623
|
if (!centerPoint) {
|
|
19086
19624
|
console.warn('无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内');
|
|
19087
|
-
|
|
19088
|
-
|
|
19089
|
-
|
|
19625
|
+
return { isValid: false, reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内' };
|
|
19626
|
+
}
|
|
19627
|
+
console.error('centerPoint--->', centerPoint);
|
|
19628
|
+
console.error('checkCanNotCreateAtPosition--->', checkCanNotCreateAtPosition(centerPoint));
|
|
19629
|
+
// 校验是否能打点
|
|
19630
|
+
if (checkCanNotCreateAtPosition(centerPoint)) {
|
|
19631
|
+
return {
|
|
19632
|
+
isValid: false,
|
|
19633
|
+
reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内',
|
|
19634
|
+
};
|
|
19090
19635
|
}
|
|
19091
19636
|
const newPoints = [...points, centerPoint];
|
|
19092
19637
|
onPointsChange?.(newPoints);
|
|
19093
|
-
return
|
|
19638
|
+
return {
|
|
19639
|
+
isValid: true,
|
|
19640
|
+
};
|
|
19094
19641
|
}, [enabled, svgElement, mapRef, points, onPointsChange]);
|
|
19095
19642
|
// 撤销最后一个点
|
|
19096
19643
|
const undoLastPoint = React.useCallback(() => {
|
|
@@ -19124,7 +19671,7 @@ const CreateObstacleElement = React.forwardRef(({ enabled = false, svgElement, o
|
|
|
19124
19671
|
if (!enabled || points.length === 0) {
|
|
19125
19672
|
return null;
|
|
19126
19673
|
}
|
|
19127
|
-
return (jsxRuntime.jsx(PolygonElement, {
|
|
19674
|
+
return (jsxRuntime.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 }));
|
|
19128
19675
|
});
|
|
19129
19676
|
CreateObstacleElement.displayName = 'CreateObstacleElement';
|
|
19130
19677
|
|
|
@@ -19180,7 +19727,7 @@ const SvgEditMap = React.forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMa
|
|
|
19180
19727
|
const { editMapInfo, setEditMapInfo } = useMapEditContext();
|
|
19181
19728
|
const { getVisionOffPoints, centerPoint } = useCreateVisionOffElement();
|
|
19182
19729
|
const { svgElementDatas } = useSvgEditContext();
|
|
19183
|
-
const { checkCanNotCreateAtPosition } = useCheckElement();
|
|
19730
|
+
const { checkCanNotCreateAtPosition, checkDoodle } = useCheckElement();
|
|
19184
19731
|
const svgRef = React.useRef(null);
|
|
19185
19732
|
const containerRef = React.useRef(null);
|
|
19186
19733
|
const { platform } = useCommonContext();
|
|
@@ -19314,7 +19861,7 @@ const SvgEditMap = React.forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMa
|
|
|
19314
19861
|
getEditMapInfo,
|
|
19315
19862
|
// 十字准心点管理器方法
|
|
19316
19863
|
addCreateObstaclePoint: () => {
|
|
19317
|
-
return pointManagerRef.current?.addPoint();
|
|
19864
|
+
return pointManagerRef.current?.addPoint?.();
|
|
19318
19865
|
},
|
|
19319
19866
|
undoCreateObstaclePoint: () => {
|
|
19320
19867
|
pointManagerRef.current?.undoLastPoint();
|
|
@@ -19336,6 +19883,7 @@ const SvgEditMap = React.forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMa
|
|
|
19336
19883
|
clearHistory,
|
|
19337
19884
|
addHistory,
|
|
19338
19885
|
addDoodle,
|
|
19886
|
+
checkDoodle: () => checkDoodle?.(),
|
|
19339
19887
|
}));
|
|
19340
19888
|
// 初始化多边形绘制 Hook
|
|
19341
19889
|
const { onSvgClick, onSvgMouseMove, onPointClick, points, completed, mousePos, updatePoints } = usePolygonDrawing({ createMode: isCreating });
|
|
@@ -19365,6 +19913,9 @@ const SvgEditMap = React.forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMa
|
|
|
19365
19913
|
// pointerEvents: 'auto', // 关键:允许接收鼠标事件
|
|
19366
19914
|
}, 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: [jsxRuntime.jsxs("defs", { children: [jsxRuntime.jsx("filter", { id: "vertex-tooltip-shadow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: jsxRuntime.jsx("feDropShadow", { dx: "2", dy: "2", stdDeviation: "2", floodColor: "#000", floodOpacity: "0.12" }) }), jsxRuntime.jsxs("filter", { id: `path-hover-${DataType.BOUNDARY}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsxRuntime.jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsxRuntime.jsx("feFlood", { floodColor: BOUNDARY_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsxRuntime.jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxRuntime.jsxs("feMerge", { children: [jsxRuntime.jsx("feMergeNode", { in: "coloredBorder" }), jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxRuntime.jsxs("filter", { id: `path-hover-${DataType.VISION_OFF}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsxRuntime.jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsxRuntime.jsx("feFlood", { floodColor: VISION_OFF_AREA_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsxRuntime.jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxRuntime.jsxs("feMerge", { children: [jsxRuntime.jsx("feMergeNode", { in: "coloredBorder" }), jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxRuntime.jsxs("filter", { id: `path-hover-${DataType.OBSTACLE}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsxRuntime.jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsxRuntime.jsx("feFlood", { floodColor: OBSTACLE_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsxRuntime.jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxRuntime.jsxs("feMerge", { children: [jsxRuntime.jsx("feMergeNode", { in: "coloredBorder" }), jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })] })] })] }), Object.keys(svgElementDatas)
|
|
19367
19915
|
?.sort?.((a, b) => {
|
|
19916
|
+
if (a === DataType.BOUNDARY || b === DataType.BOUNDARY) {
|
|
19917
|
+
return 0;
|
|
19918
|
+
}
|
|
19368
19919
|
const aVal = a === editMapInfo.elementType ? 1 : 0;
|
|
19369
19920
|
const bVal = b === editMapInfo.elementType ? 1 : 0;
|
|
19370
19921
|
return aVal - bVal;
|
|
@@ -19376,7 +19927,7 @@ const SvgEditMap = React.forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMa
|
|
|
19376
19927
|
editMapInfo.createMode &&
|
|
19377
19928
|
editMapInfo.elementType !== DataType.DOODLE &&
|
|
19378
19929
|
editMapInfo.elementType !== DataType.VISION_OFF &&
|
|
19379
|
-
(points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsxRuntime.jsx(PolygonElement, {
|
|
19930
|
+
(points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsxRuntime.jsx(PolygonElement, { points: points?.length > 0
|
|
19380
19931
|
? points.map((p) => [p.x, p.y, 2])
|
|
19381
19932
|
: 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) => {
|
|
19382
19933
|
// 创建模式下的坐标变化(拖拽时)
|
|
@@ -19452,10 +20003,10 @@ var css_248z$c = ".index-module_addEntry__QsQHD {\n position: absolute;\n righ
|
|
|
19452
20003
|
var styles$c = {"addEntry":"index-module_addEntry__QsQHD","icon":"index-module_icon__qIgA4","addItem":"index-module_addItem__mglwZ","label":"index-module_label__QqZ-9"};
|
|
19453
20004
|
styleInject(css_248z$c);
|
|
19454
20005
|
|
|
19455
|
-
var _rect$2, _path$
|
|
19456
|
-
function _extends$
|
|
20006
|
+
var _rect$2, _path$9, _defs$3;
|
|
20007
|
+
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); }
|
|
19457
20008
|
var SvgAddEntry = function SvgAddEntry(props) {
|
|
19458
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
20009
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
|
|
19459
20010
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19460
20011
|
width: 24,
|
|
19461
20012
|
height: 24,
|
|
@@ -19483,7 +20034,7 @@ var SvgAddEntry = function SvgAddEntry(props) {
|
|
|
19483
20034
|
height: "100%",
|
|
19484
20035
|
width: "100%"
|
|
19485
20036
|
}
|
|
19486
|
-
})), _path$
|
|
20037
|
+
})), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
19487
20038
|
fill: "#1F1F1F",
|
|
19488
20039
|
stroke: "url(#add-entry_svg__c)",
|
|
19489
20040
|
strokeWidth: 0.3,
|
|
@@ -19523,15 +20074,15 @@ var SvgAddEntry = function SvgAddEntry(props) {
|
|
|
19523
20074
|
})))));
|
|
19524
20075
|
};
|
|
19525
20076
|
|
|
19526
|
-
var _path$
|
|
19527
|
-
function _extends$
|
|
20077
|
+
var _path$8, _path2$3, _path3;
|
|
20078
|
+
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); }
|
|
19528
20079
|
var SvgBoundary = function SvgBoundary(props) {
|
|
19529
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
20080
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
|
|
19530
20081
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19531
20082
|
width: 16,
|
|
19532
20083
|
height: 16,
|
|
19533
20084
|
fill: "none"
|
|
19534
|
-
}, props), _path$
|
|
20085
|
+
}, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
19535
20086
|
fill: "#1DBEAC",
|
|
19536
20087
|
fillRule: "evenodd",
|
|
19537
20088
|
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",
|
|
@@ -19549,15 +20100,15 @@ var SvgBoundary = function SvgBoundary(props) {
|
|
|
19549
20100
|
})));
|
|
19550
20101
|
};
|
|
19551
20102
|
|
|
19552
|
-
var _path$
|
|
19553
|
-
function _extends$
|
|
20103
|
+
var _path$7, _path2$2, _rect$1, _rect2$1;
|
|
20104
|
+
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); }
|
|
19554
20105
|
var SvgLimitIsland = function SvgLimitIsland(props) {
|
|
19555
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
20106
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
|
|
19556
20107
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19557
20108
|
width: 16,
|
|
19558
20109
|
height: 16,
|
|
19559
20110
|
fill: "none"
|
|
19560
|
-
}, props), _path$
|
|
20111
|
+
}, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
19561
20112
|
fill: "#FFA077",
|
|
19562
20113
|
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"
|
|
19563
20114
|
})), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
@@ -19583,9 +20134,9 @@ var SvgLimitIsland = function SvgLimitIsland(props) {
|
|
|
19583
20134
|
};
|
|
19584
20135
|
|
|
19585
20136
|
var _rect, _rect2, _rect3, _rect4, _g$3;
|
|
19586
|
-
function _extends$
|
|
20137
|
+
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); }
|
|
19587
20138
|
var SvgVisionFence = function SvgVisionFence(props) {
|
|
19588
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
20139
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
|
|
19589
20140
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19590
20141
|
width: 16,
|
|
19591
20142
|
height: 16,
|
|
@@ -19638,9 +20189,9 @@ var SvgVisionFence = function SvgVisionFence(props) {
|
|
|
19638
20189
|
};
|
|
19639
20190
|
|
|
19640
20191
|
var _g$2, _defs$2;
|
|
19641
|
-
function _extends$
|
|
20192
|
+
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); }
|
|
19642
20193
|
var SvgDoodle = function SvgDoodle(props) {
|
|
19643
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
20194
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
|
|
19644
20195
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19645
20196
|
width: 16,
|
|
19646
20197
|
height: 16,
|
|
@@ -19749,25 +20300,10 @@ const CustomModal = ({ children, titleCenter, hasMinHeight, height, ...props })
|
|
|
19749
20300
|
}), cancelButtonProps: { color: 'primary', variant: 'outlined' }, cancelText: 'Cancel', ...props, children: children }));
|
|
19750
20301
|
};
|
|
19751
20302
|
|
|
19752
|
-
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
|
|
19753
|
-
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","
|
|
20303
|
+
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}";
|
|
20304
|
+
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-"};
|
|
19754
20305
|
styleInject(css_248z$a);
|
|
19755
20306
|
|
|
19756
|
-
var _path$7;
|
|
19757
|
-
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); }
|
|
19758
|
-
var SvgSelect = function SvgSelect(props) {
|
|
19759
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
|
|
19760
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19761
|
-
width: 14,
|
|
19762
|
-
height: 12,
|
|
19763
|
-
fill: "none"
|
|
19764
|
-
}, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
19765
|
-
stroke: "#6EDCCF",
|
|
19766
|
-
strokeWidth: 2,
|
|
19767
|
-
d: "m1 7.5 4 3L12.5 1"
|
|
19768
|
-
})));
|
|
19769
|
-
};
|
|
19770
|
-
|
|
19771
20307
|
const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
|
|
19772
20308
|
const { editMapInfo, setEditMapInfo, onHandleEnterRecord } = useMapEditContext();
|
|
19773
20309
|
const [selectedDoodle, setSelectedDoodle] = React.useState(null);
|
|
@@ -19785,7 +20321,7 @@ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
|
|
|
19785
20321
|
const svg = selectedDoodle?.svgStr;
|
|
19786
20322
|
const minLength = selectedDoodle.minLength;
|
|
19787
20323
|
const parseSvg = SvgParserNative.parseSvg(svg);
|
|
19788
|
-
const svgMinLength =
|
|
20324
|
+
const svgMinLength = parseSvg.height / SCALE_FACTOR;
|
|
19789
20325
|
// 使用获取到的 SVG 内容,如果没有获取到则使用 URL
|
|
19790
20326
|
newDoodle.svg = svg;
|
|
19791
20327
|
newDoodle.scale = minLength / svgMinLength;
|
|
@@ -19797,7 +20333,11 @@ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
|
|
|
19797
20333
|
})?.then(() => {
|
|
19798
20334
|
setEditMapInfo({
|
|
19799
20335
|
...editMapInfo,
|
|
19800
|
-
historyList: [
|
|
20336
|
+
historyList: [
|
|
20337
|
+
{
|
|
20338
|
+
selectElement: newDoodle,
|
|
20339
|
+
},
|
|
20340
|
+
],
|
|
19801
20341
|
currentHistoryIndex: 0,
|
|
19802
20342
|
createMode: CreateStatus.COMPLETED,
|
|
19803
20343
|
elementType: DataType.DOODLE,
|
|
@@ -19811,12 +20351,12 @@ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
|
|
|
19811
20351
|
});
|
|
19812
20352
|
}
|
|
19813
20353
|
}, [selectedDoodle, setEditMapInfo, editMapInfo, setOpen, onSelect, centerPoint]);
|
|
19814
|
-
return (jsxRuntime.jsx(CustomModal, { width: 560, title: "
|
|
20354
|
+
return (jsxRuntime.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: jsxRuntime.jsxs("div", { className: styles$a.doodleModal, children: [jsxRuntime.jsx("div", { className: styles$a.title, children: "Select the doodle that you want to create" }), jsxRuntime.jsx("div", { className: styles$a.content, children: doodleList
|
|
19815
20355
|
?.filter((item) => !noNeed.includes(item.name))
|
|
19816
20356
|
.map((item) => {
|
|
19817
|
-
return (jsxRuntime.
|
|
20357
|
+
return (jsxRuntime.jsx("div", { className: classNames(styles$a.item, {
|
|
19818
20358
|
[styles$a.active]: selectedDoodle?.svg === item.svg,
|
|
19819
|
-
}), onClick: () => handleSelectDoodle(item), children:
|
|
20359
|
+
}), onClick: () => handleSelectDoodle(item), children: jsxRuntime.jsx("div", { className: styles$a.svgImage, dangerouslySetInnerHTML: { __html: item?.svgStr } }) }, item.id));
|
|
19820
20360
|
}) })] }) }));
|
|
19821
20361
|
};
|
|
19822
20362
|
|
|
@@ -19879,7 +20419,11 @@ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
|
|
|
19879
20419
|
})?.then(() => {
|
|
19880
20420
|
setEditMapInfo({
|
|
19881
20421
|
...editMapInfo,
|
|
19882
|
-
historyList: [
|
|
20422
|
+
historyList: [
|
|
20423
|
+
{
|
|
20424
|
+
selectElement: newElement,
|
|
20425
|
+
},
|
|
20426
|
+
],
|
|
19883
20427
|
currentHistoryIndex: 0,
|
|
19884
20428
|
createMode: type === DataType.VISION_OFF ? CreateStatus.COMPLETED : CreateStatus.CREATING,
|
|
19885
20429
|
elementType: type,
|
|
@@ -19908,11 +20452,11 @@ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
|
|
|
19908
20452
|
}), children: jsxRuntime.jsx("div", { className: styles$c.icon, children: jsxRuntime.jsx(SvgAddEntry, {}) }) }), jsxRuntime.jsx(DoodleModal, { centerPoint: centerPoint, doodleList: doodleList, open: doodleOpen, onOk: () => setDoodleOpen(false), setOpen: setDoodleOpen })] }));
|
|
19909
20453
|
};
|
|
19910
20454
|
|
|
19911
|
-
var css_248z$9 = ".index-module_handleElementInfo__vWIaf {\n position: absolute;\n right: 0;\n top: 0;\n border-radius: 8px;\n padding:
|
|
19912
|
-
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","
|
|
20455
|
+
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}";
|
|
20456
|
+
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"};
|
|
19913
20457
|
styleInject(css_248z$9);
|
|
19914
20458
|
|
|
19915
|
-
var css_248z$8 = ".index-module_infoHeader__l9F6q {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding:
|
|
20459
|
+
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}";
|
|
19916
20460
|
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"};
|
|
19917
20461
|
styleInject(css_248z$8);
|
|
19918
20462
|
|
|
@@ -19944,7 +20488,7 @@ var SvgDelete = function SvgDelete(props) {
|
|
|
19944
20488
|
})));
|
|
19945
20489
|
};
|
|
19946
20490
|
|
|
19947
|
-
const Header = ({ handleDelete, handleFocus, showFocus = false, showDelete = true, type }) => {
|
|
20491
|
+
const Header = ({ handleDelete, handleFocus, showFocus = false, showDelete = true, type, }) => {
|
|
19948
20492
|
const currentType = React.useMemo(() => {
|
|
19949
20493
|
return DATE_TYPE_MAP.find((item) => item.type === type);
|
|
19950
20494
|
}, [type]);
|
|
@@ -19969,24 +20513,24 @@ var SvgEdit = function SvgEdit(props) {
|
|
|
19969
20513
|
})));
|
|
19970
20514
|
};
|
|
19971
20515
|
|
|
19972
|
-
const NameModal = ({ name, open, setOpen, onOk }) => {
|
|
20516
|
+
const NameModal = ({ title, name, open, setOpen, onOk }) => {
|
|
19973
20517
|
const [nameValue, setNameValue] = React.useState('');
|
|
19974
20518
|
React.useEffect(() => {
|
|
19975
20519
|
if (open) {
|
|
19976
20520
|
setNameValue(name || '');
|
|
19977
20521
|
}
|
|
19978
20522
|
}, [name, open]);
|
|
19979
|
-
return (jsxRuntime.jsx(CustomModal, { title: `${
|
|
20523
|
+
return (jsxRuntime.jsx(CustomModal, { title: `${title}`, titleCenter: true, open: open, onOk: () => {
|
|
19980
20524
|
onOk?.(nameValue);
|
|
19981
20525
|
setOpen(false);
|
|
19982
20526
|
}, onCancel: () => setOpen(false), okText: "Confirm", afterClose: () => {
|
|
19983
20527
|
setNameValue('');
|
|
19984
|
-
}, children: jsxRuntime.jsx(antd.Input, { maxLength:
|
|
20528
|
+
}, children: jsxRuntime.jsx(antd.Input, { maxLength: 12, showCount: true, placeholder: "Please enter boundary name", value: nameValue, onChange: (e) => setNameValue(e.target.value) }) }));
|
|
19985
20529
|
};
|
|
19986
20530
|
|
|
19987
|
-
const NameEdit = ({ name, onChange }) => {
|
|
20531
|
+
const NameEdit = ({ title, name, onChange }) => {
|
|
19988
20532
|
const [open, setOpen] = React.useState(false);
|
|
19989
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles$7.nameEdit, children: [jsxRuntime.jsx("div", { className: styles$7.content, children: name }), jsxRuntime.jsx("div", { className: styles$7.edit, onClick: () => setOpen(true), children: jsxRuntime.jsx(SvgEdit, {}) })] }), jsxRuntime.jsx(NameModal, { name: name, open: open, setOpen: setOpen, onOk: onChange })] }));
|
|
20533
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles$7.nameEdit, children: [jsxRuntime.jsx("div", { className: styles$7.content, children: name }), jsxRuntime.jsx("div", { className: styles$7.edit, onClick: () => setOpen(true), children: jsxRuntime.jsx(SvgEdit, {}) })] }), jsxRuntime.jsx(NameModal, { title: title, name: name, open: open, setOpen: setOpen, onOk: onChange })] }));
|
|
19990
20534
|
};
|
|
19991
20535
|
|
|
19992
20536
|
var _path$3;
|
|
@@ -19998,12 +20542,12 @@ var SvgArrow = function SvgArrow(props) {
|
|
|
19998
20542
|
height: 16,
|
|
19999
20543
|
fill: "none"
|
|
20000
20544
|
}, props), _path$3 || (_path$3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20001
|
-
fill: "#
|
|
20545
|
+
fill: "#1F1F1F",
|
|
20002
20546
|
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"
|
|
20003
20547
|
})));
|
|
20004
20548
|
};
|
|
20005
20549
|
|
|
20006
|
-
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:
|
|
20550
|
+
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}";
|
|
20007
20551
|
var styles$6 = {"item":"index-module_item__wwHEt"};
|
|
20008
20552
|
styleInject(css_248z$6);
|
|
20009
20553
|
|
|
@@ -20107,7 +20651,7 @@ const HeightModal = ({ zoneName, open, setOpen, onChange, value, heightOptions,
|
|
|
20107
20651
|
}), children: [jsxRuntime.jsx("div", { className: styles$4.left, children: jsxRuntime.jsxs(antd.Radio, { value: ZoneHeightModalTypeEnum.RADIO, children: ["Customize zone height (", getHeightUnit(unitType), ")"] }) }), jsxRuntime.jsx("div", { className: styles$4.right, children: jsxRuntime.jsx(CutHeightSlider, { units: unitType, value: currentValue?.cuttingHeight, heightOptions: heightOptions, onChange: onHeightChange }) })] })] }) }) }));
|
|
20108
20652
|
};
|
|
20109
20653
|
|
|
20110
|
-
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}";
|
|
20654
|
+
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}";
|
|
20111
20655
|
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"};
|
|
20112
20656
|
styleInject(css_248z$3);
|
|
20113
20657
|
|
|
@@ -20347,43 +20891,81 @@ function convertDirectionToParams(value) {
|
|
|
20347
20891
|
return directions;
|
|
20348
20892
|
}
|
|
20349
20893
|
|
|
20894
|
+
const DEFAULT_LIST = [
|
|
20895
|
+
{
|
|
20896
|
+
value: 1 << 0,
|
|
20897
|
+
text: 'A',
|
|
20898
|
+
selected: false,
|
|
20899
|
+
},
|
|
20900
|
+
{
|
|
20901
|
+
value: 1 << 1,
|
|
20902
|
+
text: 'B',
|
|
20903
|
+
selected: false,
|
|
20904
|
+
},
|
|
20905
|
+
{
|
|
20906
|
+
value: 1 << 2,
|
|
20907
|
+
text: 'C',
|
|
20908
|
+
selected: false,
|
|
20909
|
+
},
|
|
20910
|
+
{
|
|
20911
|
+
value: 1 << 3,
|
|
20912
|
+
text: 'D',
|
|
20913
|
+
selected: false,
|
|
20914
|
+
},
|
|
20915
|
+
{
|
|
20916
|
+
value: 1 << 4,
|
|
20917
|
+
text: 'E',
|
|
20918
|
+
selected: false,
|
|
20919
|
+
},
|
|
20920
|
+
{
|
|
20921
|
+
value: 1 << 5,
|
|
20922
|
+
text: 'F',
|
|
20923
|
+
selected: false,
|
|
20924
|
+
},
|
|
20925
|
+
];
|
|
20350
20926
|
const MowDirection_L = (props) => {
|
|
20351
20927
|
const { value, angleValue, optionAngle = 45, zIndex = 10000, onChange,
|
|
20352
20928
|
// children,
|
|
20353
20929
|
} = props;
|
|
20354
20930
|
const [angle, setAngle] = React.useState(0);
|
|
20355
|
-
const
|
|
20356
|
-
{
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
|
|
20364
|
-
|
|
20365
|
-
|
|
20366
|
-
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20380
|
-
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
|
|
20931
|
+
const lineList = React.useMemo(() => {
|
|
20932
|
+
return DEFAULT_LIST.map((item) => ({
|
|
20933
|
+
...item,
|
|
20934
|
+
selected: convertDirectionToParams(value).includes(item.value),
|
|
20935
|
+
}));
|
|
20936
|
+
}, [value]);
|
|
20937
|
+
// const [lineList, setLineList] = useState<LineItem[]>([
|
|
20938
|
+
// {
|
|
20939
|
+
// value: 1 << 0,
|
|
20940
|
+
// text: 'A',
|
|
20941
|
+
// selected: false,
|
|
20942
|
+
// },
|
|
20943
|
+
// {
|
|
20944
|
+
// value: 1 << 1,
|
|
20945
|
+
// text: 'B',
|
|
20946
|
+
// selected: false,
|
|
20947
|
+
// },
|
|
20948
|
+
// {
|
|
20949
|
+
// value: 1 << 2,
|
|
20950
|
+
// text: 'C',
|
|
20951
|
+
// selected: false,
|
|
20952
|
+
// },
|
|
20953
|
+
// {
|
|
20954
|
+
// value: 1 << 3,
|
|
20955
|
+
// text: 'D',
|
|
20956
|
+
// selected: false,
|
|
20957
|
+
// },
|
|
20958
|
+
// {
|
|
20959
|
+
// value: 1 << 4,
|
|
20960
|
+
// text: 'E',
|
|
20961
|
+
// selected: false,
|
|
20962
|
+
// },
|
|
20963
|
+
// {
|
|
20964
|
+
// value: 1 << 5,
|
|
20965
|
+
// text: 'F',
|
|
20966
|
+
// selected: false,
|
|
20967
|
+
// },
|
|
20968
|
+
// ]);
|
|
20387
20969
|
const hitRectAngle = React.useMemo(() => {
|
|
20388
20970
|
const direction = lineList
|
|
20389
20971
|
?.filter((item) => item?.selected)
|
|
@@ -20396,12 +20978,6 @@ const MowDirection_L = (props) => {
|
|
|
20396
20978
|
const allSelect = React.useMemo(() => {
|
|
20397
20979
|
return lineList?.every((item) => item?.selected);
|
|
20398
20980
|
}, [lineList]);
|
|
20399
|
-
React.useEffect(() => {
|
|
20400
|
-
setLineList(lineList.map((line) => ({
|
|
20401
|
-
...line,
|
|
20402
|
-
selected: convertDirectionToParams(value).includes(line.value),
|
|
20403
|
-
})));
|
|
20404
|
-
}, [value]);
|
|
20405
20981
|
React.useEffect(() => {
|
|
20406
20982
|
setAngle(angleValue);
|
|
20407
20983
|
}, [angleValue]);
|
|
@@ -20416,7 +20992,6 @@ const MowDirection_L = (props) => {
|
|
|
20416
20992
|
}
|
|
20417
20993
|
return { ...line };
|
|
20418
20994
|
});
|
|
20419
|
-
setLineList(newLine);
|
|
20420
20995
|
onChange?.(newLine
|
|
20421
20996
|
?.filter((item) => item?.selected)
|
|
20422
20997
|
.reduce((pre, line) => {
|
|
@@ -20440,10 +21015,71 @@ const MowDirection_L = (props) => {
|
|
|
20440
21015
|
}, children: [jsxRuntime.jsx("div", { className: styles$2.leftTop, children: jsxRuntime.jsx(SvgOption, {}) }), jsxRuntime.jsx("div", { className: styles$2.rightBottom, children: jsxRuntime.jsx(SvgOption, {}) })] })] }) }) }));
|
|
20441
21016
|
};
|
|
20442
21017
|
|
|
21018
|
+
const BoundarySvgRender = React.memo(({ mapJson, id, maxWidth = 300 }) => {
|
|
21019
|
+
const svgElementData = React.useMemo(() => {
|
|
21020
|
+
const data = UnifiedMapDataProcessor.processMapData(mapJson, DEFAULT_STYLES) || {};
|
|
21021
|
+
return data;
|
|
21022
|
+
}, [mapJson, DEFAULT_STYLES]);
|
|
21023
|
+
const boundaryInfo = React.useMemo(() => {
|
|
21024
|
+
const boundary = svgElementData.boundary.find((item) => item.id === id);
|
|
21025
|
+
return boundary;
|
|
21026
|
+
}, [id, svgElementData]);
|
|
21027
|
+
// 计算当前boundary的viewBox
|
|
21028
|
+
const boundaryViewBox = React.useMemo(() => {
|
|
21029
|
+
if (!boundaryInfo?.points || boundaryInfo.points.length === 0) {
|
|
21030
|
+
return null;
|
|
21031
|
+
}
|
|
21032
|
+
// 计算边界
|
|
21033
|
+
let minX = Infinity;
|
|
21034
|
+
let minY = Infinity;
|
|
21035
|
+
let maxX = -Infinity;
|
|
21036
|
+
let maxY = -Infinity;
|
|
21037
|
+
boundaryInfo.points.forEach((point) => {
|
|
21038
|
+
minX = Math.min(minX, point[0]);
|
|
21039
|
+
minY = Math.min(minY, point[1]);
|
|
21040
|
+
maxX = Math.max(maxX, point[0]);
|
|
21041
|
+
maxY = Math.max(maxY, point[1]);
|
|
21042
|
+
});
|
|
21043
|
+
// 添加边距
|
|
21044
|
+
const padding = 50;
|
|
21045
|
+
const width = maxX - minX + padding * 2;
|
|
21046
|
+
const height = maxY - minY + padding * 2;
|
|
21047
|
+
return {
|
|
21048
|
+
x: minX - padding,
|
|
21049
|
+
y: minY - padding,
|
|
21050
|
+
width,
|
|
21051
|
+
height,
|
|
21052
|
+
};
|
|
21053
|
+
}, [boundaryInfo]);
|
|
21054
|
+
const style = React.useMemo(() => {
|
|
21055
|
+
if (boundaryViewBox?.width > boundaryViewBox?.height) {
|
|
21056
|
+
return {
|
|
21057
|
+
width: maxWidth,
|
|
21058
|
+
height: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
|
|
21059
|
+
};
|
|
21060
|
+
}
|
|
21061
|
+
return {
|
|
21062
|
+
width: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
|
|
21063
|
+
height: maxWidth,
|
|
21064
|
+
};
|
|
21065
|
+
}, [boundaryViewBox, maxWidth]);
|
|
21066
|
+
return (jsxRuntime.jsxs("div", { style: {
|
|
21067
|
+
position: 'relative',
|
|
21068
|
+
width: style.width,
|
|
21069
|
+
height: style.height,
|
|
21070
|
+
margin: '0 auto',
|
|
21071
|
+
}, children: [jsxRuntime.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) => {
|
|
21072
|
+
return svgElementData[key]?.map((element) => {
|
|
21073
|
+
if (key === DataType.VISION_OFF)
|
|
21074
|
+
return null;
|
|
21075
|
+
return (jsxRuntime.jsx(GElement, { type: key, data: svgElementData[key], children: jsxRuntime.jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
|
|
21076
|
+
});
|
|
21077
|
+
}) }), jsxRuntime.jsx(CharginPile, { mapData: mapJson, mapConfig: DEFAULT_STYLES, viewBox: boundaryViewBox || null, rotation: 0 })] }));
|
|
21078
|
+
});
|
|
21079
|
+
|
|
20443
21080
|
const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, onChange, }) => {
|
|
20444
|
-
const { mapJson, mapConfig
|
|
21081
|
+
const { mapJson, mapConfig } = useCommonContext();
|
|
20445
21082
|
const { editMapInfo } = useMapEditContext();
|
|
20446
|
-
const { svgElementDatas } = useSvgEditContext();
|
|
20447
21083
|
const [directions, setDirections] = React.useState(ALL_DIRECTION_SELECTED);
|
|
20448
21084
|
const [angle, setAngle] = React.useState(MIN_DIRECTION_ANGLE);
|
|
20449
21085
|
const canSetDefault = React.useMemo(() => {
|
|
@@ -20468,56 +21104,34 @@ const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, o
|
|
|
20468
21104
|
setAngle(defaultAngle);
|
|
20469
21105
|
}
|
|
20470
21106
|
};
|
|
20471
|
-
|
|
20472
|
-
|
|
20473
|
-
|
|
20474
|
-
|
|
20475
|
-
return null;
|
|
21107
|
+
const handleCancel = React.useCallback(() => {
|
|
21108
|
+
if (!canSave) {
|
|
21109
|
+
setOpen(false);
|
|
21110
|
+
return;
|
|
20476
21111
|
}
|
|
20477
|
-
|
|
20478
|
-
|
|
20479
|
-
|
|
20480
|
-
|
|
20481
|
-
|
|
20482
|
-
|
|
20483
|
-
|
|
20484
|
-
|
|
20485
|
-
|
|
20486
|
-
|
|
21112
|
+
antd.Modal.confirm({
|
|
21113
|
+
icon: null,
|
|
21114
|
+
centered: true,
|
|
21115
|
+
title: 'Exit editing',
|
|
21116
|
+
content: 'Changes you made will not be saved. Are you sure you want to exit editing the mowing direction?',
|
|
21117
|
+
onOk: () => {
|
|
21118
|
+
setOpen(false);
|
|
21119
|
+
},
|
|
21120
|
+
okText: 'Exit',
|
|
21121
|
+
cancelText: 'Continue editing',
|
|
20487
21122
|
});
|
|
20488
|
-
|
|
20489
|
-
const padding = 50;
|
|
20490
|
-
const width = maxX - minX + padding * 2;
|
|
20491
|
-
const height = maxY - minY + padding * 2;
|
|
20492
|
-
return {
|
|
20493
|
-
x: minX - padding,
|
|
20494
|
-
y: minY - padding,
|
|
20495
|
-
width,
|
|
20496
|
-
height,
|
|
20497
|
-
};
|
|
20498
|
-
}, [editMapInfo.selectElement]);
|
|
21123
|
+
}, [canSave, setOpen]);
|
|
20499
21124
|
console.log('directionInfo=>', directionInfo, mapJson);
|
|
20500
|
-
return (jsxRuntime.jsx(CustomModal, { maskClosable: false, titleCenter: true, title: `${zoneName} mowing direction`, open: open, width: 600, onCancel: () => {
|
|
20501
|
-
setOpen(false);
|
|
20502
|
-
}, onOk: () => {
|
|
21125
|
+
return (jsxRuntime.jsx(CustomModal, { maskClosable: false, titleCenter: true, title: `${zoneName} mowing direction`, open: open, width: 600, onCancel: handleCancel, onOk: () => {
|
|
20503
21126
|
onChange?.(directions, angle);
|
|
20504
21127
|
setOpen(false);
|
|
20505
21128
|
}, okText: "Confirm", cancelText: "Cancel", okButtonProps: { disabled: !canSave }, afterClose: () => {
|
|
20506
21129
|
setDirections(ALL_DIRECTION_SELECTED);
|
|
20507
21130
|
setAngle(MIN_DIRECTION_ANGLE);
|
|
20508
|
-
}, children: jsxRuntime.jsxs("div", { className: styles$3.directions, children: [jsxRuntime.jsx("div", { className: styles$3.default, children: jsxRuntime.jsx(antd.Button, { disabled: !canSetDefault, variant: "link", color: "primary", onClick: resetDirection, children: "Default" }) }), jsxRuntime.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" }), jsxRuntime.jsxs("div", { className: styles$3.optimal, children: [jsxRuntime.jsx("div", { children: "*" }), jsxRuntime.jsx(SvgOption, {}), jsxRuntime.jsx("div", { className: styles$3.text, children: "Optimal direction" })] }), jsxRuntime.jsxs("div", { className: styles$3.content, children: [jsxRuntime.jsx("div", { className: styles$3.background, children: jsxRuntime.
|
|
20509
|
-
position: 'relative',
|
|
20510
|
-
width: `${300 * (boundaryViewBox.width / boundaryViewBox.height)}px`,
|
|
20511
|
-
height: '300px',
|
|
20512
|
-
margin: '0 auto',
|
|
20513
|
-
}, children: [boundaryViewBox && (jsxRuntime.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) => {
|
|
20514
|
-
return svgElementDatas[key]?.map((element) => {
|
|
20515
|
-
if (key === DataType.VISION_OFF)
|
|
20516
|
-
return null;
|
|
20517
|
-
return (jsxRuntime.jsx(GElement, { type: key, data: svgElementDatas[key], children: jsxRuntime.jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
|
|
20518
|
-
});
|
|
20519
|
-
}) })), jsxRuntime.jsx(CharginPile, { mapData: mapJson, mapConfig: mapConfig, viewBox: boundaryViewBox || null, rotation: drag?.rotation })] }) }), jsxRuntime.jsx("div", { className: styles$3.luppan, children: jsxRuntime.jsx(MowDirection_L, { value: directions, angleValue: angle, optionAngle: optionAngle, onChange: (value) => {
|
|
21131
|
+
}, children: jsxRuntime.jsxs("div", { className: styles$3.directions, children: [jsxRuntime.jsx("div", { className: styles$3.default, children: jsxRuntime.jsx(antd.Button, { disabled: !canSetDefault, variant: "link", color: "primary", onClick: resetDirection, children: "Default" }) }), jsxRuntime.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" }), jsxRuntime.jsxs("div", { className: styles$3.optimal, children: [jsxRuntime.jsx("div", { children: "*" }), jsxRuntime.jsx(SvgOption, {}), jsxRuntime.jsx("div", { className: styles$3.text, children: "Optimal direction" })] }), jsxRuntime.jsxs("div", { className: styles$3.content, children: [jsxRuntime.jsx("div", { className: styles$3.background, children: jsxRuntime.jsx(BoundarySvgRender, { mapJson: mapJson, id: editMapInfo.selectElement.id }) }), jsxRuntime.jsx("div", { className: styles$3.luppan, children: jsxRuntime.jsx(MowDirection_L, { value: directions, angleValue: angle, optionAngle: optionAngle, onChange: (value) => {
|
|
20520
21132
|
console.log('valie=>', value);
|
|
21133
|
+
if (!value)
|
|
21134
|
+
return antd.message.warning('Choose at least one mowing direction');
|
|
20521
21135
|
setDirections(value);
|
|
20522
21136
|
} }) })] }), jsxRuntime.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" }), jsxRuntime.jsx("div", { className: styles$3.slider, children: jsxRuntime.jsx(antd.Slider, { tooltip: {
|
|
20523
21137
|
formatter: (value) => `${value}°`,
|
|
@@ -20567,7 +21181,7 @@ const BoundaryInfo = ({ onHandleDelete }) => {
|
|
|
20567
21181
|
return editMapInfo?.selectElement?.recBaseAngle;
|
|
20568
21182
|
}, [editMapInfo.selectElement?.recBaseAngle]);
|
|
20569
21183
|
console.log('height---->', editMapInfo?.selectElement, heightValue, edgeMowingValue);
|
|
20570
|
-
return (jsxRuntime.jsxs("div", { className: styles$9.boundaryInfo, children: [jsxRuntime.jsx(Header, { handleDelete: onHandleDelete, handleFocus: onHandleFocus, type: editMapInfo.elementType }), jsxRuntime.jsx("div", { className: styles$9.nameEdit, children: jsxRuntime.jsx(NameEdit, { name: nameValue, onChange: (name) => {
|
|
21184
|
+
return (jsxRuntime.jsxs("div", { className: styles$9.boundaryInfo, children: [jsxRuntime.jsx(Header, { handleDelete: onHandleDelete, handleFocus: onHandleFocus, type: editMapInfo.elementType }), jsxRuntime.jsx("div", { className: styles$9.nameEdit, children: jsxRuntime.jsx(NameEdit, { title: "Boundary name", name: nameValue, onChange: (name) => {
|
|
20571
21185
|
setEditMapInfo({
|
|
20572
21186
|
...editMapInfo,
|
|
20573
21187
|
isShowDrag: false,
|
|
@@ -20576,13 +21190,13 @@ const BoundaryInfo = ({ onHandleDelete }) => {
|
|
|
20576
21190
|
name: name,
|
|
20577
21191
|
},
|
|
20578
21192
|
});
|
|
20579
|
-
} }) }), jsxRuntime.jsxs("div", { className: styles$9.otherEdit, children: [jsxRuntime.jsx(Item, { children: jsxRuntime.jsxs("div", { className: styles$9.otherItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "
|
|
21193
|
+
} }) }), jsxRuntime.jsx("div", { className: styles$9.border }), jsxRuntime.jsxs("div", { className: styles$9.otherEdit, children: [jsxRuntime.jsx(Item, { children: jsxRuntime.jsxs("div", { className: styles$9.otherItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Cutting height" }), jsxRuntime.jsx("div", { className: styles$9.value, children: generateHeightStr(heightValue?.cuttingHeight, unitType, true) }), jsxRuntime.jsx("div", { className: styles$9.icon, onClick: () => {
|
|
20580
21194
|
setHeightOpen(true);
|
|
20581
|
-
}, children: jsxRuntime.jsx(SvgArrow, {}) })] }) }), jsxRuntime.jsx(Item, { children: jsxRuntime.jsxs("div", { className: styles$9.otherItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "
|
|
21195
|
+
}, children: jsxRuntime.jsx(SvgArrow, {}) })] }) }), jsxRuntime.jsx(Item, { children: jsxRuntime.jsxs("div", { className: styles$9.otherItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Mowing direction" }), jsxRuntime.jsx("div", { className: styles$9.value }), jsxRuntime.jsx("div", { className: styles$9.icon, onClick: () => {
|
|
20582
21196
|
setDirectionOpen(true);
|
|
20583
|
-
}, children: jsxRuntime.jsx(SvgArrow, {}) })] }) }), jsxRuntime.jsx(Item, { children: jsxRuntime.jsxs("div", { className: styles$9.otherItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "
|
|
21197
|
+
}, children: jsxRuntime.jsx(SvgArrow, {}) })] }) }), jsxRuntime.jsx(Item, { children: jsxRuntime.jsxs("div", { className: styles$9.otherItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Edge mowing" }), jsxRuntime.jsx("div", { className: styles$9.value }), jsxRuntime.jsx("div", { className: styles$9.icon, onClick: () => {
|
|
20584
21198
|
setOpen(true);
|
|
20585
|
-
}, children: jsxRuntime.jsx(SvgArrow, {}) })] }) })] }), jsxRuntime.jsxs("div", { className: styles$9.areaInfo, children: [jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Area:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] }), jsxRuntime.jsx(MowingEdgeModal, { value: edgeMowingValue, onChange: (value) => {
|
|
21199
|
+
}, children: jsxRuntime.jsx(SvgArrow, {}) })] }) })] }), jsxRuntime.jsx("div", { className: styles$9.border }), jsxRuntime.jsxs("div", { className: styles$9.areaInfo, children: [jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Area:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] }), jsxRuntime.jsx(MowingEdgeModal, { value: edgeMowingValue, onChange: (value) => {
|
|
20586
21200
|
setEditMapInfo({
|
|
20587
21201
|
...editMapInfo,
|
|
20588
21202
|
selectElement: {
|
|
@@ -20612,7 +21226,7 @@ const BoundaryInfo = ({ onHandleDelete }) => {
|
|
|
20612
21226
|
} })] }));
|
|
20613
21227
|
};
|
|
20614
21228
|
|
|
20615
|
-
var css_248z$1 = ".index-module_timePeriod__EkVZl {\n display: flex;\n flex-direction: column;\n
|
|
21229
|
+
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}";
|
|
20616
21230
|
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"};
|
|
20617
21231
|
styleInject(css_248z$1);
|
|
20618
21232
|
|
|
@@ -20627,6 +21241,11 @@ const TimePeriod = ({ value, onChange }) => {
|
|
|
20627
21241
|
const [open, setOpen] = React.useState(false);
|
|
20628
21242
|
const [radioValue, setRadioValue] = React.useState(RadioValue.LONG_TIME);
|
|
20629
21243
|
console.log('time period->', date, radioValue);
|
|
21244
|
+
React.useEffect(() => {
|
|
21245
|
+
if (!open && date?.length !== 2) {
|
|
21246
|
+
setRadioValue(RadioValue.LONG_TIME);
|
|
21247
|
+
}
|
|
21248
|
+
}, [open]);
|
|
20630
21249
|
return (jsxRuntime.jsxs("div", { className: styles$1.timePeriod, children: [jsxRuntime.jsxs("div", { className: styles$1.timePeriodHeader, children: [jsxRuntime.jsx("div", { className: styles$1.timePeriodTitle, children: "Enabled" }), jsxRuntime.jsx("div", { className: styles$1.timePeriodHandle, children: jsxRuntime.jsx(antd.Switch, { checked: value.status === 1, onChange: (checked) => {
|
|
20631
21250
|
onChange({
|
|
20632
21251
|
...value,
|
|
@@ -20638,8 +21257,8 @@ const TimePeriod = ({ value, onChange }) => {
|
|
|
20638
21257
|
setDate(null);
|
|
20639
21258
|
onChange({
|
|
20640
21259
|
...value,
|
|
20641
|
-
|
|
20642
|
-
|
|
21260
|
+
start_timestamp: 0,
|
|
21261
|
+
end_timestamp: 0,
|
|
20643
21262
|
});
|
|
20644
21263
|
}
|
|
20645
21264
|
else if (e.target.value === RadioValue.SHORT_TIME) {
|
|
@@ -20650,19 +21269,15 @@ const TimePeriod = ({ value, onChange }) => {
|
|
|
20650
21269
|
// endTimestamp: dayjs().add(1, 'hour').unix(),
|
|
20651
21270
|
// });
|
|
20652
21271
|
}
|
|
20653
|
-
}, style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsxRuntime.jsx(antd.Radio, { value: RadioValue.LONG_TIME, children: jsxRuntime.jsx("div", { className: styles$1.timePeriodRadioItem, children: "
|
|
20654
|
-
if (!open) {
|
|
20655
|
-
setRadioValue(RadioValue.LONG_TIME);
|
|
20656
|
-
}
|
|
21272
|
+
}, style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsxRuntime.jsx(antd.Radio, { value: RadioValue.LONG_TIME, children: jsxRuntime.jsx("div", { className: styles$1.timePeriodRadioItem, children: "Always" }) }), jsxRuntime.jsx(antd.Radio, { value: RadioValue.SHORT_TIME, children: jsxRuntime.jsx("div", { className: styles$1.timePeriodRadioItem, children: jsxRuntime.jsx(antd.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) => {
|
|
20657
21273
|
setOpen(open);
|
|
20658
|
-
},
|
|
20659
|
-
|
|
21274
|
+
}, onChange: (dateValue, dateString) => {
|
|
21275
|
+
setDate(dateValue);
|
|
20660
21276
|
if (dateValue?.length === 2) {
|
|
20661
|
-
setDate(dateValue);
|
|
20662
21277
|
onChange({
|
|
20663
21278
|
status: RadioValue.SHORT_TIME,
|
|
20664
|
-
|
|
20665
|
-
|
|
21279
|
+
start_timestamp: dateValue[0].unix(),
|
|
21280
|
+
end_timestamp: dateValue[1].unix(),
|
|
20666
21281
|
});
|
|
20667
21282
|
}
|
|
20668
21283
|
} }) }) })] }) })] }));
|
|
@@ -20676,12 +21291,12 @@ const ObstacleInfo = ({ onHandleDelete }) => {
|
|
|
20676
21291
|
if (!editMapInfo.selectElement)
|
|
20677
21292
|
return null;
|
|
20678
21293
|
const status = editMapInfo.selectElement?.status;
|
|
20679
|
-
const
|
|
20680
|
-
const
|
|
21294
|
+
const start_timestamp = editMapInfo.selectElement?.start_timestamp;
|
|
21295
|
+
const end_timestamp = editMapInfo.selectElement?.end_timestamp;
|
|
20681
21296
|
return {
|
|
20682
21297
|
status,
|
|
20683
|
-
|
|
20684
|
-
|
|
21298
|
+
start_timestamp,
|
|
21299
|
+
end_timestamp,
|
|
20685
21300
|
};
|
|
20686
21301
|
}, [editMapInfo.selectElement]);
|
|
20687
21302
|
const sizeValue = React.useMemo(() => {
|
|
@@ -20699,7 +21314,7 @@ const ObstacleInfo = ({ onHandleDelete }) => {
|
|
|
20699
21314
|
}, [editMapInfo.selectElement]);
|
|
20700
21315
|
return (jsxRuntime.jsxs("div", { className: styles$9.obstacleInfo, children: [jsxRuntime.jsx(Header, { handleDelete: () => {
|
|
20701
21316
|
onHandleDelete();
|
|
20702
|
-
}, handleFocus: () => { }, type: editMapInfo.elementType }), jsxRuntime.jsx("div", { className: styles$9.nameEdit, children: jsxRuntime.jsx(NameEdit, { name: nameValue, onChange: (name) => {
|
|
21317
|
+
}, handleFocus: () => { }, type: editMapInfo.elementType }), jsxRuntime.jsx("div", { className: styles$9.nameEdit, children: jsxRuntime.jsx(NameEdit, { title: "Obstacle name", name: nameValue, onChange: (name) => {
|
|
20703
21318
|
setEditMapInfo({
|
|
20704
21319
|
...editMapInfo,
|
|
20705
21320
|
isShowDrag: false,
|
|
@@ -20708,18 +21323,18 @@ const ObstacleInfo = ({ onHandleDelete }) => {
|
|
|
20708
21323
|
name: name,
|
|
20709
21324
|
},
|
|
20710
21325
|
});
|
|
20711
|
-
} }) }), jsxRuntime.jsx("div", { className: styles$9.timePeriod, children: jsxRuntime.jsx(TimePeriod, { value: timePeriodValue, onChange: (value) => {
|
|
21326
|
+
} }) }), jsxRuntime.jsx("div", { className: styles$9.border }), jsxRuntime.jsx("div", { className: styles$9.timePeriod, children: jsxRuntime.jsx(TimePeriod, { value: timePeriodValue, onChange: (value) => {
|
|
20712
21327
|
setEditMapInfo({
|
|
20713
21328
|
...editMapInfo,
|
|
20714
21329
|
isShowDrag: editMapInfo?.isShowDrag || false,
|
|
20715
21330
|
selectElement: {
|
|
20716
21331
|
...editMapInfo.selectElement,
|
|
20717
21332
|
status: value.status,
|
|
20718
|
-
start_timestamp: value.
|
|
20719
|
-
end_timestamp: value.
|
|
21333
|
+
start_timestamp: value.start_timestamp,
|
|
21334
|
+
end_timestamp: value.end_timestamp,
|
|
20720
21335
|
},
|
|
20721
21336
|
});
|
|
20722
|
-
} }) }), jsxRuntime.jsxs("div", { className: styles$9.areaInfo, children: [jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Area:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] })] }));
|
|
21337
|
+
} }) }), jsxRuntime.jsx("div", { className: styles$9.border }), jsxRuntime.jsxs("div", { className: styles$9.areaInfo, children: [jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Area:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] })] }));
|
|
20723
21338
|
};
|
|
20724
21339
|
|
|
20725
21340
|
const DoodleInfo = ({ onHandleDelete }) => {
|
|
@@ -20741,31 +21356,37 @@ const DoodleInfo = ({ onHandleDelete }) => {
|
|
|
20741
21356
|
const create_ts = editMapInfo?.selectElement?.create_ts;
|
|
20742
21357
|
const expiration_ts = editMapInfo.selectElement.expiration_ts;
|
|
20743
21358
|
const diff = expiration_ts - create_ts;
|
|
20744
|
-
const day = Math.floor(diff / (60 * 60 * 24
|
|
20745
|
-
console.log('create_ts->', create_ts, expiration_ts, day);
|
|
21359
|
+
const day = Math.floor(diff / (60 * 60 * 24));
|
|
20746
21360
|
return {
|
|
20747
21361
|
day: day,
|
|
20748
21362
|
};
|
|
20749
21363
|
}, [editMapInfo?.selectElement]);
|
|
21364
|
+
const remainDay = React.useMemo(() => {
|
|
21365
|
+
if (!editMapInfo.selectElement)
|
|
21366
|
+
return null;
|
|
21367
|
+
const expiration_ts = editMapInfo.selectElement.expiration_ts;
|
|
21368
|
+
const diff = expiration_ts - Date.now() / 1000;
|
|
21369
|
+
return Math.floor(diff / (60 * 60 * 24));
|
|
21370
|
+
}, [editMapInfo?.selectElement]);
|
|
20750
21371
|
const sizeValue = React.useMemo(() => {
|
|
20751
21372
|
if (!editMapInfo.selectElement || !editMapInfo.selectElement.svg)
|
|
20752
21373
|
return '';
|
|
20753
21374
|
const svg = editMapInfo.selectElement?.svg;
|
|
21375
|
+
const scale = editMapInfo.selectElement.scale;
|
|
20754
21376
|
const parseSvg = SvgParserNative.parseSvg(svg);
|
|
20755
|
-
const width = parseSvg.width / SCALE_FACTOR;
|
|
20756
|
-
const height = parseSvg.height / SCALE_FACTOR;
|
|
20757
|
-
console.log('parseSvg->', parseSvg);
|
|
20758
|
-
return `${width} m x ${height} m`;
|
|
21377
|
+
const width = (parseSvg.width * scale) / SCALE_FACTOR;
|
|
21378
|
+
const height = (parseSvg.height * scale) / SCALE_FACTOR;
|
|
21379
|
+
console.log('parseSvg->', editMapInfo, parseSvg);
|
|
21380
|
+
return `${width.toFixed(1)} m x ${height.toFixed(1)} m`;
|
|
20759
21381
|
}, [editMapInfo.selectElement]);
|
|
20760
21382
|
const handleChange = React.useCallback((day) => {
|
|
20761
|
-
const lastTime = Date.now() - editMapInfo.selectElement.create_ts;
|
|
20762
21383
|
setEditMapInfo((pre) => {
|
|
20763
|
-
console.log('expiration_ts->', lastTime, day, lastTime + day * 24 * 60 * 60 * 1000);
|
|
20764
21384
|
return {
|
|
20765
21385
|
...pre,
|
|
20766
21386
|
selectElement: {
|
|
20767
21387
|
...pre.selectElement,
|
|
20768
|
-
|
|
21388
|
+
create_ts: Date.now() / 1000,
|
|
21389
|
+
expiration_ts: Date.now() / 1000 + day * 24 * 60 * 60,
|
|
20769
21390
|
},
|
|
20770
21391
|
};
|
|
20771
21392
|
});
|
|
@@ -20773,7 +21394,7 @@ const DoodleInfo = ({ onHandleDelete }) => {
|
|
|
20773
21394
|
console.log('doodleInfo->', doodleInfo);
|
|
20774
21395
|
return (jsxRuntime.jsxs("div", { className: styles$9.doodleInfo, children: [jsxRuntime.jsx(Header, { handleDelete: () => {
|
|
20775
21396
|
onHandleDelete();
|
|
20776
|
-
}, handleFocus: () => { }, type: editMapInfo.elementType }), isCreate ? (jsxRuntime.jsx(Item, { children: jsxRuntime.jsxs("div", { className: styles$9.time, children: [jsxRuntime.jsxs("div", { className: styles$9.exist, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "
|
|
21397
|
+
}, handleFocus: () => { }, type: editMapInfo.elementType }), jsxRuntime.jsx("div", { className: styles$9.border }), isCreate ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Item, { children: jsxRuntime.jsxs("div", { className: styles$9.time, children: [jsxRuntime.jsxs("div", { className: styles$9.exist, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Preserve doodle for" }), jsxRuntime.jsx("div", { className: styles$9.value, children: jsxRuntime.jsx(antd.Select, { defaultValue: doodleInfo?.day, style: { width: 80 }, onChange: (value) => handleChange(value), options: options }) })] }), doodleInfo?.day >= 14 && (jsxRuntime.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." }))] }) }), jsxRuntime.jsx("div", { className: styles$9.border }), jsxRuntime.jsx("div", { className: styles$9.areaInfo, children: jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Size:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue })] }) })] })) : (jsxRuntime.jsxs("div", { className: styles$9.areaInfo, children: [jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Remaining time:" }), jsxRuntime.jsxs("div", { className: styles$9.value, children: [remainDay, " day"] })] }), jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Size:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue })] })] }))] }));
|
|
20777
21398
|
};
|
|
20778
21399
|
|
|
20779
21400
|
const VisionOffInfo = ({ onHandleDelete }) => {
|
|
@@ -20789,7 +21410,7 @@ const VisionOffInfo = ({ onHandleDelete }) => {
|
|
|
20789
21410
|
}, [editMapInfo.selectElement]);
|
|
20790
21411
|
return (jsxRuntime.jsxs("div", { className: "visionOffInfo", children: [jsxRuntime.jsx(Header, { handleDelete: () => {
|
|
20791
21412
|
onHandleDelete?.();
|
|
20792
|
-
}, handleFocus: () => { }, type: DataType.VISION_OFF }), jsxRuntime.jsx("div", { className: styles$9.areaInfo, children: jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Size:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue })] }) })] }));
|
|
21413
|
+
}, handleFocus: () => { }, type: DataType.VISION_OFF }), jsxRuntime.jsx("div", { className: styles$9.border }), jsxRuntime.jsx("div", { className: styles$9.areaInfo, children: jsxRuntime.jsxs("div", { className: styles$9.areaItem, children: [jsxRuntime.jsx("div", { className: styles$9.label, children: "Size:" }), jsxRuntime.jsx("div", { className: styles$9.value, children: sizeValue })] }) })] }));
|
|
20793
21414
|
};
|
|
20794
21415
|
|
|
20795
21416
|
var _path$2, _path2$1;
|
|
@@ -20849,7 +21470,7 @@ const HandleElementInfo = () => {
|
|
|
20849
21470
|
const isUndoDisabled = React.useMemo(() => {
|
|
20850
21471
|
if (editMapInfo?.elementType === DataType.OBSTACLE &&
|
|
20851
21472
|
editMapInfo?.createMode === CreateStatus.CREATING) {
|
|
20852
|
-
return !(editMapInfo?.currentHistoryIndex
|
|
21473
|
+
return !(editMapInfo?.currentHistoryIndex > 0 && editMapInfo?.historyList?.length);
|
|
20853
21474
|
}
|
|
20854
21475
|
else {
|
|
20855
21476
|
return !(editMapInfo?.currentHistoryIndex > 0 && editMapInfo?.historyList?.length);
|
|
@@ -20864,12 +21485,20 @@ const HandleElementInfo = () => {
|
|
|
20864
21485
|
return !(editMapInfo?.currentHistoryIndex < editMapInfo?.historyList?.length - 1 &&
|
|
20865
21486
|
editMapInfo?.historyList?.length);
|
|
20866
21487
|
}, [editMapInfo?.currentHistoryIndex, editMapInfo?.historyList]);
|
|
20867
|
-
const handleUndo = React.useCallback(() => {
|
|
21488
|
+
const handleUndo = React.useCallback((e) => {
|
|
21489
|
+
e.stopPropagation();
|
|
21490
|
+
e.preventDefault();
|
|
21491
|
+
if (isUndoDisabled)
|
|
21492
|
+
return;
|
|
20868
21493
|
undo();
|
|
20869
|
-
}, [undo]);
|
|
20870
|
-
const handleRedo = React.useCallback(() => {
|
|
21494
|
+
}, [undo, isUndoDisabled]);
|
|
21495
|
+
const handleRedo = React.useCallback((e) => {
|
|
21496
|
+
e.stopPropagation();
|
|
21497
|
+
e.preventDefault();
|
|
21498
|
+
if (idRedoDisabled)
|
|
21499
|
+
return;
|
|
20871
21500
|
redo();
|
|
20872
|
-
}, [redo]);
|
|
21501
|
+
}, [redo, idRedoDisabled]);
|
|
20873
21502
|
const renderElementData = React.useCallback((element) => {
|
|
20874
21503
|
if (!editMapInfo.selectElement)
|
|
20875
21504
|
return null;
|
|
@@ -20923,8 +21552,8 @@ const HandleElementInfo = () => {
|
|
|
20923
21552
|
data.obstacle = {
|
|
20924
21553
|
name: element?.name,
|
|
20925
21554
|
status: element?.status || 1,
|
|
20926
|
-
end_timestamp: element?.end_timestamp
|
|
20927
|
-
start_timestamp: element?.start_timestamp
|
|
21555
|
+
end_timestamp: element?.end_timestamp,
|
|
21556
|
+
start_timestamp: element?.start_timestamp,
|
|
20928
21557
|
points: restorePointsFormat(element.points),
|
|
20929
21558
|
};
|
|
20930
21559
|
if (element?.id) {
|
|
@@ -20952,6 +21581,12 @@ const HandleElementInfo = () => {
|
|
|
20952
21581
|
const params = renderElementData(editMapInfo?.selectElement);
|
|
20953
21582
|
const isObstacle = editMapInfo?.selectElement?.type === DataType.OBSTACLE;
|
|
20954
21583
|
const hasNotEnoughPoints = params?.obstacle?.points?.length < 3;
|
|
21584
|
+
const isDoodle = editMapInfo?.selectElement?.type === DataType.DOODLE;
|
|
21585
|
+
const doodleResult = checkDoodle();
|
|
21586
|
+
if (isDoodle && !doodleResult?.isValid) {
|
|
21587
|
+
antd.message.error('Keep more distance from boundaries, off-limit island and other doodles');
|
|
21588
|
+
return;
|
|
21589
|
+
}
|
|
20955
21590
|
if (isObstacle && hasNotEnoughPoints) {
|
|
20956
21591
|
antd.message.error('Save failed, please draw a closed shape');
|
|
20957
21592
|
return;
|
|
@@ -20983,16 +21618,27 @@ const HandleElementInfo = () => {
|
|
|
20983
21618
|
antd.message.error('Save failed, please try again');
|
|
20984
21619
|
});
|
|
20985
21620
|
}
|
|
20986
|
-
}, [editMapInfo.selectElement]);
|
|
21621
|
+
}, [editMapInfo.selectElement, onUpdateBoundary, onHandleCompleteRecord]);
|
|
20987
21622
|
const handleCancel = React.useCallback(() => {
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
|
|
20994
|
-
|
|
20995
|
-
|
|
21623
|
+
const name = DATE_TYPE_MAP.find((item) => item.type === editMapInfo.elementType)?.label;
|
|
21624
|
+
antd.Modal.confirm({
|
|
21625
|
+
icon: null,
|
|
21626
|
+
centered: true,
|
|
21627
|
+
title: 'Quit editing',
|
|
21628
|
+
content: `Changes you made will not be saved. Are you sure you want to quit editing the ${name}?`,
|
|
21629
|
+
okText: 'Quit',
|
|
21630
|
+
cancelText: 'Keep editing',
|
|
21631
|
+
onOk: () => {
|
|
21632
|
+
onHandleStopRecord?.()?.then(() => {
|
|
21633
|
+
setEditMapInfo({
|
|
21634
|
+
...editMapInfo,
|
|
21635
|
+
createMode: null,
|
|
21636
|
+
elementType: null,
|
|
21637
|
+
selectElement: null,
|
|
21638
|
+
isShowDrag: false,
|
|
21639
|
+
});
|
|
21640
|
+
});
|
|
21641
|
+
},
|
|
20996
21642
|
});
|
|
20997
21643
|
}, [editMapInfo]);
|
|
20998
21644
|
const handleDelete = React.useCallback(() => {
|
|
@@ -21037,26 +21683,12 @@ const HandleElementInfo = () => {
|
|
|
21037
21683
|
},
|
|
21038
21684
|
});
|
|
21039
21685
|
}, [editMapInfo?.selectElement, onHandleDeleteElement, onHandleStopRecord]);
|
|
21040
|
-
const checkDisabled = React.useCallback(() => {
|
|
21041
|
-
if (editMapInfo.elementType === DataType.DOODLE) {
|
|
21042
|
-
const result = checkDoodle();
|
|
21043
|
-
return !result?.isValid;
|
|
21044
|
-
}
|
|
21045
|
-
return false;
|
|
21046
|
-
}, [checkDoodle, editMapInfo]);
|
|
21047
21686
|
if (!editMapInfo.selectElement)
|
|
21048
21687
|
return null;
|
|
21049
21688
|
console.log('handleElementInfo->', editMapInfo, currentType);
|
|
21050
|
-
return (jsxRuntime.jsxs("div", { className: styles$9.handleElementInfo, children: [editMapInfo?.elementType !== DataType.BOUNDARY ? (jsxRuntime.jsxs("div", { className: styles$9.undoAndRedo, children: [jsxRuntime.jsx("div", { className: classNames(styles$9.undo, { [styles$9.disabled]: isUndoDisabled }), onClick: handleUndo, children: jsxRuntime.jsx(SvgUndo, {}) }), jsxRuntime.jsx("div", { className: classNames(styles$9.redo, { [styles$9.disabled]: idRedoDisabled }), onClick: handleRedo, children: jsxRuntime.jsx(SvgRedo, {}) })] })) : null, editMapInfo?.elementType === DataType.BOUNDARY && (jsxRuntime.jsx(BoundaryInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.OBSTACLE && (jsxRuntime.jsx(ObstacleInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.DOODLE && jsxRuntime.jsx(DoodleInfo, { onHandleDelete: handleDelete }), editMapInfo?.elementType === DataType.VISION_OFF && (jsxRuntime.jsx(VisionOffInfo, { onHandleDelete: handleDelete })), jsxRuntime.
|
|
21051
|
-
|
|
21052
|
-
|
|
21053
|
-
createMode: null,
|
|
21054
|
-
editMap: false,
|
|
21055
|
-
elementType: undefined,
|
|
21056
|
-
selectElement: null,
|
|
21057
|
-
isShowDrag: false,
|
|
21058
|
-
});
|
|
21059
|
-
}, children: "Cancel" })] })] }));
|
|
21689
|
+
return (jsxRuntime.jsxs("div", { className: styles$9.handleElementInfo, children: [editMapInfo?.elementType !== DataType.BOUNDARY ? (jsxRuntime.jsxs("div", { className: styles$9.undoAndRedo, children: [jsxRuntime.jsx("div", { className: classNames(styles$9.undo, { [styles$9.disabled]: isUndoDisabled }), onClick: handleUndo, children: jsxRuntime.jsx(SvgUndo, {}) }), jsxRuntime.jsx("div", { className: classNames(styles$9.redo, { [styles$9.disabled]: idRedoDisabled }), onClick: handleRedo, children: jsxRuntime.jsx(SvgRedo, {}) })] })) : null, editMapInfo?.elementType === DataType.BOUNDARY && (jsxRuntime.jsx(BoundaryInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.OBSTACLE && (jsxRuntime.jsx(ObstacleInfo, { onHandleDelete: handleDelete })), editMapInfo?.elementType === DataType.DOODLE && jsxRuntime.jsx(DoodleInfo, { onHandleDelete: handleDelete }), editMapInfo?.elementType === DataType.VISION_OFF && (jsxRuntime.jsx(VisionOffInfo, { onHandleDelete: handleDelete })), jsxRuntime.jsx("div", { className: styles$9.border }), jsxRuntime.jsx("div", { className: styles$9.handle, children: jsxRuntime.jsxs(antd.Space, { size: 12, children: [jsxRuntime.jsx(antd.Button, { variant: "outlined", color: "default", onClick: () => {
|
|
21690
|
+
handleCancel();
|
|
21691
|
+
}, children: "Cancel" }), jsxRuntime.jsx(antd.Button, { variant: "solid", color: "primary", onClick: handleSave, children: "Save" })] }) })] }));
|
|
21060
21692
|
};
|
|
21061
21693
|
|
|
21062
21694
|
var _path;
|
|
@@ -21182,7 +21814,7 @@ const defaultMapConfig = DEFAULT_STYLES;
|
|
|
21182
21814
|
// 地图渲染器组件
|
|
21183
21815
|
const MowerMapRenderer = React.forwardRef(({ sn, platform = PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, mapConfig,
|
|
21184
21816
|
// pathConfig,
|
|
21185
|
-
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,
|
|
21817
|
+
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) => {
|
|
21186
21818
|
const [currentError, setCurrentError] = React.useState(null);
|
|
21187
21819
|
const overlayRef = React.useRef(null);
|
|
21188
21820
|
// const mapRef = useMap();
|
|
@@ -21197,6 +21829,9 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21197
21829
|
});
|
|
21198
21830
|
const [overlay, setOverlay] = React.useState(null);
|
|
21199
21831
|
const [overlayLayout, setOverlayLayout] = React.useState(null);
|
|
21832
|
+
const [overlayScale, setOverlayScale] = React.useState(1);
|
|
21833
|
+
// 参考zoom级别,在此级别时overlayScale=1,元素显示原始大小
|
|
21834
|
+
const REFERENCE_ZOOM = 19;
|
|
21200
21835
|
const svgMapRef = React.useRef(null);
|
|
21201
21836
|
const svgEditMapRef = React.useRef(null);
|
|
21202
21837
|
const [editMapInfo, setEditMapInfo] = React.useState({
|
|
@@ -21235,7 +21870,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21235
21870
|
onSaveMap,
|
|
21236
21871
|
onHandleDeleteElement,
|
|
21237
21872
|
onUpdateBoundary,
|
|
21238
|
-
|
|
21873
|
+
onHandleEvent,
|
|
21239
21874
|
};
|
|
21240
21875
|
}, [
|
|
21241
21876
|
minDistance,
|
|
@@ -21247,7 +21882,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21247
21882
|
onSaveBoundaryData,
|
|
21248
21883
|
onSaveMap,
|
|
21249
21884
|
onUpdateBoundary,
|
|
21250
|
-
|
|
21885
|
+
onHandleEvent,
|
|
21251
21886
|
]);
|
|
21252
21887
|
// 合并配置
|
|
21253
21888
|
const mergedMapConfig = React.useMemo(() => {
|
|
@@ -21280,6 +21915,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21280
21915
|
mapJson,
|
|
21281
21916
|
drag: defaultTransform,
|
|
21282
21917
|
mapRef,
|
|
21918
|
+
overlayScale,
|
|
21919
|
+
doodleList,
|
|
21283
21920
|
};
|
|
21284
21921
|
}, [
|
|
21285
21922
|
sn,
|
|
@@ -21293,6 +21930,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21293
21930
|
mapJson,
|
|
21294
21931
|
defaultTransform,
|
|
21295
21932
|
mapRef,
|
|
21933
|
+
overlayScale,
|
|
21934
|
+
doodleList,
|
|
21296
21935
|
]);
|
|
21297
21936
|
// console.log('svgElementDatas->', svgElementDatas, unStructMapData, commonValue);
|
|
21298
21937
|
// 处理地图分区边界
|
|
@@ -21311,7 +21950,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21311
21950
|
// }
|
|
21312
21951
|
// return allBoundaryElements;
|
|
21313
21952
|
// }, [mapJson]);
|
|
21314
|
-
React.useMemo(() => antennaConfig, [antennaConfig]);
|
|
21315
21953
|
const mowerPositionData = React.useMemo(() => {
|
|
21316
21954
|
// realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
|
|
21317
21955
|
if (!realTimeData || realTimeData.length === 0)
|
|
@@ -21524,6 +22162,46 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21524
22162
|
React.useEffect(() => {
|
|
21525
22163
|
setDrag(defaultTransform ?? { x: 0, y: 0, rotation: 0 });
|
|
21526
22164
|
}, [defaultTransform]);
|
|
22165
|
+
// 监听地图zoom变化,计算缩放比例
|
|
22166
|
+
React.useEffect(() => {
|
|
22167
|
+
if (!mapRef)
|
|
22168
|
+
return;
|
|
22169
|
+
const updateScale = () => {
|
|
22170
|
+
const currentZoom = mapRef.getZoom();
|
|
22171
|
+
if (currentZoom === undefined)
|
|
22172
|
+
return;
|
|
22173
|
+
// 基于固定的参考zoom级别计算overlayScale
|
|
22174
|
+
const zoomDiff = currentZoom - REFERENCE_ZOOM;
|
|
22175
|
+
const scale = Math.pow(2, -zoomDiff); // 负数实现反向缩放
|
|
22176
|
+
if (scale < 1) {
|
|
22177
|
+
setOverlayScale(1);
|
|
22178
|
+
}
|
|
22179
|
+
else if (scale > 4) {
|
|
22180
|
+
setOverlayScale(4);
|
|
22181
|
+
}
|
|
22182
|
+
else {
|
|
22183
|
+
setOverlayScale(scale);
|
|
22184
|
+
}
|
|
22185
|
+
};
|
|
22186
|
+
// 使用lodash throttle进行节流处理: 100ms内只执行一次
|
|
22187
|
+
const handleZoomChanged = throttle$2(updateScale, 50);
|
|
22188
|
+
// 添加zoom监听
|
|
22189
|
+
const listener = mapRef.addListener('zoom_changed', handleZoomChanged);
|
|
22190
|
+
// 初始化时获取当前zoom
|
|
22191
|
+
updateScale();
|
|
22192
|
+
return () => {
|
|
22193
|
+
if (listener) {
|
|
22194
|
+
window.google.maps.event.removeListener(listener);
|
|
22195
|
+
}
|
|
22196
|
+
// 取消未执行的节流函数
|
|
22197
|
+
handleZoomChanged.cancel();
|
|
22198
|
+
};
|
|
22199
|
+
}, [mapRef]);
|
|
22200
|
+
React.useEffect(() => {
|
|
22201
|
+
if (!editMap) {
|
|
22202
|
+
setEditMapInfo(INIT_EDIT_MAP_INFO);
|
|
22203
|
+
}
|
|
22204
|
+
}, [editMap]);
|
|
21527
22205
|
React.useEffect(() => {
|
|
21528
22206
|
if (!mapJson)
|
|
21529
22207
|
return;
|
|
@@ -21596,6 +22274,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21596
22274
|
addHistory: (history) => svgEditMapRef.current?.addHistory(history),
|
|
21597
22275
|
// 添加doodle
|
|
21598
22276
|
addDoodle: (doodle) => svgEditMapRef.current?.addDoodle(doodle),
|
|
22277
|
+
// 检查doodle
|
|
22278
|
+
checkDoodle: () => svgEditMapRef.current?.checkDoodle?.(),
|
|
21599
22279
|
}));
|
|
21600
22280
|
/**
|
|
21601
22281
|
* 根据割草机的位置更新路径
|
|
@@ -21620,7 +22300,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21620
22300
|
pre[cur] = parseFloat(curLayout);
|
|
21621
22301
|
return pre;
|
|
21622
22302
|
}, {});
|
|
21623
|
-
// console.log('setedit svg ------------->', layout);
|
|
21624
22303
|
if (layout?.width && layout?.height) {
|
|
21625
22304
|
svgEditMapRef?.current?.adjustSvgSize?.(layout);
|
|
21626
22305
|
setOverlayLayout(layout);
|
|
@@ -21629,6 +22308,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21629
22308
|
});
|
|
21630
22309
|
MowerMapRenderer.displayName = 'MowerMapRenderer';
|
|
21631
22310
|
|
|
22311
|
+
exports.BoundarySvgRender = BoundarySvgRender;
|
|
21632
22312
|
exports.MapDataProcessor = MapDataProcessor;
|
|
21633
22313
|
exports.MowerMapRenderer = MowerMapRenderer;
|
|
21634
22314
|
exports.PathDataProcessor = PathDataProcessor;
|