添加靶子缩放功能

This commit is contained in:
kron
2025-08-07 18:13:14 +08:00
parent 125719f294
commit d20e84f66c
3 changed files with 82 additions and 38 deletions

View File

@@ -288,11 +288,11 @@ export const isGameEnded = async (battleId) => {
};
// 获取元素尺寸和位置信息
export const getElementRect = () => {
export const getElementRect = (classname) => {
return new Promise((resolve) => {
const query = uni.createSelectorQuery();
query
.select(".container")
.select(classname)
.boundingClientRect((rect) => {
resolve(rect);
})
@@ -409,7 +409,12 @@ export const calcPinBowTarget = (
y / targetWidth >= 0.032 &&
y / targetHeight <= 0.51
) {
return calcHalfBowTarget(x - targetWidth * 0.26, y - targetHeight * 0.032, side, noX);
return calcHalfBowTarget(
x - targetWidth * 0.26,
y - targetHeight * 0.032,
side,
noX
);
} else if (x / targetHeight <= 0.48 && y / targetHeight >= 0.482) {
return calcHalfBowTarget(x, y - targetHeight * 0.482, side, noX);
} else if (x / targetHeight >= 0.52 && y / targetHeight >= 0.482) {