Update function and translation

This commit is contained in:
Nayam Amarshe
2024-10-04 14:42:03 +05:30
parent 31aa0f91e1
commit 4b29d4b012
3 changed files with 42 additions and 30 deletions

View File

@@ -1,5 +1,31 @@
import React, { useRef, useState } from "react";
const LensImage = ({
src,
alt,
lensPosition,
zoomAmount,
}: {
src: string;
alt: string;
lensPosition: { x: number; y: number };
zoomAmount: number;
}) => (
<div className="h-full w-full overflow-hidden">
<img
src={src}
alt={alt}
className="h-full w-full"
style={{
objectFit: "contain",
objectPosition: `${-lensPosition.x}px ${-lensPosition.y}px`,
transform: `scale(${zoomAmount / 100})`,
transformOrigin: "top left",
}}
/>
</div>
);
const LensViewer = ({
zoomAmount,
lensSize,
@@ -53,32 +79,18 @@ const LensViewer = ({
}}
>
<div className="flex h-full w-full">
<div className="h-full w-full overflow-hidden">
<img
src={"file:///" + sanitizedImagePath}
alt="Original"
className="h-full w-full"
style={{
objectFit: "contain",
objectPosition: `${-lensPosition.x}px ${-lensPosition.y}px`,
transform: `scale(${parseInt(zoomAmount) / 100})`,
transformOrigin: "top left",
}}
/>
</div>
<div className="h-full w-full overflow-hidden">
<img
src={"file:///" + sanitizedUpscaledImagePath}
alt="Upscaled"
className="h-full w-full"
style={{
objectFit: "contain",
objectPosition: `${-lensPosition.x}px ${-lensPosition.y}px`,
transform: `scale(${parseInt(zoomAmount) / 100})`,
transformOrigin: "top left",
}}
/>
</div>
<LensImage
src={"file:///" + sanitizedImagePath}
alt="Original"
lensPosition={lensPosition}
zoomAmount={parseInt(zoomAmount)}
/>
<LensImage
src={"file:///" + sanitizedUpscaledImagePath}
alt="Upscaled"
lensPosition={lensPosition}
zoomAmount={parseInt(zoomAmount)}
/>
</div>
<div className="absolute bottom-0 left-0 flex w-full items-center justify-around bg-black bg-opacity-50 p-1 px-2 text-center text-xs text-white backdrop-blur-sm">
<span>Original</span>

View File

@@ -127,8 +127,8 @@
"FROM_TITLE": "Увеличить с ",
"TO_TITLE": " до ",
"NO_OUTPUT_FOLDER_ALERT": "Пожалуйста, сначала выберите папку вывода",
"START_BUTTON_TITLE": "Увеличить",
"IN_PROGRESS_BUTTON_TITLE": "Увеличение⏳"
"START_BUTTON_TITLE": "Увеличить 🚀",
"IN_PROGRESS_BUTTON_TITLE": "Увеличение ⏳"
},
"IMAGE_OPTIONS": {
"RESET_BUTTON_TITLE": "Сбросить изображение",

View File

@@ -127,8 +127,8 @@
"FROM_TITLE": "从 ",
"TO_TITLE": " 升图到 ",
"NO_OUTPUT_FOLDER_ALERT": "请先选择一个输出文件夹",
"START_BUTTON_TITLE": "升图!",
"IN_PROGRESS_BUTTON_TITLE": "正在升图⏳"
"START_BUTTON_TITLE": "升图!🚀",
"IN_PROGRESS_BUTTON_TITLE": "正在升图 ⏳"
},
"IMAGE_OPTIONS": {
"RESET_BUTTON_TITLE": "重置图片",