Browse Source

don't add empty renderObjects

Alexander Rose 6 years ago
parent
commit
30006d4204

+ 1 - 1
src/mol-repr/structure/complex-visual.ts

@@ -155,7 +155,7 @@ export function ComplexVisual<P extends ComplexParams>(builder: ComplexVisualGeo
 
     return {
         get groupCount() { return locationIt ? locationIt.count : 0 },
-        get renderObject () { return renderObject },
+        get renderObject () { return locationIt && locationIt.count ? renderObject : undefined },
         createOrUpdate(ctx: VisualContext, theme: Theme, props: Partial<PD.Values<P>> = {}, structure?: Structure) {
             prepareUpdate(theme, props, structure || currentStructure)
             if (updateState.createGeometry) {

+ 1 - 1
src/mol-repr/structure/units-visual.ts

@@ -198,7 +198,7 @@ export function UnitsVisual<P extends UnitsParams>(builder: UnitsVisualGeometryB
 
     return {
         get groupCount() { return locationIt ? locationIt.count : 0 },
-        get renderObject () { return renderObject },
+        get renderObject () { return locationIt && locationIt.count ? renderObject : undefined },
         createOrUpdate(ctx: VisualContext, theme: Theme, props: Partial<PD.Values<P>> = {}, structureGroup?: StructureGroup) {
             prepareUpdate(theme, props, structureGroup || currentStructureGroup)
             if (updateState.createGeometry) {