react-cheminfo 0.63.1 → 0.64.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/lib/molecule3d/core/highlight.d.ts +53 -0
- package/lib/molecule3d/core/highlight.d.ts.map +1 -0
- package/lib/molecule3d/core/highlight.js +96 -0
- package/lib/molecule3d/core/highlight.js.map +1 -0
- package/lib/molecule3d/core/index.d.ts +3 -1
- package/lib/molecule3d/core/index.d.ts.map +1 -1
- package/lib/molecule3d/core/index.js +2 -1
- package/lib/molecule3d/core/index.js.map +1 -1
- package/lib/molecule3d/core/measurement.d.ts +17 -0
- package/lib/molecule3d/core/measurement.d.ts.map +1 -1
- package/lib/molecule3d/core/measurement.js +43 -0
- package/lib/molecule3d/core/measurement.js.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js +7 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
- package/lib/molecule3d/ui/drawScene.d.ts +4 -2
- package/lib/molecule3d/ui/drawScene.d.ts.map +1 -1
- package/lib/molecule3d/ui/drawScene.js +1 -1
- package/lib/molecule3d/ui/drawScene.js.map +1 -1
- package/lib/molecule3d/ui/highlightColor.d.ts +18 -0
- package/lib/molecule3d/ui/highlightColor.d.ts.map +1 -0
- package/lib/molecule3d/ui/highlightColor.js +31 -0
- package/lib/molecule3d/ui/highlightColor.js.map +1 -0
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts +16 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts.map +1 -1
- package/lib/molecule3d/ui/renderMolecule.d.ts +2 -0
- package/lib/molecule3d/ui/renderMolecule.d.ts.map +1 -1
- package/lib/molecule3d/ui/renderMolecule.js +1 -1
- package/lib/molecule3d/ui/renderMolecule.js.map +1 -1
- package/lib/molecule3d/ui/sceneDrawer.d.ts +47 -0
- package/lib/molecule3d/ui/sceneDrawer.d.ts.map +1 -0
- package/lib/molecule3d/ui/sceneDrawer.js +103 -0
- package/lib/molecule3d/ui/sceneDrawer.js.map +1 -0
- package/lib/molecule3d/ui/useMoleculeScene.d.ts +2 -1
- package/lib/molecule3d/ui/useMoleculeScene.d.ts.map +1 -1
- package/lib/molecule3d/ui/useMoleculeScene.js +13 -22
- package/lib/molecule3d/ui/useMoleculeScene.js.map +1 -1
- package/lib/molecule3d/ui/useSharedCamera.d.ts +1 -3
- package/lib/molecule3d/ui/useSharedCamera.d.ts.map +1 -1
- package/lib/molecule3d/ui/useSharedCamera.js.map +1 -1
- package/lib/molecule3d/ui/viewer.d.ts +9 -0
- package/lib/molecule3d/ui/viewer.d.ts.map +1 -1
- package/lib/molecule3d/ui/viewer.js +18 -2
- package/lib/molecule3d/ui/viewer.js.map +1 -1
- package/lib/molstar/core/highlights.d.ts +57 -0
- package/lib/molstar/core/highlights.d.ts.map +1 -0
- package/lib/molstar/core/highlights.js +178 -0
- package/lib/molstar/core/highlights.js.map +1 -0
- package/lib/molstar/core/index.d.ts +2 -1
- package/lib/molstar/core/index.d.ts.map +1 -1
- package/lib/molstar/core/index.js +2 -1
- package/lib/molstar/core/index.js.map +1 -1
- package/package.json +1 -1
- package/src/molecule3d/core/highlight.ts +127 -0
- package/src/molecule3d/core/index.ts +7 -0
- package/src/molecule3d/core/measurement.ts +47 -0
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +13 -0
- package/src/molecule3d/ui/drawScene.ts +13 -2
- package/src/molecule3d/ui/highlightColor.ts +34 -0
- package/src/molecule3d/ui/moleculeViewer3DProps.ts +16 -1
- package/src/molecule3d/ui/renderMolecule.ts +1 -1
- package/src/molecule3d/ui/sceneDrawer.ts +132 -0
- package/src/molecule3d/ui/useMoleculeScene.ts +16 -26
- package/src/molecule3d/ui/useSharedCamera.ts +1 -3
- package/src/molecule3d/ui/viewer.ts +23 -0
- package/src/molstar/core/highlights.ts +236 -0
- package/src/molstar/core/index.ts +2 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a highlight on a 3D molecule is, without React and without molstar: a
|
|
3
|
+
* bonded path of atoms a site points at — the two atoms of a bond, the three of
|
|
4
|
+
* an angle, the four of a dihedral — for the model to emphasise.
|
|
5
|
+
*
|
|
6
|
+
* Atoms are named by position, as measurements name them, so a row of a table
|
|
7
|
+
* read off one conformer lands on the same atoms of every other conformer of
|
|
8
|
+
* the same molecule.
|
|
9
|
+
*/
|
|
10
|
+
import type { AtomReference } from './measurement.ts';
|
|
11
|
+
/** One bonded path of atoms to emphasise on the model. */
|
|
12
|
+
export interface Molecule3DHighlight {
|
|
13
|
+
/**
|
|
14
|
+
* The atoms in the order they are bonded: two for a bond, three for the two
|
|
15
|
+
* bonds of an angle, four for the three bonds of a dihedral. One atom
|
|
16
|
+
* emphasises that atom alone.
|
|
17
|
+
*/
|
|
18
|
+
atoms: readonly AtomReference[];
|
|
19
|
+
}
|
|
20
|
+
/** Two consecutive atoms of a path: the bond a highlight emphasises. */
|
|
21
|
+
export type HighlightedBond = readonly [AtomReference, AtomReference];
|
|
22
|
+
/** Everything a list of highlights emphasises, each atom and bond once. */
|
|
23
|
+
export interface HighlightedParts {
|
|
24
|
+
/** Every atom of every path, in the order the paths first name them. */
|
|
25
|
+
atoms: readonly AtomReference[];
|
|
26
|
+
/** Every pair of consecutive atoms, in the order the paths first name them. */
|
|
27
|
+
bonds: readonly HighlightedBond[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The atoms and the bonds a list of highlights emphasises.
|
|
31
|
+
*
|
|
32
|
+
* A bond is a pair of consecutive atoms of one path, and nothing else: two
|
|
33
|
+
* atoms that are both highlighted, but by different paths or not next to each
|
|
34
|
+
* other in one, are not a bond of the highlight — so six C–H paths never
|
|
35
|
+
* emphasise the C–C bond between two of their carbons. An atom the structure
|
|
36
|
+
* lacks is left out, with the two pairs it stands in; the atoms on either side
|
|
37
|
+
* of it are not joined in its place.
|
|
38
|
+
* @param highlights - The paths, as a site passes them.
|
|
39
|
+
* @param hasAtom - Whether the structure on screen has an atom; asked only of
|
|
40
|
+
* references whose two numbers are whole and not negative.
|
|
41
|
+
* @default () => true
|
|
42
|
+
* @returns The atoms and the bonds, each once, in the order first named.
|
|
43
|
+
*/
|
|
44
|
+
export declare function highlightedParts(highlights: readonly Molecule3DHighlight[], hasAtom?: (atom: AtomReference) => boolean): HighlightedParts;
|
|
45
|
+
/**
|
|
46
|
+
* Whether two lists of highlights name the same atoms, in the same paths and
|
|
47
|
+
* the same order — what decides that the model needs no repainting.
|
|
48
|
+
* @param first - One list.
|
|
49
|
+
* @param second - The other.
|
|
50
|
+
* @returns True when every path of one is the path of the other at its place.
|
|
51
|
+
*/
|
|
52
|
+
export declare function sameHighlights(first: readonly Molecule3DHighlight[], second: readonly Molecule3DHighlight[]): boolean;
|
|
53
|
+
//# sourceMappingURL=highlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/core/highlight.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,0DAA0D;AAC1D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;CACjC;AAED,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAEtE,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,wEAAwE;IACxE,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,+EAA+E;IAC/E,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;CACnC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,SAAS,mBAAmB,EAAE,EAC1C,OAAO,GAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAmB,GACpD,gBAAgB,CA2BlB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,mBAAmB,EAAE,EACrC,MAAM,EAAE,SAAS,mBAAmB,EAAE,GACrC,OAAO,CAUT"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a highlight on a 3D molecule is, without React and without molstar: a
|
|
3
|
+
* bonded path of atoms a site points at — the two atoms of a bond, the three of
|
|
4
|
+
* an angle, the four of a dihedral — for the model to emphasise.
|
|
5
|
+
*
|
|
6
|
+
* Atoms are named by position, as measurements name them, so a row of a table
|
|
7
|
+
* read off one conformer lands on the same atoms of every other conformer of
|
|
8
|
+
* the same molecule.
|
|
9
|
+
*/
|
|
10
|
+
import { sameAtoms } from "./measurement.js";
|
|
11
|
+
/**
|
|
12
|
+
* The atoms and the bonds a list of highlights emphasises.
|
|
13
|
+
*
|
|
14
|
+
* A bond is a pair of consecutive atoms of one path, and nothing else: two
|
|
15
|
+
* atoms that are both highlighted, but by different paths or not next to each
|
|
16
|
+
* other in one, are not a bond of the highlight — so six C–H paths never
|
|
17
|
+
* emphasise the C–C bond between two of their carbons. An atom the structure
|
|
18
|
+
* lacks is left out, with the two pairs it stands in; the atoms on either side
|
|
19
|
+
* of it are not joined in its place.
|
|
20
|
+
* @param highlights - The paths, as a site passes them.
|
|
21
|
+
* @param hasAtom - Whether the structure on screen has an atom; asked only of
|
|
22
|
+
* references whose two numbers are whole and not negative.
|
|
23
|
+
* @default () => true
|
|
24
|
+
* @returns The atoms and the bonds, each once, in the order first named.
|
|
25
|
+
*/
|
|
26
|
+
export function highlightedParts(highlights, hasAtom = isAnyAtom) {
|
|
27
|
+
const atoms = [];
|
|
28
|
+
const bonds = [];
|
|
29
|
+
const atomKeys = new Set();
|
|
30
|
+
const bondKeys = new Set();
|
|
31
|
+
for (const highlight of highlights) {
|
|
32
|
+
let previous;
|
|
33
|
+
for (const atom of highlight.atoms) {
|
|
34
|
+
const present = isAtomReference(atom) && hasAtom(atom);
|
|
35
|
+
if (present && !atomKeys.has(atomKey(atom))) {
|
|
36
|
+
atomKeys.add(atomKey(atom));
|
|
37
|
+
atoms.push({ unit: atom.unit, element: atom.element });
|
|
38
|
+
}
|
|
39
|
+
if (present && previous !== undefined) {
|
|
40
|
+
const key = bondKey(previous, atom);
|
|
41
|
+
if (key !== null && !bondKeys.has(key)) {
|
|
42
|
+
bondKeys.add(key);
|
|
43
|
+
bonds.push([
|
|
44
|
+
{ unit: previous.unit, element: previous.element },
|
|
45
|
+
{ unit: atom.unit, element: atom.element },
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
previous = present ? atom : undefined;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { atoms, bonds };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Whether two lists of highlights name the same atoms, in the same paths and
|
|
56
|
+
* the same order — what decides that the model needs no repainting.
|
|
57
|
+
* @param first - One list.
|
|
58
|
+
* @param second - The other.
|
|
59
|
+
* @returns True when every path of one is the path of the other at its place.
|
|
60
|
+
*/
|
|
61
|
+
export function sameHighlights(first, second) {
|
|
62
|
+
if (first === second)
|
|
63
|
+
return true;
|
|
64
|
+
if (first.length !== second.length)
|
|
65
|
+
return false;
|
|
66
|
+
for (let index = 0; index < first.length; index++) {
|
|
67
|
+
const one = first[index]?.atoms;
|
|
68
|
+
const other = second[index]?.atoms;
|
|
69
|
+
if (one === undefined || other === undefined)
|
|
70
|
+
return false;
|
|
71
|
+
if (!sameAtoms(one, other))
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
function isAnyAtom() {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
function isAtomReference(atom) {
|
|
80
|
+
return (Number.isInteger(atom.unit) &&
|
|
81
|
+
atom.unit >= 0 &&
|
|
82
|
+
Number.isInteger(atom.element) &&
|
|
83
|
+
atom.element >= 0);
|
|
84
|
+
}
|
|
85
|
+
function atomKey(atom) {
|
|
86
|
+
return `${atom.unit}:${atom.element}`;
|
|
87
|
+
}
|
|
88
|
+
// One key for a pair whichever way round, and none for an atom with itself.
|
|
89
|
+
function bondKey(first, second) {
|
|
90
|
+
const one = atomKey(first);
|
|
91
|
+
const other = atomKey(second);
|
|
92
|
+
if (one === other)
|
|
93
|
+
return null;
|
|
94
|
+
return one < other ? `${one}-${other}` : `${other}-${one}`;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=highlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight.js","sourceRoot":"","sources":["../../../src/molecule3d/core/highlight.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAuB7C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAC9B,UAA0C,EAC1C,UAA4C,SAAS;IAErD,MAAM,KAAK,GAAoB,EAAE,CAAC;IAClC,MAAM,KAAK,GAAsB,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,QAAmC,CAAC;QACxC,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;YACnC,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;YACvD,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;gBAC5C,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC5B,KAAK,CAAC,IAAI,CAAC,E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K,SAAS,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAC3D,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IAC3C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,SAAS;IAChB,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,eAAe,CAAC,IAAmB;IAC1C,OAAO,CACL,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QAC3B,IAAI,CAAC,IAAI,IAAI,CAAC;QACd,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,OAAO,IAAI,CAAC,CAClB,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,IAAmB;IAClC,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;AACxC,CAAC;AAED,4EAA4E;AAC5E,SAAS,OAAO,CAAC,KAAoB,EAAE,MAAqB;IAC1D,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3B,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,GAAG,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAC/B,OAAO,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,GAAG,EAAE,CAAC;AAC7D,CAAC"}
|
|
@@ -4,8 +4,10 @@ export type { ImageSize } from './exportImage.ts';
|
|
|
4
4
|
export { dataUriBytes, rasterSvgMarkup } from './exportImage.ts';
|
|
5
5
|
export type { Molecule3DGesture, Molecule3DGestureKey } from './gestures.ts';
|
|
6
6
|
export { MOLECULE_3D_GESTURES } from './gestures.ts';
|
|
7
|
+
export type { HighlightedBond, HighlightedParts, Molecule3DHighlight, } from './highlight.ts';
|
|
8
|
+
export { highlightedParts, sameHighlights } from './highlight.ts';
|
|
7
9
|
export type { AtomReference, Measurement, MeasurementKind, } from './measurement.ts';
|
|
8
|
-
export { MEASUREMENT_ATOM_COUNTS, MEASUREMENT_KINDS, MEASUREMENT_LABELS, } from './measurement.ts';
|
|
10
|
+
export { MEASUREMENT_ATOM_COUNTS, MEASUREMENT_KINDS, MEASUREMENT_LABELS, sameMeasurements, } from './measurement.ts';
|
|
9
11
|
export type { Molecule3DFile, Molecule3DSettings, Molecule3DTools, RepresentationId, SurfaceColoringId, } from './settings.ts';
|
|
10
12
|
export { DEFAULT_MOLECULE_3D_SETTINGS, DEFAULT_MOLECULE_3D_TOOLS, MOLECULE_3D_RANGES, REPRESENTATIONS, REPRESENTATION_LABELS, SURFACE_CHARGE_COLORS, SURFACE_COLORINGS, SURFACE_COLORING_LABELS, isRepresentationId, isSurfaceColoringId, normalizeMolecule3DSettings, resetMolecule3DSettings, resolveMolecule3DTools, sameMolecule3DSettings, } from './settings.ts';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EACV,aAAa,EACb,WAAW,EACX,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EACV,aAAa,EACb,WAAW,EACX,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,eAAe,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { DEFAULT_MOLECULE_3D_CAMERA, MOLECULE_3D_ZOOM_RANGE, formatMolecule3DCamera, molecule3DCameraParam, normalizeMolecule3DCamera, parseMolecule3DCamera, sameMolecule3DCamera, } from "./camera.js";
|
|
2
2
|
export { dataUriBytes, rasterSvgMarkup } from "./exportImage.js";
|
|
3
3
|
export { MOLECULE_3D_GESTURES } from "./gestures.js";
|
|
4
|
-
export {
|
|
4
|
+
export { highlightedParts, sameHighlights } from "./highlight.js";
|
|
5
|
+
export { MEASUREMENT_ATOM_COUNTS, MEASUREMENT_KINDS, MEASUREMENT_LABELS, sameMeasurements, } from "./measurement.js";
|
|
5
6
|
export { DEFAULT_MOLECULE_3D_SETTINGS, DEFAULT_MOLECULE_3D_TOOLS, MOLECULE_3D_RANGES, REPRESENTATIONS, REPRESENTATION_LABELS, SURFACE_CHARGE_COLORS, SURFACE_COLORINGS, SURFACE_COLORING_LABELS, isRepresentationId, isSurfaceColoringId, normalizeMolecule3DSettings, resetMolecule3DSettings, resolveMolecule3DTools, sameMolecule3DSettings, } from "./settings.js";
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecule3d/core/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAMrD,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecule3d/core/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAMrD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMlE,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,eAAe,CAAC"}
|
|
@@ -27,4 +27,21 @@ export interface Measurement {
|
|
|
27
27
|
kind: MeasurementKind;
|
|
28
28
|
atoms: readonly AtomReference[];
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Whether two lists name the same measurements, of the same kinds over the
|
|
32
|
+
* same atoms, in the same order — what decides that nothing needs drawing
|
|
33
|
+
* again.
|
|
34
|
+
* @param first - One list.
|
|
35
|
+
* @param second - The other.
|
|
36
|
+
* @returns True when every measurement of one is the measurement of the other
|
|
37
|
+
* at its place.
|
|
38
|
+
*/
|
|
39
|
+
export declare function sameMeasurements(first: readonly Measurement[], second: readonly Measurement[]): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether two lists name the same atoms in the same order.
|
|
42
|
+
* @param first - One list.
|
|
43
|
+
* @param second - The other.
|
|
44
|
+
* @returns True when every atom of one is the atom of the other at its place.
|
|
45
|
+
*/
|
|
46
|
+
export declare function sameAtoms(first: readonly AtomReference[], second: readonly AtomReference[]): boolean;
|
|
30
47
|
//# sourceMappingURL=measurement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measurement.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/core/measurement.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,4CAA6C,CAAC;AAE5E,wCAAwC;AACxC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,oDAAoD;AACpD,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAInE,CAAC;AAEF,wCAAwC;AACxC,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAI9D,CAAC;AAEF,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qEAAqE;AACrE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;CACjC"}
|
|
1
|
+
{"version":3,"file":"measurement.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/core/measurement.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,4CAA6C,CAAC;AAE5E,wCAAwC;AACxC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,oDAAoD;AACpD,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAInE,CAAC;AAEF,wCAAwC;AACxC,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAI9D,CAAC;AAEF,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qEAAqE;AACrE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,MAAM,EAAE,SAAS,WAAW,EAAE,GAC7B,OAAO,CAYT;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,MAAM,EAAE,SAAS,aAAa,EAAE,GAC/B,OAAO,CAUT"}
|
|
@@ -21,4 +21,47 @@ export const MEASUREMENT_LABELS = {
|
|
|
21
21
|
angle: 'Angle',
|
|
22
22
|
dihedral: 'Dihedral angle',
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Whether two lists name the same measurements, of the same kinds over the
|
|
26
|
+
* same atoms, in the same order — what decides that nothing needs drawing
|
|
27
|
+
* again.
|
|
28
|
+
* @param first - One list.
|
|
29
|
+
* @param second - The other.
|
|
30
|
+
* @returns True when every measurement of one is the measurement of the other
|
|
31
|
+
* at its place.
|
|
32
|
+
*/
|
|
33
|
+
export function sameMeasurements(first, second) {
|
|
34
|
+
if (first === second)
|
|
35
|
+
return true;
|
|
36
|
+
if (first.length !== second.length)
|
|
37
|
+
return false;
|
|
38
|
+
for (let index = 0; index < first.length; index++) {
|
|
39
|
+
const one = first[index];
|
|
40
|
+
const other = second[index];
|
|
41
|
+
if (one === undefined || other === undefined)
|
|
42
|
+
return false;
|
|
43
|
+
if (one.kind !== other.kind || !sameAtoms(one.atoms, other.atoms)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether two lists name the same atoms in the same order.
|
|
51
|
+
* @param first - One list.
|
|
52
|
+
* @param second - The other.
|
|
53
|
+
* @returns True when every atom of one is the atom of the other at its place.
|
|
54
|
+
*/
|
|
55
|
+
export function sameAtoms(first, second) {
|
|
56
|
+
if (first.length !== second.length)
|
|
57
|
+
return false;
|
|
58
|
+
for (let position = 0; position < first.length; position++) {
|
|
59
|
+
const atom = first[position];
|
|
60
|
+
const match = second[position];
|
|
61
|
+
if (atom?.unit !== match?.unit || atom?.element !== match?.element) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
24
67
|
//# sourceMappingURL=measurement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measurement.js","sourceRoot":"","sources":["../../../src/molecule3d/core/measurement.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAK5E,oDAAoD;AACpD,MAAM,CAAC,MAAM,uBAAuB,GAAoC;IACtE,QAAQ,EAAE,CAAC;IACX,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEF,wCAAwC;AACxC,MAAM,CAAC,MAAM,kBAAkB,GAAoC;IACjE,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,gBAAgB;CAC3B,CAAC"}
|
|
1
|
+
{"version":3,"file":"measurement.js","sourceRoot":"","sources":["../../../src/molecule3d/core/measurement.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,CAAU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E,QAAQ,EAAE,EAAE,CAAC;QAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/B,IAAI,IAAI,EAAE,IAAI,KAAK,KAAK,EAAE,IAAI,IAAI,IAAI,EAAE,OAAO,KAAK,KAAK,EAAE,OAAO,EAAE,CAAC;YACnE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoleculeCanvas3D.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MoleculeCanvas3D.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAiBzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAOxE,yCAAyC;AACzC,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,qBAAqB,EACrB,UAAU,GAAG,mBAAmB,CACjC;IACC,2EAA2E;IAC3E,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAuK3E"}
|
|
@@ -7,6 +7,7 @@ import { Molecule3DOptions } from "./Molecule3DOptions.js";
|
|
|
7
7
|
import { Molecule3DStage } from "./Molecule3DStage.js";
|
|
8
8
|
import { Molecule3DToolbar } from "./Molecule3DToolbar.js";
|
|
9
9
|
import { createMolecule3DViewer } from "./createViewer.js";
|
|
10
|
+
import { highlightColorOf } from "./highlightColor.js";
|
|
10
11
|
import { useControlledState } from "./useControlledState.js";
|
|
11
12
|
import { useImageExport } from "./useImageExport.js";
|
|
12
13
|
import { useMoleculeScene } from "./useMoleculeScene.js";
|
|
@@ -17,7 +18,7 @@ import { usePolarSurfaceArea } from "./usePolarSurfaceArea.js";
|
|
|
17
18
|
* @returns The canvas with its toolbars.
|
|
18
19
|
*/
|
|
19
20
|
export function MoleculeCanvas3D(props) {
|
|
20
|
-
const { molfile, frameNewMolecule = 'keep', tools: toolsProp, settings: settingsProp, defaultSettings, onSettingsChange, spinning: spinningProp, defaultSpinning = false, onSpinningChange, spinSpeed = DEFAULT_SPIN_SPEED, measurements: measurementsProp, onMeasurementsChange, fileName = 'molecule', background, minHeight = 320, onFailureChange, } = props;
|
|
21
|
+
const { molfile, frameNewMolecule = 'keep', tools: toolsProp, settings: settingsProp, defaultSettings, onSettingsChange, spinning: spinningProp, defaultSpinning = false, onSpinningChange, spinSpeed = DEFAULT_SPIN_SPEED, measurements: measurementsProp, onMeasurementsChange, highlights = NO_HIGHLIGHTS, fileName = 'molecule', background, minHeight = 320, onFailureChange, } = props;
|
|
21
22
|
const tools = resolveMolecule3DTools(toolsProp);
|
|
22
23
|
const [initialSettings] = useState(() => normalizeMolecule3DSettings(defaultSettings));
|
|
23
24
|
const [settings, setSettings] = useControlledState(settingsProp, initialSettings, onSettingsChange);
|
|
@@ -71,6 +72,10 @@ export function MoleculeCanvas3D(props) {
|
|
|
71
72
|
useEffect(() => {
|
|
72
73
|
void viewerRef.current?.setMeasureKind(measureKind);
|
|
73
74
|
}, [container, measureKind]);
|
|
75
|
+
// Kept out of the scene: a new highlight repaints the model, never redraws it.
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
void viewerRef.current?.setHighlights(highlights, highlightColorOf(container));
|
|
78
|
+
}, [container, highlights]);
|
|
74
79
|
const { resetView } = useMoleculeScene({
|
|
75
80
|
container,
|
|
76
81
|
viewerRef,
|
|
@@ -90,6 +95,7 @@ export function MoleculeCanvas3D(props) {
|
|
|
90
95
|
}, onResetView: resetView, options: _jsx(Molecule3DOptions, { settings: settings, onChange: setSettings, polarSurfaceArea: polarSurfaceArea, defaults: initialSettings }), exportPanel: _jsx(Molecule3DExport, { getSize: canvasSize, onExport: exportImage, onCopy: copyImage }) }) }))] })) }));
|
|
91
96
|
}
|
|
92
97
|
const NO_MEASUREMENTS = [];
|
|
98
|
+
const NO_HIGHLIGHTS = [];
|
|
93
99
|
const STAGE_STYLE = {
|
|
94
100
|
position: 'relative',
|
|
95
101
|
flex: '1 0 auto',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoleculeCanvas3D.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"MoleculeCanvas3D.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC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OAAO,EAAE,MAAM;IACf,UAAU,EAAE,YAAY;IACxB,GAAG,EAAE,CAAC;IACN,aAAa,EAAE,MAAM;CACtB,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Measurement } from '../core/measurement.ts';
|
|
2
2
|
import type { Molecule3DFile, Molecule3DSettings } from '../core/settings.ts';
|
|
3
3
|
import type { Molecule3DViewer } from './viewer.ts';
|
|
4
|
+
/** The operations of the viewer a scene is drawn with. */
|
|
5
|
+
export type SceneViewer = Pick<Molecule3DViewer, 'showMolecule' | 'hideMolecule' | 'showSurface' | 'showMeasurements' | 'resetCamera' | 'setCamera'>;
|
|
4
6
|
/**
|
|
5
|
-
* Draw the scene. `showMolecule` empties it, so the surface and the
|
|
7
|
+
* Draw the whole scene. `showMolecule` empties it, so the surface and the
|
|
6
8
|
* measurements are added after the model, and the camera is framed last.
|
|
7
9
|
* @param viewer - The viewer holding the canvas.
|
|
8
10
|
* @param molfile - What to draw, or `null` to empty the scene.
|
|
@@ -13,5 +15,5 @@ import type { Molecule3DViewer } from './viewer.ts';
|
|
|
13
15
|
* down -z, `none` leaves the camera alone.
|
|
14
16
|
* @returns Nothing; resolves once the scene is complete.
|
|
15
17
|
*/
|
|
16
|
-
export declare function drawScene(viewer:
|
|
18
|
+
export declare function drawScene(viewer: SceneViewer, molfile: Molecule3DFile | null, settings: Molecule3DSettings, measurements: readonly Measurement[], frameCamera: 'none' | 'keep' | 'front'): Promise<void>;
|
|
17
19
|
//# sourceMappingURL=drawScene.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawScene.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/drawScene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"drawScene.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/drawScene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,0DAA0D;AAC1D,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,gBAAgB,EACd,cAAc,GACd,cAAc,GACd,aAAa,GACb,kBAAkB,GAClB,aAAa,GACb,WAAW,CACd,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,cAAc,GAAG,IAAI,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GACrC,OAAO,CAAC,IAAI,CAAC,CAqBf"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeMolecule3DSettings } from "../core/settings.js";
|
|
2
2
|
/**
|
|
3
|
-
* Draw the scene. `showMolecule` empties it, so the surface and the
|
|
3
|
+
* Draw the whole scene. `showMolecule` empties it, so the surface and the
|
|
4
4
|
* measurements are added after the model, and the camera is framed last.
|
|
5
5
|
* @param viewer - The viewer holding the canvas.
|
|
6
6
|
* @param molfile - What to draw, or `null` to empty the scene.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawScene.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/drawScene.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"drawScene.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/drawScene.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAelE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,MAAmB,EACnB,OAA8B,EAC9B,QAA4B,EAC5B,YAAoC,EACpC,WAAsC;IAEtC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;QAC5B,OAAO;IACT,CAAC;IACD,MAAM,IAAI,GAAG,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE;QACjC,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAC;IACH,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,MAAM,MAAM,CAAC,WAAW,CAAC;YACvB,KAAK,EAAE,IAAI,CAAC,YAAY;YACxB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,eAAe;YAC9B,KAAK,EAAE,IAAI,CAAC,YAAY;SACzB,CAAC,CAAC;IACL,CAAC;IACD,MAAM,MAAM,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC5C,IAAI,WAAW,KAAK,MAAM;QAAE,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;IACvD,IAAI,WAAW,KAAK,OAAO;QAAE,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The colour the 3D view emphasises in, read off the page it sits on.
|
|
3
|
+
*
|
|
4
|
+
* A WebGL colour cannot be a custom property, and the family's accent is the
|
|
5
|
+
* one colour a site owns, so it cannot be written into a shared library either:
|
|
6
|
+
* the view asks the browser what `--accent` resolved to where it is drawn, as
|
|
7
|
+
* the parallel coordinates do, and hands molstar the answer.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* What `--accent` resolved to on an element of the view.
|
|
11
|
+
* @param element - An element of the view, once it is on the page, or `null`
|
|
12
|
+
* before it is.
|
|
13
|
+
* @returns The accent as `#rrggbb`. A site that declares none emphasises in its
|
|
14
|
+
* text colour, and a page that declares neither, or no page yet, in the
|
|
15
|
+
* family's.
|
|
16
|
+
*/
|
|
17
|
+
export declare function highlightColorOf(element: Element | null): string;
|
|
18
|
+
//# sourceMappingURL=highlightColor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlightColor.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/highlightColor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CAMhE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The colour the 3D view emphasises in, read off the page it sits on.
|
|
3
|
+
*
|
|
4
|
+
* A WebGL colour cannot be a custom property, and the family's accent is the
|
|
5
|
+
* one colour a site owns, so it cannot be written into a shared library either:
|
|
6
|
+
* the view asks the browser what `--accent` resolved to where it is drawn, as
|
|
7
|
+
* the parallel coordinates do, and hands molstar the answer.
|
|
8
|
+
*/
|
|
9
|
+
import { normalizeColor } from "../../tokens/core/colors.js";
|
|
10
|
+
import { FAMILY_TOKEN_VALUES } from "../../tokens/core/familyTokens.js";
|
|
11
|
+
/**
|
|
12
|
+
* What `--accent` resolved to on an element of the view.
|
|
13
|
+
* @param element - An element of the view, once it is on the page, or `null`
|
|
14
|
+
* before it is.
|
|
15
|
+
* @returns The accent as `#rrggbb`. A site that declares none emphasises in its
|
|
16
|
+
* text colour, and a page that declares neither, or no page yet, in the
|
|
17
|
+
* family's.
|
|
18
|
+
*/
|
|
19
|
+
export function highlightColorOf(element) {
|
|
20
|
+
return (tokenColor(element, '--accent') ??
|
|
21
|
+
tokenColor(element, '--text') ??
|
|
22
|
+
FAMILY_TOKEN_VALUES['--text']);
|
|
23
|
+
}
|
|
24
|
+
function tokenColor(element, name) {
|
|
25
|
+
const resolve = globalThis.getComputedStyle;
|
|
26
|
+
if (element === null || typeof resolve !== 'function')
|
|
27
|
+
return undefined;
|
|
28
|
+
const color = normalizeColor(resolve(element).getPropertyValue(name));
|
|
29
|
+
return color === null ? undefined : `#${color}`;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=highlightColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlightColor.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/highlightColor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAuB;IACtD,OAAO,CACL,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC;QAC/B,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC7B,mBAAmB,CAAC,QAAQ,CAAC,CAC9B,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,OAAuB,EAAE,IAAY;IACvD,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC;IAC5C,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,UAAU;QAAE,OAAO,SAAS,CAAC;IACxE,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IACtE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ViewerCapability } from '../../orbital/ui/capability.ts';
|
|
3
3
|
import type { Molecule3DCamera } from '../core/camera.ts';
|
|
4
|
+
import type { Molecule3DHighlight } from '../core/highlight.ts';
|
|
4
5
|
import type { Measurement } from '../core/measurement.ts';
|
|
5
6
|
import type { Molecule3DFile, Molecule3DSettings, Molecule3DTools } from '../core/settings.ts';
|
|
6
7
|
/**
|
|
@@ -65,7 +66,9 @@ export interface MoleculeViewer3DProps {
|
|
|
65
66
|
/**
|
|
66
67
|
* The measurements drawn over the model, when the site owns them. They name
|
|
67
68
|
* atoms by position, so they carry over to another conformer of the same
|
|
68
|
-
* molecule; a site showing an unrelated molecule should clear them.
|
|
69
|
+
* molecule; a site showing an unrelated molecule should clear them. Changing
|
|
70
|
+
* them redraws the measurements and nothing else: the model, its highlights
|
|
71
|
+
* and the camera are left as they are.
|
|
69
72
|
* @default undefined
|
|
70
73
|
*/
|
|
71
74
|
measurements?: readonly Measurement[];
|
|
@@ -74,6 +77,18 @@ export interface MoleculeViewer3DProps {
|
|
|
74
77
|
* @default undefined
|
|
75
78
|
*/
|
|
76
79
|
onMeasurementsChange?: (measurements: readonly Measurement[]) => void;
|
|
80
|
+
/**
|
|
81
|
+
* The parts of the model to emphasise in the site's accent colour, each a
|
|
82
|
+
* bonded path of atoms named as measurements name them: two atoms are that
|
|
83
|
+
* bond, three the two bonds of an angle, four the three bonds of a dihedral,
|
|
84
|
+
* and one atom is that atom alone. Only the bonds between consecutive atoms
|
|
85
|
+
* of one path are emphasised, never another bond between two highlighted
|
|
86
|
+
* atoms, and an atom the structure lacks is skipped. Changing them repaints
|
|
87
|
+
* the model and nothing else: the camera, the measurements and the hover are
|
|
88
|
+
* left as they are.
|
|
89
|
+
* @default [] — nothing is emphasised
|
|
90
|
+
*/
|
|
91
|
+
highlights?: readonly Molecule3DHighlight[];
|
|
77
92
|
/**
|
|
78
93
|
* Where the camera stands when the first molecule is framed — what a shared
|
|
79
94
|
* link carries. The camera belongs to whoever is dragging it afterwards, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moleculeViewer3DProps.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/moleculeViewer3DProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC1D;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C;;;OAGG;IACH,SAAS,CAAC,E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AAS,WAAW,EAAE,CAAC;IACtC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,KAAK,IAAI,CAAC;IACtE;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC5C;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxC;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACpD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,SAAS,CAAC;CACjE"}
|
|
@@ -12,6 +12,8 @@ import type { Molecule3DFile } from '../core/settings.ts';
|
|
|
12
12
|
import type { MoleculeStyle } from './viewerTypes.ts';
|
|
13
13
|
/** State-tree ref of the structure every representation hangs off. */
|
|
14
14
|
export declare const MOLECULE_STRUCTURE_REF = "molecule3d-structure";
|
|
15
|
+
/** The drawn model, replaced in place whenever the style changes. */
|
|
16
|
+
export declare const MODEL_REPRESENTATION_REF = "molecule3d-model";
|
|
15
17
|
/**
|
|
16
18
|
* Replace the displayed molecule. Everything already on screen goes first.
|
|
17
19
|
* @param plugin - The molstar context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderMolecule.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/renderMolecule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAOvE,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"renderMolecule.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/renderMolecule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAOvE,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAK7D,qEAAqE;AACrE,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAiB3D;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,cAAc,EACvB,KAAK,GAAE,aAAkB,GACxB,OAAO,CAAC,IAAI,CAAC,CA0Cf;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAGxE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,aAAa,GACpB,SAAS,GAAG,SAAS,CAIvB"}
|
|
@@ -15,7 +15,7 @@ export const MOLECULE_STRUCTURE_REF = 'molecule3d-structure';
|
|
|
15
15
|
/** Root of the molecule subtree: deleting it removes model and surface. */
|
|
16
16
|
const MOLECULE_DATA_REF = 'molecule3d-data';
|
|
17
17
|
/** The drawn model, replaced in place whenever the style changes. */
|
|
18
|
-
const MODEL_REPRESENTATION_REF = 'molecule3d-model';
|
|
18
|
+
export const MODEL_REPRESENTATION_REF = 'molecule3d-model';
|
|
19
19
|
/**
|
|
20
20
|
* molstar's ball-and-stick radius factor that a size factor of 1 stands for:
|
|
21
21
|
* thin sticks and readable balls.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderMolecule.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/renderMolecule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,mCAAmC,EAAE,MAAM,yEAAyE,CAAC;AAC9H,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AAOtG,sEAAsE;AACtE,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAE7D,2EAA2E;AAC3E,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAE5C,qEAAqE;AACrE,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"renderMolecule.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/renderMolecule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,mCAAmC,EAAE,MAAM,yEAAyE,CAAC;AAC9H,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AAOtG,sEAAsE;AACtE,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAE7D,2EAA2E;AAC3E,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAE5C,qEAAqE;AACrE,MAAM,CAAC,MAAM,wBAAwB,GAAG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C,MAAM,WAAW,GAAG;QAClB,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE;KAC3C,CAAC;IACX,IAAI,cAAc,KAAK,WAAW,EAAE,CAAC;QACnC,OAAO,mCAAmC,CAAC,MAAM,EAAE,SAAS,EAAE;YAC5D,IAAI,EAAE,WAAW;YACjB,UAAU,EAAE,EAAE,UAAU,EAAE,UAAU,GAAG,eAAe,EAAE;YACxD,KAAK;YACL,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;IACD,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC;QAC/B,OAAO,mCAAmC,CAAC,MAAM,EAAE,SAAS,EAAE;YAC5D,IAAI,EAAE,gBAAgB;YACtB,UAAU,EAAE;gBACV,UAAU,EAAE,UAAU,GAAG,WAAW;gBACpC,eAAe,EAAE,CAAC;gBAClB,aAAa,EAAE,KAAK;aACrB;YACD,KAAK;YACL,WAAW;YACX,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE;SACzB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,mCAAmC,CAAC,MAAM,EAAE,SAAS,EAAE;QAC5D,IAAI,EAAE,gBAAgB;QACtB,UAAU,EAAE;YACV,UAAU;YACV,eAAe,EAAE,2BAA2B;YAC5C,aAAa,EAAE,KAAK;SACrB;QACD,KAAK;QACL,WAAW;KACZ,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one canvas shows, what it is asked to show next, and the least work
|
|
3
|
+
* between the two.
|
|
4
|
+
*
|
|
5
|
+
* The measurements are drawn over the model, not into it: a change of them
|
|
6
|
+
* alone replaces their own representations and leaves the model, its surface,
|
|
7
|
+
* its highlights and the camera as they are. Only another molecule, or another
|
|
8
|
+
* style for it, draws the scene again, and only another molecule frames the
|
|
9
|
+
* camera. Draws run one after another, so a measurement never lands on a model
|
|
10
|
+
* that is half built, and the last request asked is the one drawn.
|
|
11
|
+
*/
|
|
12
|
+
import type { Molecule3DCamera } from '../core/camera.ts';
|
|
13
|
+
import type { Measurement } from '../core/measurement.ts';
|
|
14
|
+
import type { Molecule3DFile, Molecule3DSettings } from '../core/settings.ts';
|
|
15
|
+
import type { SceneViewer } from './drawScene.ts';
|
|
16
|
+
/** What the canvas is asked to show. */
|
|
17
|
+
export interface SceneRequest {
|
|
18
|
+
/** What to draw, or `null` to empty the scene. */
|
|
19
|
+
molfile: Molecule3DFile | null;
|
|
20
|
+
/** How the model is drawn. */
|
|
21
|
+
settings: Molecule3DSettings;
|
|
22
|
+
/** What is drawn over it. */
|
|
23
|
+
measurements: readonly Measurement[];
|
|
24
|
+
/** How the camera meets a molecule it has not shown before. */
|
|
25
|
+
frameNewMolecule: 'front' | 'keep';
|
|
26
|
+
}
|
|
27
|
+
/** Keeps one viewer showing the last scene it was asked for. */
|
|
28
|
+
export declare class SceneDrawer {
|
|
29
|
+
#private;
|
|
30
|
+
/** The viewer drawn on. */
|
|
31
|
+
readonly viewer: SceneViewer;
|
|
32
|
+
/**
|
|
33
|
+
* Start drawing on `viewer`, whose scene is empty.
|
|
34
|
+
* @param viewer - The viewer to draw on.
|
|
35
|
+
* @param takeLinkedCamera - Asked when a molecule is new: a camera to stand
|
|
36
|
+
* at instead of framing it, or `null`.
|
|
37
|
+
*/
|
|
38
|
+
constructor(viewer: SceneViewer, takeLinkedCamera: () => Molecule3DCamera | null);
|
|
39
|
+
/**
|
|
40
|
+
* Bring the canvas to `request`, once whatever was asked before is drawn.
|
|
41
|
+
* @param request - The scene to show; replaces any request still waiting.
|
|
42
|
+
* @returns Nothing; resolves once the canvas shows the last request asked,
|
|
43
|
+
* and rejects with what stopped it from being drawn.
|
|
44
|
+
*/
|
|
45
|
+
draw(request: SceneRequest): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=sceneDrawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sceneDrawer.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/sceneDrawer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,wCAAwC;AACxC,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,8BAA8B;IAC9B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,6BAA6B;IAC7B,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;IACrC,+DAA+D;IAC/D,gBAAgB,EAAE,OAAO,GAAG,MAAM,CAAC;CACpC;AAED,gEAAgE;AAChE,qBAAa,WAAW;;IACtB,2BAA2B;IAC3B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAW7B;;;;;OAKG;gBAED,MAAM,EAAE,WAAW,EACnB,gBAAgB,EAAE,MAAM,gBAAgB,GAAG,IAAI;IAMjD;;;;;OAKG;IACH,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAoD3C"}
|