From 3a82bf9ea6e073d95351ff7fddb08b9446b0f85e Mon Sep 17 00:00:00 2001 From: szbk Date: Tue, 11 Nov 2025 00:04:43 +0300 Subject: [PATCH] =?UTF-8?q?CropStep=20bile=C5=9Feninden=20gereksiz=20offse?= =?UTF-8?q?t=20alanlar=C4=B1n=C4=B1=20ve=20=C3=B6nizleme=20=C3=B6l=C3=A7e?= =?UTF-8?q?=C4=9Fini=20kald=C4=B1rarak=20kodu=20sadele=C5=9Ftirildi;=20Ocr?= =?UTF-8?q?Step=20bile=C5=9Fenine=20geli=C5=9Ftirme=20modunu=20kontrol=20e?= =?UTF-8?q?den=20bir=20de=C4=9Fi=C5=9Fken=20eklendi=20ve=20loglama=20i?= =?UTF-8?q?=C5=9Flemleri=20g=C3=BCncellendi;=20tema=20renkleri=20g=C3=BCnc?= =?UTF-8?q?ellendi.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CropStep.jsx | 63 +++---------------------------------- src/components/OcrStep.jsx | 9 ++++-- src/main.jsx | 6 ++-- 3 files changed, 14 insertions(+), 64 deletions(-) diff --git a/src/components/CropStep.jsx b/src/components/CropStep.jsx index 0dc98c0..6dc9391 100644 --- a/src/components/CropStep.jsx +++ b/src/components/CropStep.jsx @@ -4,16 +4,13 @@ import { Box, Button, Grid, - Slider, Stack, - TextField, Typography, } from '@mui/material'; import CheckCircleIcon from '@mui/icons-material/CheckCircle'; import { useNavigate } from 'react-router-dom'; import { useAppStore } from '../store/useAppStore'; -const offsetFields = ['top', 'bottom', 'left', 'right']; const MIN_SELECTION = 5; const DEFAULT_SELECTION = { top: 10, left: 10, width: 80, height: 80 }; @@ -44,12 +41,6 @@ const CropStep = () => { const [selectedImageId, setSelectedImageId] = useState( cropConfig?.referenceImageId || uploadedImages[0]?.id || null, ); - const [offsetValues, setOffsetValues] = useState({ - top: cropConfig?.top || 0, - bottom: cropConfig?.bottom || 0, - left: cropConfig?.left || 0, - right: cropConfig?.right || 0, - }); const [imageSize, setImageSize] = useState({ width: cropConfig?.imageWidth || 0, height: cropConfig?.imageHeight || 0, @@ -57,7 +48,6 @@ const CropStep = () => { const [selection, setSelection] = useState( cropConfig?.selection ? cropConfig.selection : DEFAULT_SELECTION, ); - const [previewScale, setPreviewScale] = useState(1); const [saved, setSaved] = useState(false); const containerRef = useRef(null); const dragInfoRef = useRef(null); @@ -92,12 +82,6 @@ const CropStep = () => { cropConfig?.imageWidth ) { setSelection(selectionFromConfig(cropConfig)); - setOffsetValues({ - top: cropConfig.top || 0, - bottom: cropConfig.bottom || 0, - left: cropConfig.left || 0, - right: cropConfig.right || 0, - }); setSaved(true); } else { setSelection(DEFAULT_SELECTION); @@ -215,13 +199,6 @@ const CropStep = () => { [stopDragging], ); - const handleOffsetChange = (field) => (event) => { - const value = Number(event.target.value) || 0; - setOffsetValues((prev) => ({ ...prev, [field]: value })); - setSaved(false); - resetFromStep('crop'); - }; - const currentCropArea = useMemo(() => { if (!imageSize.width || !imageSize.height) return null; return { @@ -237,13 +214,13 @@ const CropStep = () => { const config = { x: 0, y: 0, - zoom: previewScale, + zoom: 1, width: currentCropArea.width, height: currentCropArea.height, - top: offsetValues.top, - bottom: offsetValues.bottom, - left: offsetValues.left, - right: offsetValues.right, + top: 0, + bottom: 0, + left: 0, + right: 0, cropAreaX: currentCropArea.x, cropAreaY: currentCropArea.y, imageWidth: imageSize.width, @@ -319,8 +296,6 @@ const CropStep = () => { width: '100%', maxWidth: 410, mx: 'auto', - transform: `scale(${previewScale})`, - transformOrigin: 'center top', }} > { )} - - Önizleme yakınlaştırması - { - const newValue = Array.isArray(value) ? value[0] : value; - setPreviewScale(newValue); - }} - /> - - - - {offsetFields.map((field) => ( - - - - ))} - - {saved && ( diff --git a/src/components/OcrStep.jsx b/src/components/OcrStep.jsx index dfcd5dc..0d7d8ae 100644 --- a/src/components/OcrStep.jsx +++ b/src/components/OcrStep.jsx @@ -14,6 +14,7 @@ import { correctTurkishCharacters } from '../utils/ocrUtils'; const OcrStep = () => { const navigate = useNavigate(); + const isDev = import.meta.env.DEV; const croppedImages = useAppStore((state) => state.croppedImages); const ocrText = useAppStore((state) => state.ocrText); const setOcrText = useAppStore((state) => state.setOcrText); @@ -60,7 +61,7 @@ const OcrStep = () => { workerPath: paths.workerPath, corePath: paths.corePath, langPath: paths.langPath, - logger: m => console.log('Tesseract:', m), // Debug için log + logger: isDev ? (m) => console.log('Tesseract:', m) : undefined, }, ); @@ -75,7 +76,9 @@ const OcrStep = () => { return; } // Dil ve worker zaten createWorker sırasında yüklendi - console.log('Tesseract worker başarıyla oluşturuldu'); + if (isDev) { + console.log('Tesseract worker başarıyla oluşturuldu'); + } workerRef.current = worker; setWorkerReady(true); } catch (error) { @@ -104,7 +107,7 @@ const OcrStep = () => { setWorkerReady(false); } }; - }, [assetBase, orderedImages.length, setError]); + }, [assetBase, isDev, orderedImages.length, setError]); useEffect(() => { setStatus('idle'); diff --git a/src/main.jsx b/src/main.jsx index f86a7f3..b96bb0f 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -29,7 +29,7 @@ const theme = createTheme({ secondary: '#666057', }, success: { - main: '#80A19F', + main: '#88aaa8ff', contrastText: '#30281B', }, }, @@ -40,7 +40,7 @@ const theme = createTheme({ MuiBox: { styleOverrides: { root: { - color: '#80A19F', + color: '#EDEFF2', }, }, }, @@ -69,7 +69,7 @@ const theme = createTheme({ MuiAlert: { styleOverrides: { root: { - backgroundColor: '#80A19F', + backgroundColor: '#EDEFF2', color: '#30281B', borderRadius: 16, },