molstar 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/viewer/molstar.js +1 -1
- package/lib/commonjs/extensions/rcsb/validation-report/representation.js +19 -2
- package/lib/commonjs/mol-model/structure/structure/structure.js +4 -1
- package/lib/commonjs/mol-model/structure/structure/unit/bonds/inter-compute.d.ts +1 -0
- package/lib/commonjs/mol-model/structure/structure/unit/bonds/inter-compute.js +4 -2
- package/lib/commonjs/mol-model/structure/structure/unit.js +1 -18
- package/lib/commonjs/mol-model-props/computed/representations/interactions-inter-unit-cylinder.js +9 -3
- package/lib/commonjs/mol-model-props/computed/representations/interactions-intra-unit-cylinder.js +10 -5
- package/lib/commonjs/mol-model-props/integrative/cross-link-restraint/representation.js +10 -1
- package/lib/commonjs/mol-plugin-state/helpers/root-structure.js +1 -1
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +1 -1
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.js +20 -10
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-line.d.ts +1 -1
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-line.js +10 -5
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.js +16 -6
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-line.js +8 -3
- package/lib/commonjs/mol-repr/structure/visual/carbohydrate-link-cylinder.js +10 -1
- package/lib/commonjs/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.js +10 -1
- package/lib/commonjs/mol-repr/structure/visual/element-point.d.ts +1 -1
- package/lib/commonjs/mol-repr/structure/visual/element-point.js +22 -3
- package/lib/commonjs/mol-repr/structure/visual/util/element.js +36 -2
- package/lib/commonjs/mol-repr/structure/visual/util/link.d.ts +13 -3
- package/lib/commonjs/mol-repr/structure/visual/util/link.js +55 -6
- package/lib/extensions/rcsb/validation-report/representation.js +19 -2
- package/lib/mol-model/structure/structure/structure.js +4 -1
- package/lib/mol-model/structure/structure/unit/bonds/inter-compute.d.ts +1 -0
- package/lib/mol-model/structure/structure/unit/bonds/inter-compute.js +4 -2
- package/lib/mol-model/structure/structure/unit.js +1 -18
- package/lib/mol-model-props/computed/representations/interactions-inter-unit-cylinder.js +9 -3
- package/lib/mol-model-props/computed/representations/interactions-intra-unit-cylinder.js +10 -5
- package/lib/mol-model-props/integrative/cross-link-restraint/representation.js +10 -1
- package/lib/mol-plugin/version.js +2 -2
- package/lib/mol-plugin-state/helpers/root-structure.js +1 -1
- package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +1 -1
- package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.js +20 -10
- package/lib/mol-repr/structure/visual/bond-inter-unit-line.d.ts +1 -1
- package/lib/mol-repr/structure/visual/bond-inter-unit-line.js +10 -5
- package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.js +16 -6
- package/lib/mol-repr/structure/visual/bond-intra-unit-line.js +8 -3
- package/lib/mol-repr/structure/visual/carbohydrate-link-cylinder.js +10 -1
- package/lib/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.js +10 -1
- package/lib/mol-repr/structure/visual/element-point.d.ts +1 -1
- package/lib/mol-repr/structure/visual/element-point.js +22 -3
- package/lib/mol-repr/structure/visual/util/element.js +36 -2
- package/lib/mol-repr/structure/visual/util/link.d.ts +13 -3
- package/lib/mol-repr/structure/visual/util/link.js +55 -6
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ var complex_visual_1 = require("../../../mol-repr/structure/complex-visual");
|
|
|
21
21
|
var color_1 = require("../../../mol-util/color");
|
|
22
22
|
var marker_action_1 = require("../../../mol-util/marker-action");
|
|
23
23
|
var centroid_helper_1 = require("../../../mol-math/geometry/centroid-helper");
|
|
24
|
+
var geometry_1 = require("../../../mol-math/geometry");
|
|
24
25
|
var label_1 = require("../../../mol-theme/label");
|
|
25
26
|
var params_1 = require("../../../mol-repr/structure/params");
|
|
26
27
|
//
|
|
@@ -44,7 +45,15 @@ function createIntraUnitClashCylinderMesh(ctx, unit, structure, theme, props, me
|
|
|
44
45
|
style: function (edgeIndex) { return 6 /* Disk */; },
|
|
45
46
|
radius: function (edgeIndex) { return magnitude[edgeIndex] * sizeFactor; },
|
|
46
47
|
};
|
|
47
|
-
|
|
48
|
+
var _a = (0, link_1.createLinkCylinderMesh)(ctx, builderProps, props, mesh), m = _a.mesh, boundingSphere = _a.boundingSphere;
|
|
49
|
+
if (boundingSphere) {
|
|
50
|
+
m.setBoundingSphere(boundingSphere);
|
|
51
|
+
}
|
|
52
|
+
else if (m.triangleCount > 0) {
|
|
53
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), structure.boundary.sphere, 1 * sizeFactor);
|
|
54
|
+
m.setBoundingSphere(sphere);
|
|
55
|
+
}
|
|
56
|
+
return m;
|
|
48
57
|
}
|
|
49
58
|
exports.IntraUnitClashParams = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, units_visual_1.UnitsMeshParams), link_1.LinkCylinderParams), { linkCap: param_definition_1.ParamDefinition.Boolean(true), sizeFactor: param_definition_1.ParamDefinition.Numeric(1, { min: 0, max: 10, step: 0.01 }) });
|
|
50
59
|
function IntraUnitClashVisual(materialId) {
|
|
@@ -137,7 +146,15 @@ function createInterUnitClashCylinderMesh(ctx, structure, theme, props, mesh) {
|
|
|
137
146
|
style: function (edgeIndex) { return 6 /* Disk */; },
|
|
138
147
|
radius: function (edgeIndex) { return edges[edgeIndex].props.magnitude * sizeFactor; }
|
|
139
148
|
};
|
|
140
|
-
|
|
149
|
+
var _a = (0, link_1.createLinkCylinderMesh)(ctx, builderProps, props, mesh), m = _a.mesh, boundingSphere = _a.boundingSphere;
|
|
150
|
+
if (boundingSphere) {
|
|
151
|
+
m.setBoundingSphere(boundingSphere);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), structure.boundary.sphere, 1 * sizeFactor);
|
|
155
|
+
m.setBoundingSphere(sphere);
|
|
156
|
+
}
|
|
157
|
+
return m;
|
|
141
158
|
}
|
|
142
159
|
exports.InterUnitClashParams = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, complex_visual_1.ComplexMeshParams), link_1.LinkCylinderParams), { linkCap: param_definition_1.ParamDefinition.Boolean(true), sizeFactor: param_definition_1.ParamDefinition.Numeric(1, { min: 0, max: 10, step: 0.01 }) });
|
|
143
160
|
function InterUnitClashVisual(materialId) {
|
|
@@ -283,7 +283,10 @@ var Structure = /** @class */ (function () {
|
|
|
283
283
|
this.state.interUnitBonds = new bonds_1.InterUnitBonds(new Map());
|
|
284
284
|
}
|
|
285
285
|
else {
|
|
286
|
-
this.state.interUnitBonds = (0, bonds_1.computeInterUnitBonds)(this, {
|
|
286
|
+
this.state.interUnitBonds = (0, bonds_1.computeInterUnitBonds)(this, {
|
|
287
|
+
ignoreWater: !this.dynamicBonds,
|
|
288
|
+
ignoreIon: !this.dynamicBonds,
|
|
289
|
+
});
|
|
287
290
|
}
|
|
288
291
|
return this.state.interUnitBonds;
|
|
289
292
|
},
|
|
@@ -11,6 +11,7 @@ import { InterUnitBonds } from './data';
|
|
|
11
11
|
export interface InterBondComputationProps extends BondComputationProps {
|
|
12
12
|
validUnitPair: (structure: Structure, unitA: Unit, unitB: Unit) => boolean;
|
|
13
13
|
ignoreWater: boolean;
|
|
14
|
+
ignoreIon: boolean;
|
|
14
15
|
}
|
|
15
16
|
declare function computeInterUnitBonds(structure: Structure, props?: Partial<InterBondComputationProps>): InterUnitBonds;
|
|
16
17
|
export { computeInterUnitBonds };
|
|
@@ -166,7 +166,7 @@ function findPairBonds(unitA, unitB, props, builder) {
|
|
|
166
166
|
}
|
|
167
167
|
builder.finishUnitPair();
|
|
168
168
|
}
|
|
169
|
-
var DefaultInterBondComputationProps = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, common_1.DefaultBondComputationProps), { ignoreWater: true });
|
|
169
|
+
var DefaultInterBondComputationProps = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, common_1.DefaultBondComputationProps), { ignoreWater: true, ignoreIon: true });
|
|
170
170
|
function findBonds(structure, props) {
|
|
171
171
|
var builder = new inter_unit_graph_1.InterUnitGraph.Builder();
|
|
172
172
|
var hasIndexPairBonds = structure.models.some(function (m) { return index_pair_1.IndexPairBonds.Provider.get(m); });
|
|
@@ -192,7 +192,9 @@ function computeInterUnitBonds(structure, props) {
|
|
|
192
192
|
var mtB = b.model.atomicHierarchy.derived.residue.moleculeType;
|
|
193
193
|
var notWater = ((!unit_1.Unit.isAtomic(a) || mtA[a.residueIndex[a.elements[0]]] !== 2 /* Water */) &&
|
|
194
194
|
(!unit_1.Unit.isAtomic(b) || mtB[b.residueIndex[b.elements[0]]] !== 2 /* Water */));
|
|
195
|
-
|
|
195
|
+
var notIon = ((!unit_1.Unit.isAtomic(a) || mtA[a.residueIndex[a.elements[0]]] !== 3 /* Ion */) &&
|
|
196
|
+
(!unit_1.Unit.isAtomic(b) || mtB[b.residueIndex[b.elements[0]]] !== 3 /* Ion */));
|
|
197
|
+
return structure_1.Structure.validUnitPair(s, a, b) && (notWater || !p.ignoreWater) && (notIon || !p.ignoreIon);
|
|
196
198
|
}) }));
|
|
197
199
|
}
|
|
198
200
|
exports.computeInterUnitBonds = computeInterUnitBonds;
|
|
@@ -24,8 +24,6 @@ var index_pair_1 = require("../../../mol-model-formats/structure/property/bonds/
|
|
|
24
24
|
var element_set_intra_bond_cache_1 = require("./unit/bonds/element-set-intra-bond-cache");
|
|
25
25
|
var symmetry_1 = require("../../../mol-model-formats/structure/property/symmetry");
|
|
26
26
|
var resonance_1 = require("./unit/resonance");
|
|
27
|
-
// avoiding namespace lookup improved performance in Chrome (Aug 2020)
|
|
28
|
-
var v3add = linear_algebra_1.Vec3.add;
|
|
29
27
|
var Unit;
|
|
30
28
|
(function (Unit) {
|
|
31
29
|
function isAtomic(u) { return u.kind === 0 /* Atomic */; }
|
|
@@ -158,22 +156,7 @@ var Unit;
|
|
|
158
156
|
? undefined
|
|
159
157
|
: tryRemapBonds(this, this.props.bonds, model, dynamicBonds) });
|
|
160
158
|
if (!Unit.isSameConformation(this, model)) {
|
|
161
|
-
|
|
162
|
-
if (b) {
|
|
163
|
-
var elements = this.elements;
|
|
164
|
-
var pos = this.conformation.invariantPosition;
|
|
165
|
-
var v = (0, linear_algebra_1.Vec3)();
|
|
166
|
-
var center = (0, linear_algebra_1.Vec3)();
|
|
167
|
-
for (var i = 0, il = elements.length; i < il; i++) {
|
|
168
|
-
pos(elements[i], v);
|
|
169
|
-
v3add(center, center, v);
|
|
170
|
-
}
|
|
171
|
-
linear_algebra_1.Vec3.scale(center, center, 1 / elements.length);
|
|
172
|
-
// only invalidate boundary if sphere has changed too much
|
|
173
|
-
if (linear_algebra_1.Vec3.distance(center, b.sphere.center) / b.sphere.radius >= 1.0) {
|
|
174
|
-
props.boundary = undefined;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
159
|
+
props.boundary = undefined;
|
|
177
160
|
props.lookup3d = undefined;
|
|
178
161
|
props.principalAxes = undefined;
|
|
179
162
|
}
|
package/lib/commonjs/mol-model-props/computed/representations/interactions-inter-unit-cylinder.js
CHANGED
|
@@ -76,9 +76,15 @@ function createInterUnitInteractionCylinderMesh(ctx, structure, theme, props, me
|
|
|
76
76
|
return false;
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
var _a = (0, link_1.createLinkCylinderMesh)(ctx, builderProps, props, mesh), m = _a.mesh, boundingSphere = _a.boundingSphere;
|
|
80
|
+
if (boundingSphere) {
|
|
81
|
+
m.setBoundingSphere(boundingSphere);
|
|
82
|
+
}
|
|
83
|
+
else if (m.triangleCount > 0) {
|
|
84
|
+
var child_1 = structure.child;
|
|
85
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (child_1 !== null && child_1 !== void 0 ? child_1 : structure).boundary.sphere, 1 * sizeFactor);
|
|
86
|
+
m.setBoundingSphere(sphere);
|
|
87
|
+
}
|
|
82
88
|
return m;
|
|
83
89
|
}
|
|
84
90
|
exports.InteractionsInterUnitParams = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, complex_visual_1.ComplexMeshParams), link_1.LinkCylinderParams), { sizeFactor: param_definition_1.ParamDefinition.Numeric(0.3, { min: 0, max: 10, step: 0.01 }), dashCount: param_definition_1.ParamDefinition.Numeric(6, { min: 2, max: 10, step: 2 }), dashScale: param_definition_1.ParamDefinition.Numeric(0.4, { min: 0, max: 2, step: 0.1 }), includeParent: param_definition_1.ParamDefinition.Boolean(false) });
|
package/lib/commonjs/mol-model-props/computed/representations/interactions-intra-unit-cylinder.js
CHANGED
|
@@ -21,8 +21,8 @@ var interactions_2 = require("../interactions/interactions");
|
|
|
21
21
|
var geometry_1 = require("../../../mol-math/geometry");
|
|
22
22
|
function createIntraUnitInteractionsCylinderMesh(ctx, unit, structure, theme, props, mesh) {
|
|
23
23
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
24
|
-
var child, childUnit, location, interactions, features, contacts, x, y, z, members, offsets, edgeCount, a, b, flag, sizeFactor, builderProps, m, sphere;
|
|
25
|
-
return (0, tslib_1.__generator)(this, function (
|
|
24
|
+
var child, childUnit, location, interactions, features, contacts, x, y, z, members, offsets, edgeCount, a, b, flag, sizeFactor, builderProps, _a, m, boundingSphere, sphere;
|
|
25
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
26
26
|
if (!structure_1.Unit.isAtomic(unit))
|
|
27
27
|
return [2 /*return*/, mesh_1.Mesh.createEmpty(mesh)];
|
|
28
28
|
child = structure.child;
|
|
@@ -66,9 +66,14 @@ function createIntraUnitInteractionsCylinderMesh(ctx, unit, structure, theme, pr
|
|
|
66
66
|
return false;
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
_a = (0, link_1.createLinkCylinderMesh)(ctx, builderProps, props, mesh), m = _a.mesh, boundingSphere = _a.boundingSphere;
|
|
70
|
+
if (boundingSphere) {
|
|
71
|
+
m.setBoundingSphere(boundingSphere);
|
|
72
|
+
}
|
|
73
|
+
else if (m.triangleCount > 0) {
|
|
74
|
+
sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (childUnit !== null && childUnit !== void 0 ? childUnit : unit).boundary.sphere, 1 * sizeFactor);
|
|
75
|
+
m.setBoundingSphere(sphere);
|
|
76
|
+
}
|
|
72
77
|
return [2 /*return*/, m];
|
|
73
78
|
});
|
|
74
79
|
});
|
|
@@ -18,6 +18,7 @@ var link_1 = require("../../../mol-repr/structure/visual/util/link");
|
|
|
18
18
|
var complex_visual_1 = require("../../../mol-repr/structure/complex-visual");
|
|
19
19
|
var representation_2 = require("../../../mol-repr/structure/representation");
|
|
20
20
|
var property_1 = require("./property");
|
|
21
|
+
var geometry_1 = require("../../../mol-math/geometry");
|
|
21
22
|
function createCrossLinkRestraintCylinderMesh(ctx, structure, theme, props, mesh) {
|
|
22
23
|
var crossLinks = property_1.CrossLinkRestraintProvider.get(structure).value;
|
|
23
24
|
if (!crossLinks.count)
|
|
@@ -39,7 +40,15 @@ function createCrossLinkRestraintCylinderMesh(ctx, structure, theme, props, mesh
|
|
|
39
40
|
return theme.size.size(location) * sizeFactor;
|
|
40
41
|
},
|
|
41
42
|
};
|
|
42
|
-
|
|
43
|
+
var _a = (0, link_1.createLinkCylinderMesh)(ctx, builderProps, props, mesh), m = _a.mesh, boundingSphere = _a.boundingSphere;
|
|
44
|
+
if (boundingSphere) {
|
|
45
|
+
m.setBoundingSphere(boundingSphere);
|
|
46
|
+
}
|
|
47
|
+
else if (m.triangleCount > 0) {
|
|
48
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), structure.boundary.sphere, 1 * sizeFactor);
|
|
49
|
+
m.setBoundingSphere(sphere);
|
|
50
|
+
}
|
|
51
|
+
return m;
|
|
43
52
|
}
|
|
44
53
|
exports.CrossLinkRestraintCylinderParams = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, complex_visual_1.ComplexMeshParams), link_1.LinkCylinderParams), { sizeFactor: param_definition_1.ParamDefinition.Numeric(0.5, { min: 0, max: 10, step: 0.1 }) });
|
|
45
54
|
function CrossLinkRestraintVisual(materialId) {
|
|
@@ -17,7 +17,7 @@ var symmetry_1 = require("../../mol-model/structure/model/properties/symmetry");
|
|
|
17
17
|
var objects_1 = require("../objects");
|
|
18
18
|
var symmetry_2 = require("../../mol-model-formats/structure/property/symmetry");
|
|
19
19
|
var CommonStructureParams = {
|
|
20
|
-
dynamicBonds: param_definition_1.ParamDefinition.Optional(param_definition_1.ParamDefinition.Boolean(false, { description: 'Ensure bonds are recalculated upon model changes. Also enables calculation of inter-unit bonds in water molecules.' })),
|
|
20
|
+
dynamicBonds: param_definition_1.ParamDefinition.Optional(param_definition_1.ParamDefinition.Boolean(false, { description: 'Ensure bonds are recalculated upon model changes. Also enables calculation of inter-unit bonds in water molecules and ions.' })),
|
|
21
21
|
};
|
|
22
22
|
var RootStructureDefinition;
|
|
23
23
|
(function (RootStructureDefinition) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2018-
|
|
3
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
4
|
*
|
|
5
5
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
6
|
*/
|
|
@@ -145,20 +145,30 @@ function createInterUnitBondCylinderImpostors(ctx, structure, theme, props, cyli
|
|
|
145
145
|
if (!structure.interUnitBonds.edgeCount)
|
|
146
146
|
return cylinders_1.Cylinders.createEmpty(cylinders);
|
|
147
147
|
var builderProps = getInterUnitBondCylinderBuilderProps(structure, theme, props);
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
var _a = (0, link_1.createLinkCylinderImpostors)(ctx, builderProps, props, cylinders), c = _a.cylinders, boundingSphere = _a.boundingSphere;
|
|
149
|
+
if (boundingSphere) {
|
|
150
|
+
c.setBoundingSphere(boundingSphere);
|
|
151
|
+
}
|
|
152
|
+
else if (c.cylinderCount > 0) {
|
|
153
|
+
var child = structure.child;
|
|
154
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (child !== null && child !== void 0 ? child : structure).boundary.sphere, 1 * props.sizeFactor);
|
|
155
|
+
c.setBoundingSphere(sphere);
|
|
156
|
+
}
|
|
157
|
+
return c;
|
|
153
158
|
}
|
|
154
159
|
function createInterUnitBondCylinderMesh(ctx, structure, theme, props, mesh) {
|
|
155
160
|
if (!structure.interUnitBonds.edgeCount)
|
|
156
161
|
return mesh_1.Mesh.createEmpty(mesh);
|
|
157
162
|
var builderProps = getInterUnitBondCylinderBuilderProps(structure, theme, props);
|
|
158
|
-
var
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
var _a = (0, link_1.createLinkCylinderMesh)(ctx, builderProps, props, mesh), m = _a.mesh, boundingSphere = _a.boundingSphere;
|
|
164
|
+
if (boundingSphere) {
|
|
165
|
+
m.setBoundingSphere(boundingSphere);
|
|
166
|
+
}
|
|
167
|
+
else if (m.triangleCount > 0) {
|
|
168
|
+
var child = structure.child;
|
|
169
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (child !== null && child !== void 0 ? child : structure).boundary.sphere, 1 * props.sizeFactor);
|
|
170
|
+
m.setBoundingSphere(sphere);
|
|
171
|
+
}
|
|
162
172
|
return m;
|
|
163
173
|
}
|
|
164
174
|
exports.InterUnitBondCylinderParams = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, 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) });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2020-
|
|
3
|
+
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
4
|
*
|
|
5
5
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
6
|
*/
|
|
@@ -99,10 +99,15 @@ function createInterUnitBondLines(ctx, structure, theme, props, lines) {
|
|
|
99
99
|
},
|
|
100
100
|
ignore: (0, bond_1.makeInterBondIgnoreTest)(structure, props)
|
|
101
101
|
};
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
var _a = (0, link_1.createLinkLines)(ctx, builderProps, props, lines), l = _a.lines, boundingSphere = _a.boundingSphere;
|
|
103
|
+
if (boundingSphere) {
|
|
104
|
+
l.setBoundingSphere(boundingSphere);
|
|
105
|
+
}
|
|
106
|
+
else if (l.lineCount > 0) {
|
|
107
|
+
var child = structure.child;
|
|
108
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (child !== null && child !== void 0 ? child : structure).boundary.sphere, 1 * sizeFactor);
|
|
109
|
+
l.setBoundingSphere(sphere);
|
|
110
|
+
}
|
|
106
111
|
return l;
|
|
107
112
|
}
|
|
108
113
|
exports.InterUnitBondLineParams = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, complex_visual_1.ComplexLinesParams), bond_1.BondLineParams), { includeParent: param_definition_1.ParamDefinition.Boolean(false) });
|
|
@@ -165,9 +165,14 @@ function createIntraUnitBondCylinderImpostors(ctx, unit, structure, theme, props
|
|
|
165
165
|
if (child && !childUnit)
|
|
166
166
|
return cylinders_1.Cylinders.createEmpty(cylinders);
|
|
167
167
|
var builderProps = getIntraUnitBondCylinderBuilderProps(unit, structure, theme, props);
|
|
168
|
-
var
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
var _a = (0, link_1.createLinkCylinderImpostors)(ctx, builderProps, props, cylinders), c = _a.cylinders, boundingSphere = _a.boundingSphere;
|
|
169
|
+
if (boundingSphere) {
|
|
170
|
+
c.setBoundingSphere(boundingSphere);
|
|
171
|
+
}
|
|
172
|
+
else if (c.cylinderCount > 0) {
|
|
173
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (childUnit !== null && childUnit !== void 0 ? childUnit : unit).boundary.sphere, 1 * props.sizeFactor);
|
|
174
|
+
c.setBoundingSphere(sphere);
|
|
175
|
+
}
|
|
171
176
|
return c;
|
|
172
177
|
}
|
|
173
178
|
function createIntraUnitBondCylinderMesh(ctx, unit, structure, theme, props, mesh) {
|
|
@@ -180,9 +185,14 @@ function createIntraUnitBondCylinderMesh(ctx, unit, structure, theme, props, mes
|
|
|
180
185
|
if (child && !childUnit)
|
|
181
186
|
return mesh_1.Mesh.createEmpty(mesh);
|
|
182
187
|
var builderProps = getIntraUnitBondCylinderBuilderProps(unit, structure, theme, props);
|
|
183
|
-
var
|
|
184
|
-
|
|
185
|
-
|
|
188
|
+
var _a = (0, link_1.createLinkCylinderMesh)(ctx, builderProps, props, mesh), m = _a.mesh, boundingSphere = _a.boundingSphere;
|
|
189
|
+
if (boundingSphere) {
|
|
190
|
+
m.setBoundingSphere(boundingSphere);
|
|
191
|
+
}
|
|
192
|
+
else if (m.triangleCount > 0) {
|
|
193
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (childUnit !== null && childUnit !== void 0 ? childUnit : unit).boundary.sphere, 1 * props.sizeFactor);
|
|
194
|
+
m.setBoundingSphere(sphere);
|
|
195
|
+
}
|
|
186
196
|
return m;
|
|
187
197
|
}
|
|
188
198
|
exports.IntraUnitBondCylinderParams = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, 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) });
|
|
@@ -125,9 +125,14 @@ function createIntraUnitBondLines(ctx, unit, structure, theme, props, lines) {
|
|
|
125
125
|
},
|
|
126
126
|
ignore: (0, bond_1.makeIntraBondIgnoreTest)(structure, unit, props)
|
|
127
127
|
};
|
|
128
|
-
var
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
var _b = (0, link_1.createLinkLines)(ctx, builderProps, props, lines), l = _b.lines, boundingSphere = _b.boundingSphere;
|
|
129
|
+
if (boundingSphere) {
|
|
130
|
+
l.setBoundingSphere(boundingSphere);
|
|
131
|
+
}
|
|
132
|
+
else if (l.lineCount > 0) {
|
|
133
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (childUnit !== null && childUnit !== void 0 ? childUnit : unit).boundary.sphere, 1 * sizeFactor);
|
|
134
|
+
l.setBoundingSphere(sphere);
|
|
135
|
+
}
|
|
131
136
|
return l;
|
|
132
137
|
}
|
|
133
138
|
exports.IntraUnitBondLineParams = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, units_visual_1.UnitsLinesParams), bond_1.BondLineParams), { includeParent: param_definition_1.ParamDefinition.Boolean(false) });
|
|
@@ -17,6 +17,7 @@ var units_visual_1 = require("../units-visual");
|
|
|
17
17
|
var param_definition_1 = require("../../../mol-util/param-definition");
|
|
18
18
|
var location_iterator_1 = require("../../../mol-geo/util/location-iterator");
|
|
19
19
|
var common_1 = require("./util/common");
|
|
20
|
+
var geometry_1 = require("../../../mol-math/geometry");
|
|
20
21
|
function createCarbohydrateLinkCylinderMesh(ctx, structure, theme, props, mesh) {
|
|
21
22
|
var _a = structure.carbohydrates, links = _a.links, elements = _a.elements;
|
|
22
23
|
var linkSizeFactor = props.linkSizeFactor;
|
|
@@ -37,7 +38,15 @@ function createCarbohydrateLinkCylinderMesh(ctx, structure, theme, props, mesh)
|
|
|
37
38
|
return theme.size.size(location) * linkSizeFactor;
|
|
38
39
|
},
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
+
var _b = (0, link_1.createLinkCylinderMesh)(ctx, builderProps, props, mesh), m = _b.mesh, boundingSphere = _b.boundingSphere;
|
|
42
|
+
if (boundingSphere) {
|
|
43
|
+
m.setBoundingSphere(boundingSphere);
|
|
44
|
+
}
|
|
45
|
+
else if (m.triangleCount > 0) {
|
|
46
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), structure.boundary.sphere, 1 * linkSizeFactor);
|
|
47
|
+
m.setBoundingSphere(sphere);
|
|
48
|
+
}
|
|
49
|
+
return m;
|
|
41
50
|
}
|
|
42
51
|
exports.CarbohydrateLinkParams = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, units_visual_1.UnitsMeshParams), link_1.LinkCylinderParams), { linkSizeFactor: param_definition_1.ParamDefinition.Numeric(0.3, { min: 0, max: 3, step: 0.01 }) });
|
|
43
52
|
function CarbohydrateLinkVisual(materialId) {
|
|
@@ -18,6 +18,7 @@ var int_1 = require("../../../mol-data/int");
|
|
|
18
18
|
var loci_1 = require("../../../mol-model/loci");
|
|
19
19
|
var common_1 = require("../../../mol-model/structure/structure/unit/bonds/common");
|
|
20
20
|
var common_2 = require("./util/common");
|
|
21
|
+
var geometry_1 = require("../../../mol-math/geometry");
|
|
21
22
|
function createCarbohydrateTerminalLinkCylinderMesh(ctx, structure, theme, props, mesh) {
|
|
22
23
|
var _a = structure.carbohydrates, terminalLinks = _a.terminalLinks, elements = _a.elements;
|
|
23
24
|
var terminalLinkSizeFactor = props.terminalLinkSizeFactor;
|
|
@@ -56,7 +57,15 @@ function createCarbohydrateTerminalLinkCylinderMesh(ctx, structure, theme, props
|
|
|
56
57
|
return common_1.MetalsSet.has(beI) ? 1 /* Dashed */ : 0 /* Solid */;
|
|
57
58
|
}
|
|
58
59
|
};
|
|
59
|
-
|
|
60
|
+
var _b = (0, link_1.createLinkCylinderMesh)(ctx, builderProps, props, mesh), m = _b.mesh, boundingSphere = _b.boundingSphere;
|
|
61
|
+
if (boundingSphere) {
|
|
62
|
+
m.setBoundingSphere(boundingSphere);
|
|
63
|
+
}
|
|
64
|
+
else if (m.triangleCount > 0) {
|
|
65
|
+
var sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), structure.boundary.sphere, 1 * terminalLinkSizeFactor);
|
|
66
|
+
m.setBoundingSphere(sphere);
|
|
67
|
+
}
|
|
68
|
+
return m;
|
|
60
69
|
}
|
|
61
70
|
exports.CarbohydrateTerminalLinkParams = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, units_visual_1.UnitsMeshParams), link_1.LinkCylinderParams), { terminalLinkSizeFactor: param_definition_1.ParamDefinition.Numeric(0.2, { min: 0, max: 3, step: 0.01 }) });
|
|
62
71
|
function CarbohydrateTerminalLinkVisual(materialId) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2018-
|
|
3
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
4
|
*
|
|
5
5
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
6
|
*/
|
|
@@ -14,6 +14,8 @@ var points_builder_1 = require("../../../mol-geo/geometry/points/points-builder"
|
|
|
14
14
|
var linear_algebra_1 = require("../../../mol-math/linear-algebra");
|
|
15
15
|
var element_1 = require("./util/element");
|
|
16
16
|
var geometry_1 = require("../../../mol-math/geometry");
|
|
17
|
+
// avoiding namespace lookup improved performance in Chrome (Aug 2020)
|
|
18
|
+
var v3add = linear_algebra_1.Vec3.add;
|
|
17
19
|
exports.ElementPointParams = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, units_visual_1.UnitsPointsParams), { pointSizeAttenuation: param_definition_1.ParamDefinition.Boolean(false), ignoreHydrogens: param_definition_1.ParamDefinition.Boolean(false), traceOnly: param_definition_1.ParamDefinition.Boolean(false) });
|
|
18
20
|
// TODO size
|
|
19
21
|
function createElementPoint(ctx, unit, structure, theme, props, points) {
|
|
@@ -27,23 +29,40 @@ function createElementPoint(ctx, unit, structure, theme, props, points) {
|
|
|
27
29
|
var p = (0, linear_algebra_1.Vec3)();
|
|
28
30
|
var pos = unit.conformation.invariantPosition;
|
|
29
31
|
var ignore = (0, element_1.makeElementIgnoreTest)(structure, unit, props);
|
|
32
|
+
var center = (0, linear_algebra_1.Vec3)();
|
|
33
|
+
var count = 0;
|
|
30
34
|
if (ignore) {
|
|
31
35
|
for (var i = 0; i < n; ++i) {
|
|
32
36
|
if (ignore(elements[i]))
|
|
33
37
|
continue;
|
|
34
38
|
pos(elements[i], p);
|
|
39
|
+
v3add(center, center, p);
|
|
40
|
+
count += 1;
|
|
35
41
|
builder.add(p[0], p[1], p[2], i);
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
else {
|
|
39
45
|
for (var i = 0; i < n; ++i) {
|
|
40
46
|
pos(elements[i], p);
|
|
47
|
+
v3add(center, center, p);
|
|
48
|
+
count += 1;
|
|
41
49
|
builder.add(p[0], p[1], p[2], i);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
52
|
+
var oldBoundingSphere = points ? geometry_1.Sphere3D.clone(points.boundingSphere) : undefined;
|
|
44
53
|
var pt = builder.getPoints();
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
if (count === 0)
|
|
55
|
+
return pt;
|
|
56
|
+
// re-use boundingSphere if it has not changed much
|
|
57
|
+
var boundingSphere;
|
|
58
|
+
linear_algebra_1.Vec3.scale(center, center, 1 / count);
|
|
59
|
+
if (oldBoundingSphere && linear_algebra_1.Vec3.distance(center, oldBoundingSphere.center) / oldBoundingSphere.radius < 1.0) {
|
|
60
|
+
boundingSphere = oldBoundingSphere;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
boundingSphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), unit.boundary.sphere, 1 * props.sizeFactor);
|
|
64
|
+
}
|
|
65
|
+
pt.setBoundingSphere(boundingSphere);
|
|
47
66
|
return pt;
|
|
48
67
|
}
|
|
49
68
|
exports.createElementPoint = createElementPoint;
|
|
@@ -20,6 +20,8 @@ var spheres_1 = require("../../../../mol-geo/geometry/spheres/spheres");
|
|
|
20
20
|
var spheres_builder_1 = require("../../../../mol-geo/geometry/spheres/spheres-builder");
|
|
21
21
|
var common_1 = require("./common");
|
|
22
22
|
var geometry_1 = require("../../../../mol-math/geometry");
|
|
23
|
+
// avoiding namespace lookup improved performance in Chrome (Aug 2020)
|
|
24
|
+
var v3add = linear_algebra_1.Vec3.add;
|
|
23
25
|
function makeElementIgnoreTest(structure, unit, props) {
|
|
24
26
|
var ignoreHydrogens = props.ignoreHydrogens, traceOnly = props.traceOnly;
|
|
25
27
|
var atomicNumber = unit.model.atomicHierarchy.derived.atom.atomicNumber;
|
|
@@ -52,20 +54,36 @@ function createElementSphereMesh(ctx, unit, structure, theme, props, mesh) {
|
|
|
52
54
|
var ignore = makeElementIgnoreTest(structure, unit, props);
|
|
53
55
|
var l = structure_1.StructureElement.Location.create(structure, unit);
|
|
54
56
|
var themeSize = theme.size.size;
|
|
57
|
+
var center = (0, linear_algebra_1.Vec3)();
|
|
55
58
|
var maxSize = 0;
|
|
59
|
+
var count = 0;
|
|
56
60
|
for (var i = 0; i < elementCount; i++) {
|
|
57
61
|
if (ignore && ignore(elements[i]))
|
|
58
62
|
continue;
|
|
59
63
|
l.element = elements[i];
|
|
60
64
|
pos(elements[i], v);
|
|
65
|
+
v3add(center, center, v);
|
|
66
|
+
count += 1;
|
|
61
67
|
builderState.currentGroup = i;
|
|
62
68
|
var size = themeSize(l);
|
|
63
69
|
if (size > maxSize)
|
|
64
70
|
maxSize = size;
|
|
65
71
|
(0, sphere_2.addSphere)(builderState, v, size * sizeFactor, detail);
|
|
66
72
|
}
|
|
73
|
+
var oldBoundingSphere = mesh ? geometry_1.Sphere3D.clone(mesh.boundingSphere) : undefined;
|
|
67
74
|
var m = mesh_builder_1.MeshBuilder.getMesh(builderState);
|
|
68
|
-
|
|
75
|
+
if (count === 0)
|
|
76
|
+
return m;
|
|
77
|
+
// re-use boundingSphere if it has not changed much
|
|
78
|
+
var boundingSphere;
|
|
79
|
+
linear_algebra_1.Vec3.scale(center, center, 1 / count);
|
|
80
|
+
if (oldBoundingSphere && linear_algebra_1.Vec3.distance(center, oldBoundingSphere.center) / oldBoundingSphere.radius < 1.0) {
|
|
81
|
+
boundingSphere = oldBoundingSphere;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
boundingSphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (childUnit !== null && childUnit !== void 0 ? childUnit : unit).boundary.sphere, maxSize * sizeFactor + 0.05);
|
|
85
|
+
}
|
|
86
|
+
m.setBoundingSphere(boundingSphere);
|
|
69
87
|
return m;
|
|
70
88
|
}
|
|
71
89
|
exports.createElementSphereMesh = createElementSphereMesh;
|
|
@@ -82,19 +100,35 @@ function createElementSphereImpostor(ctx, unit, structure, theme, props, spheres
|
|
|
82
100
|
var ignore = makeElementIgnoreTest(structure, unit, props);
|
|
83
101
|
var l = structure_1.StructureElement.Location.create(structure, unit);
|
|
84
102
|
var themeSize = theme.size.size;
|
|
103
|
+
var center = (0, linear_algebra_1.Vec3)();
|
|
85
104
|
var maxSize = 0;
|
|
105
|
+
var count = 0;
|
|
86
106
|
for (var i = 0; i < elementCount; i++) {
|
|
87
107
|
if (ignore === null || ignore === void 0 ? void 0 : ignore(elements[i]))
|
|
88
108
|
continue;
|
|
89
109
|
pos(elements[i], v);
|
|
90
110
|
builder.add(v[0], v[1], v[2], i);
|
|
111
|
+
v3add(center, center, v);
|
|
112
|
+
count += 1;
|
|
91
113
|
l.element = elements[i];
|
|
92
114
|
var size = themeSize(l);
|
|
93
115
|
if (size > maxSize)
|
|
94
116
|
maxSize = size;
|
|
95
117
|
}
|
|
118
|
+
var oldBoundingSphere = spheres ? geometry_1.Sphere3D.clone(spheres.boundingSphere) : undefined;
|
|
96
119
|
var s = builder.getSpheres();
|
|
97
|
-
|
|
120
|
+
if (count === 0)
|
|
121
|
+
return s;
|
|
122
|
+
// re-use boundingSphere if it has not changed much
|
|
123
|
+
var boundingSphere;
|
|
124
|
+
linear_algebra_1.Vec3.scale(center, center, 1 / count);
|
|
125
|
+
if (oldBoundingSphere && linear_algebra_1.Vec3.distance(center, oldBoundingSphere.center) / oldBoundingSphere.radius < 1.0) {
|
|
126
|
+
boundingSphere = oldBoundingSphere;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
boundingSphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), (childUnit !== null && childUnit !== void 0 ? childUnit : unit).boundary.sphere, maxSize * props.sizeFactor + 0.05);
|
|
130
|
+
}
|
|
131
|
+
s.setBoundingSphere(boundingSphere);
|
|
98
132
|
return s;
|
|
99
133
|
}
|
|
100
134
|
exports.createElementSphereImpostor = createElementSphereImpostor;
|
|
@@ -9,6 +9,7 @@ import { Mesh } from '../../../../mol-geo/geometry/mesh/mesh';
|
|
|
9
9
|
import { VisualContext } from '../../../visual';
|
|
10
10
|
import { Lines } from '../../../../mol-geo/geometry/lines/lines';
|
|
11
11
|
import { Cylinders } from '../../../../mol-geo/geometry/cylinders/cylinders';
|
|
12
|
+
import { Sphere3D } from '../../../../mol-math/geometry/primitives/sphere3d';
|
|
12
13
|
export declare const LinkCylinderParams: {
|
|
13
14
|
linkScale: PD.Numeric;
|
|
14
15
|
linkSpacing: PD.Numeric;
|
|
@@ -75,14 +76,23 @@ export declare const enum LinkStyle {
|
|
|
75
76
|
* Each edge is included twice to allow for coloring/picking
|
|
76
77
|
* the half closer to the first vertex, i.e. vertex a.
|
|
77
78
|
*/
|
|
78
|
-
export declare function createLinkCylinderMesh(ctx: VisualContext, linkBuilder: LinkBuilderProps, props: LinkCylinderProps, mesh?: Mesh):
|
|
79
|
+
export declare function createLinkCylinderMesh(ctx: VisualContext, linkBuilder: LinkBuilderProps, props: LinkCylinderProps, mesh?: Mesh): {
|
|
80
|
+
mesh: Mesh;
|
|
81
|
+
boundingSphere?: Sphere3D;
|
|
82
|
+
};
|
|
79
83
|
/**
|
|
80
84
|
* Each edge is included twice to allow for coloring/picking
|
|
81
85
|
* the half closer to the first vertex, i.e. vertex a.
|
|
82
86
|
*/
|
|
83
|
-
export declare function createLinkCylinderImpostors(ctx: VisualContext, linkBuilder: LinkBuilderProps, props: LinkCylinderProps, cylinders?: Cylinders):
|
|
87
|
+
export declare function createLinkCylinderImpostors(ctx: VisualContext, linkBuilder: LinkBuilderProps, props: LinkCylinderProps, cylinders?: Cylinders): {
|
|
88
|
+
cylinders: Cylinders;
|
|
89
|
+
boundingSphere?: Sphere3D;
|
|
90
|
+
};
|
|
84
91
|
/**
|
|
85
92
|
* Each edge is included twice to allow for coloring/picking
|
|
86
93
|
* the half closer to the first vertex, i.e. vertex a.
|
|
87
94
|
*/
|
|
88
|
-
export declare function createLinkLines(ctx: VisualContext, linkBuilder: LinkBuilderProps, props: LinkLineProps, lines?: Lines):
|
|
95
|
+
export declare function createLinkLines(ctx: VisualContext, linkBuilder: LinkBuilderProps, props: LinkLineProps, lines?: Lines): {
|
|
96
|
+
lines: Lines;
|
|
97
|
+
boundingSphere?: Sphere3D;
|
|
98
|
+
};
|