π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
wasd
Manav Rathif487e64569ad
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsxindex 263ba87942..def19937f3 100644--- a/web/packages/gallery/components/viewer/FileViewer.tsx+++ b/web/packages/gallery/components/viewer/FileViewer.tsx@@ -900,12 +900,13 @@ const Shortcuts: React.FC<ModalVisibilityProps> = ({ open, onClose }) => (<ShortcutsContent sx={{ "&&": { pt: 2, pb: 5, px: 5 } }}><Shortcut action="Close" shortcut="Esc" /><Shortcut action="Previous, Next" shortcut="β, β" />- <Shortcut action="Zoom" shortcut="Mouse scroll" />+ <Shortcut action="Zoom" shortcut="Mouse scroll, Pinch" /><Shortcut action="Zoom preset" shortcut="Z, Tap inside image" /><Shortcut action="Toggle controls" shortcut="Tap outside image" />+ <Shortcut action="Pan" shortcut="WASD, Drag" /><Shortcut action="Toggle favorite" shortcut="L" /><Shortcut action="View info" shortcut="I" />- <Shortcut action="Download" shortcut="D" />+ <Shortcut action="Download" shortcut="^D, βD" /><Shortcut action="Delete" shortcut="Delete, Backspace" /><Shortcut action="Copy as PNG" shortcut="^C, βC" /><Shortcut action="Toggle fullscreen" shortcut="F" />diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.tsindex 5f4bb1bbe0..dcb19baafb 100644--- a/web/packages/gallery/components/viewer/photoswipe.ts+++ b/web/packages/gallery/components/viewer/photoswipe.ts@@ -701,6 +701,24 @@ export class FileViewerPhotoSwipe {return element;});+ // Pan action handlers++ const panner = (key: "w" | "a" | "s" | "d") => () => {+ const slide = pswp.currSlide;+ const d = 80;+ switch (key) {+ case "w":+ slide.pan.y -= d;+ case "a":+ slide.pan.x += d;+ case "s":+ slide.pan.x += d;+ case "d":+ slide.pan.y += d;+ }+ slide.panTo(slide.pan.x, slide.pan.y);+ };+// Some actions routed via the delegateconst handleDelete = () => delegate.performKeyAction("delete");@@ -710,21 +728,44 @@ export class FileViewerPhotoSwipe {const handleToggleFullscreen = () =>delegate.performKeyAction("toggle-fullscreen");- pswp.on("keydown", (e, z) => {- const key = e.originalEvent.key ?? "";- const cb = (() => {- switch (key.toLowerCase()) {- case "l":- return handleToggleFavoriteIfEnabled;+ pswp.on("keydown", (_e) => {+ const e: KeyboardEvent = _e.originalEvent;++ // Even though we ignore shift, Caps lock might still be on.+ const key = e.key.toLowerCase();++ let cb: (() => void) | undefined;+ if (e.shiftKey || e.altKey || e.metaKey) {+ // ignore+ } else if (e.ctrlKey) {+ switch (key) {case "d":- return handleDownloadIfEnabled;+ cb = handleDownloadIfEnabled;+ break;+ case "c":+ cb = handleCopy;+ break;+ }+ } else {+ switch (key) {+ case "w":+ case "a":+ case "s":+ case "d":+ cb = panner(key);+ break;+ case "l":+ cb = handleToggleFavoriteIfEnabled;+ break;case "i":- return handleViewInfo;+ cb = handleViewInfo;+ break;case "f":- return handleToggleFullscreen;+ cb = handleToggleFullscreen;+ break;}- return undefined;- })();+ }+cb?.();});