完成信标 bug 修复

This commit is contained in:
锦恢 2024-09-01 23:57:08 +08:00
parent 2953ea46c6
commit 93b54f4351
3 changed files with 15 additions and 16 deletions

View File

@ -3,6 +3,7 @@
<!-- <TimeScale></TimeScale> --> <!-- <TimeScale></TimeScale> -->
<div <div
class="vcd-render-wrapper" class="vcd-render-wrapper"
id="vcd-render-wrapper"
@mousedown="onMousedown()" @mousedown="onMousedown()"
@mouseup="onMouseup()" @mouseup="onMouseup()"
@mouseenter="onEnter()" @mouseenter="onEnter()"

View File

@ -23,7 +23,7 @@ import { eventHandler, registerWheelEvent } from '@/hook/wave-view';
import { computed, defineComponent, ref, onMounted } from 'vue'; import { computed, defineComponent, ref, onMounted } from 'vue';
import { calcCursorLeft, MovingPivot } from './cursor'; import { calcCursorLeft, MovingPivot } from './cursor';
import formatTime from '@/hook/wave-view/format-time'; import formatTime from '@/hook/wave-view/format-time';
import { getNearestUserPivot } from './pivot-view'; import { getNearestUserPivot, UserPivots } from './pivot-view';
defineComponent({ name: 'user-pivot' }); defineComponent({ name: 'user-pivot' });
const element = ref(null); const element = ref(null);
@ -61,6 +61,13 @@ function onMousemove(event) {
MovingPivot.label = formatTime(currentT, timescale); MovingPivot.label = formatTime(currentT, timescale);
MovingPivot.left = calcCursorLeft(currentT); MovingPivot.left = calcCursorLeft(currentT);
const pivot = UserPivots.get(currentT);
if (pivot !== undefined) {
MovingPivot.show = false;
MovingPivot.currentTakenPivot = pivot;
return;
}
if (MovingPivot.currentTakenPivot !== undefined) { if (MovingPivot.currentTakenPivot !== undefined) {
return; return;
} }

View File

@ -126,7 +126,6 @@ const vline = reactive({
dragEnable: false, dragEnable: false,
element: undefined, element: undefined,
originTime: 0, originTime: 0,
delayTag: false,
}); });
@ -155,11 +154,9 @@ function onVLineMousedown() {
// console.log('begin to drag'); // console.log('begin to drag');
mousemoveEventPipes.set(pivot.id, event => { mousemoveEventPipes.set(pivot.id, event => {
if (vline.dragEnable === false || vline.delayTag === true) { if (vline.dragEnable === false) {
return; return;
} }
console.log('move pivot', vline);
const x = event.clientX || event.x; const x = event.clientX || event.x;
pivot.x = x; pivot.x = x;
const pstate = globalLookup.pstate; const pstate = globalLookup.pstate;
@ -172,16 +169,6 @@ function onVLineMousedown() {
}); });
} }
document.onmouseup = () => {
vline.delayTag = true;
console.log('mouse up');
console.log(vline);
setTimeout(() => {
vline.delayTag = false;
}, 300);
onVLineMouseup();
}
function onVLineMouseup() { function onVLineMouseup() {
MovingPivot.dragEnable = false; MovingPivot.dragEnable = false;
mousemoveEventPipes.delete(props.id); mousemoveEventPipes.delete(props.id);
@ -239,6 +226,10 @@ function displayRelativeAxis() {
onMounted(() => { onMounted(() => {
UserPivotCtxShows.set(props.id, false); UserPivotCtxShows.set(props.id, false);
const wrapper = document.getElementById('vcd-render-wrapper');
if (wrapper instanceof HTMLElement) {
wrapper.addEventListener('mouseup', onVLineMouseup);
}
}); });
</script> </script>