完成信标 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> -->
<div
class="vcd-render-wrapper"
id="vcd-render-wrapper"
@mousedown="onMousedown()"
@mouseup="onMouseup()"
@mouseenter="onEnter()"

View File

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

View File

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