fix: rotation

This commit is contained in:
martabal 2023-12-02 22:02:45 +01:00
parent 14120e0c65
commit 9fdc982ca6
No known key found for this signature in database
GPG key ID: C00196E3148A52BD
2 changed files with 9 additions and 4 deletions

View file

@ -205,9 +205,9 @@ export class AssetBulkUpdateDto extends BulkIdsDto {
longitude?: number;
@Optional()
@IsInt()
@Min(1)
@Max(8)
@IsInt()
@Type(() => Number)
orientation?: number;
}
@ -240,9 +240,9 @@ export class UpdateAssetDto {
longitude?: number;
@Optional()
@IsInt()
@Min(1)
@Max(8)
@IsInt()
@Type(() => Number)
orientation?: number;
}

View file

@ -30,14 +30,19 @@
// }
// };
const getRotationModulo = (rotation: number): number => {
return ((rotation % 360) + 360) % 360;
};
$: {
$zoomImageWheelState.currentRotation === 0 || $zoomImageWheelState.currentRotation === 180
getRotationModulo($zoomImageWheelState.currentRotation) === 0 ||
getRotationModulo($zoomImageWheelState.currentRotation) === 180
? ([imgHeight, imgWidth] = [clientHeight, clientWidth])
: ([imgWidth, imgHeight] = [clientHeight, clientWidth]);
}
const rotationToOrientation = (rotation: number): number => {
switch (((rotation % 360) + 360) % 360) {
switch (getRotationModulo(rotation)) {
case 0:
return 1;
case 90: