From b607eebcb709daee421aba4e19d7729e4766b974 Mon Sep 17 00:00:00 2001 From: V Date: Fri, 30 Jun 2023 15:50:56 +0200 Subject: [PATCH] ImageZoom: Add square lens option --- .../imageZoom/components/Magnifier.tsx | 5 +++- src/plugins/imageZoom/index.tsx | 24 +++++++++++++++---- src/plugins/imageZoom/styles.css | 6 ++++- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/plugins/imageZoom/components/Magnifier.tsx b/src/plugins/imageZoom/components/Magnifier.tsx index 4e5b66794..6a3fc05a0 100644 --- a/src/plugins/imageZoom/components/Magnifier.tsx +++ b/src/plugins/imageZoom/components/Magnifier.tsx @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +import { classNameFactory } from "@api/Styles"; import { FluxDispatcher, React, useRef, useState } from "@webpack/common"; import { ELEMENT_ID } from "../constants"; @@ -33,6 +34,8 @@ export interface MagnifierProps { instance: any; } +const cl = classNameFactory("vc-imgzoom-"); + export const Magnifier: React.FC = ({ instance, size: initialSize, zoom: initalZoom }) => { const [ready, setReady] = useState(false); @@ -156,7 +159,7 @@ export const Magnifier: React.FC = ({ instance, size: initialSiz return (
() => { children.push( - {/* thanks SpotifyControls */} + { + settings.store.square = !settings.store.square; + ContextMenu.close(); + }} + /> ( () => { )} /> ( () => { )} /> ( img { +.vc-imgzoom-square { + border-radius: 0; +} + +.vc-imgzoom-nearest-neighbor > img { image-rendering: pixelated; /* https://googlechrome.github.io/samples/image-rendering-pixelated/index.html */ }