diff --git a/dsLightRag/ChangZheng/1.html b/dsLightRag/ChangZheng/1.html
index 7e83dabb..cf404d4d 100644
--- a/dsLightRag/ChangZheng/1.html
+++ b/dsLightRag/ChangZheng/1.html
@@ -74,7 +74,7 @@
@@ -125,6 +125,9 @@
const svgPoint = route.ownerSVGElement.createSVGPoint();
svgPoint.x = point.x;
svgPoint.y = point.y;
+
+ console.log("svgPoint.x:"+point.x)
+ console.log("svgPoint.y:"+point.y)
const matrix = route.ownerSVGElement.getScreenCTM();
const transformedPoint = svgPoint.matrixTransform(matrix);
@@ -139,31 +142,10 @@
}
// 更新红旗位置
- function updateFlagPosition(percent) {
- // 获取SVG元素和路径
- const svg = document.querySelector('svg');
- const path = document.querySelector('#route');
- const pathLength = path.getTotalLength();
- const point = path.getPointAtLength(pathLength * percent / 100);
-
- // 仅在动画进行中输出(避免与初始坐标重复)
- if (percent > 0) {
- console.log(`SVG实时坐标: (${point.x.toFixed(6)}, ${point.y.toFixed(6)})`);
- }
-
- // 转换为页面坐标
- const svgPoint = svg.createSVGPoint();
- svgPoint.x = point.x;
- svgPoint.y = point.y;
- const screenPoint = svgPoint.matrixTransform(svg.getScreenCTM());
-
- // 设置红旗位置
- const mapRect = map.getBoundingClientRect();
- const x = screenPoint.x - mapRect.left;
- const y = screenPoint.y - mapRect.top;
-
- flag.style.left = `${x}px`;
- flag.style.top = `${y}px`;
+ function updateFlagPosition(percent) {
+ const point = getPointOnPath(percent);
+ flag.style.left = `${point.x}px`;
+ flag.style.top = `${point.y}px`;
}
// 动画循环
@@ -237,22 +219,6 @@
};
img.src = 'hongqi.jpg';
});
-
- // 添加页面加载完成事件监听
- document.addEventListener('DOMContentLoaded', function() {
- // 确保SVG和图片加载完成后执行
- setTimeout(function() {
- // 输出初始SVG坐标
- logInitialSVGCoordinates();
- }, 100); // 短暂延迟确保资源加载完成
- });
-
- // 初始SVG坐标日志(仅输出一次)
- function logInitialSVGCoordinates() {
- const path = document.querySelector('#route');
- const point = path.getPointAtLength(0); // 路径起点
- console.log(`SVG初始坐标: (${point.x.toFixed(6)}, ${point.y.toFixed(6)})`);
- }