simplify
This commit is contained in:
parent
728233bf86
commit
7818aeebf2
1 changed files with 4 additions and 10 deletions
|
@ -29,16 +29,10 @@
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
|
|
||||||
const isHorizontal = (zoom: number): boolean => {
|
|
||||||
return (((zoom % 360) + 360) / 90) % 2 === 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (isHorizontal($zoomImageWheelState.currentRotation)) {
|
$zoomImageWheelState.currentRotation === 0 || $zoomImageWheelState.currentRotation === 180
|
||||||
[imgWidth, imgHeight] = [clientWidth, clientHeight];
|
? ([imgHeight, imgWidth] = [clientHeight, clientWidth])
|
||||||
} else {
|
: ([imgWidth, imgHeight] = [clientHeight, clientWidth]);
|
||||||
[imgHeight, imgWidth] = [clientWidth, clientHeight];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const rotationToOrientation = (rotation: number): number => {
|
const rotationToOrientation = (rotation: number): number => {
|
||||||
|
@ -57,7 +51,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const doRotate = async () => {
|
const doRotate = async () => {
|
||||||
setZoomImageWheelState({ currentRotation: $zoomImageWheelState.currentRotation + 90 });
|
setZoomImageWheelState({ currentRotation: $zoomImageWheelState.currentRotation + 90, currentZoom: 1 });
|
||||||
try {
|
try {
|
||||||
await api.assetApi.updateAsset({
|
await api.assetApi.updateAsset({
|
||||||
id: asset.id,
|
id: asset.id,
|
||||||
|
|
Loading…
Reference in a new issue