From fbe3143ff61c828f2e5b61a870985f0921d56dee Mon Sep 17 00:00:00 2001
From: Nayam Amarshe <25067102+NayamAmarshe@users.noreply.github.com>
Date: Wed, 30 Oct 2024 20:18:32 +0530
Subject: [PATCH] Fix lens
---
.../components/main-content/lens-view.tsx | 113 ++++++------------
1 file changed, 39 insertions(+), 74 deletions(-)
diff --git a/renderer/components/main-content/lens-view.tsx b/renderer/components/main-content/lens-view.tsx
index b11f6ff..74b991f 100644
--- a/renderer/components/main-content/lens-view.tsx
+++ b/renderer/components/main-content/lens-view.tsx
@@ -1,31 +1,5 @@
import React, { useRef, useState } from "react";
-const LensImage = ({
- src,
- alt,
- lensPosition,
- zoomAmount,
-}: {
- src: string;
- alt: string;
- lensPosition: { x: number; y: number };
- zoomAmount: number;
-}) => (
-
-
-
-);
-
const LensViewer = ({
zoomAmount,
lensSize,
@@ -38,9 +12,9 @@ const LensViewer = ({
sanitizedUpscaledImagePath: string;
}) => {
const [hoverPosition, setHoverPosition] = useState({ x: 0, y: 0 });
- const [isHovering, setIsHovering] = useState(false);
+ const zoomLevel = 4; // Adjust zoom level as needed
- const handleMouseMove = (e) => {
+ const handleMouseMove = (e: React.MouseEvent) => {
const { left, top, width, height } =
e.currentTarget.getBoundingClientRect();
const x = ((e.clientX - left) / width) * 100;
@@ -49,74 +23,65 @@ const LensViewer = ({
setHoverPosition({ x, y });
};
- const handleMouseEnter = () => setIsHovering(true);
- const handleMouseLeave = () => setIsHovering(false);
-
const originalImage = "file:///" + sanitizedImagePath;
const upscaledImage = "file:///" + sanitizedUpscaledImagePath;
return (
-
+
{/* Main image container */}
- {isHovering && (
-
- )}
+
{/* Enlarged views for original and upscaled images */}
- {isHovering && (
+
-
-
- Original
-
-
-
-
- AI Upscaled
-
-
+
+ Original
+
- )}
+
+
+ AI Upscaled
+
+
+
);
};