压线精度调整
This commit is contained in:
@@ -423,7 +423,7 @@ export const generateShareImage = async (canvasId, data) => {
|
|||||||
drawLine(ctx, 15, ringBarHeight - 15, 362, ringBarHeight - 15, "#333");
|
drawLine(ctx, 15, ringBarHeight - 15, 362, ringBarHeight - 15, "#333");
|
||||||
|
|
||||||
const qrcodeSrc = await loadImage(
|
const qrcodeSrc = await loadImage(
|
||||||
"https://static.shelingxingqiu.com/attachment/2025-11-13/de7fzgghsfgqu0ytu6.png"
|
"https://static.shelingxingqiu.com/attachment/2025-12-04/dep4rqoc0svyrzcakv.jpg"
|
||||||
);
|
);
|
||||||
const qrcodeImg = await loadCanvasImage(canvas, qrcodeSrc);
|
const qrcodeImg = await loadCanvasImage(canvas, qrcodeSrc);
|
||||||
ctx.drawImage(qrcodeImg, 40, hasPoint ? 715 : 358, 68, 68);
|
ctx.drawImage(qrcodeImg, 40, hasPoint ? 715 : 358, 68, 68);
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ 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));
|
||||||
console.log(target);
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
scrollTop.value = target > 180 ? target + 10 : target;
|
scrollTop.value = target > 180 ? target + 10 : target;
|
||||||
}, 200);
|
}, 200);
|
||||||
@@ -66,7 +65,8 @@ const onClick = async (e) => {
|
|||||||
props.id,
|
props.id,
|
||||||
newArrow.x / scale.value - rect.value.width * 0.05,
|
newArrow.x / scale.value - rect.value.width * 0.05,
|
||||||
newArrow.y / scale.value - rect.value.width * 0.05,
|
newArrow.y / scale.value - rect.value.width * 0.05,
|
||||||
rect.value.width * 0.9
|
rect.value.width * 0.9,
|
||||||
|
(10 * scale.value) / 2
|
||||||
);
|
);
|
||||||
arrow.value = {
|
arrow.value = {
|
||||||
...newArrow,
|
...newArrow,
|
||||||
@@ -130,7 +130,8 @@ const onDrag = async (e) => {
|
|||||||
props.id,
|
props.id,
|
||||||
arrow.value.x / scale.value - rect.value.width * 0.05,
|
arrow.value.x / scale.value - rect.value.width * 0.05,
|
||||||
arrow.value.y / scale.value - rect.value.width * 0.05,
|
arrow.value.y / scale.value - rect.value.width * 0.05,
|
||||||
rect.value.width * 0.9
|
rect.value.width * 0.9,
|
||||||
|
(10 * scale.value) / 2
|
||||||
);
|
);
|
||||||
|
|
||||||
arrow.value.x = arrow.value.x / side;
|
arrow.value.x = arrow.value.x / side;
|
||||||
@@ -212,7 +213,11 @@ onMounted(async () => {
|
|||||||
:x="arrow ? rect.width * arrow.x : 0"
|
:x="arrow ? rect.width * arrow.x : 0"
|
||||||
:y="arrow ? rect.width * arrow.y : 0"
|
:y="arrow ? rect.width * arrow.y : 0"
|
||||||
>
|
>
|
||||||
<view class="point"> </view>
|
<view
|
||||||
|
class="point"
|
||||||
|
:style="{ minWidth: 10 * scale + 'px', minHeight: 10 * scale + 'px' }"
|
||||||
|
>
|
||||||
|
</view>
|
||||||
<view v-if="arrow" class="edit-buttons" @touchstart.stop>
|
<view v-if="arrow" class="edit-buttons" @touchstart.stop>
|
||||||
<view class="edit-btn-text">
|
<view class="edit-btn-text">
|
||||||
<text>{{ arrow.ring === 0 ? "M" : arrow.ring }}</text>
|
<text>{{ arrow.ring === 0 ? "M" : arrow.ring }}</text>
|
||||||
|
|||||||
36
src/util.js
36
src/util.js
@@ -472,7 +472,7 @@ const calcHalfBowTarget = (x, y, diameter, arrowRadius, noX = false) => {
|
|||||||
if (relativeDistance <= 0.4) return 9;
|
if (relativeDistance <= 0.4) return 9;
|
||||||
if (relativeDistance <= 0.6) return 8;
|
if (relativeDistance <= 0.6) return 8;
|
||||||
if (relativeDistance <= 0.8) return 7;
|
if (relativeDistance <= 0.8) return 7;
|
||||||
if (relativeDistance <= 0.992) return 6;
|
if (relativeDistance <= 1) return 6;
|
||||||
|
|
||||||
return 0; // 脱靶
|
return 0; // 脱靶
|
||||||
};
|
};
|
||||||
@@ -484,60 +484,58 @@ export const calcTripleBowTarget = (
|
|||||||
arrowRadius,
|
arrowRadius,
|
||||||
noX = false
|
noX = false
|
||||||
) => {
|
) => {
|
||||||
const side = diameter * 0.324;
|
const side = diameter * 0.31;
|
||||||
if (x / diameter >= 0.316) {
|
if (y / diameter >= 0.649) {
|
||||||
if (y / diameter >= 0.654) {
|
|
||||||
return calcHalfBowTarget(
|
return calcHalfBowTarget(
|
||||||
x - diameter * 0.342,
|
x - diameter * 0.355,
|
||||||
y - diameter * 0.68,
|
y - diameter * 0.693,
|
||||||
side,
|
side,
|
||||||
arrowRadius,
|
arrowRadius,
|
||||||
noX
|
noX
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (y / diameter >= 0.313) {
|
if (y / diameter >= 0.31) {
|
||||||
return calcHalfBowTarget(
|
return calcHalfBowTarget(
|
||||||
x - diameter * 0.342,
|
x - diameter * 0.355,
|
||||||
y - diameter * 0.34,
|
y - diameter * 0.356,
|
||||||
side,
|
side,
|
||||||
arrowRadius,
|
arrowRadius,
|
||||||
noX
|
noX
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (y / diameter >= -0.023) {
|
if (y / diameter >= -0.025) {
|
||||||
return calcHalfBowTarget(
|
return calcHalfBowTarget(
|
||||||
x - diameter * 0.342,
|
x - diameter * 0.355,
|
||||||
y - diameter * 0.005,
|
y - diameter * 0.018,
|
||||||
side,
|
side,
|
||||||
arrowRadius,
|
arrowRadius,
|
||||||
noX
|
noX
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const calcPinBowTarget = (x, y, diameter, arrowRadius, noX = false) => {
|
export const calcPinBowTarget = (x, y, diameter, arrowRadius, noX = false) => {
|
||||||
const side = diameter * 0.484;
|
const side = diameter * 0.482;
|
||||||
let r1 = 0;
|
let r1 = 0;
|
||||||
let r2 = 0;
|
let r2 = 0;
|
||||||
let r3 = 0;
|
let r3 = 0;
|
||||||
if (x / diameter >= 0.23 && y / diameter >= 0.005) {
|
if (x / diameter >= 0.23 && y / diameter >= 0.005) {
|
||||||
r1 = calcHalfBowTarget(
|
r1 = calcHalfBowTarget(
|
||||||
x - diameter * 0.26,
|
x - diameter * 0.26,
|
||||||
y - diameter * 0.0345,
|
y - diameter * 0.034,
|
||||||
side,
|
side,
|
||||||
arrowRadius,
|
arrowRadius,
|
||||||
noX
|
noX
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (x / diameter >= -0.03 && y / diameter >= 0.456) {
|
if (x / diameter >= -0.03 && y / diameter >= 0.456) {
|
||||||
r2 = calcHalfBowTarget(x, y - diameter * 0.486, side, arrowRadius, noX);
|
r2 = calcHalfBowTarget(x, y - diameter * 0.484, side, arrowRadius, noX);
|
||||||
}
|
}
|
||||||
if (x / diameter >= 0.49 && y / diameter >= 0.456) {
|
if (x / diameter >= 0.49 && y / diameter >= 0.456) {
|
||||||
r3 = calcHalfBowTarget(
|
r3 = calcHalfBowTarget(
|
||||||
x - diameter * 0.52,
|
x - diameter * 0.52,
|
||||||
y - diameter * 0.49,
|
y - diameter * 0.485,
|
||||||
side,
|
side,
|
||||||
arrowRadius,
|
arrowRadius,
|
||||||
noX
|
noX
|
||||||
@@ -546,11 +544,11 @@ export const calcPinBowTarget = (x, y, diameter, arrowRadius, noX = false) => {
|
|||||||
return r1 || r2 || r3;
|
return r1 || r2 || r3;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const calcRing = (bowtargetId, x, y, diameter, arrowRadius = 5) => {
|
export const calcRing = (bowtargetId, x, y, diameter, arrowRadius) => {
|
||||||
if (bowtargetId < 4) {
|
if (bowtargetId < 4) {
|
||||||
return calcNormalBowTarget(x, y, diameter, arrowRadius);
|
return calcNormalBowTarget(x, y, diameter, arrowRadius);
|
||||||
} else if (bowtargetId < 7) {
|
} else if (bowtargetId < 7) {
|
||||||
return calcHalfBowTarget(x, y, diameter + 2, arrowRadius);
|
return calcHalfBowTarget(x, y, diameter, arrowRadius);
|
||||||
} else if (bowtargetId === 7) {
|
} else if (bowtargetId === 7) {
|
||||||
return calcTripleBowTarget(x, y, diameter, arrowRadius);
|
return calcTripleBowTarget(x, y, diameter, arrowRadius);
|
||||||
} else if (bowtargetId === 8) {
|
} else if (bowtargetId === 8) {
|
||||||
|
|||||||
Reference in New Issue
Block a user