diff --git a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Proxy.kt b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Proxy.kt index 557d728d..b7fb006f 100644 --- a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Proxy.kt +++ b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Proxy.kt @@ -5,6 +5,7 @@ package hep.dataforge.vis.spatial import hep.dataforge.meta.Config import hep.dataforge.meta.Laminate import hep.dataforge.meta.MetaItem +import hep.dataforge.meta.descriptors.NodeDescriptor import hep.dataforge.meta.get import hep.dataforge.names.* import hep.dataforge.vis.* @@ -88,6 +89,9 @@ class Proxy private constructor( //override fun findAllStyles(): Laminate = Laminate((styles + prototype.styles).mapNotNull { findStyle(it) }) + override val descriptor: NodeDescriptor? + get() = prototype.descriptor + inner class ProxyChild(val name: Name) : AbstractVisualObject(), VisualGroup { @@ -139,6 +143,9 @@ class Proxy private constructor( override fun allProperties(): Laminate = Laminate(properties, mergedStyles, prototype.allProperties(), parent?.allProperties()) + + override val descriptor: NodeDescriptor? + get() = prototype.descriptor } companion object { diff --git a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualGroup3D.kt b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualGroup3D.kt index ba12fef2..2bdf5552 100644 --- a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualGroup3D.kt +++ b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualGroup3D.kt @@ -40,8 +40,8 @@ class VisualGroup3D : AbstractVisualGroup(), VisualObject3D, PrototypeHolder { */ fun prototypes(builder: MutableVisualGroup.() -> Unit): Unit { (prototypes ?: Prototypes().also { - attach(it) prototypes = it + attach(it) }).run(builder) } @@ -90,7 +90,7 @@ class VisualGroup3D : AbstractVisualGroup(), VisualObject3D, PrototypeHolder { * Ger a prototype redirecting the request to the parent if prototype is not found */ tailrec fun PrototypeHolder.getPrototype(name: Name): VisualObject3D? = - prototypes?.get(name) as? VisualObject3D ?: (parent as? VisualGroup3D)?.getPrototype(name) + prototypes?.get(name) as? VisualObject3D ?: (parent as? PrototypeHolder)?.getPrototype(name) /** * Define a group with given [name], attach it to this parent and return it.