mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
fix(studio): only seek layers on selection (#790)
This commit is contained in:
@@ -103,13 +103,6 @@ export const LayersPanel = memo(function LayersPanel() {
|
||||
}
|
||||
}, [compositionLoading, collectLayers]);
|
||||
|
||||
useEffect(() => {
|
||||
const ref = hoverSeekTimerRef;
|
||||
return () => {
|
||||
if (ref.current) clearTimeout(ref.current);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const resolveSelection = useCallback(
|
||||
(layer: DomEditLayerItem) =>
|
||||
resolveDomEditSelection(layer.element, {
|
||||
@@ -120,8 +113,6 @@ export const LayersPanel = memo(function LayersPanel() {
|
||||
[activeCompPath, isMasterView],
|
||||
);
|
||||
|
||||
const hoverSeekTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const seekToLayer = useCallback(
|
||||
(layer: DomEditLayerItem) => {
|
||||
const selection = resolveSelection(layer);
|
||||
@@ -169,17 +160,13 @@ export const LayersPanel = memo(function LayersPanel() {
|
||||
const handleLayerHover = useCallback(
|
||||
(layer: DomEditLayerItem | null) => {
|
||||
if (!layer) {
|
||||
if (hoverSeekTimerRef.current) clearTimeout(hoverSeekTimerRef.current);
|
||||
updateDomEditHoverSelection(null);
|
||||
return;
|
||||
}
|
||||
const selection = resolveSelection(layer);
|
||||
updateDomEditHoverSelection(selection);
|
||||
// Debounce hover seeks so brushing past items doesn't thrash the player
|
||||
if (hoverSeekTimerRef.current) clearTimeout(hoverSeekTimerRef.current);
|
||||
hoverSeekTimerRef.current = setTimeout(() => seekToLayer(layer), 300);
|
||||
},
|
||||
[resolveSelection, updateDomEditHoverSelection, seekToLayer],
|
||||
[resolveSelection, updateDomEditHoverSelection],
|
||||
);
|
||||
|
||||
const toggleCollapse = useCallback((key: string, e: React.MouseEvent) => {
|
||||
|
||||
Reference in New Issue
Block a user