fix(web): restore timeline scroll when the asset id cannot be resolved (#30916)
Co-authored-by: Daniel Dietzler <mail@ddietzler.dev> Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>
This commit is contained in:
co-authored by
Daniel Dietzler
Daniel Dietzler
parent
f46e107d16
commit
05e84dd5db
@@ -210,13 +210,13 @@
|
||||
}
|
||||
const scrollTarget = assetViewerManager.gridScrollTarget?.at;
|
||||
const scrolled = scrollTarget ? await scrollAndLoadAsset(scrollTarget) : false;
|
||||
if (!scrolled) {
|
||||
// if the asset is not found, scroll to the top
|
||||
timelineManager.scrollTo(0);
|
||||
} else if (scrollTarget) {
|
||||
if (scrolled && scrollTarget) {
|
||||
await tick();
|
||||
focusAsset(scrollTarget);
|
||||
} else {
|
||||
timelineManager.scrollTo(lastVisibleScrollTop);
|
||||
}
|
||||
|
||||
invisible = false;
|
||||
};
|
||||
|
||||
@@ -224,6 +224,9 @@
|
||||
let initialLoadWasAssetViewer: boolean | null = null;
|
||||
// only modified in beforeNavigate()
|
||||
let hasNavigatedToOrFromAssetViewer: boolean = false;
|
||||
// The layout sets `display: none` on this subtree while the viewer is open.
|
||||
// Browsers drop the scroll offset of a hidden element.
|
||||
let lastVisibleScrollTop = 0;
|
||||
|
||||
// beforeNavigate is only called AFTER a svelte route has already been loaded
|
||||
// and a new route is being navigated to. It will never be called on direct
|
||||
@@ -309,6 +312,9 @@
|
||||
if (!scrollableElement) {
|
||||
return;
|
||||
}
|
||||
if (!assetViewerManager.isViewing) {
|
||||
lastVisibleScrollTop = scrollableElement.scrollTop;
|
||||
}
|
||||
|
||||
if (timelineManager.limitedScroll) {
|
||||
// edge case - scroll limited due to size of content, must adjust - use the overall percent instead
|
||||
|
||||
Reference in New Issue
Block a user