Keep timeline drags in place
This commit is contained in:
@@ -289,6 +289,7 @@ function configure(node) {
|
||||
let autocompleteRange = null;
|
||||
let promptFrame = null;
|
||||
let suggestionLayer = null;
|
||||
let encoder = null;
|
||||
const focusPrompt = () => {
|
||||
if (!prompt) return;
|
||||
try {
|
||||
@@ -341,7 +342,12 @@ function configure(node) {
|
||||
document.removeEventListener("mouseup", finish, true);
|
||||
promptText = retimePrompt(promptText ?? prompt?.value ?? clip.prompt ?? "", clip);
|
||||
commitPrompt(clip, promptText);
|
||||
render();
|
||||
// The timeline is already updated in place. Avoid rebuilding
|
||||
// the panel, which moves the textarea and canvas viewport.
|
||||
if (prompt) prompt.value = promptText;
|
||||
if (encoder) encoder.textContent = clip.slots
|
||||
.map((item, itemIndex) => `Shot ${itemIndex + 1} ${formatTime(item.start)}`)
|
||||
.join(" ");
|
||||
};
|
||||
const moveMouse = (event) => { if (dragging) move(event); };
|
||||
handle.onpointerdown = (event) => {
|
||||
@@ -591,7 +597,7 @@ function configure(node) {
|
||||
const checkLabel = el("div", "PROMPT CHECK"); checkLabel.style.cssText = "color:#8fa898;font-size:10px;letter-spacing:.08em;margin:7px 0 3px"; panel.append(checkLabel);
|
||||
const check = el("div", `${clip.slots.length} shot${clip.slots.length === 1 ? "" : "s"} · ${duration.toFixed(1)}s chunk · @ references preserved`); check.style.cssText = "padding:6px 8px;background:#171717;border:1px solid #444;border-radius:4px;color:#9bd0a8;font:11px monospace"; panel.append(check);
|
||||
const encoderLabel = el("div", "SENT TO ENCODER AS"); encoderLabel.style.cssText = "color:#8fa898;font-size:10px;letter-spacing:.08em;margin:7px 0 3px"; panel.append(encoderLabel);
|
||||
const encoder = el("div", clip.slots.map((slot, index) => `Shot ${index + 1} ${formatTime(slot.start)}`).join(" ")); encoder.style.cssText = "padding:6px 8px;background:#171717;border:1px solid #444;border-radius:4px;color:#7cc4d5;font:11px monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis"; panel.append(encoder);
|
||||
encoder = el("div", clip.slots.map((slot, index) => `Shot ${index + 1} ${formatTime(slot.start)}`).join(" ")); encoder.style.cssText = "padding:6px 8px;background:#171717;border:1px solid #444;border-radius:4px;color:#7cc4d5;font:11px monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis"; panel.append(encoder);
|
||||
const actions = el("div"); actions.style.cssText = "display:flex;gap:5px;margin-top:5px";
|
||||
const add = el("button", "@ Add shot"); add.type = "button"; add.onclick = () => { clip.prompt = prompt.value; syncPrompt(clip, clip.prompt); addSlot(clip); rebuildPromptAfterStructureChange(clip); setState(); render(); }; actions.append(add);
|
||||
if (clip.slots.length > 1) { const remove = el("button", "Remove last shot"); remove.type = "button"; remove.onclick = () => { clip.prompt = prompt.value; syncPrompt(clip, clip.prompt); clip.slots.pop(); clip.slots.at(-1).end = clip.duration; rebuildPromptAfterStructureChange(clip); setState(); render(); }; actions.append(remove); }
|
||||
|
||||
Reference in New Issue
Block a user