优化点击放大的方向

This commit is contained in:
kron
2025-11-05 16:58:27 +08:00
parent 20ae92729f
commit 4e10f3228e

View File

@@ -47,7 +47,9 @@ const onClick = async (e) => {
const clickYInContainer = e.detail.y - rect.value.top; const clickYInContainer = e.detail.y - rect.value.top;
let target = clickYInContainer * scale.value - viewportH / 2; let target = clickYInContainer * scale.value - viewportH / 2;
target = Math.max(0, Math.min(contentH - viewportH, target)); target = Math.max(0, Math.min(contentH - viewportH, target));
scrollTop.value = Math.round(target); setTimeout(() => {
scrollTop.value = target;
}, 100);
} }
const newArrow = { const newArrow = {
x: (e.detail.x - 6) * scale.value, x: (e.detail.x - 6) * scale.value,