Add collapsible panels to orx-gui
This commit is contained in:
@@ -39,6 +39,10 @@ class GUI : Extension {
|
|||||||
this.height = 100.percent
|
this.height = 100.percent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
styleSheet(has class_ "collapsed") {
|
||||||
|
this.display = Display.NONE
|
||||||
|
}
|
||||||
|
|
||||||
styleSheet(has class_ "sidebar") {
|
styleSheet(has class_ "sidebar") {
|
||||||
this.width = 200.px
|
this.width = 200.px
|
||||||
this.paddingBottom = 20.px
|
this.paddingBottom = 20.px
|
||||||
@@ -48,10 +52,23 @@ class GUI : Extension {
|
|||||||
this.marginRight = 2.px
|
this.marginRight = 2.px
|
||||||
this.height = 100.percent
|
this.height = 100.percent
|
||||||
this.background = Color.RGBa(ColorRGBa.GRAY.copy(a = 0.2))
|
this.background = Color.RGBa(ColorRGBa.GRAY.copy(a = 0.2))
|
||||||
|
this.overflow = Overflow.Scroll
|
||||||
|
|
||||||
descendant(has type "colorpicker-button") {
|
descendant(has type "colorpicker-button") {
|
||||||
this.width = 175.px
|
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") {
|
styleSheet(has type "dropdown-button") {
|
||||||
@@ -72,10 +89,19 @@ class GUI : Extension {
|
|||||||
div("sidebar") {
|
div("sidebar") {
|
||||||
id = "sidebar"
|
id = "sidebar"
|
||||||
for ((obj, parameters) in trackedParams) {
|
for ((obj, parameters) in trackedParams) {
|
||||||
h3 { obj.title() ?: "untitled" }
|
val header = h3 { obj.title() ?: "untitled" }
|
||||||
|
val collapsible = div {
|
||||||
for (parameter in parameters) {
|
for (parameter in parameters) {
|
||||||
addControl(obj, parameter)
|
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