添加支持另外2种靶纸的环数计算

This commit is contained in:
kron
2025-08-04 13:51:36 +08:00
parent 6798123840
commit 54a51d2a28
4 changed files with 78 additions and 13 deletions

View File

@@ -29,7 +29,7 @@ const onClick = async (e) => {
newArrow.x,
newArrow.y,
rect.value.width * 0.9,
rect.value.width * 0.9
rect.value.height - rect.value.top
);
arrow.value = newArrow;
};
@@ -66,17 +66,13 @@ const onDrag = async (e) => {
const deltaX = clientX - dragStartPos.value.x;
const deltaY = clientY - dragStartPos.value.y;
const length = rect.value.width * 0.9;
const width = rect.value.width * 0.9;
const height = rect.value.height - rect.value.top;
// 更新坐标
arrow.value.x = Math.max(0, Math.min(length, arrow.value.x + deltaX));
arrow.value.y = Math.max(0, Math.min(length, arrow.value.y + deltaY));
arrow.value.ring = calcRing(
arrow.value.x,
arrow.value.y,
rect.value.width * 0.9,
rect.value.width * 0.9
);
arrow.value.x = Math.max(0, Math.min(width, arrow.value.x + deltaX));
arrow.value.y = Math.max(0, Math.min(height, arrow.value.y + deltaY));
arrow.value.ring = calcRing(arrow.value.x, arrow.value.y, width, height);
// 更新拖拽起始位置
dragStartPos.value = { x: clientX, y: clientY };
@@ -101,7 +97,6 @@ onMounted(async () => {
@touchend="endDrag"
>
<image src="../static/bow-target.png" mode="widthFix" />
<view
v-for="(arrow, index) in arrows"
:key="index"