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