ron
11/01/2017, 2:20 PMron
11/01/2017, 3:01 PMron
11/01/2017, 3:01 PMClearly I dont want a year formatted like this:▾
anidotnet
11/01/2017, 5:10 PMromainbsl
11/01/2017, 5:32 PMcarlw
11/01/2017, 6:43 PMcarlw
11/01/2017, 6:43 PMromainbsl
11/01/2017, 6:49 PMcarlw
11/01/2017, 6:52 PMGreg Stepniewski
11/01/2017, 6:58 PMcarlw
11/01/2017, 7:01 PMGreg Stepniewski
11/01/2017, 7:02 PMGreg Stepniewski
11/01/2017, 7:03 PMcarlw
11/01/2017, 7:04 PMcarlw
11/01/2017, 7:04 PMcarlw
11/01/2017, 7:05 PMGreg Stepniewski
11/01/2017, 7:08 PMoverride val root = borderpane {
top {
hbox {
// stuff
}
}
center {
vbox {
stackpane {
imageview(controller.image) {
isPreserveRatio = true
fitHeightProperty().bind((parent.parent as Pane).heightProperty())
fitWidthProperty().bind((parent.parent as Pane).widthProperty())
}
}
}
}
}
Greg Stepniewski
11/01/2017, 7:09 PMcarlw
11/01/2017, 7:13 PMGreg Stepniewski
11/01/2017, 7:15 PMcenter {
vbox {
imageview(controller.image) {
isPreserveRatio = true
}
}
}
now the image is not center, not scaled to fit the window and does not react to resizing, as expected I think ?carlw
11/01/2017, 7:34 PMGreg Stepniewski
11/01/2017, 7:41 PMron
11/01/2017, 7:43 PMron
11/01/2017, 7:43 PMprivate fun showImagePopup(photo: Photo) {
runAsync {
ImageView(Image(photo.toURL().toExternalForm()))
} ui {
var height: Double
var width: Double
val visualBounds = Screen.getPrimary().visualBounds
val screenRatio = visualBounds.width / visualBounds.height
if (it.image.ratio() <= screenRatio) {
// The scaled size is based on the height
height = Math.min(visualBounds.height, it.image.height)
width = height * it.image.ratio()
} else {
// The scaled size is based on the width
width = Math.min(visualBounds.width, it.image.width)
height = width / it.image.ratio()
}
builderWindow {
stackpane {
prefWidth = width
prefHeight = height
it.apply {
fitHeightProperty().bind(this@stackpane.heightProperty())
fitWidthProperty().bind(this@stackpane.widthProperty())
}
add(it)
}
}
}
}
ron
11/01/2017, 7:44 PMGreg Stepniewski
11/01/2017, 7:55 PMcenter {
stackpane {
imageview(controller.image) {
isPreserveRatio = true
this@center.heightProperty().onChange { fitHeight = it - this@borderpane.top.layoutBounds.height }
this@center.widthProperty().onChange { fitWidth = it }
}
}
}
It's incredibly ugly and I have no idea why center would give me the full height of the borderpane, but it seem to work for now...ron
11/01/2017, 7:56 PMbind
is enoughron
11/01/2017, 7:57 PMonChange
neededron
11/01/2017, 7:57 PMron
11/01/2017, 8:10 PM