修复 orderTimes 排序错误的问题 | 修复点击清除全部信标后,相对坐标轴不消失的问题

This commit is contained in:
锦恢 2024-11-17 22:46:30 +08:00
parent 2fd8e87162
commit c847eb5a83
5 changed files with 8 additions and 4 deletions

Binary file not shown.

View File

@ -56,7 +56,7 @@ export function createPivot(time) {
Id2Pivot.set(id, pivot); Id2Pivot.set(id, pivot);
orderedTimes.push(time); orderedTimes.push(time);
orderedTimes.sort((a, b) => a < b); orderedTimes.sort((a, b) => a - b);
} }
export function searchOrderedTimeIndex(time) { export function searchOrderedTimeIndex(time) {
@ -163,7 +163,6 @@ export function getNearestUserPivot(time) {
} }
const i = bisearch(orderedTimes, time); const i = bisearch(orderedTimes, time);
// console.log(i, orderedTimes, time);
if (i === pivotNum - 1) { if (i === pivotNum - 1) {
return UserPivots.get(orderedTimes[i]); return UserPivots.get(orderedTimes[i]);

View File

@ -197,7 +197,7 @@ function onVLineMouseup() {
UserPivots.delete(vline.originTime); UserPivots.delete(vline.originTime);
UserPivots.set(pivot.time, pivot); UserPivots.set(pivot.time, pivot);
orderedTimes.push(pivot.time); orderedTimes.push(pivot.time);
orderedTimes.sort((a, b) => a < b); orderedTimes.sort((a, b) => a - b);
} }
currentPivotId.value = 0; currentPivotId.value = 0;

View File

@ -107,6 +107,7 @@ import { clearAllPivot, makePivot, toBegin, toEnd, toNextChange, toPrevChange }
import { globalLookup } from '@/hook/global'; import { globalLookup } from '@/hook/global';
import { SystemPivot } from '../pivot/cursor'; import { SystemPivot } from '../pivot/cursor';
import { currentPivotId, Id2Pivot, orderedTimes, UserPivotCtxShows, UserPivots } from '../pivot/pivot-view'; import { currentPivotId, Id2Pivot, orderedTimes, UserPivotCtxShows, UserPivots } from '../pivot/pivot-view';
import { RelativeAxis } from '../pivot/relative-axis';
defineComponent({ name: 'cursor-location' }); defineComponent({ name: 'cursor-location' });
@ -116,11 +117,15 @@ const clearLocationDialogShow = ref(false);
function confirmClearLocation() { function confirmClearLocation() {
orderedTimes.length === 0; orderedTimes.length === 0;
UserPivots.clear(); UserPivots.clear();
Id2Pivot.clear(); Id2Pivot.clear();
currentPivotId.value = 0; currentPivotId.value = 0;
UserPivotCtxShows.clear(); UserPivotCtxShows.clear();
clearLocationDialogShow.value = false; clearLocationDialogShow.value = false;
//
RelativeAxis.show = false;
} }
</script> </script>

View File

@ -212,7 +212,7 @@ export function recoverSession(topModules) {
Id2Pivot.set(id, pivot); Id2Pivot.set(id, pivot);
orderedTimes.push(time); orderedTimes.push(time);
} }
orderedTimes.sort((a, b) => a < b); orderedTimes.sort((a, b) => a - b);
} }
// 恢复 treeviewExpands // 恢复 treeviewExpands