压线精度调整

This commit is contained in:
kron
2025-12-04 14:11:56 +08:00
parent fa394bdd87
commit b33f5263f6
3 changed files with 44 additions and 41 deletions

View File

@@ -423,7 +423,7 @@ export const generateShareImage = async (canvasId, data) => {
drawLine(ctx, 15, ringBarHeight - 15, 362, ringBarHeight - 15, "#333");
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);
ctx.drawImage(qrcodeImg, 40, hasPoint ? 715 : 358, 68, 68);

View File

@@ -51,7 +51,6 @@ const onClick = async (e) => {
const clickYInContainer = e.detail.y - rect.value.top;
let target = clickYInContainer * scale.value - viewportH / 2;
target = Math.max(0, Math.min(contentH - viewportH, target));
console.log(target);
setTimeout(() => {
scrollTop.value = target > 180 ? target + 10 : target;
}, 200);
@@ -66,7 +65,8 @@ const onClick = async (e) => {
props.id,
newArrow.x / 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 = {
...newArrow,
@@ -130,7 +130,8 @@ const onDrag = async (e) => {
props.id,
arrow.value.x / 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;
@@ -212,7 +213,11 @@ onMounted(async () => {
:x="arrow ? rect.width * arrow.x : 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 class="edit-btn-text">
<text>{{ arrow.ring === 0 ? "M" : arrow.ring }}</text>

View File

@@ -472,7 +472,7 @@ const calcHalfBowTarget = (x, y, diameter, arrowRadius, noX = false) => {
if (relativeDistance <= 0.4) return 9;
if (relativeDistance <= 0.6) return 8;
if (relativeDistance <= 0.8) return 7;
if (relativeDistance <= 0.992) return 6;
if (relativeDistance <= 1) return 6;
return 0; // 脱靶
};
@@ -484,60 +484,58 @@ export const calcTripleBowTarget = (
arrowRadius,
noX = false
) => {
const side = diameter * 0.324;
if (x / diameter >= 0.316) {
if (y / diameter >= 0.654) {
const side = diameter * 0.31;
if (y / diameter >= 0.649) {
return calcHalfBowTarget(
x - diameter * 0.342,
y - diameter * 0.68,
x - diameter * 0.355,
y - diameter * 0.693,
side,
arrowRadius,
noX
);
}
if (y / diameter >= 0.313) {
if (y / diameter >= 0.31) {
return calcHalfBowTarget(
x - diameter * 0.342,
y - diameter * 0.34,
x - diameter * 0.355,
y - diameter * 0.356,
side,
arrowRadius,
noX
);
}
if (y / diameter >= -0.023) {
if (y / diameter >= -0.025) {
return calcHalfBowTarget(
x - diameter * 0.342,
y - diameter * 0.005,
x - diameter * 0.355,
y - diameter * 0.018,
side,
arrowRadius,
noX
);
}
}
return 0;
};
export const calcPinBowTarget = (x, y, diameter, arrowRadius, noX = false) => {
const side = diameter * 0.484;
const side = diameter * 0.482;
let r1 = 0;
let r2 = 0;
let r3 = 0;
if (x / diameter >= 0.23 && y / diameter >= 0.005) {
r1 = calcHalfBowTarget(
x - diameter * 0.26,
y - diameter * 0.0345,
y - diameter * 0.034,
side,
arrowRadius,
noX
);
}
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) {
r3 = calcHalfBowTarget(
x - diameter * 0.52,
y - diameter * 0.49,
y - diameter * 0.485,
side,
arrowRadius,
noX
@@ -546,11 +544,11 @@ export const calcPinBowTarget = (x, y, diameter, arrowRadius, noX = false) => {
return r1 || r2 || r3;
};
export const calcRing = (bowtargetId, x, y, diameter, arrowRadius = 5) => {
export const calcRing = (bowtargetId, x, y, diameter, arrowRadius) => {
if (bowtargetId < 4) {
return calcNormalBowTarget(x, y, diameter, arrowRadius);
} else if (bowtargetId < 7) {
return calcHalfBowTarget(x, y, diameter + 2, arrowRadius);
return calcHalfBowTarget(x, y, diameter, arrowRadius);
} else if (bowtargetId === 7) {
return calcTripleBowTarget(x, y, diameter, arrowRadius);
} else if (bowtargetId === 8) {