aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/utils/Snabbdom.kt3
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/window/Window.kt8
2 files changed, 11 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/utils/Snabbdom.kt b/src/main/kotlin/pl/treksoft/kvision/utils/Snabbdom.kt
index ccb11ff9..7bb18a58 100644
--- a/src/main/kotlin/pl/treksoft/kvision/utils/Snabbdom.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/utils/Snabbdom.kt
@@ -56,6 +56,8 @@ private fun vNodeData(): VNodeData = js("({})")
*/
interface KvJQueryEventObject : JQueryEventObject {
val clickedIndex: Int
+ val width: Int
+ val height: Int
}
/**
@@ -100,6 +102,7 @@ interface BtOn : On {
var fileResetUpload: ((KvEvent) -> kotlin.Unit)?
var fileBrowseUpload: ((KvEvent) -> kotlin.Unit)?
var filePreUpload: ((KvEvent) -> kotlin.Unit)?
+ var resizeWindow: ((KvEvent) -> kotlin.Unit)?
}
/**
diff --git a/src/main/kotlin/pl/treksoft/kvision/window/Window.kt b/src/main/kotlin/pl/treksoft/kvision/window/Window.kt
index 2b1aabb7..bdfb2c0f 100644
--- a/src/main/kotlin/pl/treksoft/kvision/window/Window.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/window/Window.kt
@@ -36,6 +36,7 @@ import pl.treksoft.kvision.html.TAG
import pl.treksoft.kvision.html.Tag
import pl.treksoft.kvision.modal.CloseIcon
import pl.treksoft.kvision.panel.SimplePanel
+import pl.treksoft.kvision.utils.obj
import pl.treksoft.kvision.utils.px
internal const val DEFAULT_Z_INDEX = 900
@@ -230,6 +231,7 @@ open class Window(
}
}
+ @Suppress("UnsafeCastFromDynamic")
private fun checkResizablEventHandler() {
if (isResizable) {
isResizeEvent = true
@@ -244,6 +246,12 @@ open class Window(
isResizable = true
content.width = (intWidth - 2).px
content.height = (intHeight - WINDOW_HEADER_HEIGHT - WINDOW_CONTENT_MARGIN_BOTTOM - 1 - 2).px
+ this.dispatchEvent("resizeWindow", obj {
+ detail = obj {
+ this.width = intWidth
+ this.height = intHeight
+ }
+ })
}
}
} else if (isResizeEvent) {