edvin / tornadofx2

TornadoFX 2.0
Apache License 2.0
154 stars 40 forks source link

Dialogs move to lower right each time they are opened #31

Closed the-rene closed 3 years ago

the-rene commented 3 years ago

Each time an existing instance of a View is opened as a dialog, it is displayed lower and more to the right then before.

A newly created instance works as excpected and is rendered at the same position each time.

See the code below to reproduce this issue and the gif to show the behavior

import tornadofx.*

class MyMainView : View("main") {

    override val root = buttonbar {
        minHeight = 50.0
        minWidth = 200.0
        button("find dialog").action { find<MyDialog>().apply { openModal() } }
        button("new dialog").action { MyDialog().apply { openModal() } }
    }
}

class MyDialog : View("dialog") {
    override val root = buttonbar {
        minHeight = 50.0
        minWidth = 100.0
        button("close").action { close() }
    }
}

class MyApp : App(MyMainView::class)
fun main() = launch<MyApp>()

tornadofx2_dialog

SKeeneCode commented 3 years ago

Verified, looks like a simple fix. Will work on PR.

the-rene commented 3 years ago

I can confirm the PR fixes this.

Thanks a lot for the quick response and fix!