mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
added support for image orientation filter (#4404)
* added support for image orientation filter * Add orientation filtering to scenes --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
32
ui/v2.5/src/utils/orientation.ts
Normal file
32
ui/v2.5/src/utils/orientation.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { OrientationEnum } from "src/core/generated-graphql";
|
||||
|
||||
const stringOrientationMap = new Map<string, OrientationEnum>([
|
||||
["Landscape", OrientationEnum.Landscape],
|
||||
["Portrait", OrientationEnum.Portrait],
|
||||
["Square", OrientationEnum.Square],
|
||||
]);
|
||||
|
||||
export const stringToOrientation = (
|
||||
value?: string | null,
|
||||
caseInsensitive?: boolean
|
||||
) => {
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const ret = stringOrientationMap.get(value);
|
||||
if (ret || !caseInsensitive) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
const asUpper = value.toUpperCase();
|
||||
const foundEntry = Array.from(stringOrientationMap.entries()).find((e) => {
|
||||
return e[0].toUpperCase() === asUpper;
|
||||
});
|
||||
|
||||
if (foundEntry) {
|
||||
return foundEntry[1];
|
||||
}
|
||||
};
|
||||
|
||||
export const orientationStrings = Array.from(stringOrientationMap.keys());
|
||||
Reference in New Issue
Block a user