1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-29 00:27:37 +00:00

change drag move image scale (#8075)

This commit is contained in:
Michael An
2025-07-23 18:30:09 +08:00
committed by GitHub
parent 7e746d3269
commit 5c78232363
5 changed files with 31 additions and 12 deletions

View File

@@ -13,7 +13,7 @@ const SCALE_OPTIONS_2 = [
];
const DEFAULT_SCALE = SCALE_OPTIONS_2[0];
const ImageZoomer = ({ setImageScale }) => {
const ImageZoomer = ({ setImageScale, setDefaultPageFitScale }) => {
const [curScale, setScale] = useState(1);
const [curScaleText, setScaleText] = useState(DEFAULT_SCALE.text); // for the text shown in the input
@@ -59,7 +59,7 @@ const ImageZoomer = ({ setImageScale }) => {
if (!imageElement || (imageElement.clientWidth === 2 && imageElement.clientHeight === 2)) {
setTimeout(() => {
scaleImageToPageFit();
}, 100);
}, 1);
return;
}
const borderWidth = 1;
@@ -77,7 +77,8 @@ const ImageZoomer = ({ setImageScale }) => {
const scale = Math.min(hScale, vScale);
setScale(scale);
scaleImage(scale);
}, [setScale, scaleImage]);
setDefaultPageFitScale(scale);
}, [setScale, scaleImage, setDefaultPageFitScale]);
const onMenuItemClick = useCallback((value) => {
setSelectedScale(value);