feat(studio): highlight timeline selection sets

Render selected styling from selectedElementIds in the timeline.

Sync the set into preview group selection boxes without collapsing the anchor.
This commit is contained in:
Miguel Angel Simon Sierra
2026-07-09 16:54:34 -04:00
parent cca31feffe
commit 1d858f004d
8 changed files with 363 additions and 4 deletions
+17 -1
View File
@@ -24,6 +24,7 @@ import {
type DomEditSelection,
} from "../components/editor/domEditing";
import { reapplyPositionEditsAfterSeek } from "../components/editor/manualEdits";
import { usePlayerStore } from "../player/store/playerStore";
// ── Types ──
@@ -537,7 +538,22 @@ export function useDomSelection({
timelineElements,
nextSelection.sourceFile || "index.html",
);
setSelectedTimelineElementId(nextTimelineId);
const nextTimelineIds = nextGroup
.map(
(selection) =>
findMatchingTimelineElementId(selection, timelineElements) ??
findTimelineIdByAncestor(
selection.element,
timelineElements,
selection.sourceFile || "index.html",
),
)
.filter((id): id is string => Boolean(id));
if (nextTimelineIds.length > 0) {
usePlayerStore.getState().setSelection(nextTimelineIds, nextTimelineId);
} else {
setSelectedTimelineElementId(null);
}
},
[applyDomSelection, timelineElements, setSelectedTimelineElementId],
);