diff --git a/src/components/BowTargetEdit.vue b/src/components/BowTargetEdit.vue
index 1b41dc5..48c558e 100644
--- a/src/components/BowTargetEdit.vue
+++ b/src/components/BowTargetEdit.vue
@@ -27,8 +27,6 @@ const isDragging = ref(false);
const dragStartPos = ref({ x: 0, y: 0 });
const capsuleHeight = ref(0);
const scale = ref(1);
-const zoomPos = ref({ x: 0, y: 0 });
-const targetPos = ref({ x: 0, y: 0 });
let lastMoveTime = 0;
// 点击靶纸创建新的点
@@ -40,21 +38,14 @@ const onClick = async (e) => {
) {
return;
}
-
+ if (props.id === 7 || props.id === 9) {
+ scale.value = 1.5;
+ }
const newArrow = {
- x: e.detail.x - zoomPos.value.x - 6 / scale.value,
- y:
- e.detail.y -
- rect.value.top -
- capsuleHeight.value -
- zoomPos.value.y -
- 6 / scale.value,
+ x: (e.detail.x - 6) * scale.value,
+ y: (e.detail.y - rect.value.top - capsuleHeight.value - 6) * scale.value,
};
- targetPos.value = {
- x: zoomPos.value.x,
- y: zoomPos.value.y,
- };
const side = rect.value.width;
newArrow.ring = calcRing(
props.id,
@@ -72,10 +63,6 @@ const onClick = async (e) => {
// 确认添加箭矢
const confirmAdd = () => {
if (props.onChange) {
- targetPos.value = {
- x: zoomPos.value.x,
- y: zoomPos.value.y,
- };
props.onChange({
x: arrow.value.x / scale.value,
y: arrow.value.y / scale.value,
@@ -83,15 +70,13 @@ const confirmAdd = () => {
});
}
arrow.value = null;
+ scale.value = 1;
};
// 删除箭矢
const deleteArrow = () => {
arrow.value = null;
- targetPos.value = {
- x: zoomPos.value.x,
- y: zoomPos.value.y,
- };
+ scale.value = 1;
};
// 开始拖拽 - 同样修复坐标获取
@@ -142,21 +127,17 @@ const onDrag = async (e) => {
const endDrag = (e) => {
isDragging.value = false;
};
-const onScale = (e) => {
- lastMoveTime = Date.now();
- const lastScale = scale.value;
- scale.value = e.detail.scale;
- zoomPos.value = { x: e.detail.x, y: e.detail.y };
- if (arrow.value) {
- arrow.value.x = arrow.value.x * (scale.value / lastScale);
- arrow.value.y = arrow.value.y * (scale.value / lastScale);
- }
-};
-const onMove = (e) => {
- if (e.detail.source) {
- zoomPos.value = { x: e.detail.x, y: e.detail.y };
+const getNewPos = () => {
+ if (props.id === 7 || props.id === 9) {
+ if (arrow.value.y > 1.4)
+ return { left: "-12px", bottom: "calc(50% - 12px)" };
+ } else {
+ if (arrow.value.y > 0.88) {
+ return { left: "-12px", bottom: "calc(50% - 12px)" };
+ }
}
+ return { left: "calc(50% - 12px)", bottom: "-12px" };
};
onMounted(async () => {
@@ -174,82 +155,77 @@ onMounted(async () => {
@touchmove="onDrag"
@touchend="endDrag"
>
-
-
+
+
-
+ {{ index + 1 }}
+
+
+
+
+
+
+
+ {{ arrow.ring === 0 ? "M" : arrow.ring }}
+ 环
+
- {{ index + 1 }}
+
+
+
+
+
+
+
-
-
-
-
-
- {{ arrow.ring === 0 ? "M" : arrow.ring }}
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -259,14 +235,25 @@ onMounted(async () => {
.container {
width: 100vw;
height: 100vw;
- overflow: hidden;
- transform: translateY(-10px);
+ overflow-x: hidden;
+ overflow-y: auto;
}
.move-area {
width: 100%;
height: 100%;
- position: relative;
+ transition: all 0.3s ease;
+}
+.move-area::-webkit-scrollbar {
+ width: 0;
+ height: 0;
+ color: transparent;
+}
+
+.move-area > image {
+ width: 90%;
+ height: 90%;
+ margin: 5%;
}
.move-view {
@@ -300,6 +287,7 @@ onMounted(async () => {
background-color: #ff4444;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
transition: all 0.1s linear;
+ position: relative;
}
.point > text {
@@ -323,8 +311,8 @@ onMounted(async () => {
.edit-btn-text {
width: 100%;
display: flex;
- /* justify-content: center; */
- margin-left: 10px;
+ justify-content: center;
+ /* margin-left: 10px; */
}
.edit-btn-text > text {
@@ -350,8 +338,7 @@ onMounted(async () => {
}
.confirm-btn {
- left: calc(50% - 12px);
- bottom: -12px;
+ transition: all 0.3s ease;
}
.delete-btn {
diff --git a/src/pages/point-book-detail.vue b/src/pages/point-book-detail.vue
index 20e90a7..f27f755 100644
--- a/src/pages/point-book-detail.vue
+++ b/src/pages/point-book-detail.vue
@@ -13,6 +13,7 @@ const showTip = ref(false);
const showTip2 = ref(false);
const groups = ref([]);
const data = ref({});
+const targetId = ref("");
const targetSrc = ref("");
const arrows = ref([]);
@@ -42,6 +43,7 @@ onLoad(async (options) => {
const config = uni.getStorageSync("point-book-config");
config.targetOption.some((item) => {
if (item.id === result.targetType) {
+ targetId.value = item.id;
targetSrc.value = item.icon;
}
});
@@ -122,7 +124,7 @@ onLoad(async (options) => {
/>
-
+
关闭
diff --git a/src/util.js b/src/util.js
index 147011a..8c8b81b 100644
--- a/src/util.js
+++ b/src/util.js
@@ -380,25 +380,25 @@ const calcHalfBowTarget = (x, y, diameter, noX = false) => {
};
export const calcTripleBowTarget = (x, y, diameter, noX = false) => {
- const side = diameter * 0.324;
- if (x / diameter >= 0.306) {
- if (y / diameter >= 0.64) {
+ const side = diameter * 0.319;
+ if (x / diameter >= 0.312) {
+ if (y / diameter >= 0.65) {
return calcHalfBowTarget(
- x - diameter * 0.342,
- y - diameter * 0.68,
+ x - diameter * 0.344,
+ y - diameter * 0.684,
side,
noX
);
}
- if (y / diameter >= 0.304) {
+ if (y / diameter >= 0.31) {
return calcHalfBowTarget(
x - diameter * 0.342,
- y - diameter * 0.34,
+ y - diameter * 0.344,
side,
noX
);
}
- if (y / diameter >= -0.03) {
+ if (y / diameter >= -0.025) {
return calcHalfBowTarget(x - diameter * 0.342, y, side, noX);
}
}
@@ -406,10 +406,10 @@ export const calcTripleBowTarget = (x, y, diameter, noX = false) => {
};
export const calcPinBowTarget = (x, y, diameter, noX = false) => {
- const side = diameter * 0.482;
+ const side = diameter * 0.484;
if (x / diameter >= 0.488 && y / diameter >= 0.456) {
return calcHalfBowTarget(
- x - diameter * 0.527,
+ x - diameter * 0.523,
y - diameter * 0.486,
side,
noX