-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from Gahara-Editor/feat/search-inserted-clips-…
…in-timeline feat: enhance search list functionality
- Loading branch information
Showing
11 changed files
with
325 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script lang="ts"> | ||
import { isVideo, isVideoNode } from "../lib/utils"; | ||
import { searchListstore } from "../stores"; | ||
import VideoNodeItem from "./VideoNodeItem.svelte"; | ||
import VideoItem from "./VideoItem.svelte"; | ||
const { activeList, searchIdx } = searchListstore; | ||
</script> | ||
|
||
<div | ||
id="content-wrap" | ||
class="z-10 bg-gblue0 min-h-[40vh] max-h-[40vh] min-w-[60vw] max-w-[60vw] rounded border-white border-2 p-2 overflow-y-scroll" | ||
> | ||
<div id="video-clip-list"> | ||
<h1 class="text-center font-semibold text-lg">Results</h1> | ||
<ul class="divide-y divide-gray-200 text-white"> | ||
{#each $activeList as item, idx} | ||
{#if isVideo(item)} | ||
<VideoItem {item} {idx} selected={idx === $searchIdx} /> | ||
{:else if isVideoNode(item)} | ||
<VideoNodeItem {item} {idx} selected={idx === $searchIdx} /> | ||
{/if} | ||
{/each} | ||
</ul> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script lang="ts"> | ||
import { searchListstore } from "../stores"; | ||
import type { main } from "../../wailsjs/go/models"; | ||
import { scrollVertical } from "../lib/searchlist"; | ||
export let idx: number; | ||
export let item: main.Video; | ||
export let selected: boolean; | ||
let el: HTMLLIElement = null; | ||
const { setSearchIdx } = searchListstore; | ||
$: if (selected && el) { | ||
scrollVertical(el); | ||
} | ||
</script> | ||
|
||
{#if selected} | ||
<li class=" bg-obsternary p-2 truncate rounded-md" bind:this={el}> | ||
<span class="text-teal font-semibold">></span> | ||
<span class="font-semibold text-gyellow">[CLIP]</span> | ||
{item.name} | ||
</li> | ||
{:else} | ||
<li | ||
class=" bg-obsbg p-2 truncate rounded-md" | ||
on:click={() => setSearchIdx(idx)} | ||
> | ||
<span class="font-semibold text-gyellow">[CLIP]</span> | ||
{item.name} | ||
</li> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script lang="ts"> | ||
import { searchListstore } from "../stores"; | ||
import type { video } from "wailsjs/go/models"; | ||
import { scrollVertical } from "../lib/searchlist"; | ||
export let idx: number; | ||
export let item: video.VideoNode; | ||
export let selected: boolean; | ||
let el: HTMLLIElement = null; | ||
const { setSearchIdx } = searchListstore; | ||
$: if (selected && el) { | ||
scrollVertical(el); | ||
} | ||
</script> | ||
|
||
{#if selected} | ||
<li class=" bg-obsternary p-2 truncate rounded-md" bind:this={el}> | ||
<span class="text-teal font-semibold">></span> | ||
<span class="font-semibold text-teal">[TIMELINE]</span> | ||
{item.name} | ||
</li> | ||
{:else} | ||
<li | ||
class=" bg-obsbg p-2 truncate rounded-md" | ||
on:click={() => setSearchIdx(idx)} | ||
> | ||
<span class="font-semibold text-teal">[TIMELINE]</span> | ||
{item.name} | ||
</li> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export function scrollVertical(node: HTMLLIElement) { | ||
const listContainer = document.getElementById("content-wrap"); | ||
const listRect = listContainer.getBoundingClientRect(); | ||
const nodeRect = node.getBoundingClientRect(); | ||
|
||
const isNodeVisible = | ||
nodeRect.top >= listRect.top && nodeRect.bottom <= listRect.bottom; | ||
|
||
if (!isNodeVisible) { | ||
const scrollY = nodeRect.top - listRect.top + listContainer.scrollTop; | ||
listContainer.scrollTo({ | ||
top: scrollY, | ||
behavior: "smooth", | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { toolingStore } from "../stores"; | ||
|
||
export function handleKeybindTrackClipMove() { | ||
const videoNodeDiv = document | ||
.getElementById(`track-0`) | ||
?.querySelector(`div:nth-child(${toolingStore.getCursorIdx() + 1})`) | ||
?.querySelector("div"); | ||
if (videoNodeDiv) { | ||
videoNodeDiv.click(); | ||
scrollToNode(videoNodeDiv); | ||
} | ||
} | ||
|
||
function scrollToNode(node: HTMLDivElement) { | ||
const timelineContainer = document.getElementById("timeline"); | ||
const timelineRect = timelineContainer.getBoundingClientRect(); | ||
const nodeRect = node.getBoundingClientRect(); | ||
|
||
const isNodeVisible = | ||
nodeRect.left >= timelineRect.left && nodeRect.right <= timelineRect.right; | ||
|
||
if (!isNodeVisible) { | ||
const scrollX = | ||
nodeRect.left - timelineRect.left + timelineContainer.scrollLeft; | ||
timelineContainer.scrollTo({ | ||
left: scrollX, | ||
behavior: "smooth", | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.