Skip to content

Commit

Permalink
context-menu: allow cuting start and end
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Nov 11, 2023
1 parent a61a3b3 commit d616a31
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
11 changes: 10 additions & 1 deletion src/components/TimeGraphComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@
bb.cutEntries(tl.windowHoverIndex);
contextMenu.show = false;
"
>Cut Here</a
>Stat Cut Here</a
>
</li>
<li>
<a
@click="
bb.cutEntries(0, tl.windowHoverIndex);
contextMenu.show = false;
"
>End Cut Here</a
>
</li>
</ul>
Expand Down
13 changes: 7 additions & 6 deletions src/stores/blackbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ export function unitBlackbox(field: BlackboxFieldDef) {
}

function processEntries(entries: any[], fields: BlackboxFieldDef[]) {
const rawEntries = entries.filter((entry: any[], index: number) => {
let lastEntry: any[];
const rawEntries = entries.map((entry: any[]) => {
if (entry.length != fields.length) {
console.warn("invalid entry at", index, "of", entries.length);
return false;
//console.warn("invalid entry at", index, "of", entries.length, entry);
return lastEntry;
}
return true;
return (lastEntry = entry);
});

const startLoop = rawEntries[0][0];
Expand Down Expand Up @@ -230,9 +231,9 @@ export const useBlackboxStore = defineStore("blackbox", {
const spectrum = useSpectrumStore();
spectrum.initSpectrum();
},
cutEntries(end: number) {
cutEntries(start = 0, end = -1) {
for (const key of Object.keys(this.entries)) {
this.entries[key] = this.entries[key].slice(0, end);
this.entries[key] = this.entries[key].slice(start, end);
}

this.duration =
Expand Down

0 comments on commit d616a31

Please sign in to comment.