diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-01-29 12:06:25 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-01-29 12:06:25 +0100 |
commit | 8899fe0d98089cf8605ae603043b8187f33a3c83 (patch) | |
tree | 436b12b5aef4474a3fa35481ac57e91ec7e92400 | |
parent | 960e60e24734fec82e21144502cf971423df9e62 (diff) | |
download | kvision-8899fe0d98089cf8605ae603043b8187f33a3c83.tar.gz kvision-8899fe0d98089cf8605ae603043b8187f33a3c83.tar.bz2 kvision-8899fe0d98089cf8605ae603043b8187f33a3c83.zip |
Dependencies update.
Fix for resizable windows.
-rw-r--r-- | build.gradle | 6 | ||||
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/window/Window.kt | 39 |
2 files changed, 24 insertions, 21 deletions
diff --git a/build.gradle b/build.gradle index 84bb5ce8..f09d550f 100644 --- a/build.gradle +++ b/build.gradle @@ -132,10 +132,10 @@ kotlinFrontend { dependency("url-loader", "1.1.2") dependency("jquery", "3.2.1") dependency("fecha", "2.3.2") - dependency("snabbdom", "0.7.1") + dependency("snabbdom", "0.7.3") dependency("snabbdom-virtualize", "0.7.0") - dependency("jquery-resizable-dom", "0.28.0") - dependency("element-resize-event", "2.0.9") + dependency("jquery-resizable-dom", "0.32.0") + dependency("element-resize-event", "3.0.3") dependency("navigo", "7.0.0") devDependency("karma", "3.1.4") devDependency("qunit", "2.8.0") diff --git a/src/main/kotlin/pl/treksoft/kvision/window/Window.kt b/src/main/kotlin/pl/treksoft/kvision/window/Window.kt index ee20dc51..16e23e45 100644 --- a/src/main/kotlin/pl/treksoft/kvision/window/Window.kt +++ b/src/main/kotlin/pl/treksoft/kvision/window/Window.kt @@ -134,6 +134,7 @@ open class Window( private val captionTag = Tag(TAG.H4, caption, classes = setOf("modal-title")) private var isResizeEvent = false + private var isResizing = false init { id = "kv_window_$counter" @@ -221,12 +222,12 @@ open class Window( if (isResizable) { resize = Resize.BOTH val intHeight = (getElementJQuery()?.height()?.toInt() ?: 0) + 2 - this.height = (intHeight + WINDOW_CONTENT_MARGIN_BOTTOM - 1).px + content.height = (intHeight - WINDOW_HEADER_HEIGHT - WINDOW_CONTENT_MARGIN_BOTTOM - 2).px content.marginBottom = WINDOW_CONTENT_MARGIN_BOTTOM.px } else { resize = Resize.NONE val intHeight = (getElementJQuery()?.height()?.toInt() ?: 0) + 2 - this.height = (intHeight - WINDOW_CONTENT_MARGIN_BOTTOM - 1).px + content.height = (intHeight - WINDOW_HEADER_HEIGHT - 2).px content.marginBottom = 0.px } } @@ -236,22 +237,24 @@ open class Window( if (isResizable) { isResizeEvent = true KVManager.setResizeEvent(this) { - val eid = getElementJQuery()?.attr("id") - if (eid == id) { - val intWidth = (getElementJQuery()?.width()?.toInt() ?: 0) + 2 - val intHeight = (getElementJQuery()?.height()?.toInt() ?: 0) + 2 - isResizable = false - width = intWidth.px - height = intHeight.px - 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 - } - }) + if (!isResizing) { + val eid = getElementJQuery()?.attr("id") + if (eid == id) { + val intWidth = (getElementJQuery()?.width()?.toInt() ?: 0) + 2 + val intHeight = (getElementJQuery()?.height()?.toInt() ?: 0) + 2 + isResizing = true + width = intWidth.px + height = intHeight.px + isResizing = false + content.width = (intWidth - 2).px + content.height = (intHeight - WINDOW_HEADER_HEIGHT - WINDOW_CONTENT_MARGIN_BOTTOM - 2).px + this.dispatchEvent("resizeWindow", obj { + detail = obj { + this.width = intWidth + this.height = intHeight + } + }) + } } } } else if (isResizeEvent) { |