细节优化
This commit is contained in:
@@ -202,7 +202,6 @@ onMounted(async () => {
|
|||||||
<view
|
<view
|
||||||
v-if="arrow.x !== undefined && arrow.y !== undefined"
|
v-if="arrow.x !== undefined && arrow.y !== undefined"
|
||||||
class="point"
|
class="point"
|
||||||
:style="{ transform: `scale(${1 / scale})` }"
|
|
||||||
>
|
>
|
||||||
<text>{{ index + 1 }}</text>
|
<text>{{ index + 1 }}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -216,8 +215,7 @@ onMounted(async () => {
|
|||||||
:x="arrow ? (rect.width * arrow.x) / scale : 0"
|
:x="arrow ? (rect.width * arrow.x) / scale : 0"
|
||||||
:y="arrow ? (rect.width * arrow.y) / scale : 0"
|
:y="arrow ? (rect.width * arrow.y) / scale : 0"
|
||||||
>
|
>
|
||||||
<view class="point" :style="{ transform: `scale(${1 / scale})` }">
|
<view class="point"> </view>
|
||||||
</view>
|
|
||||||
<view
|
<view
|
||||||
v-if="arrow"
|
v-if="arrow"
|
||||||
class="edit-buttons"
|
class="edit-buttons"
|
||||||
@@ -225,18 +223,18 @@ onMounted(async () => {
|
|||||||
:style="{ transform: `scale(${1 / scale})` }"
|
:style="{ transform: `scale(${1 / scale})` }"
|
||||||
>
|
>
|
||||||
<view class="edit-btn-text">
|
<view class="edit-btn-text">
|
||||||
<text v-if="arrow.ring === 0" :style="{ width: '100%' }"
|
<!-- <text v-if="arrow.ring === 0" :style="{ width: '100%' }"
|
||||||
>未上靶</text
|
>未上靶</text
|
||||||
>
|
> -->
|
||||||
<text v-if="arrow.ring !== 0">{{ arrow.ring }}</text>
|
<text>{{ arrow.ring === 0 ? "M" : arrow.ring }}</text>
|
||||||
<text
|
<!-- <text
|
||||||
v-if="arrow.ring > 0"
|
v-if="arrow.ring > 0"
|
||||||
:style="{
|
:style="{
|
||||||
fontSize: '16px',
|
fontSize: '16px',
|
||||||
marginLeft: '2px',
|
marginLeft: '2px',
|
||||||
}"
|
}"
|
||||||
>环</text
|
>环</text
|
||||||
>
|
> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="edit-btn confirm-btn" @touchstart.stop="confirmAdd">
|
<view class="edit-btn confirm-btn" @touchstart.stop="confirmAdd">
|
||||||
<image src="../static/arrow-edit-save.png" mode="widthFix" />
|
<image src="../static/arrow-edit-save.png" mode="widthFix" />
|
||||||
@@ -325,7 +323,8 @@ onMounted(async () => {
|
|||||||
.edit-btn-text {
|
.edit-btn-text {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
/* justify-content: center; */
|
||||||
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-btn-text > text {
|
.edit-btn-text > text {
|
||||||
|
|||||||
20
src/util.js
20
src/util.js
@@ -324,7 +324,10 @@ const calcNormalBowTarget = (x, y, diameter) => {
|
|||||||
const targetRadius = diameter / 2;
|
const targetRadius = diameter / 2;
|
||||||
|
|
||||||
// 计算相对距离(0-1之间)
|
// 计算相对距离(0-1之间)
|
||||||
const relativeDistance = distance / targetRadius;
|
let relativeDistance = distance / targetRadius;
|
||||||
|
|
||||||
|
relativeDistance -= 0.005;
|
||||||
|
|
||||||
// 全环靶有10个环,每个环占半径的10%
|
// 全环靶有10个环,每个环占半径的10%
|
||||||
// 从外到内:1环到10环
|
// 从外到内:1环到10环
|
||||||
// 距离越近靶心,环数越高
|
// 距离越近靶心,环数越高
|
||||||
@@ -366,7 +369,8 @@ const calcHalfBowTarget = (x, y, diameter, noX = false) => {
|
|||||||
const targetRadius = diameter / 2;
|
const targetRadius = diameter / 2;
|
||||||
|
|
||||||
// 计算相对距离(0-1之间)
|
// 计算相对距离(0-1之间)
|
||||||
const relativeDistance = distance / targetRadius;
|
let relativeDistance = distance / targetRadius;
|
||||||
|
relativeDistance -= 0.004;
|
||||||
if (relativeDistance <= 0.1) return noX ? 10 : "X";
|
if (relativeDistance <= 0.1) return noX ? 10 : "X";
|
||||||
if (relativeDistance <= 0.2) return noX ? 9 : 10;
|
if (relativeDistance <= 0.2) return noX ? 9 : 10;
|
||||||
if (relativeDistance <= 0.4) return 9;
|
if (relativeDistance <= 0.4) return 9;
|
||||||
@@ -378,7 +382,7 @@ const calcHalfBowTarget = (x, y, diameter, noX = false) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const calcTripleBowTarget = (x, y, diameter, noX = false) => {
|
export const calcTripleBowTarget = (x, y, diameter, noX = false) => {
|
||||||
const side = diameter * 0.325;
|
const side = diameter * 0.324;
|
||||||
if (x / diameter >= 0.306) {
|
if (x / diameter >= 0.306) {
|
||||||
if (y / diameter >= 0.64) {
|
if (y / diameter >= 0.64) {
|
||||||
return calcHalfBowTarget(
|
return calcHalfBowTarget(
|
||||||
@@ -404,22 +408,22 @@ export const calcTripleBowTarget = (x, y, diameter, noX = false) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const calcPinBowTarget = (x, y, diameter, noX = false) => {
|
export const calcPinBowTarget = (x, y, diameter, noX = false) => {
|
||||||
const side = diameter * 0.484;
|
const side = diameter * 0.482;
|
||||||
if (x / diameter >= 0.488 && y / diameter >= 0.456) {
|
if (x / diameter >= 0.488 && y / diameter >= 0.456) {
|
||||||
return calcHalfBowTarget(
|
return calcHalfBowTarget(
|
||||||
x - diameter * 0.52,
|
x - diameter * 0.527,
|
||||||
y - diameter * 0.484,
|
y - diameter * 0.486,
|
||||||
side,
|
side,
|
||||||
noX
|
noX
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (x / diameter >= -0.03 && y / diameter >= 0.456) {
|
if (x / diameter >= -0.03 && y / diameter >= 0.456) {
|
||||||
return calcHalfBowTarget(x, y - diameter * 0.484, side, noX);
|
return calcHalfBowTarget(x, y - diameter * 0.486, side, noX);
|
||||||
}
|
}
|
||||||
if (x / diameter >= 0.23 && y / diameter >= 0.005) {
|
if (x / diameter >= 0.23 && y / diameter >= 0.005) {
|
||||||
return calcHalfBowTarget(
|
return calcHalfBowTarget(
|
||||||
x - diameter * 0.26,
|
x - diameter * 0.26,
|
||||||
y - diameter * 0.036,
|
y - diameter * 0.0345,
|
||||||
side,
|
side,
|
||||||
noX
|
noX
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user