From e59a23054bbaf71124ca1e7e642f1108b5c68786 Mon Sep 17 00:00:00 2001
From: jinglun-cloud <jinglun2019@foxmail.com>
Date: 星期三, 06 五月 2026 10:13:08 +0800
Subject: [PATCH] 运动都放到中轨上计算
---
src/main/webapp/components/MapCanvas.js | 46 +++++++++++++++++-----------------------------
1 files changed, 17 insertions(+), 29 deletions(-)
diff --git a/src/main/webapp/components/MapCanvas.js b/src/main/webapp/components/MapCanvas.js
index 8e0a6f7..09a1112 100644
--- a/src/main/webapp/components/MapCanvas.js
+++ b/src/main/webapp/components/MapCanvas.js
@@ -1444,27 +1444,26 @@
);
const deltaDistance = (allDistance * passedSegmentCount) / totalSegmentCount;
const initPath = sprite.path;
- const initMovePoint = G.snapToAnnulusOuterPath(
+ const initMovePoint = G.snapToAnnulusPath(
sprite.trackInfo,
sprite.x,
sprite.y,
initPath
);
- let mappingInfo = G.computeFinalPosition(
- sprite.trackInfo,
- initMovePoint,
+ let mappingInfo = G.getPositionAfterMove({
+ point: initMovePoint,
pathList,
- initPath,
+ path: initPath,
deltaDistance,
- sprite.currentAngle
- );
+ angle: sprite.currentAngle
+ });
sprite.x = mappingInfo.x;
sprite.y = mappingInfo.y;
sprite.path = mappingInfo.path;
sprite.rotation = G.getRotate(mappingInfo, mappingInfo.path) || sprite.rotation;
sprite.currentAngle = mappingInfo.angle;
sprite.mappingInfo = mappingInfo;
- const anchorPoint = G.snapToAnnulusOuterPath(
+ const anchorPoint = G.snapToAnnulusPath(
sprite.trackInfo,
mappingInfo.x,
mappingInfo.y,
@@ -1562,21 +1561,20 @@
} else {
smoothDistance = stepCap;
}
- const movePointBarcode = G.snapToAnnulusOuterPath(
+ const movePointBarcode = G.snapToAnnulusPath(
sprite.trackInfo,
sprite.x,
sprite.y,
path
);
const angle = Math.atan2(sprite.y - path.y, sprite.x - path.x);
- const p = G.computeFinalPosition(
- sprite.trackInfo,
- movePointBarcode,
+ const p = G.getPositionAfterMove({
+ point: movePointBarcode,
pathList,
path,
- smoothDistance,
+ deltaDistance: smoothDistance,
angle
- );
+ });
sprite.path = p.path;
sprite.x = p.x;
sprite.y = p.y;
@@ -1610,7 +1608,7 @@
anchor.totalSegmentCount !== totalSegmentCount;
if (needResetAnchor) {
const anchorPath = sprite.path;
- const anchorPoint = G.snapToAnnulusOuterPath(
+ const anchorPoint = G.snapToAnnulusPath(
sprite.trackInfo,
sprite.x,
sprite.y,
@@ -1638,14 +1636,13 @@
const deltaDistance = (allDistance * passedSegmentCount) / totalSegmentCount;
const path = anchor.path || sprite.path;
const barcodeMovePoint = { x: anchor.x, y: anchor.y };
- let finalPosition = G.computeFinalPosition(
- sprite.trackInfo,
- barcodeMovePoint,
+ let finalPosition = G.getPositionAfterMove({
+ point: barcodeMovePoint,
pathList,
path,
deltaDistance,
- anchor.angle
- );
+ angle: anchor.angle
+ });
let curveDistance = G.calcDistance(sprite, finalPosition);
if (!isFinite(curveDistance)) {
curveDistance = deltaDistance;
@@ -1663,9 +1660,6 @@
typeof sprite.maV === 'number' && isFinite(sprite.maV)
? sprite.maV * (1 - alpha) + v * alpha
: v;
- }
- if(device.index === 18) {
- console.log("device",device,curveDistance,oldSprite.barcode, device.rgvPos,sprite.id)
}
if (curveDistance < EPSILON) {
this.finishDeviceMotion(sprite);
@@ -3665,12 +3659,6 @@
}
}
});
-
- if (sprite.trackInfo.type === 'annulus' && minPath && x != null && y != null) {
- const c = G.centerAnnulusBandPoint(sprite.trackInfo, x, y, minPath);
- x = c.x;
- y = c.y;
- }
return { x, y, angle, path: minPath };
},
--
Gitblit v1.9.1