Skip to content

Commit b22bdda

Browse files
committed
fix: 修复缩放域条件判断,确保数据边界有效时才渲染按钮
1 parent ec520dc commit b22bdda

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

app/explore/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,12 @@ export default function ExplorePage() {
11001100
<span className="text-slate-400">渲染点数:</span>
11011101
<span>{formatNumberWithCommas(data?.returned ?? 0)}</span>
11021102
</div>
1103-
{zoomDomain && (
1103+
{zoomDomain && dataBounds && (() => {
1104+
const totalXRange = dataBounds.x[1] - dataBounds.x[0];
1105+
const zoomXRange = zoomDomain.x[1] - zoomDomain.x[0];
1106+
const zoomRatio = totalXRange > 0 ? zoomXRange / totalXRange : 1;
1107+
return zoomRatio < 0.999;
1108+
})() && (
11041109
<button
11051110
type="button"
11061111
onClick={resetZoom}

0 commit comments

Comments
 (0)