diff --git a/dataforge-vis-common/src/commonMain/kotlin/hep/dataforge/vis/common/AbstractVisualObject.kt b/dataforge-vis-common/src/commonMain/kotlin/hep/dataforge/vis/common/AbstractVisualObject.kt index c4ce41ae..01e2c770 100644 --- a/dataforge-vis-common/src/commonMain/kotlin/hep/dataforge/vis/common/AbstractVisualObject.kt +++ b/dataforge-vis-common/src/commonMain/kotlin/hep/dataforge/vis/common/AbstractVisualObject.kt @@ -56,13 +56,13 @@ abstract class AbstractVisualObject : VisualObject { config[name] = value } - private var styleCache: Laminate? = null + private var styleCache: Meta? = null /** * Collect all styles for this object in a laminate */ - val appliedStyles: Laminate - get() = styleCache ?: Laminate(style.map { it.toName() }.mapNotNull(::findStyle)).also { styleCache = it } + protected val appliedStyles: Meta + get() = styleCache ?: Laminate(style.map { it.toName() }.mapNotNull(::findStyle)).merge().also { styleCache = it } /** diff --git a/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt b/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt index 49f8a382..d3417530 100644 --- a/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt +++ b/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt @@ -4,7 +4,10 @@ import hep.dataforge.context.Global import hep.dataforge.vis.common.VisualGroup import hep.dataforge.vis.hmr.ApplicationBase import hep.dataforge.vis.hmr.startApplication -import hep.dataforge.vis.spatial.* +import hep.dataforge.vis.spatial.Visual3DPlugin +import hep.dataforge.vis.spatial.VisualGroup3D +import hep.dataforge.vis.spatial.VisualObject3D +import hep.dataforge.vis.spatial.attachChildren import hep.dataforge.vis.spatial.gdml.GDMLTransformer import hep.dataforge.vis.spatial.gdml.LUnit import hep.dataforge.vis.spatial.gdml.toVisual @@ -137,15 +140,15 @@ private class GDMLDemoApp : ApplicationBase() { } solidConfiguration = { parent, solid -> - if (!parent.physVolumes.isEmpty()) { - opacity = 0.3 - } - if (solid.name.startsWith("Coil") + if (parent.physVolumes.isNotEmpty() + || solid.name.startsWith("Coil") || solid.name.startsWith("Yoke") || solid.name.startsWith("Magnet") || solid.name.startsWith("Pole") ) { - opacity = 0.3 + useStyle("opaque") { + VisualObject3D.OPACITY_KEY to 0.3 + } } } }