highlight the selected element, closes #9
This commit is contained in:
parent
9200e9277a
commit
da153091bd
@ -25,11 +25,18 @@ class GUIModel constructor(var data: Texture, img: Image) : VBox(){
|
|||||||
private val gmc = find(GUIModelController::class)
|
private val gmc = find(GUIModelController::class)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
//super.setPadding(Insets(10.0, 10.0, 10.0, 10.0))
|
super.setPadding(Insets(5.0, 5.0, 5.0, 5.0))
|
||||||
super.getChildren().addAll(image, label)
|
super.getChildren().addAll(image, label)
|
||||||
super.setOnContextMenuRequested { p0 -> contextMenu.show(this@GUIModel, p0.screenX, p0.screenY) }
|
super.setOnContextMenuRequested { p0 -> contextMenu.show(this@GUIModel, p0.screenX, p0.screenY) }
|
||||||
super.setOnMouseClicked{
|
super.setOnMouseClicked{
|
||||||
//this.background = Background(BackgroundFill(Paint.valueOf("#42adaf"), CornerRadii.EMPTY, Insets.EMPTY))
|
if (gmc.isLastSelectedInitialized()) {
|
||||||
|
gmc.lastSelected.background = Background.EMPTY
|
||||||
|
this.background = Background(BackgroundFill(Paint.valueOf("#42adaf"), CornerRadii.EMPTY, Insets.EMPTY))
|
||||||
|
gmc.lastSelected = this
|
||||||
|
} else {
|
||||||
|
this.background = Background(BackgroundFill(Paint.valueOf("#42adaf"), CornerRadii.EMPTY, Insets.EMPTY))
|
||||||
|
gmc.lastSelected = this
|
||||||
|
}
|
||||||
gmc.previewSelectedAction(data)
|
gmc.previewSelectedAction(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,9 @@ class GUIModelController: Controller() {
|
|||||||
|
|
||||||
private val rootc = find(RootController::class)
|
private val rootc = find(RootController::class)
|
||||||
|
|
||||||
|
lateinit var lastSelected: GUIModel
|
||||||
|
fun isLastSelectedInitialized() = ::lastSelected.isInitialized
|
||||||
|
|
||||||
fun export(data: Texture) {
|
fun export(data: Texture) {
|
||||||
rootc.exportTexture(data)
|
rootc.exportTexture(data)
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@ import tornadofx.*
|
|||||||
class FolderView : View("FolderView"){
|
class FolderView : View("FolderView"){
|
||||||
|
|
||||||
override val root = flowpane {
|
override val root = flowpane {
|
||||||
hgap = 15.0
|
hgap = 5.0
|
||||||
vgap = 15.0
|
vgap = 5.0
|
||||||
paddingAll = 12.0
|
paddingAll = 10.0
|
||||||
prefWidth = 732.0
|
prefWidth = 732.0
|
||||||
prefHeight = 401.0
|
prefHeight = 401.0
|
||||||
background = Background(BackgroundFill(Paint.valueOf("#cfcfcf"), CornerRadii.EMPTY, Insets.EMPTY))
|
background = Background(BackgroundFill(Paint.valueOf("#cfcfcf"), CornerRadii.EMPTY, Insets.EMPTY))
|
||||||
|
Loading…
Reference in New Issue
Block a user