From 7412217b0c9a7bda42a0a7e916744ff68ec8a7b1 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 29 May 2022 10:22:57 +0600 Subject: [PATCH] add Element.isOverflow --- CHANGELOG.md | 3 +++ .../kotlin/dev/inmo/micro_utils/common/IsOverflow.kt | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 common/src/jsMain/kotlin/dev/inmo/micro_utils/common/IsOverflow.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 85710e116a9..1716489a86a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 0.10.8 +* `Common` + * Add `Element.isOverflow*` extension properties + ## 0.10.7 * `Pagination`: diff --git a/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/IsOverflow.kt b/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/IsOverflow.kt new file mode 100644 index 00000000000..28412eaa0b0 --- /dev/null +++ b/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/IsOverflow.kt @@ -0,0 +1,12 @@ +package dev.inmo.micro_utils.common + +import org.w3c.dom.Element + +inline val Element.isOverflowWidth + get() = scrollWidth > clientWidth + +inline val Element.isOverflowHeight + get() = scrollHeight > clientHeight + +inline val Element.isOverflow + get() = isOverflowHeight || isOverflowWidth