From 6f9c19bbf638f9720cdcb08d6b2164b0990bd143 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 27 May 2022 11:39:09 +0600 Subject: [PATCH] fixes in ResizeObserver --- .../inmo/micro_utils/common/ResizeObserver.kt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/ResizeObserver.kt b/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/ResizeObserver.kt index f35eb20ff58..ec1086aee67 100644 --- a/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/ResizeObserver.kt +++ b/common/src/jsMain/kotlin/dev/inmo/micro_utils/common/ResizeObserver.kt @@ -14,15 +14,17 @@ external class ResizeObserver( fun disconnect() } -external class ResizeObserverEntry { - val borderBoxSize: Int? - val contentBoxSize: Int? - val devicePixelContentBoxSize: Int? - val contentRect: DOMRectReadOnly +external interface ResizeObserverSize { + val blockSize: Float + val inlineSize: Float } -fun ResizeObserverEntry.sizeOrThrow(): Int { - return contentBoxSize ?: borderBoxSize ?: devicePixelContentBoxSize ?: error("Unable to find default size in entry $this") +external interface ResizeObserverEntry { + val borderBoxSize: Array + val contentBoxSize: Array + val devicePixelContentBoxSize: Array + val contentRect: DOMRectReadOnly + val target: Element } fun ResizeObserver.observe(target: Element, options: ResizeObserverObserveOptions) = observe(