Dev #24
@ -90,11 +90,13 @@ class ObjectTreeComponent : RComponent<ObjectTreeProps, TreeState>() {
|
|||||||
fun RBuilder.objectTree(
|
fun RBuilder.objectTree(
|
||||||
obj: VisualObject,
|
obj: VisualObject,
|
||||||
clickCallback: (Name) -> Unit = {}
|
clickCallback: (Name) -> Unit = {}
|
||||||
) = child(ObjectTreeComponent::class) {
|
) = card("Object tree") {
|
||||||
attrs {
|
child(ObjectTreeComponent::class) {
|
||||||
name = Name.EMPTY
|
attrs {
|
||||||
this.obj = obj
|
name = Name.EMPTY
|
||||||
this.clickCallback = clickCallback
|
this.obj = obj
|
||||||
|
this.clickCallback = clickCallback
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,10 +124,10 @@ inline fun VisualGroup3D.prototypes(builder: VisualGroup3D.() -> Unit): Unit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define a group with given [key], attach it to this parent and return it.
|
* Define a group with given [name], attach it to this parent and return it.
|
||||||
*/
|
*/
|
||||||
fun VisualGroup3D.group(key: String = "", action: VisualGroup3D.() -> Unit = {}): VisualGroup3D =
|
fun VisualGroup3D.group(name: String = "", action: VisualGroup3D.() -> Unit = {}): VisualGroup3D =
|
||||||
VisualGroup3D().apply(action).also {
|
VisualGroup3D().apply(action).also {
|
||||||
set(key, it)
|
set(name, it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ private class PlayGroundApp : Application {
|
|||||||
document.getElementById("app") as? HTMLElement ?: error("Element with id 'canvas' not found on page")
|
document.getElementById("app") as? HTMLElement ?: error("Element with id 'canvas' not found on page")
|
||||||
|
|
||||||
val obj = VisualGroup3D().apply {
|
val obj = VisualGroup3D().apply {
|
||||||
box(100, 100, 100)
|
box(100, 100, 100, name = "A")
|
||||||
group {
|
group("B") {
|
||||||
position = Point3D(120, 0, 0)
|
position = Point3D(120, 0, 0)
|
||||||
box(100, 100, 100)
|
box(100, 100, 100, name = "C")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user