@fleet-frontend/mower-maps 0.2.0-beta.2 → 0.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +500 -110
- package/dist/index.js +500 -109
- package/dist/src/context/common.d.ts +3 -0
- package/dist/src/context/common.d.ts.map +1 -1
- package/dist/src/context/mapEdit.d.ts +3 -3
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.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/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/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.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/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/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/VisionOffTransformWrapper/VisionOffTransformWrapper.d.ts.map +1 -1
- package/dist/src/render/svgElement/VisionOffElement/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3071,7 +3071,7 @@ function copyObject(source, props, object, customizer) {
|
|
|
3071
3071
|
}
|
|
3072
3072
|
|
|
3073
3073
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
3074
|
-
var nativeMax$
|
|
3074
|
+
var nativeMax$2 = Math.max;
|
|
3075
3075
|
|
|
3076
3076
|
/**
|
|
3077
3077
|
* A specialized version of `baseRest` which transforms the rest array.
|
|
@@ -3083,11 +3083,11 @@ var nativeMax$1 = Math.max;
|
|
|
3083
3083
|
* @returns {Function} Returns the new function.
|
|
3084
3084
|
*/
|
|
3085
3085
|
function overRest(func, start, transform) {
|
|
3086
|
-
start = nativeMax$
|
|
3086
|
+
start = nativeMax$2(start === undefined ? (func.length - 1) : start, 0);
|
|
3087
3087
|
return function() {
|
|
3088
3088
|
var args = arguments,
|
|
3089
3089
|
index = -1,
|
|
3090
|
-
length = nativeMax$
|
|
3090
|
+
length = nativeMax$2(args.length - start, 0),
|
|
3091
3091
|
array = Array(length);
|
|
3092
3092
|
|
|
3093
3093
|
while (++index < length) {
|
|
@@ -4089,7 +4089,7 @@ function isPlainObject(value) {
|
|
|
4089
4089
|
|
|
4090
4090
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
4091
4091
|
var nativeIsFinite = root$3.isFinite,
|
|
4092
|
-
nativeMin$
|
|
4092
|
+
nativeMin$2 = Math.min;
|
|
4093
4093
|
|
|
4094
4094
|
/**
|
|
4095
4095
|
* Creates a function like `_.round`.
|
|
@@ -4102,7 +4102,7 @@ function createRound(methodName) {
|
|
|
4102
4102
|
var func = Math[methodName];
|
|
4103
4103
|
return function(number, precision) {
|
|
4104
4104
|
number = toNumber$2(number);
|
|
4105
|
-
precision = precision == null ? 0 : nativeMin$
|
|
4105
|
+
precision = precision == null ? 0 : nativeMin$2(toInteger(precision), 292);
|
|
4106
4106
|
if (precision && nativeIsFinite(number)) {
|
|
4107
4107
|
// Shift with exponential notation to avoid floating-point issues.
|
|
4108
4108
|
// See [MDN](https://mdn.io/round#Examples) for more details.
|
|
@@ -4325,6 +4325,212 @@ function createBaseFor(fromRight) {
|
|
|
4325
4325
|
*/
|
|
4326
4326
|
var baseFor = createBaseFor();
|
|
4327
4327
|
|
|
4328
|
+
/**
|
|
4329
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
4330
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
4331
|
+
*
|
|
4332
|
+
* @static
|
|
4333
|
+
* @memberOf _
|
|
4334
|
+
* @since 2.4.0
|
|
4335
|
+
* @category Date
|
|
4336
|
+
* @returns {number} Returns the timestamp.
|
|
4337
|
+
* @example
|
|
4338
|
+
*
|
|
4339
|
+
* _.defer(function(stamp) {
|
|
4340
|
+
* console.log(_.now() - stamp);
|
|
4341
|
+
* }, _.now());
|
|
4342
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
4343
|
+
*/
|
|
4344
|
+
var now$2 = function() {
|
|
4345
|
+
return root$3.Date.now();
|
|
4346
|
+
};
|
|
4347
|
+
|
|
4348
|
+
/** Error message constants. */
|
|
4349
|
+
var FUNC_ERROR_TEXT$3 = 'Expected a function';
|
|
4350
|
+
|
|
4351
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
4352
|
+
var nativeMax$1 = Math.max,
|
|
4353
|
+
nativeMin$1 = Math.min;
|
|
4354
|
+
|
|
4355
|
+
/**
|
|
4356
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
4357
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
4358
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
4359
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
4360
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
4361
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
4362
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
4363
|
+
* calls to the debounced function return the result of the last `func`
|
|
4364
|
+
* invocation.
|
|
4365
|
+
*
|
|
4366
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
4367
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
4368
|
+
* is invoked more than once during the `wait` timeout.
|
|
4369
|
+
*
|
|
4370
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
4371
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
4372
|
+
*
|
|
4373
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
4374
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
4375
|
+
*
|
|
4376
|
+
* @static
|
|
4377
|
+
* @memberOf _
|
|
4378
|
+
* @since 0.1.0
|
|
4379
|
+
* @category Function
|
|
4380
|
+
* @param {Function} func The function to debounce.
|
|
4381
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
4382
|
+
* @param {Object} [options={}] The options object.
|
|
4383
|
+
* @param {boolean} [options.leading=false]
|
|
4384
|
+
* Specify invoking on the leading edge of the timeout.
|
|
4385
|
+
* @param {number} [options.maxWait]
|
|
4386
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
4387
|
+
* @param {boolean} [options.trailing=true]
|
|
4388
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
4389
|
+
* @returns {Function} Returns the new debounced function.
|
|
4390
|
+
* @example
|
|
4391
|
+
*
|
|
4392
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
4393
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
4394
|
+
*
|
|
4395
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
4396
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
4397
|
+
* 'leading': true,
|
|
4398
|
+
* 'trailing': false
|
|
4399
|
+
* }));
|
|
4400
|
+
*
|
|
4401
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
4402
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
4403
|
+
* var source = new EventSource('/stream');
|
|
4404
|
+
* jQuery(source).on('message', debounced);
|
|
4405
|
+
*
|
|
4406
|
+
* // Cancel the trailing debounced invocation.
|
|
4407
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
4408
|
+
*/
|
|
4409
|
+
function debounce$2(func, wait, options) {
|
|
4410
|
+
var lastArgs,
|
|
4411
|
+
lastThis,
|
|
4412
|
+
maxWait,
|
|
4413
|
+
result,
|
|
4414
|
+
timerId,
|
|
4415
|
+
lastCallTime,
|
|
4416
|
+
lastInvokeTime = 0,
|
|
4417
|
+
leading = false,
|
|
4418
|
+
maxing = false,
|
|
4419
|
+
trailing = true;
|
|
4420
|
+
|
|
4421
|
+
if (typeof func != 'function') {
|
|
4422
|
+
throw new TypeError(FUNC_ERROR_TEXT$3);
|
|
4423
|
+
}
|
|
4424
|
+
wait = toNumber$2(wait) || 0;
|
|
4425
|
+
if (isObject$4(options)) {
|
|
4426
|
+
leading = !!options.leading;
|
|
4427
|
+
maxing = 'maxWait' in options;
|
|
4428
|
+
maxWait = maxing ? nativeMax$1(toNumber$2(options.maxWait) || 0, wait) : maxWait;
|
|
4429
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
4430
|
+
}
|
|
4431
|
+
|
|
4432
|
+
function invokeFunc(time) {
|
|
4433
|
+
var args = lastArgs,
|
|
4434
|
+
thisArg = lastThis;
|
|
4435
|
+
|
|
4436
|
+
lastArgs = lastThis = undefined;
|
|
4437
|
+
lastInvokeTime = time;
|
|
4438
|
+
result = func.apply(thisArg, args);
|
|
4439
|
+
return result;
|
|
4440
|
+
}
|
|
4441
|
+
|
|
4442
|
+
function leadingEdge(time) {
|
|
4443
|
+
// Reset any `maxWait` timer.
|
|
4444
|
+
lastInvokeTime = time;
|
|
4445
|
+
// Start the timer for the trailing edge.
|
|
4446
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4447
|
+
// Invoke the leading edge.
|
|
4448
|
+
return leading ? invokeFunc(time) : result;
|
|
4449
|
+
}
|
|
4450
|
+
|
|
4451
|
+
function remainingWait(time) {
|
|
4452
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
4453
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
4454
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
4455
|
+
|
|
4456
|
+
return maxing
|
|
4457
|
+
? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
4458
|
+
: timeWaiting;
|
|
4459
|
+
}
|
|
4460
|
+
|
|
4461
|
+
function shouldInvoke(time) {
|
|
4462
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
4463
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
4464
|
+
|
|
4465
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
4466
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
4467
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
4468
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
4469
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
4470
|
+
}
|
|
4471
|
+
|
|
4472
|
+
function timerExpired() {
|
|
4473
|
+
var time = now$2();
|
|
4474
|
+
if (shouldInvoke(time)) {
|
|
4475
|
+
return trailingEdge(time);
|
|
4476
|
+
}
|
|
4477
|
+
// Restart the timer.
|
|
4478
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
4479
|
+
}
|
|
4480
|
+
|
|
4481
|
+
function trailingEdge(time) {
|
|
4482
|
+
timerId = undefined;
|
|
4483
|
+
|
|
4484
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
4485
|
+
// debounced at least once.
|
|
4486
|
+
if (trailing && lastArgs) {
|
|
4487
|
+
return invokeFunc(time);
|
|
4488
|
+
}
|
|
4489
|
+
lastArgs = lastThis = undefined;
|
|
4490
|
+
return result;
|
|
4491
|
+
}
|
|
4492
|
+
|
|
4493
|
+
function cancel() {
|
|
4494
|
+
if (timerId !== undefined) {
|
|
4495
|
+
clearTimeout(timerId);
|
|
4496
|
+
}
|
|
4497
|
+
lastInvokeTime = 0;
|
|
4498
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
4499
|
+
}
|
|
4500
|
+
|
|
4501
|
+
function flush() {
|
|
4502
|
+
return timerId === undefined ? result : trailingEdge(now$2());
|
|
4503
|
+
}
|
|
4504
|
+
|
|
4505
|
+
function debounced() {
|
|
4506
|
+
var time = now$2(),
|
|
4507
|
+
isInvoking = shouldInvoke(time);
|
|
4508
|
+
|
|
4509
|
+
lastArgs = arguments;
|
|
4510
|
+
lastThis = this;
|
|
4511
|
+
lastCallTime = time;
|
|
4512
|
+
|
|
4513
|
+
if (isInvoking) {
|
|
4514
|
+
if (timerId === undefined) {
|
|
4515
|
+
return leadingEdge(lastCallTime);
|
|
4516
|
+
}
|
|
4517
|
+
if (maxing) {
|
|
4518
|
+
// Handle invocations in a tight loop.
|
|
4519
|
+
clearTimeout(timerId);
|
|
4520
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4521
|
+
return invokeFunc(lastCallTime);
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4524
|
+
if (timerId === undefined) {
|
|
4525
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4526
|
+
}
|
|
4527
|
+
return result;
|
|
4528
|
+
}
|
|
4529
|
+
debounced.cancel = cancel;
|
|
4530
|
+
debounced.flush = flush;
|
|
4531
|
+
return debounced;
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4328
4534
|
/**
|
|
4329
4535
|
* This function is like `assignValue` except that it doesn't assign
|
|
4330
4536
|
* `undefined` values.
|
|
@@ -4609,6 +4815,71 @@ var merge$1 = createAssigner(function(object, source, srcIndex) {
|
|
|
4609
4815
|
*/
|
|
4610
4816
|
var round = createRound('round');
|
|
4611
4817
|
|
|
4818
|
+
/** Error message constants. */
|
|
4819
|
+
var FUNC_ERROR_TEXT$2 = 'Expected a function';
|
|
4820
|
+
|
|
4821
|
+
/**
|
|
4822
|
+
* Creates a throttled function that only invokes `func` at most once per
|
|
4823
|
+
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
4824
|
+
* method to cancel delayed `func` invocations and a `flush` method to
|
|
4825
|
+
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
4826
|
+
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
4827
|
+
* timeout. The `func` is invoked with the last arguments provided to the
|
|
4828
|
+
* throttled function. Subsequent calls to the throttled function return the
|
|
4829
|
+
* result of the last `func` invocation.
|
|
4830
|
+
*
|
|
4831
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
4832
|
+
* invoked on the trailing edge of the timeout only if the throttled function
|
|
4833
|
+
* is invoked more than once during the `wait` timeout.
|
|
4834
|
+
*
|
|
4835
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
4836
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
4837
|
+
*
|
|
4838
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
4839
|
+
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
4840
|
+
*
|
|
4841
|
+
* @static
|
|
4842
|
+
* @memberOf _
|
|
4843
|
+
* @since 0.1.0
|
|
4844
|
+
* @category Function
|
|
4845
|
+
* @param {Function} func The function to throttle.
|
|
4846
|
+
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
4847
|
+
* @param {Object} [options={}] The options object.
|
|
4848
|
+
* @param {boolean} [options.leading=true]
|
|
4849
|
+
* Specify invoking on the leading edge of the timeout.
|
|
4850
|
+
* @param {boolean} [options.trailing=true]
|
|
4851
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
4852
|
+
* @returns {Function} Returns the new throttled function.
|
|
4853
|
+
* @example
|
|
4854
|
+
*
|
|
4855
|
+
* // Avoid excessively updating the position while scrolling.
|
|
4856
|
+
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
4857
|
+
*
|
|
4858
|
+
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
4859
|
+
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
4860
|
+
* jQuery(element).on('click', throttled);
|
|
4861
|
+
*
|
|
4862
|
+
* // Cancel the trailing throttled invocation.
|
|
4863
|
+
* jQuery(window).on('popstate', throttled.cancel);
|
|
4864
|
+
*/
|
|
4865
|
+
function throttle$2(func, wait, options) {
|
|
4866
|
+
var leading = true,
|
|
4867
|
+
trailing = true;
|
|
4868
|
+
|
|
4869
|
+
if (typeof func != 'function') {
|
|
4870
|
+
throw new TypeError(FUNC_ERROR_TEXT$2);
|
|
4871
|
+
}
|
|
4872
|
+
if (isObject$4(options)) {
|
|
4873
|
+
leading = 'leading' in options ? !!options.leading : leading;
|
|
4874
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
4875
|
+
}
|
|
4876
|
+
return debounce$2(func, wait, {
|
|
4877
|
+
'leading': leading,
|
|
4878
|
+
'maxWait': wait,
|
|
4879
|
+
'trailing': trailing
|
|
4880
|
+
});
|
|
4881
|
+
}
|
|
4882
|
+
|
|
4612
4883
|
/**
|
|
4613
4884
|
* 工具模块类型定义
|
|
4614
4885
|
*/
|
|
@@ -13746,6 +14017,7 @@ const CommonContext = React.createContext({
|
|
|
13746
14017
|
mapRef: null,
|
|
13747
14018
|
globalHeight: 0,
|
|
13748
14019
|
heightOptions: [],
|
|
14020
|
+
overlayScale: 1,
|
|
13749
14021
|
});
|
|
13750
14022
|
const CommonContextProvider = CommonContext.Provider;
|
|
13751
14023
|
const useCommonContext = () => React.useContext(CommonContext);
|
|
@@ -14755,13 +15027,15 @@ function generateStraightParallelPaths(points, offsetDistance) {
|
|
|
14755
15027
|
}
|
|
14756
15028
|
return [parallelPath2Data, parallelPath1Data];
|
|
14757
15029
|
}
|
|
14758
|
-
const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className }) => {
|
|
15030
|
+
const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className, }) => {
|
|
14759
15031
|
const [parallelPath2Data, parallelPath1Data] = generateStraightParallelPaths(points, strokeWidth);
|
|
14760
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("path", {
|
|
15032
|
+
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
15033
|
};
|
|
14762
15034
|
|
|
14763
15035
|
const VertexElement = React.memo(({ r, stroke, ...props }) => {
|
|
14764
|
-
|
|
15036
|
+
const { overlayScale } = useCommonContext();
|
|
15037
|
+
const radius = typeof r === 'number' ? r : 12;
|
|
15038
|
+
return (jsxRuntime.jsx("circle", { r: radius * overlayScale, stroke: stroke || '#fff', fill: '#fff', strokeWidth: 2 * overlayScale, ...props }));
|
|
14765
15039
|
});
|
|
14766
15040
|
|
|
14767
15041
|
var _path$c;
|
|
@@ -14893,14 +15167,12 @@ const calculatePhysicalDistance$1 = (point1, point2) => {
|
|
|
14893
15167
|
* @returns 中点坐标 [x, y]
|
|
14894
15168
|
*/
|
|
14895
15169
|
const calculateMidpoint$1 = (point1, point2) => {
|
|
14896
|
-
return [
|
|
14897
|
-
(point1[0] + point2[0]) / 2,
|
|
14898
|
-
(point1[1] + point2[1]) / 2
|
|
14899
|
-
];
|
|
15170
|
+
return [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
|
|
14900
15171
|
};
|
|
14901
15172
|
const DistanceLabels = ({ coordinates, createMode = false, editMode = false, completed = false, showPoints = false, mousePos: _mousePos = null, ghostLastDistance = null, ghostLastMidpoint = null, ghostFirstDistance = null, ghostFirstMidpoint = null, }) => {
|
|
14902
15173
|
// 只在显示可操作顶点时显示距离
|
|
14903
|
-
if (!(createMode && showPoints || editMode || (createMode && completed)) ||
|
|
15174
|
+
if (!((createMode && showPoints) || editMode || (createMode && completed)) ||
|
|
15175
|
+
coordinates.length < 1) {
|
|
14904
15176
|
return null;
|
|
14905
15177
|
}
|
|
14906
15178
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [coordinates.map((coord, idx) => {
|
|
@@ -14952,7 +15224,7 @@ var ClickEventType;
|
|
|
14952
15224
|
const INIT_EDIT_MAP_INFO = {
|
|
14953
15225
|
editMap: false,
|
|
14954
15226
|
selectElement: null,
|
|
14955
|
-
createMode:
|
|
15227
|
+
createMode: null,
|
|
14956
15228
|
elementType: undefined,
|
|
14957
15229
|
isShowDrag: false,
|
|
14958
15230
|
mobileMode: MobileEditMode.START,
|
|
@@ -15476,8 +15748,9 @@ const createPathData = (points) => {
|
|
|
15476
15748
|
}
|
|
15477
15749
|
return pathData;
|
|
15478
15750
|
};
|
|
15479
|
-
const PolygonElement = ({
|
|
15751
|
+
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
15752
|
}) => {
|
|
15753
|
+
const { overlayScale } = useCommonContext();
|
|
15481
15754
|
const { svgRef } = useSvgEditContext();
|
|
15482
15755
|
const [dragState, setDragState] = React.useState({
|
|
15483
15756
|
isDragging: false,
|
|
@@ -15493,6 +15766,10 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15493
15766
|
const { checkCanNotCreateAtPosition } = useCheckElement();
|
|
15494
15767
|
const { editMapInfo } = useMapEditContext();
|
|
15495
15768
|
const { platform } = useCommonContext();
|
|
15769
|
+
// delete icon可能被上一个点遮挡,因为delete在右上方,所以手动处理点让点按照顺时针渲染,这样delete icon层级就会高一些
|
|
15770
|
+
const coordinates = React.useMemo(() => {
|
|
15771
|
+
return editMapInfo?.createMode === CreateStatus.CREATING ? points : [...points].reverse();
|
|
15772
|
+
}, [points, editMapInfo?.createMode]);
|
|
15496
15773
|
// 计算点到线段的垂足坐标(使用通用工具函数)
|
|
15497
15774
|
const calculatePerpendicularFoot$1 = React.useCallback((point, lineStart, lineEnd) => {
|
|
15498
15775
|
return calculatePerpendicularFoot(point, lineStart, lineEnd);
|
|
@@ -15694,7 +15971,9 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15694
15971
|
console.log('handleMouseUp', JSON.stringify(dragState));
|
|
15695
15972
|
if (dragState.isDragging && dragState.currentPosition) {
|
|
15696
15973
|
// 构建新的坐标数组
|
|
15697
|
-
const newCoordinates =
|
|
15974
|
+
const newCoordinates = editMapInfo?.createMode === CreateStatus.CREATING
|
|
15975
|
+
? [...coordinates]
|
|
15976
|
+
: [...coordinates].reverse();
|
|
15698
15977
|
// 如果是新创建的顶点,需要确保它已经被插入
|
|
15699
15978
|
if (dragState.dragType === 'new' && dragState.newVertexIndex !== -1) {
|
|
15700
15979
|
if (showNotCreateCursor) ;
|
|
@@ -15726,7 +16005,7 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15726
16005
|
edgeInfo: null,
|
|
15727
16006
|
dragType: null,
|
|
15728
16007
|
});
|
|
15729
|
-
}, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor]);
|
|
16008
|
+
}, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor, editMapInfo?.createMode]);
|
|
15730
16009
|
// 添加全局事件监听(支持触摸和鼠标事件)
|
|
15731
16010
|
React.useEffect(() => {
|
|
15732
16011
|
if (dragState.isDragging) {
|
|
@@ -15798,24 +16077,17 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15798
16077
|
mousePos.y,
|
|
15799
16078
|
])
|
|
15800
16079
|
: null;
|
|
15801
|
-
const ghostFirstDistance = createMode &&
|
|
15802
|
-
mousePos &&
|
|
15803
|
-
renderCoordinates.length > 0 &&
|
|
15804
|
-
!completed &&
|
|
15805
|
-
renderCoordinates.length >= 3
|
|
16080
|
+
const ghostFirstDistance = createMode && mousePos && !completed && renderCoordinates.length >= 1
|
|
15806
16081
|
? calculatePhysicalDistance(renderCoordinates[0], [mousePos.x, mousePos.y])
|
|
15807
16082
|
: null;
|
|
15808
16083
|
// 虚拟连线的中点坐标
|
|
15809
16084
|
const ghostLastMidpoint = createMode && mousePos && renderCoordinates.length > 0 && !completed
|
|
15810
16085
|
? calculateMidpoint(renderCoordinates[renderCoordinates.length - 1], [mousePos.x, mousePos.y])
|
|
15811
16086
|
: null;
|
|
15812
|
-
const ghostFirstMidpoint = createMode &&
|
|
15813
|
-
mousePos &&
|
|
15814
|
-
renderCoordinates.length > 0 &&
|
|
15815
|
-
!completed &&
|
|
15816
|
-
renderCoordinates.length >= 3
|
|
16087
|
+
const ghostFirstMidpoint = createMode && mousePos && !completed && renderCoordinates.length >= 1
|
|
15817
16088
|
? calculateMidpoint(renderCoordinates[0], [mousePos.x, mousePos.y])
|
|
15818
16089
|
: null;
|
|
16090
|
+
console.log('ghostFirstMidpoint', ghostFirstMidpoint, ghostFirstDistance);
|
|
15819
16091
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(editMode || (createMode && completed)) &&
|
|
15820
16092
|
dragState.isDragging &&
|
|
15821
16093
|
dragState.dragType !== 'new' &&
|
|
@@ -15867,14 +16139,14 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15867
16139
|
setHoverVertex(null);
|
|
15868
16140
|
},
|
|
15869
16141
|
}) }, `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 >=
|
|
16142
|
+
}), 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
16143
|
renderCoordinates.map((coord, idx) => {
|
|
15872
16144
|
// 判断当前顶点的状态
|
|
15873
16145
|
const isLastPoint = idx === renderCoordinates.length - 1;
|
|
15874
16146
|
const canComplete = createMode && !completed && renderCoordinates.length >= 3 && isLastPoint;
|
|
15875
16147
|
const isCreatedAndCanDrag = createMode && completed; // 创建完成后可拖拽
|
|
15876
16148
|
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) => {
|
|
16149
|
+
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
16150
|
// 阻止双击事件冒泡到Google Maps
|
|
15879
16151
|
e.preventDefault();
|
|
15880
16152
|
e.stopPropagation();
|
|
@@ -15922,7 +16194,18 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15922
16194
|
}
|
|
15923
16195
|
}
|
|
15924
16196
|
},
|
|
15925
|
-
|
|
16197
|
+
onMouseUp: (e) => {
|
|
16198
|
+
// 拖拽逻辑:编辑模式或创建完成后
|
|
16199
|
+
if (isInEditMode || isCreatedAndCanDrag) {
|
|
16200
|
+
if (draggable) {
|
|
16201
|
+
// 延迟执行mouseDown,等待可能的doubleClick
|
|
16202
|
+
if (mouseDownTimerRef.current !== null) {
|
|
16203
|
+
window.clearTimeout(mouseDownTimerRef.current);
|
|
16204
|
+
}
|
|
16205
|
+
}
|
|
16206
|
+
}
|
|
16207
|
+
},
|
|
16208
|
+
}) }), tooltipIndex === idx && (jsxRuntime.jsxs("g", { transform: `translate(${coord[0] + 4 * overlayScale * 2}, ${coord[1] - 4 * overlayScale * 2}) scale(${overlayScale * 2})`, onClick: (e) => {
|
|
15926
16209
|
e.preventDefault();
|
|
15927
16210
|
e.stopPropagation();
|
|
15928
16211
|
if (onVertexDelete &&
|
|
@@ -15931,7 +16214,19 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15931
16214
|
onVertexDelete(idx);
|
|
15932
16215
|
}
|
|
15933
16216
|
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("
|
|
16217
|
+
}, 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" }) }) })
|
|
16218
|
+
// <rect
|
|
16219
|
+
// x={coord[0]}
|
|
16220
|
+
// y={coord[1]}
|
|
16221
|
+
// width={20}
|
|
16222
|
+
// height={20}
|
|
16223
|
+
// rx={2}
|
|
16224
|
+
// ry={2}
|
|
16225
|
+
// fill="transparent"
|
|
16226
|
+
// style={{ pointerEvents: 'none' }}
|
|
16227
|
+
// >
|
|
16228
|
+
// </rect>
|
|
16229
|
+
)] }, `vertex-${idx}`));
|
|
15935
16230
|
})] }));
|
|
15936
16231
|
};
|
|
15937
16232
|
|
|
@@ -15983,7 +16278,7 @@ const BoundaryElement = ({ data }) => {
|
|
|
15983
16278
|
}));
|
|
15984
16279
|
}
|
|
15985
16280
|
}, [platform, data, editMapInfo]);
|
|
15986
|
-
return (jsxRuntime.jsx(PolygonElement, {
|
|
16281
|
+
return (jsxRuntime.jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: onPathClick, onCoordinatesChange: (coordinates) => {
|
|
15987
16282
|
console.log('onCoordinatesChange', coordinates);
|
|
15988
16283
|
setEditMapInfo((prev) => ({
|
|
15989
16284
|
...prev,
|
|
@@ -16118,6 +16413,7 @@ const ObstacleElement = ({ data }) => {
|
|
|
16118
16413
|
}
|
|
16119
16414
|
}, [editMapInfo]);
|
|
16120
16415
|
const currentPoints = React.useMemo(() => {
|
|
16416
|
+
// 为了方便解决删除顶点的时候,delete icon被遮挡的问题,所以逆序一下
|
|
16121
16417
|
if (editMapInfo?.selectElement?.id === data.id) {
|
|
16122
16418
|
return editMapInfo.selectElement.points;
|
|
16123
16419
|
}
|
|
@@ -16161,7 +16457,11 @@ const ObstacleElement = ({ data }) => {
|
|
|
16161
16457
|
setEditMapInfo((prev) => ({
|
|
16162
16458
|
...prev,
|
|
16163
16459
|
selectElement: data,
|
|
16164
|
-
historyList: [
|
|
16460
|
+
historyList: [
|
|
16461
|
+
{
|
|
16462
|
+
selectElement: data,
|
|
16463
|
+
},
|
|
16464
|
+
],
|
|
16165
16465
|
currentHistoryIndex: 0,
|
|
16166
16466
|
elementType: DataType.OBSTACLE,
|
|
16167
16467
|
editMap: true,
|
|
@@ -16175,7 +16475,7 @@ const ObstacleElement = ({ data }) => {
|
|
|
16175
16475
|
}
|
|
16176
16476
|
return editMapInfo?.selectElement?.id === data.id;
|
|
16177
16477
|
}, [editMapInfo, data, platform]);
|
|
16178
|
-
return (jsxRuntime.jsx(PolygonElement, {
|
|
16478
|
+
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
16479
|
if (platform === PlatformType.H5) {
|
|
16180
16480
|
onPathClick();
|
|
16181
16481
|
}
|
|
@@ -16764,6 +17064,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
|
|
|
16764
17064
|
};
|
|
16765
17065
|
|
|
16766
17066
|
const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCancel, onDragEnd, onDragMove, disabled = false, className = '', scaleConstraints = { minEdgeLength: 0.5, maxEdgeLength: 10000 }, showInfo = true, }) => {
|
|
17067
|
+
const { overlayScale } = useCommonContext();
|
|
16767
17068
|
const { platform } = useCommonContext();
|
|
16768
17069
|
const { editMapInfo } = useMapEditContext();
|
|
16769
17070
|
const dataPoints = React.useMemo(() => {
|
|
@@ -16879,7 +17180,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
16879
17180
|
return;
|
|
16880
17181
|
onDragMove?.(currentPoints.map((point) => [point.x, point.y]));
|
|
16881
17182
|
}, [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, {
|
|
17183
|
+
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
17184
|
onSelect?.();
|
|
16884
17185
|
}, onPolygonClick: () => {
|
|
16885
17186
|
if (platform === PlatformType.H5) {
|
|
@@ -16908,9 +17209,9 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
16908
17209
|
const infoBoxWidth = 140; // 信息框宽度
|
|
16909
17210
|
const infoBoxHeight = 30; // 信息框高度
|
|
16910
17211
|
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
16911
|
-
const scale = isWeb ? 2 : 1;
|
|
17212
|
+
const scale = (isWeb ? 2 : 1) * overlayScale;
|
|
16912
17213
|
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: "#
|
|
17214
|
+
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
17215
|
? {
|
|
16915
17216
|
onTouchStart: createReactEventHandler((e) => {
|
|
16916
17217
|
handleMouseDownWithDisabled(e);
|
|
@@ -17017,7 +17318,11 @@ const VisionOffElement = ({ data, onSelect }) => {
|
|
|
17017
17318
|
...prev,
|
|
17018
17319
|
selectElement: data,
|
|
17019
17320
|
elementType: DataType.VISION_OFF,
|
|
17020
|
-
historyList: [
|
|
17321
|
+
historyList: [
|
|
17322
|
+
{
|
|
17323
|
+
selectElement: data,
|
|
17324
|
+
},
|
|
17325
|
+
],
|
|
17021
17326
|
currentHistoryIndex: 0,
|
|
17022
17327
|
editMap: true,
|
|
17023
17328
|
isShowDrag: true,
|
|
@@ -17776,7 +18081,14 @@ const DoodleElement = ({ data }) => {
|
|
|
17776
18081
|
})?.then(() => {
|
|
17777
18082
|
setEditMapInfo((prev) => ({
|
|
17778
18083
|
...prev,
|
|
17779
|
-
historyList: [
|
|
18084
|
+
historyList: [
|
|
18085
|
+
{
|
|
18086
|
+
selectElement: {
|
|
18087
|
+
...data,
|
|
18088
|
+
transformedPoints: transformedElements,
|
|
18089
|
+
},
|
|
18090
|
+
},
|
|
18091
|
+
],
|
|
17780
18092
|
currentHistoryIndex: 0,
|
|
17781
18093
|
selectElement: {
|
|
17782
18094
|
...data,
|
|
@@ -17983,6 +18295,7 @@ const ChannelClipPath = React.memo(() => {
|
|
|
17983
18295
|
svgRef?.viewBox.baseVal?.width,
|
|
17984
18296
|
svgRef?.viewBox.baseVal?.height,
|
|
17985
18297
|
]);
|
|
18298
|
+
console.log('boundaryData---->', svgRef?.viewBox.baseVal);
|
|
17986
18299
|
/**
|
|
17987
18300
|
* 判断多边形是否为逆时针方向
|
|
17988
18301
|
* 使用叉积法计算多边形的有向面积
|
|
@@ -19124,7 +19437,7 @@ const CreateObstacleElement = React.forwardRef(({ enabled = false, svgElement, o
|
|
|
19124
19437
|
if (!enabled || points.length === 0) {
|
|
19125
19438
|
return null;
|
|
19126
19439
|
}
|
|
19127
|
-
return (jsxRuntime.jsx(PolygonElement, {
|
|
19440
|
+
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
19441
|
});
|
|
19129
19442
|
CreateObstacleElement.displayName = 'CreateObstacleElement';
|
|
19130
19443
|
|
|
@@ -19365,6 +19678,9 @@ const SvgEditMap = React.forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMa
|
|
|
19365
19678
|
// pointerEvents: 'auto', // 关键:允许接收鼠标事件
|
|
19366
19679
|
}, 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
19680
|
?.sort?.((a, b) => {
|
|
19681
|
+
if (a === DataType.BOUNDARY || b === DataType.BOUNDARY) {
|
|
19682
|
+
return 0;
|
|
19683
|
+
}
|
|
19368
19684
|
const aVal = a === editMapInfo.elementType ? 1 : 0;
|
|
19369
19685
|
const bVal = b === editMapInfo.elementType ? 1 : 0;
|
|
19370
19686
|
return aVal - bVal;
|
|
@@ -19376,7 +19692,7 @@ const SvgEditMap = React.forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMa
|
|
|
19376
19692
|
editMapInfo.createMode &&
|
|
19377
19693
|
editMapInfo.elementType !== DataType.DOODLE &&
|
|
19378
19694
|
editMapInfo.elementType !== DataType.VISION_OFF &&
|
|
19379
|
-
(points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsxRuntime.jsx(PolygonElement, {
|
|
19695
|
+
(points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsxRuntime.jsx(PolygonElement, { points: points?.length > 0
|
|
19380
19696
|
? points.map((p) => [p.x, p.y, 2])
|
|
19381
19697
|
: 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
19698
|
// 创建模式下的坐标变化(拖拽时)
|
|
@@ -19797,7 +20113,11 @@ const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
|
|
|
19797
20113
|
})?.then(() => {
|
|
19798
20114
|
setEditMapInfo({
|
|
19799
20115
|
...editMapInfo,
|
|
19800
|
-
historyList: [
|
|
20116
|
+
historyList: [
|
|
20117
|
+
{
|
|
20118
|
+
selectElement: newDoodle,
|
|
20119
|
+
},
|
|
20120
|
+
],
|
|
19801
20121
|
currentHistoryIndex: 0,
|
|
19802
20122
|
createMode: CreateStatus.COMPLETED,
|
|
19803
20123
|
elementType: DataType.DOODLE,
|
|
@@ -19879,7 +20199,11 @@ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
|
|
|
19879
20199
|
})?.then(() => {
|
|
19880
20200
|
setEditMapInfo({
|
|
19881
20201
|
...editMapInfo,
|
|
19882
|
-
historyList: [
|
|
20202
|
+
historyList: [
|
|
20203
|
+
{
|
|
20204
|
+
selectElement: newElement,
|
|
20205
|
+
},
|
|
20206
|
+
],
|
|
19883
20207
|
currentHistoryIndex: 0,
|
|
19884
20208
|
createMode: type === DataType.VISION_OFF ? CreateStatus.COMPLETED : CreateStatus.CREATING,
|
|
19885
20209
|
elementType: type,
|
|
@@ -19908,11 +20232,11 @@ const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
|
|
|
19908
20232
|
}), 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
20233
|
};
|
|
19910
20234
|
|
|
19911
|
-
var css_248z$9 = ".index-module_handleElementInfo__vWIaf {\n position: absolute;\n right: 0;\n top: 0;\n border-radius: 8px;\n padding: 4px 8px;\n background: #fff;\n width: 265px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 {\n position: absolute;\n left: -96px;\n top: 0;\n display: flex;\n gap: 12px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u- {\n background: #fff;\n border-radius: 8px;\n padding: 6px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X:not(.index-module_disabled__w6gCJ):hover,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-:not(.index-module_disabled__w6gCJ):hover {\n opacity: 0.8;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X.index-module_disabled__w6gCJ,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-.index-module_disabled__w6gCJ {\n color: #d8d8d8;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 0 0 4px 0;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- input {\n padding: 2px 0;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- .index-module_edit__b0r9I {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_boundaryOther__FyJvt {\n padding-top: 4px;\n border-top: 1px solid rgb(197, 197, 197);\n}\n.index-module_handleElementInfo__vWIaf .index-module_handle__4mIxr {\n border-top: 1px solid rgb(197, 197, 197);\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 0;\n}\n\n.index-module_doodleInfo__bd2ua .index-module_time__1bUFf {\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_exist__gWtNo {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_tip__1HNmj {\n color: #ff3f33;\n margin-top: 10px;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px;\n}\n\n.index-module_obstacleInfo__w6Sod .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\n}\n\n.index-module_areaInfo__-WJPL {\n color: #9e9e9e;\n width: 100%;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px; /* 114.286% */\n}\n.index-module_areaInfo__-WJPL .index-module_areaItem__fk-i2 {\n display: flex;\n justify-content: space-between;\n padding: 6px 0;\n}\n\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM {\n color: #1f1f1f;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_value__x3-se {\n margin-left: auto;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_icon__167WB {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_boundaryInfo__VfR-N .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\n}";
|
|
20235
|
+
var css_248z$9 = ".index-module_handleElementInfo__vWIaf {\n position: absolute;\n right: 0;\n top: 0;\n border-radius: 8px;\n padding: 4px 8px;\n background: #fff;\n width: 265px;\n user-select: none;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 {\n position: absolute;\n left: -96px;\n top: 0;\n display: flex;\n gap: 12px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u- {\n background: #fff;\n border-radius: 8px;\n padding: 6px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X:not(.index-module_disabled__w6gCJ):hover,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-:not(.index-module_disabled__w6gCJ):hover {\n opacity: 0.8;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X.index-module_disabled__w6gCJ,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-.index-module_disabled__w6gCJ {\n color: #d8d8d8;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 0 0 4px 0;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- input {\n padding: 2px 0;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- .index-module_edit__b0r9I {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_boundaryOther__FyJvt {\n padding-top: 4px;\n border-top: 1px solid rgb(197, 197, 197);\n}\n.index-module_handleElementInfo__vWIaf .index-module_handle__4mIxr {\n border-top: 1px solid rgb(197, 197, 197);\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 0;\n}\n\n.index-module_doodleInfo__bd2ua .index-module_time__1bUFf {\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_exist__gWtNo {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_tip__1HNmj {\n color: #ff3f33;\n margin-top: 10px;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px;\n}\n\n.index-module_obstacleInfo__w6Sod .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\n}\n\n.index-module_areaInfo__-WJPL {\n color: #9e9e9e;\n width: 100%;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px; /* 114.286% */\n}\n.index-module_areaInfo__-WJPL .index-module_areaItem__fk-i2 {\n display: flex;\n justify-content: space-between;\n padding: 6px 0;\n}\n\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM {\n color: #1f1f1f;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_value__x3-se {\n margin-left: auto;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_icon__167WB {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_boundaryInfo__VfR-N .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\n}";
|
|
19912
20236
|
var styles$9 = {"handleElementInfo":"index-module_handleElementInfo__vWIaf","undoAndRedo":"index-module_undoAndRedo__EKeA8","undo":"index-module_undo__lPY1X","redo":"index-module_redo__EU5u-","disabled":"index-module_disabled__w6gCJ","nameEdit":"index-module_nameEdit__eVzQ-","handle":"index-module_handle__4mIxr","doodleInfo":"index-module_doodleInfo__bd2ua","time":"index-module_time__1bUFf","exist":"index-module_exist__gWtNo","tip":"index-module_tip__1HNmj","obstacleInfo":"index-module_obstacleInfo__w6Sod","areaInfo":"index-module_areaInfo__-WJPL","areaItem":"index-module_areaItem__fk-i2","boundaryInfo":"index-module_boundaryInfo__VfR-N","otherEdit":"index-module_otherEdit__17SuM","otherItem":"index-module_otherItem__ATLFZ","value":"index-module_value__x3-se","icon":"index-module_icon__167WB"};
|
|
19913
20237
|
styleInject(css_248z$9);
|
|
19914
20238
|
|
|
19915
|
-
var css_248z$8 = ".index-module_infoHeader__l9F6q {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 8px 0;\n border-bottom: 1px solid rgb(197, 197, 197);\n}\n.index-module_infoHeader__l9F6q .index-module_headerIcon__sK1hg {\n width: 16px;\n height: 16px;\n
|
|
20239
|
+
var css_248z$8 = ".index-module_infoHeader__l9F6q {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 8px 0;\n border-bottom: 1px solid rgb(197, 197, 197);\n}\n.index-module_infoHeader__l9F6q .index-module_headerIcon__sK1hg {\n width: 16px;\n height: 16px;\n}\n.index-module_infoHeader__l9F6q .index-module_headerName__UGnrH {\n margin-left: 4px;\n color: rgb(158, 158, 158);\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n pointer-events: none;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f {\n margin-left: auto;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f .index-module_focus__llcox {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f .index-module_delete__hD4-Q {\n width: 16px;\n height: 16px;\n margin-left: 8px;\n cursor: pointer;\n}";
|
|
19916
20240
|
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
20241
|
styleInject(css_248z$8);
|
|
19918
20242
|
|
|
@@ -19944,7 +20268,7 @@ var SvgDelete = function SvgDelete(props) {
|
|
|
19944
20268
|
})));
|
|
19945
20269
|
};
|
|
19946
20270
|
|
|
19947
|
-
const Header = ({ handleDelete, handleFocus, showFocus = false, showDelete = true, type }) => {
|
|
20271
|
+
const Header = ({ handleDelete, handleFocus, showFocus = false, showDelete = true, type, }) => {
|
|
19948
20272
|
const currentType = React.useMemo(() => {
|
|
19949
20273
|
return DATE_TYPE_MAP.find((item) => item.type === type);
|
|
19950
20274
|
}, [type]);
|
|
@@ -19969,14 +20293,14 @@ var SvgEdit = function SvgEdit(props) {
|
|
|
19969
20293
|
})));
|
|
19970
20294
|
};
|
|
19971
20295
|
|
|
19972
|
-
const NameModal = ({ name, open, setOpen, onOk }) => {
|
|
20296
|
+
const NameModal = ({ title, name, open, setOpen, onOk }) => {
|
|
19973
20297
|
const [nameValue, setNameValue] = React.useState('');
|
|
19974
20298
|
React.useEffect(() => {
|
|
19975
20299
|
if (open) {
|
|
19976
20300
|
setNameValue(name || '');
|
|
19977
20301
|
}
|
|
19978
20302
|
}, [name, open]);
|
|
19979
|
-
return (jsxRuntime.jsx(CustomModal, { title: `${
|
|
20303
|
+
return (jsxRuntime.jsx(CustomModal, { title: `${title}`, titleCenter: true, open: open, onOk: () => {
|
|
19980
20304
|
onOk?.(nameValue);
|
|
19981
20305
|
setOpen(false);
|
|
19982
20306
|
}, onCancel: () => setOpen(false), okText: "Confirm", afterClose: () => {
|
|
@@ -19984,9 +20308,9 @@ const NameModal = ({ name, open, setOpen, onOk }) => {
|
|
|
19984
20308
|
}, children: jsxRuntime.jsx(antd.Input, { maxLength: 120, showCount: true, placeholder: "Please enter boundary name", value: nameValue, onChange: (e) => setNameValue(e.target.value) }) }));
|
|
19985
20309
|
};
|
|
19986
20310
|
|
|
19987
|
-
const NameEdit = ({ name, onChange }) => {
|
|
20311
|
+
const NameEdit = ({ title, name, onChange }) => {
|
|
19988
20312
|
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 })] }));
|
|
20313
|
+
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
20314
|
};
|
|
19991
20315
|
|
|
19992
20316
|
var _path$3;
|
|
@@ -20107,7 +20431,7 @@ const HeightModal = ({ zoneName, open, setOpen, onChange, value, heightOptions,
|
|
|
20107
20431
|
}), 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
20432
|
};
|
|
20109
20433
|
|
|
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}";
|
|
20434
|
+
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
20435
|
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
20436
|
styleInject(css_248z$3);
|
|
20113
20437
|
|
|
@@ -20440,10 +20764,71 @@ const MowDirection_L = (props) => {
|
|
|
20440
20764
|
}, children: [jsxRuntime.jsx("div", { className: styles$2.leftTop, children: jsxRuntime.jsx(SvgOption, {}) }), jsxRuntime.jsx("div", { className: styles$2.rightBottom, children: jsxRuntime.jsx(SvgOption, {}) })] })] }) }) }));
|
|
20441
20765
|
};
|
|
20442
20766
|
|
|
20767
|
+
const BoundarySvgRender = React.memo(({ mapJson, id, maxWidth = 300 }) => {
|
|
20768
|
+
const svgElementData = React.useMemo(() => {
|
|
20769
|
+
const data = UnifiedMapDataProcessor.processMapData(mapJson, DEFAULT_STYLES) || {};
|
|
20770
|
+
return data;
|
|
20771
|
+
}, [mapJson, DEFAULT_STYLES]);
|
|
20772
|
+
const boundaryInfo = React.useMemo(() => {
|
|
20773
|
+
const boundary = svgElementData.boundary.find((item) => item.id === id);
|
|
20774
|
+
return boundary;
|
|
20775
|
+
}, [id, svgElementData]);
|
|
20776
|
+
// 计算当前boundary的viewBox
|
|
20777
|
+
const boundaryViewBox = React.useMemo(() => {
|
|
20778
|
+
if (!boundaryInfo?.points || boundaryInfo.points.length === 0) {
|
|
20779
|
+
return null;
|
|
20780
|
+
}
|
|
20781
|
+
// 计算边界
|
|
20782
|
+
let minX = Infinity;
|
|
20783
|
+
let minY = Infinity;
|
|
20784
|
+
let maxX = -Infinity;
|
|
20785
|
+
let maxY = -Infinity;
|
|
20786
|
+
boundaryInfo.points.forEach((point) => {
|
|
20787
|
+
minX = Math.min(minX, point[0]);
|
|
20788
|
+
minY = Math.min(minY, point[1]);
|
|
20789
|
+
maxX = Math.max(maxX, point[0]);
|
|
20790
|
+
maxY = Math.max(maxY, point[1]);
|
|
20791
|
+
});
|
|
20792
|
+
// 添加边距
|
|
20793
|
+
const padding = 50;
|
|
20794
|
+
const width = maxX - minX + padding * 2;
|
|
20795
|
+
const height = maxY - minY + padding * 2;
|
|
20796
|
+
return {
|
|
20797
|
+
x: minX - padding,
|
|
20798
|
+
y: minY - padding,
|
|
20799
|
+
width,
|
|
20800
|
+
height,
|
|
20801
|
+
};
|
|
20802
|
+
}, [boundaryInfo]);
|
|
20803
|
+
const style = React.useMemo(() => {
|
|
20804
|
+
if (boundaryViewBox?.width > boundaryViewBox?.height) {
|
|
20805
|
+
return {
|
|
20806
|
+
width: maxWidth,
|
|
20807
|
+
height: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
|
|
20808
|
+
};
|
|
20809
|
+
}
|
|
20810
|
+
return {
|
|
20811
|
+
width: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
|
|
20812
|
+
height: maxWidth,
|
|
20813
|
+
};
|
|
20814
|
+
}, [boundaryViewBox, maxWidth]);
|
|
20815
|
+
return (jsxRuntime.jsxs("div", { style: {
|
|
20816
|
+
position: 'relative',
|
|
20817
|
+
width: style.width,
|
|
20818
|
+
height: style.height,
|
|
20819
|
+
margin: '0 auto',
|
|
20820
|
+
}, 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) => {
|
|
20821
|
+
return svgElementData[key]?.map((element) => {
|
|
20822
|
+
if (key === DataType.VISION_OFF)
|
|
20823
|
+
return null;
|
|
20824
|
+
return (jsxRuntime.jsx(GElement, { type: key, data: svgElementData[key], children: jsxRuntime.jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
|
|
20825
|
+
});
|
|
20826
|
+
}) }), jsxRuntime.jsx(CharginPile, { mapData: mapJson, mapConfig: DEFAULT_STYLES, viewBox: boundaryViewBox || null, rotation: 0 })] }));
|
|
20827
|
+
});
|
|
20828
|
+
|
|
20443
20829
|
const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, onChange, }) => {
|
|
20444
|
-
const { mapJson, mapConfig
|
|
20830
|
+
const { mapJson, mapConfig } = useCommonContext();
|
|
20445
20831
|
const { editMapInfo } = useMapEditContext();
|
|
20446
|
-
const { svgElementDatas } = useSvgEditContext();
|
|
20447
20832
|
const [directions, setDirections] = React.useState(ALL_DIRECTION_SELECTED);
|
|
20448
20833
|
const [angle, setAngle] = React.useState(MIN_DIRECTION_ANGLE);
|
|
20449
20834
|
const canSetDefault = React.useMemo(() => {
|
|
@@ -20468,34 +20853,6 @@ const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, o
|
|
|
20468
20853
|
setAngle(defaultAngle);
|
|
20469
20854
|
}
|
|
20470
20855
|
};
|
|
20471
|
-
// 计算当前boundary的viewBox
|
|
20472
|
-
const boundaryViewBox = React.useMemo(() => {
|
|
20473
|
-
const currentBoundary = editMapInfo.selectElement;
|
|
20474
|
-
if (!currentBoundary?.points || currentBoundary.points.length === 0) {
|
|
20475
|
-
return null;
|
|
20476
|
-
}
|
|
20477
|
-
// 计算边界
|
|
20478
|
-
let minX = Infinity;
|
|
20479
|
-
let minY = Infinity;
|
|
20480
|
-
let maxX = -Infinity;
|
|
20481
|
-
let maxY = -Infinity;
|
|
20482
|
-
currentBoundary.points.forEach((point) => {
|
|
20483
|
-
minX = Math.min(minX, point[0]);
|
|
20484
|
-
minY = Math.min(minY, point[1]);
|
|
20485
|
-
maxX = Math.max(maxX, point[0]);
|
|
20486
|
-
maxY = Math.max(maxY, point[1]);
|
|
20487
|
-
});
|
|
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]);
|
|
20499
20856
|
console.log('directionInfo=>', directionInfo, mapJson);
|
|
20500
20857
|
return (jsxRuntime.jsx(CustomModal, { maskClosable: false, titleCenter: true, title: `${zoneName} mowing direction`, open: open, width: 600, onCancel: () => {
|
|
20501
20858
|
setOpen(false);
|
|
@@ -20505,18 +20862,7 @@ const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, o
|
|
|
20505
20862
|
}, okText: "Confirm", cancelText: "Cancel", okButtonProps: { disabled: !canSave }, afterClose: () => {
|
|
20506
20863
|
setDirections(ALL_DIRECTION_SELECTED);
|
|
20507
20864
|
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) => {
|
|
20865
|
+
}, 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
20866
|
console.log('valie=>', value);
|
|
20521
20867
|
setDirections(value);
|
|
20522
20868
|
} }) })] }), 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: {
|
|
@@ -20567,7 +20913,7 @@ const BoundaryInfo = ({ onHandleDelete }) => {
|
|
|
20567
20913
|
return editMapInfo?.selectElement?.recBaseAngle;
|
|
20568
20914
|
}, [editMapInfo.selectElement?.recBaseAngle]);
|
|
20569
20915
|
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) => {
|
|
20916
|
+
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
20917
|
setEditMapInfo({
|
|
20572
20918
|
...editMapInfo,
|
|
20573
20919
|
isShowDrag: false,
|
|
@@ -20627,6 +20973,11 @@ const TimePeriod = ({ value, onChange }) => {
|
|
|
20627
20973
|
const [open, setOpen] = React.useState(false);
|
|
20628
20974
|
const [radioValue, setRadioValue] = React.useState(RadioValue.LONG_TIME);
|
|
20629
20975
|
console.log('time period->', date, radioValue);
|
|
20976
|
+
React.useEffect(() => {
|
|
20977
|
+
if (!open && date?.length !== 2) {
|
|
20978
|
+
setRadioValue(RadioValue.LONG_TIME);
|
|
20979
|
+
}
|
|
20980
|
+
}, [open]);
|
|
20630
20981
|
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
20982
|
onChange({
|
|
20632
20983
|
...value,
|
|
@@ -20650,15 +21001,11 @@ const TimePeriod = ({ value, onChange }) => {
|
|
|
20650
21001
|
// endTimestamp: dayjs().add(1, 'hour').unix(),
|
|
20651
21002
|
// });
|
|
20652
21003
|
}
|
|
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: "\u957F\u65F6\u95F4\u5F00\u542F" }) }), jsxRuntime.jsx(antd.Radio, { value: RadioValue.SHORT_TIME, children: jsxRuntime.jsx("div", { className: styles$1.timePeriodRadioItem, children: jsxRuntime.jsx(antd.DatePicker.RangePicker, { open: open, onOpenChange: (open) => {
|
|
20654
|
-
if (!open) {
|
|
20655
|
-
setRadioValue(RadioValue.LONG_TIME);
|
|
20656
|
-
}
|
|
21004
|
+
}, 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: "\u957F\u65F6\u95F4\u5F00\u542F" }) }), 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
21005
|
setOpen(open);
|
|
20658
|
-
},
|
|
20659
|
-
|
|
21006
|
+
}, onChange: (dateValue, dateString) => {
|
|
21007
|
+
setDate(dateValue);
|
|
20660
21008
|
if (dateValue?.length === 2) {
|
|
20661
|
-
setDate(dateValue);
|
|
20662
21009
|
onChange({
|
|
20663
21010
|
status: RadioValue.SHORT_TIME,
|
|
20664
21011
|
startTimestamp: dateValue[0].unix(),
|
|
@@ -20699,7 +21046,7 @@ const ObstacleInfo = ({ onHandleDelete }) => {
|
|
|
20699
21046
|
}, [editMapInfo.selectElement]);
|
|
20700
21047
|
return (jsxRuntime.jsxs("div", { className: styles$9.obstacleInfo, children: [jsxRuntime.jsx(Header, { handleDelete: () => {
|
|
20701
21048
|
onHandleDelete();
|
|
20702
|
-
}, handleFocus: () => { }, type: editMapInfo.elementType }), jsxRuntime.jsx("div", { className: styles$9.nameEdit, children: jsxRuntime.jsx(NameEdit, { name: nameValue, onChange: (name) => {
|
|
21049
|
+
}, handleFocus: () => { }, type: editMapInfo.elementType }), jsxRuntime.jsx("div", { className: styles$9.nameEdit, children: jsxRuntime.jsx(NameEdit, { title: "Obstacle name", name: nameValue, onChange: (name) => {
|
|
20703
21050
|
setEditMapInfo({
|
|
20704
21051
|
...editMapInfo,
|
|
20705
21052
|
isShowDrag: false,
|
|
@@ -20849,7 +21196,7 @@ const HandleElementInfo = () => {
|
|
|
20849
21196
|
const isUndoDisabled = React.useMemo(() => {
|
|
20850
21197
|
if (editMapInfo?.elementType === DataType.OBSTACLE &&
|
|
20851
21198
|
editMapInfo?.createMode === CreateStatus.CREATING) {
|
|
20852
|
-
return !(editMapInfo?.currentHistoryIndex
|
|
21199
|
+
return !(editMapInfo?.currentHistoryIndex > 0 && editMapInfo?.historyList?.length);
|
|
20853
21200
|
}
|
|
20854
21201
|
else {
|
|
20855
21202
|
return !(editMapInfo?.currentHistoryIndex > 0 && editMapInfo?.historyList?.length);
|
|
@@ -20864,12 +21211,20 @@ const HandleElementInfo = () => {
|
|
|
20864
21211
|
return !(editMapInfo?.currentHistoryIndex < editMapInfo?.historyList?.length - 1 &&
|
|
20865
21212
|
editMapInfo?.historyList?.length);
|
|
20866
21213
|
}, [editMapInfo?.currentHistoryIndex, editMapInfo?.historyList]);
|
|
20867
|
-
const handleUndo = React.useCallback(() => {
|
|
21214
|
+
const handleUndo = React.useCallback((e) => {
|
|
21215
|
+
e.stopPropagation();
|
|
21216
|
+
e.preventDefault();
|
|
21217
|
+
if (isUndoDisabled)
|
|
21218
|
+
return;
|
|
20868
21219
|
undo();
|
|
20869
|
-
}, [undo]);
|
|
20870
|
-
const handleRedo = React.useCallback(() => {
|
|
21220
|
+
}, [undo, isUndoDisabled]);
|
|
21221
|
+
const handleRedo = React.useCallback((e) => {
|
|
21222
|
+
e.stopPropagation();
|
|
21223
|
+
e.preventDefault();
|
|
21224
|
+
if (idRedoDisabled)
|
|
21225
|
+
return;
|
|
20871
21226
|
redo();
|
|
20872
|
-
}, [redo]);
|
|
21227
|
+
}, [redo, idRedoDisabled]);
|
|
20873
21228
|
const renderElementData = React.useCallback((element) => {
|
|
20874
21229
|
if (!editMapInfo.selectElement)
|
|
20875
21230
|
return null;
|
|
@@ -21197,6 +21552,9 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21197
21552
|
});
|
|
21198
21553
|
const [overlay, setOverlay] = React.useState(null);
|
|
21199
21554
|
const [overlayLayout, setOverlayLayout] = React.useState(null);
|
|
21555
|
+
const [overlayScale, setOverlayScale] = React.useState(1);
|
|
21556
|
+
// 参考zoom级别,在此级别时overlayScale=1,元素显示原始大小
|
|
21557
|
+
const REFERENCE_ZOOM = 19;
|
|
21200
21558
|
const svgMapRef = React.useRef(null);
|
|
21201
21559
|
const svgEditMapRef = React.useRef(null);
|
|
21202
21560
|
const [editMapInfo, setEditMapInfo] = React.useState({
|
|
@@ -21280,6 +21638,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21280
21638
|
mapJson,
|
|
21281
21639
|
drag: defaultTransform,
|
|
21282
21640
|
mapRef,
|
|
21641
|
+
overlayScale,
|
|
21283
21642
|
};
|
|
21284
21643
|
}, [
|
|
21285
21644
|
sn,
|
|
@@ -21293,6 +21652,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21293
21652
|
mapJson,
|
|
21294
21653
|
defaultTransform,
|
|
21295
21654
|
mapRef,
|
|
21655
|
+
overlayScale,
|
|
21296
21656
|
]);
|
|
21297
21657
|
// console.log('svgElementDatas->', svgElementDatas, unStructMapData, commonValue);
|
|
21298
21658
|
// 处理地图分区边界
|
|
@@ -21311,7 +21671,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21311
21671
|
// }
|
|
21312
21672
|
// return allBoundaryElements;
|
|
21313
21673
|
// }, [mapJson]);
|
|
21314
|
-
React.useMemo(() => antennaConfig, [antennaConfig]);
|
|
21315
21674
|
const mowerPositionData = React.useMemo(() => {
|
|
21316
21675
|
// realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
|
|
21317
21676
|
if (!realTimeData || realTimeData.length === 0)
|
|
@@ -21524,6 +21883,38 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21524
21883
|
React.useEffect(() => {
|
|
21525
21884
|
setDrag(defaultTransform ?? { x: 0, y: 0, rotation: 0 });
|
|
21526
21885
|
}, [defaultTransform]);
|
|
21886
|
+
// 监听地图zoom变化,计算缩放比例
|
|
21887
|
+
React.useEffect(() => {
|
|
21888
|
+
if (!mapRef)
|
|
21889
|
+
return;
|
|
21890
|
+
const updateScale = () => {
|
|
21891
|
+
const currentZoom = mapRef.getZoom();
|
|
21892
|
+
if (currentZoom === undefined)
|
|
21893
|
+
return;
|
|
21894
|
+
// 基于固定的参考zoom级别计算overlayScale
|
|
21895
|
+
const zoomDiff = currentZoom - REFERENCE_ZOOM;
|
|
21896
|
+
const scale = Math.pow(2, -zoomDiff); // 负数实现反向缩放
|
|
21897
|
+
setOverlayScale(scale);
|
|
21898
|
+
};
|
|
21899
|
+
// 使用lodash throttle进行节流处理: 100ms内只执行一次
|
|
21900
|
+
const handleZoomChanged = throttle$2(updateScale, 50);
|
|
21901
|
+
// 添加zoom监听
|
|
21902
|
+
const listener = mapRef.addListener('zoom_changed', handleZoomChanged);
|
|
21903
|
+
// 初始化时获取当前zoom
|
|
21904
|
+
updateScale();
|
|
21905
|
+
return () => {
|
|
21906
|
+
if (listener) {
|
|
21907
|
+
window.google.maps.event.removeListener(listener);
|
|
21908
|
+
}
|
|
21909
|
+
// 取消未执行的节流函数
|
|
21910
|
+
handleZoomChanged.cancel();
|
|
21911
|
+
};
|
|
21912
|
+
}, [mapRef]);
|
|
21913
|
+
React.useEffect(() => {
|
|
21914
|
+
if (!editMap) {
|
|
21915
|
+
setEditMapInfo(INIT_EDIT_MAP_INFO);
|
|
21916
|
+
}
|
|
21917
|
+
}, [editMap]);
|
|
21527
21918
|
React.useEffect(() => {
|
|
21528
21919
|
if (!mapJson)
|
|
21529
21920
|
return;
|
|
@@ -21620,7 +22011,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21620
22011
|
pre[cur] = parseFloat(curLayout);
|
|
21621
22012
|
return pre;
|
|
21622
22013
|
}, {});
|
|
21623
|
-
// console.log('setedit svg ------------->', layout);
|
|
21624
22014
|
if (layout?.width && layout?.height) {
|
|
21625
22015
|
svgEditMapRef?.current?.adjustSvgSize?.(layout);
|
|
21626
22016
|
setOverlayLayout(layout);
|
|
@@ -21629,6 +22019,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21629
22019
|
});
|
|
21630
22020
|
MowerMapRenderer.displayName = 'MowerMapRenderer';
|
|
21631
22021
|
|
|
22022
|
+
exports.BoundarySvgRender = BoundarySvgRender;
|
|
21632
22023
|
exports.MapDataProcessor = MapDataProcessor;
|
|
21633
22024
|
exports.MowerMapRenderer = MowerMapRenderer;
|
|
21634
22025
|
exports.PathDataProcessor = PathDataProcessor;
|