From 9b33efcbfa0e989e566fe7402b3ef498f6941878 Mon Sep 17 00:00:00 2001 From: Shea Date: Fri, 5 Jun 2026 07:33:53 +0300 Subject: [PATCH] implement 'smart' pixelation in chat Signed-off-by: Shea --- .changeset/change-pixelation-behavior.md | 5 +++++ src/app/components/RenderMessageContent.tsx | 4 ++-- src/app/components/image-viewer/ImageViewer.tsx | 4 +--- src/app/components/media/Image.tsx | 9 ++++++--- src/app/components/url-preview/UrlPreviewCard.tsx | 1 + src/app/state/settings.ts | 2 +- 6 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 .changeset/change-pixelation-behavior.md diff --git a/.changeset/change-pixelation-behavior.md b/.changeset/change-pixelation-behavior.md new file mode 100644 index 000000000..b5d53bbfe --- /dev/null +++ b/.changeset/change-pixelation-behavior.md @@ -0,0 +1,5 @@ +--- +default: patch +--- + +Change image rendering to allow enabling anti-aliasing in the image viewer diff --git a/src/app/components/RenderMessageContent.tsx b/src/app/components/RenderMessageContent.tsx index c28004fa5..9fdcdedac 100644 --- a/src/app/components/RenderMessageContent.tsx +++ b/src/app/components/RenderMessageContent.tsx @@ -359,11 +359,11 @@ function RenderMessageContentInternal({ if (isGif && !autoplayGifs && p.src) { return ( - + ); } - return ; + return ; }} renderViewer={(p) => } /> diff --git a/src/app/components/image-viewer/ImageViewer.tsx b/src/app/components/image-viewer/ImageViewer.tsx index 501e190ce..573ef0cfa 100644 --- a/src/app/components/image-viewer/ImageViewer.tsx +++ b/src/app/components/image-viewer/ImageViewer.tsx @@ -28,8 +28,6 @@ export const ImageViewer = as<'div', ImageViewerProps>( const [isPixelated, setIsPixelated] = useState( isPixelatedRendering(pixelatedImageRendering, info) ); - // oxlint-disable-next-line no-console - console.log(info); const { transforms, @@ -98,7 +96,7 @@ export const ImageViewer = as<'div', ImageViewerProps>( radii="Pill" onClick={() => setIsPixelated(!isPixelated)} aria-label="Toggle Pixelation" - title={`Turn ${isPixelated ? 'Antialiasing' : 'Pixelation'} on`} + title={`Turn ${isPixelated ? 'Anti-aliasing' : 'Pixelation'} on`} > diff --git a/src/app/components/media/Image.tsx b/src/app/components/media/Image.tsx index 3dc8b71ab..389bbf810 100644 --- a/src/app/components/media/Image.tsx +++ b/src/app/components/media/Image.tsx @@ -4,16 +4,19 @@ import classNames from 'classnames'; import { useSetting } from '$state/hooks/settings'; import { isPixelatedRendering, settingsAtom } from '$state/settings'; import * as css from './media.css'; +import type { IImageInfo } from '$types/matrix/common'; -export const Image = forwardRef>( - ({ className, alt, ...props }, ref) => { +type ImageProps = ImgHTMLAttributes & { info?: IImageInfo }; + +export const Image = forwardRef( + ({ className, alt, info, ...props }, ref) => { const [pixelatedImageRendering] = useSetting(settingsAtom, 'pixelatedImageRendering'); return ( {alt} } renderImage={(p) => (