mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-11-14 09:04:10 +01:00
chore: remove flip x and y
This commit is contained in:
@@ -14,7 +14,7 @@ import ToolFileResult from '@components/result/ToolFileResult';
|
||||
import { processImage } from './service';
|
||||
|
||||
const initialValues: InitialValuesType = {
|
||||
rotateAngle: '0',
|
||||
rotateAngle: '90',
|
||||
rotateMethod: 'Preset'
|
||||
};
|
||||
|
||||
@@ -73,9 +73,7 @@ export default function RotateImage({ title }: ToolComponentProps) {
|
||||
options={[
|
||||
{ label: '90 degrees', value: '90' },
|
||||
{ label: '180 degrees', value: '180' },
|
||||
{ label: '270 degrees', value: '270' },
|
||||
{ label: 'Flip horizontally', value: 'flip-x' },
|
||||
{ label: 'Flip vertically', value: 'flip-y' }
|
||||
{ label: '270 degrees', value: '270' }
|
||||
]}
|
||||
/>
|
||||
</Box>
|
||||
@@ -118,7 +116,7 @@ export default function RotateImage({ title }: ToolComponentProps) {
|
||||
value={input}
|
||||
onChange={setInput}
|
||||
title={'Input Image'}
|
||||
accept={['image/jpeg', 'image/png', 'image/svg+xml', 'image/gif']}
|
||||
accept={['image/*']}
|
||||
/>
|
||||
}
|
||||
resultComponent={
|
||||
|
||||
@@ -18,19 +18,7 @@ export const processImage = async (
|
||||
// Get current transform attribute or create new one
|
||||
let currentTransform = svgElement.getAttribute('transform') || '';
|
||||
|
||||
// Calculate rotation angle
|
||||
let angle = 0;
|
||||
if (rotateMethod === 'Preset') {
|
||||
if (rotateAngle === 'flip-x') {
|
||||
currentTransform += ' scale(-1,1)';
|
||||
} else if (rotateAngle === 'flip-y') {
|
||||
currentTransform += ' scale(1,-1)';
|
||||
} else {
|
||||
angle = parseInt(rotateAngle);
|
||||
}
|
||||
} else {
|
||||
angle = parseInt(rotateAngle);
|
||||
}
|
||||
const angle = parseInt(rotateAngle);
|
||||
|
||||
// Add rotation if needed
|
||||
if (angle !== 0) {
|
||||
@@ -65,18 +53,7 @@ export const processImage = async (
|
||||
await ffmpeg.writeFile('input', await fetchFile(file));
|
||||
|
||||
// Determine rotation command
|
||||
let rotateCmd = '';
|
||||
if (rotateMethod === 'Preset') {
|
||||
if (rotateAngle === 'flip-x') {
|
||||
rotateCmd = 'hflip';
|
||||
} else if (rotateAngle === 'flip-y') {
|
||||
rotateCmd = 'vflip';
|
||||
} else {
|
||||
rotateCmd = `rotate=${rotateAngle}*PI/180`;
|
||||
}
|
||||
} else {
|
||||
rotateCmd = `rotate=${rotateAngle}*PI/180`;
|
||||
}
|
||||
const rotateCmd = `rotate=${rotateAngle}*PI/180`;
|
||||
|
||||
// Execute FFmpeg command
|
||||
await ffmpeg.exec([
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type InitialValuesType = {
|
||||
rotateAngle: string | 'flip-x' | 'flip-y'; // the angle to rotate the image
|
||||
rotateAngle: string; // the angle to rotate the image
|
||||
rotateMethod: 'Preset' | 'Custom';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user