π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
feat: flip image
httpjamesmecfde69855bb
diff --git a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsxindex 83f57e070c..1946429c63 100644--- a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx+++ b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx@@ -24,6 +24,7 @@ import CloseIcon from '@mui/icons-material/Close';import RotateLeftIcon from '@mui/icons-material/RotateLeft';import RotateRightIcon from '@mui/icons-material/RotateRight';import { HorizontalFlex } from 'components/Container';+import FlipIcon from '@mui/icons-material/Flip';interface IProps {file: EnteFile;show: boolean;@@ -182,6 +183,31 @@ const ImageEditorOverlay = (props: IProps) => {};};+ const flipCanvas = (direction: 'vertical' | 'horizontal') => {+ const context = canvasRef.current?.getContext('2d');+ context.imageSmoothingEnabled = false;+ const canvas = canvasRef.current;+ if (!context || !canvas) return;+ const img = new Image();+ // img.src = fileURL;+ img.src = canvas.toDataURL();++ img.onload = () => {+ context.save();++ if (direction === 'vertical') {+ context.translate(canvas.width, 0);+ context.scale(-1, 1);+ } else {+ context.translate(0, canvas.height);+ context.scale(1, -1);+ }+ context.drawImage(img, 0, 0, canvas.width, canvas.height);++ context.restore();+ };+ };+const exportCanvasToBlob = (callback: (blob: Blob) => void) => {const canvas = canvasRef.current;if (!canvas) return new Blob();@@ -484,6 +510,28 @@ const ImageEditorOverlay = (props: IProps) => {label="Rotate Right 90Λ"/></MenuItemGroup>+ <MenuSectionTitle title={'Flip'} />+ <MenuItemGroup+ style={{+ marginBottom: '1rem',+ }}>+ <EnteMenuItem+ disabled={cropLoading}+ startIcon={<FlipIcon />}+ onClick={() => {+ flipCanvas('vertical');+ }}+ label="Flip Vertically"+ />+ <EnteMenuItem+ disabled={cropLoading}+ startIcon={<FlipIcon />}+ onClick={() => {+ flipCanvas('horizontal');+ }}+ label="Flip Horizontally"+ />+ </MenuItemGroup><MenuSectionTitle title={'Export'} /><MenuItemGroup>