mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-21 06:59:33 +02:00
chore: change default dimensions
This commit is contained in:
123
.idea/workspace.xml
generated
123
.idea/workspace.xml
generated
@@ -6,8 +6,7 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="fix: misc">
|
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="fix: misc">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/components/input/BaseFileInput.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/input/BaseFileInput.tsx" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/crop-video/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/crop-video/index.tsx" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/tools/pdf/protect-pdf/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/pdf/protect-pdf/service.ts" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -43,108 +42,108 @@
|
|||||||
"state": "OPEN"
|
"state": "OPEN"
|
||||||
}
|
}
|
||||||
}</component>
|
}</component>
|
||||||
<component name="GitHubPullRequestState"><![CDATA[{
|
<component name="GitHubPullRequestState">{
|
||||||
"prStates": [
|
"prStates": [
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts51PkS9",
|
"id": "PR_kwDOMJIfts51PkS9",
|
||||||
"number": 22
|
"number": 22
|
||||||
},
|
},
|
||||||
"lastSeen": 1741207144695
|
"lastSeen": 1741207144695
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6NiNYl",
|
"id": "PR_kwDOMJIfts6NiNYl",
|
||||||
"number": 32
|
"number": 32
|
||||||
},
|
},
|
||||||
"lastSeen": 1741209723869
|
"lastSeen": 1741209723869
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6Nheyd",
|
"id": "PR_kwDOMJIfts6Nheyd",
|
||||||
"number": 31
|
"number": 31
|
||||||
},
|
},
|
||||||
"lastSeen": 1741213371410
|
"lastSeen": 1741213371410
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6NmRBs",
|
"id": "PR_kwDOMJIfts6NmRBs",
|
||||||
"number": 33
|
"number": 33
|
||||||
},
|
},
|
||||||
"lastSeen": 1741282429036
|
"lastSeen": 1741282429036
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts5zyFTs",
|
"id": "PR_kwDOMJIfts5zyFTs",
|
||||||
"number": 15
|
"number": 15
|
||||||
},
|
},
|
||||||
"lastSeen": 1741535540953
|
"lastSeen": 1741535540953
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6QQB3c",
|
"id": "PR_kwDOMJIfts6QQB3c",
|
||||||
"number": 59
|
"number": 59
|
||||||
},
|
},
|
||||||
"lastSeen": 1743018960900
|
"lastSeen": 1743018960900
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6QMPEg",
|
"id": "PR_kwDOMJIfts6QMPEg",
|
||||||
"number": 58
|
"number": 58
|
||||||
},
|
},
|
||||||
"lastSeen": 1743019452983
|
"lastSeen": 1743019452983
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6QZvRI",
|
"id": "PR_kwDOMJIfts6QZvRI",
|
||||||
"number": 61
|
"number": 61
|
||||||
},
|
},
|
||||||
"lastSeen": 1743103196866
|
"lastSeen": 1743103196866
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6QqPrQ",
|
"id": "PR_kwDOMJIfts6QqPrQ",
|
||||||
"number": 73
|
"number": 73
|
||||||
},
|
},
|
||||||
"lastSeen": 1743265865001
|
"lastSeen": 1743265865001
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6Qp5nI",
|
"id": "PR_kwDOMJIfts6Qp5nI",
|
||||||
"number": 72
|
"number": 72
|
||||||
},
|
},
|
||||||
"lastSeen": 1743338472110
|
"lastSeen": 1743338472110
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6QsjlS",
|
"id": "PR_kwDOMJIfts6QsjlS",
|
||||||
"number": 76
|
"number": 76
|
||||||
},
|
},
|
||||||
"lastSeen": 1743352150953
|
"lastSeen": 1743352150953
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6Q0JBe",
|
"id": "PR_kwDOMJIfts6Q0JBe",
|
||||||
"number": 82
|
"number": 82
|
||||||
},
|
},
|
||||||
"lastSeen": 1743470267269
|
"lastSeen": 1743470267269
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6UE9-x",
|
"id": "PR_kwDOMJIfts6UE9-x",
|
||||||
"number": 102
|
"number": 102
|
||||||
},
|
},
|
||||||
"lastSeen": 1747171977348
|
"lastSeen": 1747171977348
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6XPua_",
|
"id": "PR_kwDOMJIfts6XPua_",
|
||||||
"number": 117
|
"number": 117
|
||||||
},
|
},
|
||||||
"lastSeen": 1747929835864
|
"lastSeen": 1747929835864
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="GithubPullRequestsUISettings">{
|
<component name="GithubPullRequestsUISettings">{
|
||||||
"selectedUrlAndAccountId": {
|
"selectedUrlAndAccountId": {
|
||||||
"url": "https://github.com/iib0011/omni-tools.git",
|
"url": "https://github.com/iib0011/omni-tools.git",
|
||||||
@@ -197,7 +196,7 @@
|
|||||||
"Vitest.replaceText function (regexp mode).should return the original text when passed an invalid regexp.executor": "Run",
|
"Vitest.replaceText function (regexp mode).should return the original text when passed an invalid regexp.executor": "Run",
|
||||||
"Vitest.replaceText function.executor": "Run",
|
"Vitest.replaceText function.executor": "Run",
|
||||||
"Vitest.timeBetweenDates.executor": "Run",
|
"Vitest.timeBetweenDates.executor": "Run",
|
||||||
"git-widget-placeholder": "#117 on fork/nevolodia/flip-video",
|
"git-widget-placeholder": "#122 on fork/nevolodia/crop-video",
|
||||||
"ignore.virus.scanning.warn.message": "true",
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"last_opened_file_path": "C:/Users/Ibrahima/IdeaProjects/omni-tools/src",
|
"last_opened_file_path": "C:/Users/Ibrahima/IdeaProjects/omni-tools/src",
|
||||||
|
@@ -9,7 +9,7 @@ import ToolVideoInput from '@components/input/ToolVideoInput';
|
|||||||
import { cropVideo, getVideoDimensions } from './service';
|
import { cropVideo, getVideoDimensions } from './service';
|
||||||
import { InitialValuesType } from './types';
|
import { InitialValuesType } from './types';
|
||||||
|
|
||||||
export const initialValues: InitialValuesType = {
|
const initialValues: InitialValuesType = {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: 100,
|
width: 100,
|
||||||
@@ -26,23 +26,6 @@ export default function CropVideo({ title }: ToolComponentProps) {
|
|||||||
} | null>(null);
|
} | null>(null);
|
||||||
const [processingError, setProcessingError] = useState<string>('');
|
const [processingError, setProcessingError] = useState<string>('');
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (input) {
|
|
||||||
getVideoDimensions(input)
|
|
||||||
.then((dimensions) => {
|
|
||||||
setVideoDimensions(dimensions);
|
|
||||||
setProcessingError('');
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Error getting video dimensions:', error);
|
|
||||||
setProcessingError('Failed to load video dimensions');
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setVideoDimensions(null);
|
|
||||||
setProcessingError('');
|
|
||||||
}
|
|
||||||
}, [input]);
|
|
||||||
|
|
||||||
const validateDimensions = (values: InitialValuesType): string => {
|
const validateDimensions = (values: InitialValuesType): string => {
|
||||||
if (!videoDimensions) return '';
|
if (!videoDimensions) return '';
|
||||||
|
|
||||||
@@ -177,13 +160,40 @@ export default function CropVideo({ title }: ToolComponentProps) {
|
|||||||
<ToolContent
|
<ToolContent
|
||||||
title={title}
|
title={title}
|
||||||
input={input}
|
input={input}
|
||||||
inputComponent={
|
renderCustomInput={(values, setFieldValue) => (
|
||||||
<ToolVideoInput
|
<ToolVideoInput
|
||||||
value={input}
|
value={input}
|
||||||
onChange={setInput}
|
onChange={(video) => {
|
||||||
|
if (video) {
|
||||||
|
getVideoDimensions(video)
|
||||||
|
.then((dimensions) => {
|
||||||
|
const newOptions: InitialValuesType = {
|
||||||
|
x: dimensions.width / 4,
|
||||||
|
y: dimensions.height / 4,
|
||||||
|
width: dimensions.width / 2,
|
||||||
|
height: dimensions.height / 2
|
||||||
|
};
|
||||||
|
setFieldValue('x', newOptions.x);
|
||||||
|
setFieldValue('y', newOptions.y);
|
||||||
|
setFieldValue('width', newOptions.width);
|
||||||
|
setFieldValue('height', newOptions.height);
|
||||||
|
|
||||||
|
setVideoDimensions(dimensions);
|
||||||
|
setProcessingError('');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error getting video dimensions:', error);
|
||||||
|
setProcessingError('Failed to load video dimensions');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setVideoDimensions(null);
|
||||||
|
setProcessingError('');
|
||||||
|
}
|
||||||
|
setInput(video);
|
||||||
|
}}
|
||||||
title={'Input Video'}
|
title={'Input Video'}
|
||||||
/>
|
/>
|
||||||
}
|
)}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
loading ? (
|
loading ? (
|
||||||
<ToolFileResult
|
<ToolFileResult
|
||||||
|
Reference in New Issue
Block a user