diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-02-26 12:49:32 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-02-26 12:49:32 +0100 |
commit | 5f0f0400e28365c5521b6c0b038fdd32101d8a1f (patch) | |
tree | 6e81c95d5e02687c49d86658cfd9eddca4b9ed07 /src/main/kotlin/pl/treksoft/kvision/KVManager.kt | |
parent | 0cb239ac0d48005b66a6a407ee2b44cc1c9d058a (diff) | |
download | kvision-5f0f0400e28365c5521b6c0b038fdd32101d8a1f.tar.gz kvision-5f0f0400e28365c5521b6c0b038fdd32101d8a1f.tar.bz2 kvision-5f0f0400e28365c5521b6c0b038fdd32101d8a1f.zip |
Floating, resizable window container.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/KVManager.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/KVManager.kt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt index 4ba518b5..d3001b1d 100644 --- a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt +++ b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt @@ -29,6 +29,7 @@ import com.github.snabbdom.datasetModule import com.github.snabbdom.eventListenersModule import com.github.snabbdom.propsModule import com.github.snabbdom.styleModule +import pl.treksoft.kvision.core.Component import kotlin.browser.document import kotlin.dom.clear @@ -102,6 +103,10 @@ internal object KVManager { require("bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js") } catch (e: Throwable) { } + private val elementResizeEvent = try { + require("element-resize-event") + } catch (e: Throwable) { + } private val resizable = require("jquery-resizable-dom") internal val fecha = require("fecha") @@ -128,4 +133,18 @@ internal object KVManager { internal fun virtualize(html: String): VNode { return sdVirtualize(html) } + + @Suppress("UnsafeCastFromDynamic") + internal fun setResizeEvent(component: Component, callback: () -> Unit) { + component.getElement()?.let { + elementResizeEvent(it, callback) + } + } + + @Suppress("UnsafeCastFromDynamic") + internal fun clearResizeEvent(component: Component) { + component.getElement()?.let { + elementResizeEvent.unbind(it) + } + } } |