UNPKG

molstar

Version:

A comprehensive macromolecular library.

505 lines (504 loc) 28.1 kB
"use strict"; /** * Copyright (c) 2018-2024 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> * @author Gianluca Tomasello <giagitom@gmail.com> * @author Herman Bergwerf <post@hbergwerf.nl> */ Object.defineProperty(exports, "__esModule", { value: true }); exports.StructureIntraUnitBondCylinderParams = exports.IntraUnitBondCylinderParams = void 0; exports.IntraUnitBondCylinderVisual = IntraUnitBondCylinderVisual; exports.IntraUnitBondCylinderImpostorVisual = IntraUnitBondCylinderImpostorVisual; exports.IntraUnitBondCylinderMeshVisual = IntraUnitBondCylinderMeshVisual; exports.StructureIntraUnitBondCylinderVisual = StructureIntraUnitBondCylinderVisual; exports.StructureIntraUnitBondCylinderImpostorVisual = StructureIntraUnitBondCylinderImpostorVisual; exports.StructureIntraUnitBondCylinderMeshVisual = StructureIntraUnitBondCylinderMeshVisual; const param_definition_1 = require("../../../mol-util/param-definition"); const structure_1 = require("../../../mol-model/structure"); const mesh_1 = require("../../../mol-geo/geometry/mesh/mesh"); const linear_algebra_1 = require("../../../mol-math/linear-algebra"); const mol_util_1 = require("../../../mol-util"); const link_1 = require("./util/link"); const units_visual_1 = require("../units-visual"); const types_1 = require("../../../mol-model/structure/model/types"); const bond_1 = require("./util/bond"); const geometry_1 = require("../../../mol-math/geometry"); const graph_1 = require("../../../mol-math/graph"); const cylinders_1 = require("../../../mol-geo/geometry/cylinders/cylinders"); const int_1 = require("../../../mol-data/int"); const array_1 = require("../../../mol-util/array"); const size_1 = require("../../../mol-theme/size"); const complex_visual_1 = require("../complex-visual"); const location_iterator_1 = require("../../../mol-geo/util/location-iterator"); // avoiding namespace lookup improved performance in Chrome (Aug 2020) const isBondType = types_1.BondType.is; function getIntraUnitBondCylinderBuilderProps(unit, structure, theme, props) { const elements = unit.elements; const bonds = unit.bonds; const { edgeCount, a, b, edgeProps, offset } = bonds; const { order: _order, flags: _flags } = edgeProps; const { sizeFactor, sizeAspectRatio, adjustCylinderLength, aromaticBonds, includeTypes, excludeTypes, multipleBonds } = props; const mbOff = multipleBonds === 'off'; const mbSymmetric = multipleBonds === 'symmetric'; const include = types_1.BondType.fromNames(includeTypes); const exclude = types_1.BondType.fromNames(excludeTypes); const ignoreComputedAromatic = (0, bond_1.ignoreBondType)(include, exclude, 32 /* BondType.Flag.Computed */); const vRef = (0, linear_algebra_1.Vec3)(), delta = (0, linear_algebra_1.Vec3)(); const c = unit.conformation; let stub; const locE = structure_1.StructureElement.Location.create(structure, unit); const locB = structure_1.Bond.Location(structure, unit, undefined, structure, unit, undefined); const { child } = structure; if (props.includeParent && child) { const childUnit = child.unitMap.get(unit.id); if (!childUnit) throw new Error('expected childUnit to exist'); stub = (edgeIndex) => { const eA = elements[a[edgeIndex]]; const eB = elements[b[edgeIndex]]; return int_1.SortedArray.has(childUnit.elements, eA) && !int_1.SortedArray.has(childUnit.elements, eB); }; } const radius = (edgeIndex) => { locB.aIndex = a[edgeIndex]; locB.bIndex = b[edgeIndex]; return theme.size.size(locB) * sizeFactor; }; const radiusA = (edgeIndex) => { locE.element = elements[a[edgeIndex]]; return theme.size.size(locE) * sizeFactor; }; const radiusB = (edgeIndex) => { locE.element = elements[b[edgeIndex]]; return theme.size.size(locE) * sizeFactor; }; const { elementRingIndices, elementAromaticRingIndices } = unit.rings; const deloTriplets = aromaticBonds ? unit.resonance.delocalizedTriplets : undefined; return { linkCount: edgeCount * 2, referencePosition: (edgeIndex) => { let aI = a[edgeIndex], bI = b[edgeIndex]; const rI = deloTriplets === null || deloTriplets === void 0 ? void 0 : deloTriplets.getThirdElement(aI, bI); if (rI !== undefined) return c.invariantPosition(elements[rI], vRef); if (aI > bI) [aI, bI] = [bI, aI]; if (offset[aI + 1] - offset[aI] === 1) [aI, bI] = [bI, aI]; const aR = elementAromaticRingIndices.get(aI) || elementRingIndices.get(aI); let maxSize = 0; for (let i = offset[aI], il = offset[aI + 1]; i < il; ++i) { const _bI = b[i]; if (_bI !== bI && _bI !== aI) { if (aR) { const _bR = elementAromaticRingIndices.get(_bI) || elementRingIndices.get(_bI); if (!_bR) continue; const size = (0, array_1.arrayIntersectionSize)(aR, _bR); if (size > maxSize) { maxSize = size; c.invariantPosition(elements[_bI], vRef); } } else { return c.invariantPosition(elements[_bI], vRef); } } } return maxSize > 0 ? vRef : null; }, position: (posA, posB, edgeIndex, adjust) => { c.invariantPosition(elements[a[edgeIndex]], posA); c.invariantPosition(elements[b[edgeIndex]], posB); if (adjust && adjustCylinderLength) { const rA = radiusA(edgeIndex), rB = radiusB(edgeIndex); const r = Math.min(rA, rB) * sizeAspectRatio; const oA = Math.sqrt(Math.max(0, rA * rA - r * r)) - 0.05; const oB = Math.sqrt(Math.max(0, rB * rB - r * r)) - 0.05; if (oA <= 0.01 && oB <= 0.01) return; linear_algebra_1.Vec3.normalize(delta, linear_algebra_1.Vec3.sub(delta, posB, posA)); linear_algebra_1.Vec3.scaleAndAdd(posA, posA, delta, oA); linear_algebra_1.Vec3.scaleAndAdd(posB, posB, delta, -oB); } }, style: (edgeIndex) => { const o = _order[edgeIndex]; const f = _flags[edgeIndex]; if (isBondType(f, 2 /* BondType.Flag.MetallicCoordination */) || isBondType(f, 4 /* BondType.Flag.HydrogenBond */)) { // show metallic coordinations and hydrogen bonds with dashed cylinders return 1 /* LinkStyle.Dashed */; } else if (o === 3) { return mbOff ? 0 /* LinkStyle.Solid */ : mbSymmetric ? 4 /* LinkStyle.Triple */ : 5 /* LinkStyle.OffsetTriple */; } else if (aromaticBonds) { const aI = a[edgeIndex], bI = b[edgeIndex]; const aR = elementAromaticRingIndices.get(aI); const bR = elementAromaticRingIndices.get(bI); const arCount = (aR && bR) ? (0, array_1.arrayIntersectionSize)(aR, bR) : 0; if (isBondType(f, 16 /* BondType.Flag.Aromatic */) || (arCount && !ignoreComputedAromatic)) { if (arCount === 2) { return 8 /* LinkStyle.MirroredAromatic */; } else { return 7 /* LinkStyle.Aromatic */; } } } return (o !== 2 || mbOff) ? 0 /* LinkStyle.Solid */ : mbSymmetric ? 2 /* LinkStyle.Double */ : 3 /* LinkStyle.OffsetDouble */; }, radius: (edgeIndex) => { return radius(edgeIndex) * sizeAspectRatio; }, ignore: (0, bond_1.makeIntraBondIgnoreTest)(structure, unit, props), stub }; } function createIntraUnitBondCylinderImpostors(ctx, unit, structure, theme, props, cylinders) { if (!structure_1.Unit.isAtomic(unit)) return cylinders_1.Cylinders.createEmpty(cylinders); if (!(0, bond_1.hasUnitVisibleBonds)(unit, props)) return cylinders_1.Cylinders.createEmpty(cylinders); if (!unit.bonds.edgeCount) return cylinders_1.Cylinders.createEmpty(cylinders); const { child } = structure; const childUnit = child === null || child === void 0 ? void 0 : child.unitMap.get(unit.id); if (child && !childUnit) return cylinders_1.Cylinders.createEmpty(cylinders); const builderProps = getIntraUnitBondCylinderBuilderProps(unit, structure, theme, props); const { cylinders: c, boundingSphere } = (0, link_1.createLinkCylinderImpostors)(ctx, builderProps, props, cylinders); if (boundingSphere) { c.setBoundingSphere(boundingSphere); } else if (c.cylinderCount > 0) { const sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (childUnit !== null && childUnit !== void 0 ? childUnit : unit).boundary.sphere, 1 * props.sizeFactor); c.setBoundingSphere(sphere); } return c; } function createIntraUnitBondCylinderMesh(ctx, unit, structure, theme, props, mesh) { if (!structure_1.Unit.isAtomic(unit)) return mesh_1.Mesh.createEmpty(mesh); if (!(0, bond_1.hasUnitVisibleBonds)(unit, props)) return mesh_1.Mesh.createEmpty(mesh); if (!unit.bonds.edgeCount) return mesh_1.Mesh.createEmpty(mesh); const { child } = structure; const childUnit = child === null || child === void 0 ? void 0 : child.unitMap.get(unit.id); if (child && !childUnit) return mesh_1.Mesh.createEmpty(mesh); const builderProps = getIntraUnitBondCylinderBuilderProps(unit, structure, theme, props); const { mesh: m, boundingSphere } = (0, link_1.createLinkCylinderMesh)(ctx, builderProps, props, mesh); if (boundingSphere) { m.setBoundingSphere(boundingSphere); } else if (m.triangleCount > 0) { const sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (childUnit !== null && childUnit !== void 0 ? childUnit : unit).boundary.sphere, 1 * props.sizeFactor); m.setBoundingSphere(sphere); } return m; } exports.IntraUnitBondCylinderParams = { ...units_visual_1.UnitsMeshParams, ...units_visual_1.UnitsCylindersParams, ...bond_1.BondCylinderParams, sizeFactor: param_definition_1.ParamDefinition.Numeric(0.3, { min: 0, max: 10, step: 0.01 }), sizeAspectRatio: param_definition_1.ParamDefinition.Numeric(2 / 3, { min: 0, max: 3, step: 0.01 }), tryUseImpostor: param_definition_1.ParamDefinition.Boolean(true), includeParent: param_definition_1.ParamDefinition.Boolean(false), }; function IntraUnitBondCylinderVisual(materialId, structure, props, webgl) { return props.tryUseImpostor && webgl && webgl.extensions.fragDepth ? IntraUnitBondCylinderImpostorVisual(materialId) : IntraUnitBondCylinderMeshVisual(materialId); } function IntraUnitBondCylinderImpostorVisual(materialId) { return (0, units_visual_1.UnitsCylindersVisual)({ defaultProps: param_definition_1.ParamDefinition.getDefaultValues(exports.IntraUnitBondCylinderParams), createGeometry: createIntraUnitBondCylinderImpostors, createLocationIterator: (structureGroup, props) => bond_1.BondIterator.fromGroup(structureGroup, { includeLocation2: props.colorMode === 'interpolate' }), getLoci: bond_1.getIntraBondLoci, eachLocation: bond_1.eachIntraBond, setUpdateState: (state, newProps, currentProps, newTheme, currentTheme, newStructureGroup, currentStructureGroup) => { state.createGeometry = (newProps.sizeFactor !== currentProps.sizeFactor || newProps.sizeAspectRatio !== currentProps.sizeAspectRatio || newProps.linkScale !== currentProps.linkScale || newProps.linkSpacing !== currentProps.linkSpacing || newProps.ignoreHydrogens !== currentProps.ignoreHydrogens || newProps.ignoreHydrogensVariant !== currentProps.ignoreHydrogensVariant || newProps.linkCap !== currentProps.linkCap || newProps.aromaticScale !== currentProps.aromaticScale || newProps.aromaticSpacing !== currentProps.aromaticSpacing || newProps.aromaticDashCount !== currentProps.aromaticDashCount || newProps.dashCount !== currentProps.dashCount || newProps.dashScale !== currentProps.dashScale || newProps.dashCap !== currentProps.dashCap || newProps.stubCap !== currentProps.stubCap || !(0, mol_util_1.arrayEqual)(newProps.includeTypes, currentProps.includeTypes) || !(0, mol_util_1.arrayEqual)(newProps.excludeTypes, currentProps.excludeTypes) || newProps.adjustCylinderLength !== currentProps.adjustCylinderLength || newProps.aromaticBonds !== currentProps.aromaticBonds || newProps.multipleBonds !== currentProps.multipleBonds || newProps.adjustCylinderLength && !size_1.SizeTheme.areEqual(newTheme.size, currentTheme.size)); if (newProps.colorMode !== currentProps.colorMode) { state.createGeometry = true; state.updateTransform = true; state.updateColor = true; } const newUnit = newStructureGroup.group.units[0]; const currentUnit = currentStructureGroup.group.units[0]; if (structure_1.Unit.isAtomic(newUnit) && structure_1.Unit.isAtomic(currentUnit)) { if (!graph_1.IntAdjacencyGraph.areEqual(newUnit.bonds, currentUnit.bonds)) { state.createGeometry = true; state.updateTransform = true; state.updateColor = true; state.updateSize = true; } } }, mustRecreate: (structureGroup, props, webgl) => { return !props.tryUseImpostor || !webgl; } }, materialId); } function IntraUnitBondCylinderMeshVisual(materialId) { return (0, units_visual_1.UnitsMeshVisual)({ defaultProps: param_definition_1.ParamDefinition.getDefaultValues(exports.IntraUnitBondCylinderParams), createGeometry: createIntraUnitBondCylinderMesh, createLocationIterator: (structureGroup) => bond_1.BondIterator.fromGroup(structureGroup), getLoci: bond_1.getIntraBondLoci, eachLocation: bond_1.eachIntraBond, setUpdateState: (state, newProps, currentProps, newTheme, currentTheme, newStructureGroup, currentStructureGroup) => { state.createGeometry = (newProps.sizeFactor !== currentProps.sizeFactor || newProps.sizeAspectRatio !== currentProps.sizeAspectRatio || newProps.radialSegments !== currentProps.radialSegments || newProps.linkScale !== currentProps.linkScale || newProps.linkSpacing !== currentProps.linkSpacing || newProps.ignoreHydrogens !== currentProps.ignoreHydrogens || newProps.ignoreHydrogensVariant !== currentProps.ignoreHydrogensVariant || newProps.linkCap !== currentProps.linkCap || newProps.aromaticScale !== currentProps.aromaticScale || newProps.aromaticSpacing !== currentProps.aromaticSpacing || newProps.aromaticDashCount !== currentProps.aromaticDashCount || newProps.dashCount !== currentProps.dashCount || newProps.dashScale !== currentProps.dashScale || newProps.dashCap !== currentProps.dashCap || newProps.stubCap !== currentProps.stubCap || !(0, mol_util_1.arrayEqual)(newProps.includeTypes, currentProps.includeTypes) || !(0, mol_util_1.arrayEqual)(newProps.excludeTypes, currentProps.excludeTypes) || newProps.adjustCylinderLength !== currentProps.adjustCylinderLength || newProps.aromaticBonds !== currentProps.aromaticBonds || newProps.multipleBonds !== currentProps.multipleBonds); const newUnit = newStructureGroup.group.units[0]; const currentUnit = currentStructureGroup.group.units[0]; if (structure_1.Unit.isAtomic(newUnit) && structure_1.Unit.isAtomic(currentUnit)) { if (!graph_1.IntAdjacencyGraph.areEqual(newUnit.bonds, currentUnit.bonds)) { state.createGeometry = true; state.updateTransform = true; state.updateColor = true; state.updateSize = true; } } }, mustRecreate: (structureGroup, props, webgl) => { return props.tryUseImpostor && !!webgl; } }, materialId); } // function getStructureIntraUnitBondCylinderBuilderProps(structure, theme, props) { const intraUnitProps = []; const { bondCount, unitIndex, unitEdgeIndex, unitGroupIndex } = structure.intraUnitBondMapping; const { child } = structure; for (const ug of structure.unitSymmetryGroups) { const unit = ug.units[0]; const childUnit = child === null || child === void 0 ? void 0 : child.unitMap.get(unit.id); const p = structure_1.Unit.isAtomic(unit) && !(child && !childUnit) ? getIntraUnitBondCylinderBuilderProps(unit, structure, theme, props) : link_1.EmptyLinkBuilderProps; intraUnitProps.push({ group: ug, props: p }); } return { linkCount: bondCount, referencePosition: (edgeIndex) => { const { group, props } = intraUnitProps[unitIndex[edgeIndex]]; if (!props.referencePosition) return null; const v = props.referencePosition(unitEdgeIndex[edgeIndex]); if (!v) return null; const u = group.units[unitGroupIndex[edgeIndex]]; linear_algebra_1.Vec3.transformMat4(v, v, u.conformation.operator.matrix); return v; }, position: (posA, posB, edgeIndex, adjust) => { const { group, props } = intraUnitProps[unitIndex[edgeIndex]]; props.position(posA, posB, unitEdgeIndex[edgeIndex], adjust); const u = group.units[unitGroupIndex[edgeIndex]]; linear_algebra_1.Vec3.transformMat4(posA, posA, u.conformation.operator.matrix); linear_algebra_1.Vec3.transformMat4(posB, posB, u.conformation.operator.matrix); }, style: (edgeIndex) => { const { props } = intraUnitProps[unitIndex[edgeIndex]]; return props.style ? props.style(unitEdgeIndex[edgeIndex]) : 0 /* LinkStyle.Solid */; }, radius: (edgeIndex) => { const { props } = intraUnitProps[unitIndex[edgeIndex]]; return props.radius(unitEdgeIndex[edgeIndex]); }, ignore: (edgeIndex) => { const { props } = intraUnitProps[unitIndex[edgeIndex]]; return props.ignore ? props.ignore(unitEdgeIndex[edgeIndex]) : false; }, stub: (edgeIndex) => { const { props } = intraUnitProps[unitIndex[edgeIndex]]; return props.stub ? props.stub(unitEdgeIndex[edgeIndex]) : false; } }; } function createStructureIntraUnitBondCylinderImpostors(ctx, structure, theme, props, cylinders) { if (!(0, bond_1.hasStructureVisibleBonds)(structure, props)) return cylinders_1.Cylinders.createEmpty(cylinders); if (!structure.intraUnitBondMapping.bondCount) return cylinders_1.Cylinders.createEmpty(cylinders); const builderProps = getStructureIntraUnitBondCylinderBuilderProps(structure, theme, props); const { cylinders: c, boundingSphere } = (0, link_1.createLinkCylinderImpostors)(ctx, builderProps, props, cylinders); if (boundingSphere) { c.setBoundingSphere(boundingSphere); } else if (c.cylinderCount > 0) { const { child } = structure; const sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (child !== null && child !== void 0 ? child : structure).boundary.sphere, 1 * props.sizeFactor); c.setBoundingSphere(sphere); } return c; } function createStructureIntraUnitBondCylinderMesh(ctx, structure, theme, props, mesh) { if (!(0, bond_1.hasStructureVisibleBonds)(structure, props)) return mesh_1.Mesh.createEmpty(mesh); if (!structure.intraUnitBondMapping.bondCount) return mesh_1.Mesh.createEmpty(mesh); const builderProps = getStructureIntraUnitBondCylinderBuilderProps(structure, theme, props); const { mesh: m, boundingSphere } = (0, link_1.createLinkCylinderMesh)(ctx, builderProps, props, mesh); if (boundingSphere) { m.setBoundingSphere(boundingSphere); } else if (m.triangleCount > 0) { const { child } = structure; const sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (child !== null && child !== void 0 ? child : structure).boundary.sphere, 1 * props.sizeFactor); m.setBoundingSphere(sphere); } return m; } exports.StructureIntraUnitBondCylinderParams = { ...complex_visual_1.ComplexMeshParams, ...complex_visual_1.ComplexCylindersParams, ...bond_1.BondCylinderParams, sizeFactor: param_definition_1.ParamDefinition.Numeric(0.3, { min: 0, max: 10, step: 0.01 }), sizeAspectRatio: param_definition_1.ParamDefinition.Numeric(2 / 3, { min: 0, max: 3, step: 0.01 }), tryUseImpostor: param_definition_1.ParamDefinition.Boolean(true), includeParent: param_definition_1.ParamDefinition.Boolean(false), }; function StructureIntraUnitBondCylinderVisual(materialId, structure, props, webgl) { return props.tryUseImpostor && webgl && webgl.extensions.fragDepth ? StructureIntraUnitBondCylinderImpostorVisual(materialId) : StructureIntraUnitBondCylinderMeshVisual(materialId); } function StructureIntraUnitBondCylinderImpostorVisual(materialId) { return (0, complex_visual_1.ComplexCylindersVisual)({ defaultProps: param_definition_1.ParamDefinition.getDefaultValues(exports.StructureIntraUnitBondCylinderParams), createGeometry: createStructureIntraUnitBondCylinderImpostors, createLocationIterator: (structure, props) => { return !(0, bond_1.hasStructureVisibleBonds)(structure, props) ? location_iterator_1.EmptyLocationIterator : bond_1.BondIterator.fromStructureGroups(structure, { includeLocation2: props.colorMode === 'interpolate' }); }, getLoci: bond_1.getStructureGroupsBondLoci, eachLocation: bond_1.eachStructureGroupsBond, setUpdateState: (state, newProps, currentProps, newTheme, currentTheme, newStructure, currentStructure) => { state.createGeometry = (newProps.sizeFactor !== currentProps.sizeFactor || newProps.sizeAspectRatio !== currentProps.sizeAspectRatio || newProps.linkScale !== currentProps.linkScale || newProps.linkSpacing !== currentProps.linkSpacing || newProps.ignoreHydrogens !== currentProps.ignoreHydrogens || newProps.ignoreHydrogensVariant !== currentProps.ignoreHydrogensVariant || newProps.linkCap !== currentProps.linkCap || newProps.aromaticScale !== currentProps.aromaticScale || newProps.aromaticSpacing !== currentProps.aromaticSpacing || newProps.aromaticDashCount !== currentProps.aromaticDashCount || newProps.dashCount !== currentProps.dashCount || newProps.dashScale !== currentProps.dashScale || newProps.dashCap !== currentProps.dashCap || newProps.stubCap !== currentProps.stubCap || !(0, mol_util_1.arrayEqual)(newProps.includeTypes, currentProps.includeTypes) || !(0, mol_util_1.arrayEqual)(newProps.excludeTypes, currentProps.excludeTypes) || newProps.adjustCylinderLength !== currentProps.adjustCylinderLength || newProps.multipleBonds !== currentProps.multipleBonds); if (newProps.colorMode !== currentProps.colorMode) { state.createGeometry = true; state.updateTransform = true; state.updateColor = true; } if ((0, bond_1.hasStructureVisibleBonds)(newStructure, newProps) && newStructure.interUnitBonds !== currentStructure.interUnitBonds) { state.createGeometry = true; state.updateTransform = true; state.updateColor = true; state.updateSize = true; } }, mustRecreate: (structure, props, webgl) => { return !props.tryUseImpostor || !webgl; } }, materialId); } function StructureIntraUnitBondCylinderMeshVisual(materialId) { return (0, complex_visual_1.ComplexMeshVisual)({ defaultProps: param_definition_1.ParamDefinition.getDefaultValues(exports.StructureIntraUnitBondCylinderParams), createGeometry: createStructureIntraUnitBondCylinderMesh, createLocationIterator: (structure, props) => { return !(0, bond_1.hasStructureVisibleBonds)(structure, props) ? location_iterator_1.EmptyLocationIterator : bond_1.BondIterator.fromStructureGroups(structure); }, getLoci: bond_1.getStructureGroupsBondLoci, eachLocation: bond_1.eachStructureGroupsBond, setUpdateState: (state, newProps, currentProps, newTheme, currentTheme, newStructure, currentStructure) => { state.createGeometry = (newProps.sizeFactor !== currentProps.sizeFactor || newProps.sizeAspectRatio !== currentProps.sizeAspectRatio || newProps.radialSegments !== currentProps.radialSegments || newProps.linkScale !== currentProps.linkScale || newProps.linkSpacing !== currentProps.linkSpacing || newProps.ignoreHydrogens !== currentProps.ignoreHydrogens || newProps.ignoreHydrogensVariant !== currentProps.ignoreHydrogensVariant || newProps.linkCap !== currentProps.linkCap || newProps.aromaticScale !== currentProps.aromaticScale || newProps.aromaticSpacing !== currentProps.aromaticSpacing || newProps.aromaticDashCount !== currentProps.aromaticDashCount || newProps.dashCount !== currentProps.dashCount || newProps.dashScale !== currentProps.dashScale || newProps.dashCap !== currentProps.dashCap || newProps.stubCap !== currentProps.stubCap || !(0, mol_util_1.arrayEqual)(newProps.includeTypes, currentProps.includeTypes) || !(0, mol_util_1.arrayEqual)(newProps.excludeTypes, currentProps.excludeTypes) || newProps.adjustCylinderLength !== currentProps.adjustCylinderLength || newProps.multipleBonds !== currentProps.multipleBonds || newProps.adjustCylinderLength && !size_1.SizeTheme.areEqual(newTheme.size, currentTheme.size)); if ((0, bond_1.hasStructureVisibleBonds)(newStructure, newProps) && newStructure.interUnitBonds !== currentStructure.interUnitBonds) { state.createGeometry = true; state.updateTransform = true; state.updateColor = true; state.updateSize = true; } }, mustRecreate: (structure, props, webgl) => { return props.tryUseImpostor && !!webgl; } }, materialId); }