aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-05-22 14:35:45 +0200
committerRobert Jaros <rjaros@finn.pl>2018-05-22 14:35:45 +0200
commitf63340e6324b557abb96cacc6df3d94f5b1fa71d (patch)
tree22777247e79917928bb094768fd9c571de81bc51 /src
parent1cb5675924a56baf6f8dce62e569bf6f2416d58e (diff)
downloadkvision-f63340e6324b557abb96cacc6df3d94f5b1fa71d.tar.gz
kvision-f63340e6324b557abb96cacc6df3d94f5b1fa71d.tar.bz2
kvision-f63340e6324b557abb96cacc6df3d94f5b1fa71d.zip
Add resizeWindow event to Window component.
Diffstat (limited to 'src')
-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) {