Add collapsible panels to orx-gui
This commit is contained in:
@@ -39,6 +39,10 @@ class GUI : Extension {
|
||||
this.height = 100.percent
|
||||
}
|
||||
|
||||
styleSheet(has class_ "collapsed") {
|
||||
this.display = Display.NONE
|
||||
}
|
||||
|
||||
styleSheet(has class_ "sidebar") {
|
||||
this.width = 200.px
|
||||
this.paddingBottom = 20.px
|
||||
@@ -48,10 +52,23 @@ class GUI : Extension {
|
||||
this.marginRight = 2.px
|
||||
this.height = 100.percent
|
||||
this.background = Color.RGBa(ColorRGBa.GRAY.copy(a = 0.2))
|
||||
this.overflow = Overflow.Scroll
|
||||
|
||||
descendant(has type "colorpicker-button") {
|
||||
this.width = 175.px
|
||||
}
|
||||
|
||||
descendant(has type "slider") {
|
||||
this.width = 175.px
|
||||
}
|
||||
|
||||
descendant(has type "button") {
|
||||
this.width = 175.px
|
||||
}
|
||||
|
||||
descendant(has type "textfield") {
|
||||
this.width = 175.px
|
||||
}
|
||||
}
|
||||
|
||||
styleSheet(has type "dropdown-button") {
|
||||
@@ -72,12 +89,21 @@ class GUI : Extension {
|
||||
div("sidebar") {
|
||||
id = "sidebar"
|
||||
for ((obj, parameters) in trackedParams) {
|
||||
h3 { obj.title() ?: "untitled" }
|
||||
|
||||
val header = h3 { obj.title() ?: "untitled" }
|
||||
val collapsible = div {
|
||||
for (parameter in parameters) {
|
||||
addControl(obj, parameter)
|
||||
}
|
||||
}
|
||||
header.mouse.pressed.subscribe {
|
||||
val c = ElementClass("collapsed")
|
||||
if (c in collapsible.classes) {
|
||||
collapsible.classes.remove(c)
|
||||
} else {
|
||||
collapsible.classes.add(c)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user