fix: 修复几何坐标轴绘制范围问题

This commit is contained in:
dmy
2026-03-04 10:57:07 +08:00
parent 52a1ca7c2e
commit 45b5dbaab2

View File

@@ -95,7 +95,7 @@ const calculateRange = () => {
const allHeights = [...hArmNums, ...actualHeights, 0]
const allX = [...gcXNums, -gcXNums[0] * 0.5, gcXNums[0] * 1.5] // 扩展水平范围
const yMin = 0
const yMin = -10
const yMax = Math.max(...allHeights) * 1.15
const xMin = Math.min(...allX) * 1.2
const xMax = Math.max(...allX) * 1.2
@@ -157,8 +157,8 @@ const draw = () => {
// X 轴(地面)
ctx.beginPath()
ctx.moveTo(margin.left, toCanvasY(0, range))
ctx.lineTo(margin.left + plotWidth, toCanvasY(0, range))
ctx.moveTo(margin.left, toCanvasY(range.yMin, range))
ctx.lineTo(margin.left + plotWidth, toCanvasY(range.yMin, range))
ctx.stroke()
// 绘制刻度标签