From 91febc31ad8b34ad9c2bd158a445f774461286c0 Mon Sep 17 00:00:00 2001 From: nea Date: Sun, 23 Jul 2023 01:35:16 +0200 Subject: Make image preview scalable --- src/main/kotlin/moe/nea/firmament/util/propertyutil.kt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/main/kotlin/moe/nea/firmament/util/propertyutil.kt (limited to 'src/main/kotlin/moe/nea/firmament/util/propertyutil.kt') diff --git a/src/main/kotlin/moe/nea/firmament/util/propertyutil.kt b/src/main/kotlin/moe/nea/firmament/util/propertyutil.kt new file mode 100644 index 0000000..89b8251 --- /dev/null +++ b/src/main/kotlin/moe/nea/firmament/util/propertyutil.kt @@ -0,0 +1,7 @@ +package moe.nea.firmament.util + +import kotlin.properties.ReadOnlyProperty + +fun ReadOnlyProperty.map(mapper: (V) -> M): ReadOnlyProperty { + return ReadOnlyProperty { thisRef, property -> mapper(this@map.getValue(thisRef, property)) } +} -- cgit