Skip to content

Commit

Permalink
added saving to previous and deletions
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Feb 13, 2025
1 parent f6b847a commit 5f9764c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
let shiftKeyIsDown = $state(false);
let lastAssetMouseEvent: AssetResponseDto | null = $state(null);
// loads in savedIndex
// loads in savedIndex from localStorage
const savedIndex = localStorage.getItem('galleryViewerIndex');
if (savedIndex) {
currentViewAssetIndex = parseInt(savedIndex);
Expand Down Expand Up @@ -219,13 +219,13 @@
} else {
currentViewAssetIndex = currentViewAssetIndex + 1;
asset = currentViewAssetIndex < assets.length ? assets[currentViewAssetIndex] : undefined;
localStorage.setItem('galleryViewerIndex', currentViewAssetIndex.toString());
}
if (!asset) {
return false;
}
localStorage.setItem('galleryViewerIndex', currentViewAssetIndex.toString());
await navigateToAsset(asset);
return true;
} catch (error) {
Expand Down Expand Up @@ -266,6 +266,7 @@
} else {
currentViewAssetIndex = currentViewAssetIndex - 1;
asset = currentViewAssetIndex >= 0 ? assets[currentViewAssetIndex] : undefined;
localStorage.setItem('galleryViewerIndex', currentViewAssetIndex.toString());
}
if (!asset) {
Expand Down Expand Up @@ -302,6 +303,7 @@
await handlePrevious();
} else {
setAsset(assets[currentViewAssetIndex]);
localStorage.setItem('galleryViewerIndex', currentViewAssetIndex.toString());
}
break;
}
Expand Down

0 comments on commit 5f9764c

Please sign in to comment.