22 lines
531 B
TypeScript
22 lines
531 B
TypeScript
import type { Bookmark } from "@/timeline";
|
|
import type { SnapPoint } from "@/timeline/snapping";
|
|
import type { MediaTime } from "@/wasm";
|
|
|
|
export function getBookmarkSnapPoints({
|
|
bookmarks,
|
|
excludeBookmarkTime,
|
|
}: {
|
|
bookmarks: Bookmark[];
|
|
excludeBookmarkTime?: MediaTime;
|
|
}): SnapPoint[] {
|
|
return bookmarks.flatMap((bookmark) => {
|
|
if (excludeBookmarkTime != null && bookmark.time === excludeBookmarkTime) {
|
|
return [];
|
|
}
|
|
|
|
return [
|
|
{ time: bookmark.time, type: "bookmark" satisfies SnapPoint["type"] },
|
|
];
|
|
});
|
|
}
|