From c9a168a13803f831be592f32f1c5b32ee3af02bc Mon Sep 17 00:00:00 2001 From: Alexander Rose <alexander.rose@weirdbyte.de> Date: Sun, 8 Jan 2023 21:08:00 -0800 Subject: [PATCH] improve checks in UnitsRepresentation setVisualState --- src/mol-repr/structure/units-representation.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mol-repr/structure/units-representation.ts b/src/mol-repr/structure/units-representation.ts index b713ede00..a286188a5 100644 --- a/src/mol-repr/structure/units-representation.ts +++ b/src/mol-repr/structure/units-representation.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2018-2023 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> * @author David Sehnal <david.sehnal@gmail.com> @@ -232,12 +232,16 @@ export function UnitsRepresentation<P extends StructureParams>(label: string, ct if (substance !== undefined) visual.setSubstance(substance, webgl); if (clipping !== undefined) visual.setClipping(clipping); if (themeStrength !== undefined) visual.setThemeStrength(themeStrength); - if (transform !== undefined) visual.setTransform(transform); + if (transform !== undefined) { + if (transform !== _state.transform || !Mat4.areEqual(transform, _state.transform, EPSILON)) { + visual.setTransform(transform); + } + } if (unitTransforms !== undefined) { if (unitTransforms) { // console.log(group.hashCode, unitTransforms.getSymmetryGroupTransforms(group)) visual.setTransform(undefined, unitTransforms.getSymmetryGroupTransforms(group)); - } else { + } else if (unitTransforms !== _state.unitTransforms) { visual.setTransform(undefined, null); } } -- GitLab