添加靶子缩放功能
This commit is contained in:
11
src/util.js
11
src/util.js
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user