diff --git a/renderer/components/ImageOptions.tsx b/renderer/components/ImageOptions.tsx index 97d2751..68db807 100644 --- a/renderer/components/ImageOptions.tsx +++ b/renderer/components/ImageOptions.tsx @@ -3,9 +3,13 @@ import React from "react"; const ImageOptions = ({ zoomAmount, setZoomAmount, + leftImageRef, + rightImageRef, }: { - zoomAmount: number; + zoomAmount: string; setZoomAmount: (arg: any) => void; + leftImageRef: React.RefObject; + rightImageRef: React.RefObject; }) => { const [zoomLevel, setZoomLevel] = React.useState("125"); @@ -42,27 +46,40 @@ const ImageOptions = ({

Zoom:

- + + + -
-
-

Position:

- - - -
diff --git a/renderer/pages/index.tsx b/renderer/pages/index.tsx index 3b4e297..7a55d44 100644 --- a/renderer/pages/index.tsx +++ b/renderer/pages/index.tsx @@ -13,6 +13,7 @@ import RightPaneInfo from "../components/RightPaneInfo"; import ImageOptions from "../components/ImageOptions"; import LeftPaneVideoSteps from "../components/LeftPaneVideoSteps"; import LeftPaneImageSteps from "../components/LeftPaneImageSteps"; +import { TransformComponent, TransformWrapper } from "react-zoom-pan-pinch"; const Home = () => { // STATES @@ -34,7 +35,12 @@ const Home = () => { const [doubleUpscaylCounter, setDoubleUpscaylCounter] = useState(0); const [gpuId, setGpuId] = useState(""); const [saveImageAs, setSaveImageAs] = useState("png"); - const [zoomAmount, setZoomAmount] = useState(""); + const [zoomAmount, setZoomAmount] = useState("200%"); + const [backgroundPosition, setBackgroundPosition] = useState("0% 0%"); + + // REFS + const leftImageRef = useRef(); + const rightImageRef = useRef(); // EFFECTS useEffect(() => { @@ -185,6 +191,13 @@ const Home = () => { }; // HANDLERS + const handleMouseMove = (e) => { + const { left, top, width, height } = e.target.getBoundingClientRect(); + const x = ((e.pageX - left) / width) * 100; + const y = ((e.pageY - top) / height) * 100; + setBackgroundPosition(`${x}% ${y}%`); + }; + const selectVideoHandler = async () => { resetImagePaths(); @@ -521,6 +534,8 @@ const Home = () => { {

Original

- } @@ -543,17 +563,21 @@ const Home = () => {

Upscayled

- } - className="h-screen" + className="group h-screen" /> )} diff --git a/tailwind.config.js b/tailwind.config.js index 96da9a8..b0d637f 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -4,9 +4,11 @@ module.exports = { "./renderer/components/**/*.{js,ts,jsx,tsx}", ], safelist: [ - { - pattern: /scale-/, - }, + "group-hover:scale-[100%]", + "group-hover:scale-[125%]", + "group-hover:scale-[150%]", + "group-hover:scale-[175%]", + "group-hover:scale-[200%]", ], theme: { extend: {