Add isLandscape to orientation

This commit is contained in:
Ivan Malison 2024-01-31 16:25:49 -07:00
parent 08f37070a4
commit e82f068b21

View File

@ -8,6 +8,14 @@ enum class Orientation(override val unionValue: String) : JSUnionValue {
PORTRAIT_UPSIDE_DOWN("portrait-upside-down"),
LANDSCAPE_LEFT("landscape-left");
fun isLandscape(): Boolean =
when (this) {
PORTRAIT -> false
PORTRAIT_UPSIDE_DOWN -> false
LANDSCAPE_LEFT -> true
LANDSCAPE_RIGHT -> true
}
fun toDegrees(): Int =
when (this) {
PORTRAIT -> 0