mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-02-27 00:27:06 +08:00
修复Bug
This commit is contained in:
parent
b38e334753
commit
c29a958689
@ -35,6 +35,7 @@ const canvasAttr = props.type === 'horizontal' ? 'width' : 'height';
|
|||||||
|
|
||||||
let ctx: CanvasRenderingContext2D;
|
let ctx: CanvasRenderingContext2D;
|
||||||
let content: HTMLDivElement;
|
let content: HTMLDivElement;
|
||||||
|
let fromSelf = false;
|
||||||
|
|
||||||
const resize = () => {
|
const resize = () => {
|
||||||
calHeight();
|
calHeight();
|
||||||
@ -89,6 +90,7 @@ function scroll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onUpdated(() => {
|
onUpdated(() => {
|
||||||
|
if (fromSelf) return;
|
||||||
now = props.now ?? now;
|
now = props.now ?? now;
|
||||||
content.style.transition = `${cssTarget} 0.2s ease-out`;
|
content.style.transition = `${cssTarget} 0.2s ease-out`;
|
||||||
calHeight();
|
calHeight();
|
||||||
@ -105,7 +107,6 @@ function canvasDrag(x: number, y: number) {
|
|||||||
last = d;
|
last = d;
|
||||||
if (ctx.canvas[canvasAttr] < total * scale)
|
if (ctx.canvas[canvasAttr] < total * scale)
|
||||||
now += ((dy * total) / ctx.canvas[canvasAttr]) * scale;
|
now += ((dy * total) / ctx.canvas[canvasAttr]) * scale;
|
||||||
content.style.transition = '';
|
|
||||||
scroll();
|
scroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +116,6 @@ function contentDrag(x: number, y: number) {
|
|||||||
const dy = d - contentLast;
|
const dy = d - contentLast;
|
||||||
contentLast = d;
|
contentLast = d;
|
||||||
if (ctx.canvas[canvasAttr] < total * scale) now -= dy;
|
if (ctx.canvas[canvasAttr] < total * scale) now -= dy;
|
||||||
content.style.transition = '';
|
|
||||||
scroll();
|
scroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,10 +149,13 @@ onMounted(() => {
|
|||||||
canvas,
|
canvas,
|
||||||
canvasDrag,
|
canvasDrag,
|
||||||
(x, y) => {
|
(x, y) => {
|
||||||
|
fromSelf = true;
|
||||||
last = props.type === 'horizontal' ? x : y;
|
last = props.type === 'horizontal' ? x : y;
|
||||||
|
content.style.transition = '';
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
setTimeout(() => emits('update:drag', false));
|
setTimeout(() => emits('update:drag', false));
|
||||||
|
fromSelf = false;
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -162,15 +165,19 @@ onMounted(() => {
|
|||||||
content,
|
content,
|
||||||
contentDrag,
|
contentDrag,
|
||||||
(x, y) => {
|
(x, y) => {
|
||||||
|
fromSelf = true;
|
||||||
contentLast = props.type === 'horizontal' ? x : y;
|
contentLast = props.type === 'horizontal' ? x : y;
|
||||||
|
content.style.transition = '';
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
setTimeout(() => emits('update:drag', false));
|
setTimeout(() => emits('update:drag', false));
|
||||||
|
fromSelf = false;
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
useWheel(content, (x, y) => {
|
useWheel(content, (x, y) => {
|
||||||
|
fromSelf = true;
|
||||||
const d = x !== 0 ? x : y;
|
const d = x !== 0 ? x : y;
|
||||||
if (Math.abs(d) > 50) {
|
if (Math.abs(d) > 50) {
|
||||||
content.style.transition = `${cssTarget} 0.2s ease-out`;
|
content.style.transition = `${cssTarget} 0.2s ease-out`;
|
||||||
@ -179,6 +186,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
now += d;
|
now += d;
|
||||||
scroll();
|
scroll();
|
||||||
|
fromSelf = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue';
|
|||||||
import EnemyCritical from '../panel/enemyCritical.vue';
|
import EnemyCritical from '../panel/enemyCritical.vue';
|
||||||
import { KeyCode } from '../plugin/keyCodes';
|
import { KeyCode } from '../plugin/keyCodes';
|
||||||
import { keycode } from '../plugin/utils';
|
import { keycode } from '../plugin/utils';
|
||||||
|
import { sleep } from 'mutate-animate';
|
||||||
|
|
||||||
const enemy = core.plugin.bookDetailEnemy;
|
const enemy = core.plugin.bookDetailEnemy;
|
||||||
const top = ref(core.plugin.bookDetailPos);
|
const top = ref(core.plugin.bookDetailPos);
|
||||||
@ -81,7 +82,7 @@ function key(e: KeyboardEvent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
top.value = 0;
|
top.value = 0;
|
||||||
detail = document.getElementById('detail') as HTMLDivElement;
|
detail = document.getElementById('detail') as HTMLDivElement;
|
||||||
detail.style.opacity = '1';
|
detail.style.opacity = '1';
|
||||||
@ -91,6 +92,8 @@ onMounted(() => {
|
|||||||
let moved = false;
|
let moved = false;
|
||||||
let pos = [0, 0];
|
let pos = [0, 0];
|
||||||
|
|
||||||
|
await sleep(600);
|
||||||
|
|
||||||
useDrag(
|
useDrag(
|
||||||
detail,
|
detail,
|
||||||
(x, y) => {
|
(x, y) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user