react-cheminfo 0.39.1 → 0.40.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/bin/check-deploy.mjs +4 -2
- package/lib/deploy/core/checkDeploy.d.ts +3 -1
- package/lib/deploy/core/checkDeploy.d.ts.map +1 -1
- package/lib/deploy/core/checkDeploy.js +8 -2
- package/lib/deploy/core/checkDeploy.js.map +1 -1
- package/lib/deploy/core/index.d.ts +1 -0
- package/lib/deploy/core/index.d.ts.map +1 -1
- package/lib/deploy/core/index.js +1 -0
- package/lib/deploy/core/index.js.map +1 -1
- package/lib/deploy/core/publishedImage.d.ts +30 -0
- package/lib/deploy/core/publishedImage.d.ts.map +1 -0
- package/lib/deploy/core/publishedImage.js +96 -0
- package/lib/deploy/core/publishedImage.js.map +1 -0
- package/lib/deploy/core/types.d.ts +1 -1
- package/lib/deploy/core/types.d.ts.map +1 -1
- package/lib/deploy/core/types.js.map +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.d.ts +9 -7
- package/lib/molecule3d/ui/Molecule3DToolbar.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.js +13 -8
- package/lib/molecule3d/ui/Molecule3DToolbar.js.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
- package/lib/molecule3d/ui/camera.d.ts +0 -11
- package/lib/molecule3d/ui/camera.d.ts.map +1 -1
- package/lib/molecule3d/ui/camera.js +6 -80
- package/lib/molecule3d/ui/camera.js.map +1 -1
- package/lib/molecule3d/ui/exportMoleculeImage.d.ts +6 -2
- package/lib/molecule3d/ui/exportMoleculeImage.d.ts.map +1 -1
- package/lib/molecule3d/ui/exportMoleculeImage.js.map +1 -1
- package/lib/molecule3d/ui/index.d.ts +9 -0
- package/lib/molecule3d/ui/index.d.ts.map +1 -1
- package/lib/molecule3d/ui/index.js +5 -0
- package/lib/molecule3d/ui/index.js.map +1 -1
- package/lib/molecule3d/ui/useImageExport.d.ts +2 -2
- package/lib/molecule3d/ui/useImageExport.d.ts.map +1 -1
- package/lib/molecule3d/ui/useImageExport.js.map +1 -1
- package/lib/molecule3d/ui/viewer.d.ts.map +1 -1
- package/lib/molecule3d/ui/viewer.js +18 -53
- package/lib/molecule3d/ui/viewer.js.map +1 -1
- package/lib/molstar/core/camera.d.ts +37 -0
- package/lib/molstar/core/camera.d.ts.map +1 -0
- package/lib/molstar/core/camera.js +49 -0
- package/lib/molstar/core/camera.js.map +1 -0
- package/lib/molstar/core/cameraPose.d.ts +54 -0
- package/lib/molstar/core/cameraPose.d.ts.map +1 -0
- package/lib/molstar/core/cameraPose.js +78 -0
- package/lib/molstar/core/cameraPose.js.map +1 -0
- package/lib/{molecule3d/ui → molstar/core}/captureScene.d.ts +1 -1
- package/lib/molstar/core/captureScene.d.ts.map +1 -0
- package/lib/molstar/core/captureScene.js.map +1 -0
- package/lib/molstar/core/hover.d.ts +49 -0
- package/lib/molstar/core/hover.d.ts.map +1 -0
- package/lib/molstar/core/hover.js +92 -0
- package/lib/molstar/core/hover.js.map +1 -0
- package/lib/molstar/core/index.d.ts +26 -0
- package/lib/molstar/core/index.d.ts.map +1 -0
- package/lib/molstar/core/index.js +23 -0
- package/lib/molstar/core/index.js.map +1 -0
- package/lib/{molecule3d/ui → molstar/core}/measurements.d.ts +23 -3
- package/lib/molstar/core/measurements.d.ts.map +1 -0
- package/lib/{molecule3d/ui → molstar/core}/measurements.js +31 -7
- package/lib/molstar/core/measurements.js.map +1 -0
- package/lib/molstar/core/plugin.d.ts +83 -0
- package/lib/molstar/core/plugin.d.ts.map +1 -0
- package/lib/molstar/core/plugin.js +128 -0
- package/lib/molstar/core/plugin.js.map +1 -0
- package/lib/structure/ui/ConformerTable.d.ts +8 -0
- package/lib/structure/ui/ConformerTable.d.ts.map +1 -1
- package/lib/structure/ui/ConformerTable.js +24 -4
- package/lib/structure/ui/ConformerTable.js.map +1 -1
- package/package.json +2 -1
- package/src/deploy/core/checkDeploy.ts +14 -2
- package/src/deploy/core/index.ts +5 -0
- package/src/deploy/core/publishedImage.ts +110 -0
- package/src/deploy/core/types.ts +3 -1
- package/src/molecule3d/ui/Molecule3DToolbar.tsx +23 -16
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +1 -1
- package/src/molecule3d/ui/camera.ts +18 -93
- package/src/molecule3d/ui/exportMoleculeImage.ts +6 -2
- package/src/molecule3d/ui/index.ts +12 -0
- package/src/molecule3d/ui/useImageExport.ts +2 -2
- package/src/molecule3d/ui/viewer.ts +36 -58
- package/src/molstar/core/camera.ts +61 -0
- package/src/molstar/core/cameraPose.ts +126 -0
- package/src/{molecule3d/ui → molstar/core}/captureScene.ts +1 -1
- package/src/molstar/core/hover.ts +110 -0
- package/src/molstar/core/index.ts +38 -0
- package/src/{molecule3d/ui → molstar/core}/measurements.ts +48 -8
- package/src/molstar/core/plugin.ts +162 -0
- package/src/structure/ui/ConformerTable.tsx +38 -4
- package/lib/molecule3d/ui/captureScene.d.ts.map +0 -1
- package/lib/molecule3d/ui/captureScene.js.map +0 -1
- package/lib/molecule3d/ui/measurements.d.ts.map +0 -1
- package/lib/molecule3d/ui/measurements.js.map +0 -1
- package/lib/molecule3d/ui/viewerSpec.d.ts +0 -17
- package/lib/molecule3d/ui/viewerSpec.d.ts.map +0 -1
- package/lib/molecule3d/ui/viewerSpec.js +0 -34
- package/lib/molecule3d/ui/viewerSpec.js.map +0 -1
- package/src/molecule3d/ui/viewerSpec.ts +0 -38
- /package/lib/{molecule3d/ui → molstar/core}/captureScene.js +0 -0
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { FigureFormat } from '../../download/core/downloadFigure.ts';
|
|
2
2
|
import type { ImageSize } from '../core/exportImage.ts';
|
|
3
|
-
|
|
3
|
+
/** The one thing an export asks of a viewer: a picture of its scene. */
|
|
4
|
+
export interface SceneCapture {
|
|
5
|
+
/** Render the scene at that pixel size, as a `data:` URI. */
|
|
6
|
+
captureImage: (size: ImageSize) => Promise<string | undefined>;
|
|
7
|
+
}
|
|
4
8
|
/** What {@link exportMoleculeImage} writes. */
|
|
5
9
|
export interface MoleculeImageRequest {
|
|
6
10
|
format: FigureFormat;
|
|
@@ -17,5 +21,5 @@ export interface MoleculeImageRequest {
|
|
|
17
21
|
* @param request - See {@link MoleculeImageRequest}.
|
|
18
22
|
* @returns Nothing; resolves once the download has been started.
|
|
19
23
|
*/
|
|
20
|
-
export declare function exportMoleculeImage(viewer:
|
|
24
|
+
export declare function exportMoleculeImage(viewer: SceneCapture, request: MoleculeImageRequest): Promise<void>;
|
|
21
25
|
//# sourceMappingURL=exportMoleculeImage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportMoleculeImage.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/exportMoleculeImage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAK1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,
|
|
1
|
+
{"version":3,"file":"exportMoleculeImage.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/exportMoleculeImage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAK1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,YAAY,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAChE;AAED,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,YAAY,CAAC;IACrB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,IAAI,EAAE,SAAS,CAAC;IAChB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportMoleculeImage.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/exportMoleculeImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAE3E,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"exportMoleculeImage.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/exportMoleculeImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAE3E,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAmBvE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAoB,EACpB,OAA6B;IAE7B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAClD,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO;IAClC,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,YAAY,CACV,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EAC5D,GAAG,IAAI,MAAM,CACd,CAAC;QACF,OAAO;IACT,CAAC;IACD,YAAY,CACV,IAAI,IAAI,CAAC,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EACvE,GAAG,IAAI,MAAM,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -6,6 +6,15 @@
|
|
|
6
6
|
* `React.lazy` boundary inside `MoleculeViewer3D`. Type-only re-exports are
|
|
7
7
|
* erased and so are safe.
|
|
8
8
|
*/
|
|
9
|
+
export { Molecule3DExport } from './Molecule3DExport.tsx';
|
|
10
|
+
export type { Molecule3DExportProps } from './Molecule3DExport.tsx';
|
|
11
|
+
export { Molecule3DHelp } from './Molecule3DHelp.tsx';
|
|
12
|
+
export { Molecule3DToolbar } from './Molecule3DToolbar.tsx';
|
|
13
|
+
export type { Molecule3DToolbarProps } from './Molecule3DToolbar.tsx';
|
|
14
|
+
export type { MoleculeImageRequest, SceneCapture, } from './exportMoleculeImage.ts';
|
|
15
|
+
export { exportMoleculeImage } from './exportMoleculeImage.ts';
|
|
16
|
+
export type { ImageExport } from './useImageExport.ts';
|
|
17
|
+
export { useImageExport } from './useImageExport.ts';
|
|
9
18
|
export { MoleculeViewer3D } from './MoleculeViewer3D.tsx';
|
|
10
19
|
export type { MoleculeViewer3DProps } from './moleculeViewer3DProps.ts';
|
|
11
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,YAAY,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,YAAY,EACV,oBAAoB,EACpB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -6,5 +6,10 @@
|
|
|
6
6
|
* `React.lazy` boundary inside `MoleculeViewer3D`. Type-only re-exports are
|
|
7
7
|
* erased and so are safe.
|
|
8
8
|
*/
|
|
9
|
+
export { Molecule3DExport } from "./Molecule3DExport.js";
|
|
10
|
+
export { Molecule3DHelp } from "./Molecule3DHelp.js";
|
|
11
|
+
export { Molecule3DToolbar } from "./Molecule3DToolbar.js";
|
|
12
|
+
export { exportMoleculeImage } from "./exportMoleculeImage.js";
|
|
13
|
+
export { useImageExport } from "./useImageExport.js";
|
|
9
14
|
export { MoleculeViewer3D } from "./MoleculeViewer3D.js";
|
|
10
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAM5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
2
|
import type { FigureFormat } from '../../download/core/downloadFigure.ts';
|
|
3
3
|
import type { FigurePixels } from '../../download/core/figureScale.ts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { SceneCapture } from './exportMoleculeImage.ts';
|
|
5
5
|
/** What {@link useImageExport} hands the export panel. */
|
|
6
6
|
export interface ImageExport {
|
|
7
7
|
/** Size of the canvas on screen, or `null` before it is laid out. */
|
|
@@ -16,5 +16,5 @@ export interface ImageExport {
|
|
|
16
16
|
* @param fileName - File name without its extension.
|
|
17
17
|
* @returns See {@link ImageExport}.
|
|
18
18
|
*/
|
|
19
|
-
export declare function useImageExport(container: HTMLDivElement | null, viewerRef: RefObject<
|
|
19
|
+
export declare function useImageExport(container: HTMLDivElement | null, viewerRef: RefObject<SceneCapture | null>, fileName: string): ImageExport;
|
|
20
20
|
//# sourceMappingURL=useImageExport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useImageExport.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/useImageExport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"useImageExport.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/useImageExport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,UAAU,EAAE,MAAM,YAAY,GAAG,IAAI,CAAC;IACtC,+DAA+D;IAC/D,WAAW,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,cAAc,GAAG,IAAI,EAChC,SAAS,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,EACzC,QAAQ,EAAE,MAAM,GACf,WAAW,CAqBb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useImageExport.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/useImageExport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useImageExport.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/useImageExport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAMpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAU/D;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,SAAgC,EAChC,SAAyC,EACzC,QAAgB;IAEhB,MAAM,UAAU,GAAG,WAAW,CAAC,GAAwB,EAAE;QACvD,IAAI,SAAS,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QACpC,MAAM,GAAG,GAAG,SAAS,CAAC,qBAAqB,EAAE,CAAC;QAC9C,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACnD,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1E,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,MAAM,WAAW,GAAG,WAAW,CAC7B,KAAK,EAAE,MAAoB,EAAE,KAAa,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;QACjC,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;QAC1B,IAAI,MAAM,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACxD,CAAC;QACD,MAAM,mBAAmB,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC,EACD,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAClC,CAAC;IAEF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewer.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"viewer.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAS1D,OAAO,KAAK,EACV,uBAAuB,EACvB,aAAa,EACb,YAAY,EACb,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,qBAAa,gBAAgB;;IAI3B,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B;;;;OAIG;gBACS,SAAS,EAAE,WAAW,EAAE,OAAO,GAAE,uBAA4B;IAgBzE;;;;;;OAMG;IACH,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAO3E;;;OAGG;IACH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAO7B;;;;OAIG;IACH,WAAW,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;OAIG;IACH,gBAAgB,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAMrE;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3D;;;;;;OAMG;IACH,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAI1D;;;;;OAKG;IACH,WAAW,CACT,oBAAoB,SAA0B,EAC9C,SAAS,UAAQ,GAChB,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE,oBAAoB,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5E;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI;IAI5E;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,SAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMrE,kEAAkE;IAClE,YAAY,IAAI,IAAI;IAIpB,sEAAsE;IACtE,OAAO,IAAI,IAAI;CAUhB"}
|
|
@@ -7,20 +7,17 @@
|
|
|
7
7
|
* the viewer has been disposed. molstar's own UI is not mounted: every control
|
|
8
8
|
* is the component's.
|
|
9
9
|
*/
|
|
10
|
-
import { DEFAULT_CAMERA_DURATION, DEFAULT_SPIN_SPEED,
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { clearMolecule, renderMolecule } from "./renderMolecule.js";
|
|
10
|
+
import { DEFAULT_CAMERA_DURATION, DEFAULT_SPIN_SPEED, MeasurementPicker, MolstarPlugin, captureScene, clearMeasurements, renderMeasurements, setSpin, } from "../../molstar/core/index.js";
|
|
11
|
+
import { applyCamera, resetCamera, watchCamera } from "./camera.js";
|
|
12
|
+
import { clearMolecule, moleculeStructure, renderMolecule, } from "./renderMolecule.js";
|
|
14
13
|
import { clearSurface, renderSurface } from "./renderSurface.js";
|
|
15
|
-
import { mountMolecule3DPlugin } from "./viewerSpec.js";
|
|
16
14
|
/**
|
|
17
15
|
* One molstar canvas, and every operation the component performs on it. Every
|
|
18
16
|
* method resolves to nothing once `dispose` has been called.
|
|
19
17
|
*/
|
|
20
18
|
export class Molecule3DViewer {
|
|
21
|
-
#
|
|
19
|
+
#plugin;
|
|
22
20
|
#picker;
|
|
23
|
-
#disposed = false;
|
|
24
21
|
/** Resolves once the canvas exists; every method awaits it internally. */
|
|
25
22
|
ready;
|
|
26
23
|
/**
|
|
@@ -29,16 +26,15 @@ export class Molecule3DViewer {
|
|
|
29
26
|
* @param options - See {@link Molecule3DViewerOptions}.
|
|
30
27
|
*/
|
|
31
28
|
constructor(container, options = {}) {
|
|
32
|
-
const { background
|
|
33
|
-
|
|
34
|
-
this
|
|
35
|
-
this.ready = this.#model.initialized;
|
|
29
|
+
const { background, onMeasure = ignore } = options;
|
|
30
|
+
this.#plugin = new MolstarPlugin(container, { background });
|
|
31
|
+
this.ready = this.#plugin.ready;
|
|
36
32
|
// Registered before any `#run`, so the picker exists by the time one runs.
|
|
37
|
-
this
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
void this.#plugin
|
|
34
|
+
.run((plugin) => {
|
|
35
|
+
this.#picker = new MeasurementPicker(plugin, onMeasure, moleculeStructure);
|
|
36
|
+
})
|
|
37
|
+
.catch(ignore);
|
|
42
38
|
}
|
|
43
39
|
/**
|
|
44
40
|
* Replace the displayed molecule, clearing any surface and measurement.
|
|
@@ -84,7 +80,7 @@ export class Molecule3DViewer {
|
|
|
84
80
|
* @returns Nothing; resolves once the labels are on screen.
|
|
85
81
|
*/
|
|
86
82
|
showMeasurements(measurements) {
|
|
87
|
-
return this.#run((plugin) => renderMeasurements(plugin, measurements));
|
|
83
|
+
return this.#run((plugin) => renderMeasurements(plugin, measurements, moleculeStructure));
|
|
88
84
|
}
|
|
89
85
|
/**
|
|
90
86
|
* Make clicks on atoms build a measurement, or give them back to the camera.
|
|
@@ -135,17 +131,7 @@ export class Molecule3DViewer {
|
|
|
135
131
|
* the canvas exists.
|
|
136
132
|
*/
|
|
137
133
|
watchCamera(listener) {
|
|
138
|
-
|
|
139
|
-
let cancelled = false;
|
|
140
|
-
void this.#run((plugin) => {
|
|
141
|
-
if (!cancelled)
|
|
142
|
-
stop = watchCamera(plugin, listener);
|
|
143
|
-
});
|
|
144
|
-
return () => {
|
|
145
|
-
cancelled = true;
|
|
146
|
-
stop?.();
|
|
147
|
-
stop = null;
|
|
148
|
-
};
|
|
134
|
+
return this.#plugin.subscribe((plugin) => watchCamera(plugin, listener));
|
|
149
135
|
}
|
|
150
136
|
/**
|
|
151
137
|
* Turn the automatic spin on or off.
|
|
@@ -160,36 +146,15 @@ export class Molecule3DViewer {
|
|
|
160
146
|
}
|
|
161
147
|
/** Re-read the container's size. Call from a `ResizeObserver`. */
|
|
162
148
|
handleResize() {
|
|
163
|
-
|
|
164
|
-
return;
|
|
165
|
-
this.#model.plugin.handleResize();
|
|
149
|
+
this.#plugin.handleResize();
|
|
166
150
|
}
|
|
167
151
|
/** Tear the viewer down and release its WebGL context. Idempotent. */
|
|
168
152
|
dispose() {
|
|
169
|
-
if (this.#disposed)
|
|
170
|
-
return;
|
|
171
|
-
this.#disposed = true;
|
|
172
153
|
this.#picker?.dispose();
|
|
173
|
-
|
|
174
|
-
.catch(() => undefined)
|
|
175
|
-
.then(() => {
|
|
176
|
-
this.#model.plugin.dispose();
|
|
177
|
-
});
|
|
154
|
+
this.#plugin.dispose();
|
|
178
155
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return undefined;
|
|
182
|
-
await this.ready;
|
|
183
|
-
if (this.#disposed)
|
|
184
|
-
return undefined;
|
|
185
|
-
try {
|
|
186
|
-
return await action(this.#model.plugin);
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
if (this.#disposed)
|
|
190
|
-
return undefined;
|
|
191
|
-
throw error;
|
|
192
|
-
}
|
|
156
|
+
#run(action) {
|
|
157
|
+
return this.#plugin.run(action);
|
|
193
158
|
}
|
|
194
159
|
}
|
|
195
160
|
function ignore() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewer.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"viewer.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,OAAO,GACR,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOjE;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAClB,OAAO,CAAgB;IAChC,OAAO,CAAgC;IAEvC,0EAA0E;IACjE,KAAK,CAAgB;IAE9B;;;;OAIG;IACH,YAAY,SAAsB,EAAE,UAAmC,EAAE;QACvE,MAAM,EAAE,UAAU,EAAE,SAAS,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,CAAC,SAAS,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAChC,2EAA2E;QAC3E,KAAK,IAAI,CAAC,OAAO;aACd,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;Y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AAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,CACF,MAA2D;QAE3D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF;AAED,SAAS,MAAM;IACb,iBAAiB;AACnB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The camera moves every molstar scene of ours needs, and the one measurement
|
|
3
|
+
* they all take: how big a sphere has to be framed for a handful of atoms to
|
|
4
|
+
* be legible.
|
|
5
|
+
*/
|
|
6
|
+
import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
|
|
7
|
+
/** Transition length used when the caller does not pick one, milliseconds. */
|
|
8
|
+
export declare const DEFAULT_CAMERA_DURATION = 250;
|
|
9
|
+
/** Turn rate used when the caller does not pick one, in molstar's spin unit. */
|
|
10
|
+
export declare const DEFAULT_SPIN_SPEED: number;
|
|
11
|
+
/**
|
|
12
|
+
* Fraction of the bounding sphere kept as breathing room around the scene.
|
|
13
|
+
*
|
|
14
|
+
* `camera.reset()` frames with molstar's own margin, which suits a protein
|
|
15
|
+
* filling a wide viewport and leaves a small molecule a speck in the middle:
|
|
16
|
+
* measured coverage was 20% of the pixels. Framing the visible bounding sphere
|
|
17
|
+
* directly, with a small margin, is what makes a single water molecule legible.
|
|
18
|
+
*/
|
|
19
|
+
export declare const FRAMING_MARGIN = 0.08;
|
|
20
|
+
/** Smallest radius framed, ångström, so one atom is not a close-up. */
|
|
21
|
+
export declare const MINIMUM_FRAMING_RADIUS = 0.5;
|
|
22
|
+
/**
|
|
23
|
+
* The radius a reset frames, which is the length every stored camera is
|
|
24
|
+
* measured against — so reading a camera and applying it are the same move in
|
|
25
|
+
* opposite directions.
|
|
26
|
+
* @param radius - Radius of the scene's visible bounding sphere.
|
|
27
|
+
* @returns The framed radius.
|
|
28
|
+
*/
|
|
29
|
+
export declare function framedRadius(radius: number): number;
|
|
30
|
+
/**
|
|
31
|
+
* Turn the automatic spin on or off. It moves the camera, never the object.
|
|
32
|
+
* @param plugin - The molstar context.
|
|
33
|
+
* @param spinning - Whether the scene should keep turning.
|
|
34
|
+
* @param speed - Turn rate, in molstar's own spin unit.
|
|
35
|
+
*/
|
|
36
|
+
export declare function setSpin(plugin: PluginContext, spinning: boolean, speed?: number): void;
|
|
37
|
+
//# sourceMappingURL=camera.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../../src/molstar/core/camera.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,uEAAuE;AACvE,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAK1C;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,OAAO,EACjB,KAAK,SAAqB,GACzB,IAAI,CAQN"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The camera moves every molstar scene of ours needs, and the one measurement
|
|
3
|
+
* they all take: how big a sphere has to be framed for a handful of atoms to
|
|
4
|
+
* be legible.
|
|
5
|
+
*/
|
|
6
|
+
import { Vec3 } from 'molstar/lib/mol-math/linear-algebra.js';
|
|
7
|
+
/** Transition length used when the caller does not pick one, milliseconds. */
|
|
8
|
+
export const DEFAULT_CAMERA_DURATION = 250;
|
|
9
|
+
/** Turn rate used when the caller does not pick one, in molstar's spin unit. */
|
|
10
|
+
export const DEFAULT_SPIN_SPEED = 1 / 3;
|
|
11
|
+
/**
|
|
12
|
+
* Fraction of the bounding sphere kept as breathing room around the scene.
|
|
13
|
+
*
|
|
14
|
+
* `camera.reset()` frames with molstar's own margin, which suits a protein
|
|
15
|
+
* filling a wide viewport and leaves a small molecule a speck in the middle:
|
|
16
|
+
* measured coverage was 20% of the pixels. Framing the visible bounding sphere
|
|
17
|
+
* directly, with a small margin, is what makes a single water molecule legible.
|
|
18
|
+
*/
|
|
19
|
+
export const FRAMING_MARGIN = 0.08;
|
|
20
|
+
/** Smallest radius framed, ångström, so one atom is not a close-up. */
|
|
21
|
+
export const MINIMUM_FRAMING_RADIUS = 0.5;
|
|
22
|
+
/** Axis the automatic spin turns about: screen up. */
|
|
23
|
+
const SPIN_AXIS = Vec3.create(0, 1, 0);
|
|
24
|
+
/**
|
|
25
|
+
* The radius a reset frames, which is the length every stored camera is
|
|
26
|
+
* measured against — so reading a camera and applying it are the same move in
|
|
27
|
+
* opposite directions.
|
|
28
|
+
* @param radius - Radius of the scene's visible bounding sphere.
|
|
29
|
+
* @returns The framed radius.
|
|
30
|
+
*/
|
|
31
|
+
export function framedRadius(radius) {
|
|
32
|
+
return Math.max(radius * (1 + FRAMING_MARGIN), MINIMUM_FRAMING_RADIUS);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Turn the automatic spin on or off. It moves the camera, never the object.
|
|
36
|
+
* @param plugin - The molstar context.
|
|
37
|
+
* @param spinning - Whether the scene should keep turning.
|
|
38
|
+
* @param speed - Turn rate, in molstar's own spin unit.
|
|
39
|
+
*/
|
|
40
|
+
export function setSpin(plugin, spinning, speed = DEFAULT_SPIN_SPEED) {
|
|
41
|
+
plugin.canvas3d?.setProps({
|
|
42
|
+
trackball: {
|
|
43
|
+
animate: spinning
|
|
44
|
+
? { name: 'spin', params: { speed, axis: SPIN_AXIS } }
|
|
45
|
+
: { name: 'off', params: {} },
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=camera.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera.js","sourceRoot":"","sources":["../../../src/molstar/core/camera.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAG9D,8EAA8E;AAC9E,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAG,CAAC,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC,uEAAuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C,sDAAsD;AACtD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC,EAAE,sBAAsB,CAAC,CAAC;AACzE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CACrB,MAAqB,EACrB,QAAiB,EACjB,KAAK,GAAG,kBAAkB;IAE1B,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC;QACxB,SAAS,EAAE;YACT,OAAO,EAAE,QAAQ;gBACf,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;gBACtD,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;SAChC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two directions between molstar's camera and the camera a shared link
|
|
3
|
+
* carries.
|
|
4
|
+
*
|
|
5
|
+
* A link stores the camera against what is drawn rather than against ångström —
|
|
6
|
+
* a rotation from the front view, a zoom against the distance that frames the
|
|
7
|
+
* scene, and a target offset in its own radii — so a view opens the same on any
|
|
8
|
+
* screen. Which sphere is the yardstick is the caller's to decide: a site whose
|
|
9
|
+
* scene grows after the model arrives measures against the model alone, or one
|
|
10
|
+
* view would read as two zooms.
|
|
11
|
+
*/
|
|
12
|
+
import { Vec3 } from 'molstar/lib/mol-math/linear-algebra.js';
|
|
13
|
+
import type { Molecule3DCamera } from '../../molecule3d/core/camera.ts';
|
|
14
|
+
/** Where the camera is and where it looks, in world coordinates. */
|
|
15
|
+
export interface CameraPose {
|
|
16
|
+
position: Vec3;
|
|
17
|
+
target: Vec3;
|
|
18
|
+
up: Vec3;
|
|
19
|
+
}
|
|
20
|
+
/** The sphere a stored camera is measured against. */
|
|
21
|
+
export interface CameraReference {
|
|
22
|
+
center: Vec3;
|
|
23
|
+
/** Radius, ångström, framing margin included. */
|
|
24
|
+
radius: number;
|
|
25
|
+
}
|
|
26
|
+
/** How small an offset, in radii, is written as none at all. */
|
|
27
|
+
export interface PoseOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Target offsets below this, in radii, are read as zero. The framing centres
|
|
30
|
+
* on the scene a hair off the atoms' own centre, and that hair would
|
|
31
|
+
* otherwise be written into every link as `,0,0,0`.
|
|
32
|
+
* @default 0
|
|
33
|
+
*/
|
|
34
|
+
snapOffset?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Measure a pose against what is drawn.
|
|
38
|
+
* @param pose - Where the camera is.
|
|
39
|
+
* @param reference - The sphere to measure against.
|
|
40
|
+
* @param framingDistance - How far from the target the camera stands to frame
|
|
41
|
+
* the reference sphere; the length `zoom: 1` means.
|
|
42
|
+
* @param options - See {@link PoseOptions}.
|
|
43
|
+
* @returns The camera, or `null` for a degenerate pose.
|
|
44
|
+
*/
|
|
45
|
+
export declare function poseToCamera(pose: CameraPose, reference: CameraReference, framingDistance: number, options?: PoseOptions): Molecule3DCamera | null;
|
|
46
|
+
/**
|
|
47
|
+
* The pose a stored camera stands at: {@link poseToCamera} the other way round.
|
|
48
|
+
* @param camera - The stored camera.
|
|
49
|
+
* @param reference - The sphere it was measured against.
|
|
50
|
+
* @param framingDistance - See {@link poseToCamera}.
|
|
51
|
+
* @returns The pose.
|
|
52
|
+
*/
|
|
53
|
+
export declare function cameraToPose(camera: Molecule3DCamera, reference: CameraReference, framingDistance: number): CameraPose;
|
|
54
|
+
//# sourceMappingURL=cameraPose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cameraPose.d.ts","sourceRoot":"","sources":["../../../src/molstar/core/cameraPose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAQ,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAEpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,oEAAoE;AACpE,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,EAAE,IAAI,CAAC;IACb,EAAE,EAAE,IAAI,CAAC;CACV;AAED,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,IAAI,CAAC;IACb,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,gEAAgE;AAChE,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,eAAe,EAC1B,eAAe,EAAE,MAAM,EACvB,OAAO,GAAE,WAAgB,GACxB,gBAAgB,GAAG,IAAI,CA6BzB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,eAAe,EAC1B,eAAe,EAAE,MAAM,GACtB,UAAU,CAmBZ"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two directions between molstar's camera and the camera a shared link
|
|
3
|
+
* carries.
|
|
4
|
+
*
|
|
5
|
+
* A link stores the camera against what is drawn rather than against ångström —
|
|
6
|
+
* a rotation from the front view, a zoom against the distance that frames the
|
|
7
|
+
* scene, and a target offset in its own radii — so a view opens the same on any
|
|
8
|
+
* screen. Which sphere is the yardstick is the caller's to decide: a site whose
|
|
9
|
+
* scene grows after the model arrives measures against the model alone, or one
|
|
10
|
+
* view would read as two zooms.
|
|
11
|
+
*/
|
|
12
|
+
import { Quat, Vec3 } from 'molstar/lib/mol-math/linear-algebra.js';
|
|
13
|
+
import { normalizeMolecule3DCamera } from "../../molecule3d/core/camera.js";
|
|
14
|
+
/** The camera's own axes, which a stored rotation turns into world ones. */
|
|
15
|
+
const CAMERA_UP = Vec3.create(0, 1, 0);
|
|
16
|
+
const CAMERA_BACK = Vec3.create(0, 0, 1);
|
|
17
|
+
/**
|
|
18
|
+
* Measure a pose against what is drawn.
|
|
19
|
+
* @param pose - Where the camera is.
|
|
20
|
+
* @param reference - The sphere to measure against.
|
|
21
|
+
* @param framingDistance - How far from the target the camera stands to frame
|
|
22
|
+
* the reference sphere; the length `zoom: 1` means.
|
|
23
|
+
* @param options - See {@link PoseOptions}.
|
|
24
|
+
* @returns The camera, or `null` for a degenerate pose.
|
|
25
|
+
*/
|
|
26
|
+
export function poseToCamera(pose, reference, framingDistance, options = {}) {
|
|
27
|
+
const { snapOffset = 0 } = options;
|
|
28
|
+
const { position, target, up } = pose;
|
|
29
|
+
const back = Vec3.sub(Vec3.zero(), position, target);
|
|
30
|
+
const distance = Vec3.magnitude(back);
|
|
31
|
+
if (distance <= 0)
|
|
32
|
+
return null;
|
|
33
|
+
Vec3.scale(back, back, 1 / distance);
|
|
34
|
+
// The trackball keeps up and back close to square, never exactly so.
|
|
35
|
+
const trueUp = Vec3.scaleAndAdd(Vec3.zero(), up, back, -Vec3.dot(up, back));
|
|
36
|
+
if (Vec3.magnitude(trueUp) <= 0)
|
|
37
|
+
return null;
|
|
38
|
+
Vec3.normalize(trueUp, trueUp);
|
|
39
|
+
const right = Vec3.cross(Vec3.zero(), trueUp, back);
|
|
40
|
+
const rotation = Quat.fromBasis(Quat.identity(), right, trueUp, back);
|
|
41
|
+
const offset = Vec3.sub(Vec3.zero(), target, reference.center);
|
|
42
|
+
Vec3.scale(offset, offset, 1 / reference.radius);
|
|
43
|
+
return normalizeMolecule3DCamera({
|
|
44
|
+
rotation: [
|
|
45
|
+
rotation[0] ?? 0,
|
|
46
|
+
rotation[1] ?? 0,
|
|
47
|
+
rotation[2] ?? 0,
|
|
48
|
+
rotation[3] ?? 1,
|
|
49
|
+
],
|
|
50
|
+
zoom: framingDistance / distance,
|
|
51
|
+
offset: [
|
|
52
|
+
snap(offset[0], snapOffset),
|
|
53
|
+
snap(offset[1], snapOffset),
|
|
54
|
+
snap(offset[2], snapOffset),
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The pose a stored camera stands at: {@link poseToCamera} the other way round.
|
|
60
|
+
* @param camera - The stored camera.
|
|
61
|
+
* @param reference - The sphere it was measured against.
|
|
62
|
+
* @param framingDistance - See {@link poseToCamera}.
|
|
63
|
+
* @returns The pose.
|
|
64
|
+
*/
|
|
65
|
+
export function cameraToPose(camera, reference, framingDistance) {
|
|
66
|
+
const { rotation, zoom, offset } = normalizeMolecule3DCamera(camera);
|
|
67
|
+
const turn = Quat.create(rotation[0], rotation[1], rotation[2], rotation[3]);
|
|
68
|
+
const up = Vec3.transformQuat(Vec3.zero(), CAMERA_UP, turn);
|
|
69
|
+
const back = Vec3.transformQuat(Vec3.zero(), CAMERA_BACK, turn);
|
|
70
|
+
const shift = Vec3.create(offset[0], offset[1], offset[2]);
|
|
71
|
+
const target = Vec3.scaleAndAdd(Vec3.zero(), reference.center, shift, reference.radius);
|
|
72
|
+
const position = Vec3.scaleAndAdd(Vec3.zero(), target, back, framingDistance / zoom);
|
|
73
|
+
return { position, target, up };
|
|
74
|
+
}
|
|
75
|
+
function snap(value, threshold) {
|
|
76
|
+
return value === undefined || Math.abs(value) < threshold ? 0 : value;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=cameraPose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cameraPose.js","sourceRoot":"","sources":["../../../src/molstar/core/cameraPose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAGpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AA2B5E,4EAA4E;AAC5E,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAgB,EAChB,SAA0B,EAC1B,eAAuB,EACvB,UAAuB,EAAE;IAEzB,MAAM,EAAE,UAAU,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;IACnC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/B,IAAI,CAAC,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,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACxE,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* A picture of the scene, rendered off screen at a size of its own.
|
|
3
3
|
*/
|
|
4
4
|
import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
|
|
5
|
-
import type { ImageSize } from '
|
|
5
|
+
import type { ImageSize } from '../../molecule3d/core/exportImage.ts';
|
|
6
6
|
/**
|
|
7
7
|
* Render the scene without its selection highlights or its axes.
|
|
8
8
|
* @param plugin - The molstar context.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captureScene.d.ts","sourceRoot":"","sources":["../../../src/molstar/core/captureScene.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,MAAM,CAAC,CAYjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captureScene.js","sourceRoot":"","sources":["../../../src/molstar/core/captureScene.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAqB,EACrB,IAAe;IAEf,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACjD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;QAC3B,GAAG,MAAM,CAAC,MAAM;QAChB,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE;QAC5C,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;QACjC,WAAW,EAAE,KAAK;KACnB,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,eAAe,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the pointer rests on, as a line of text.
|
|
3
|
+
*
|
|
4
|
+
* Every drawing our sites make carries a label already — `C1 sp³ σ to H5 (+)`,
|
|
5
|
+
* `C3 along [111]` — but molstar's own UI is not mounted, so nothing shows
|
|
6
|
+
* them. This turns the plugin's hover behaviour into that one string, which the
|
|
7
|
+
* canvas renders itself.
|
|
8
|
+
*/
|
|
9
|
+
import type { Loci } from 'molstar/lib/mol-model/loci.js';
|
|
10
|
+
import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
|
|
11
|
+
/**
|
|
12
|
+
* Report whatever the pointer rests on.
|
|
13
|
+
* @param plugin - The molstar context.
|
|
14
|
+
* @param listener - Called with the loci, or `null` when the pointer is over
|
|
15
|
+
* nothing. The pointer over the background reports an empty loci, whose label
|
|
16
|
+
* is the word "Nothing" — a sentence, not an absence — so it arrives as `null`.
|
|
17
|
+
* @returns The unsubscribe function.
|
|
18
|
+
*/
|
|
19
|
+
export declare function subscribeHover(plugin: PluginContext, listener: (loci: Loci | null) => void): () => void;
|
|
20
|
+
/**
|
|
21
|
+
* The one line a loci is worth, in molstar's own words.
|
|
22
|
+
* @param loci - What the pointer is over.
|
|
23
|
+
* @returns The label, stripped of the markup molstar writes into it, or `null`
|
|
24
|
+
* when there is nothing to say.
|
|
25
|
+
*/
|
|
26
|
+
export declare function lociText(loci: Loci): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* The atoms a loci holds, in words a reader wants.
|
|
29
|
+
*
|
|
30
|
+
* molstar names one after the row it parsed — `xyz | Model 0 | Instance 1_555 |
|
|
31
|
+
* A | MOL 1 | O [idx 1]` — which is the address of a line in a file we wrote to
|
|
32
|
+
* hand it the atoms, and says nothing a student wants. The element and which
|
|
33
|
+
* atom of the scene it is do: the two hydrogens of water can then be told apart.
|
|
34
|
+
* @param loci - What the pointer rests on: an atom, or the two ends of a bond.
|
|
35
|
+
* @returns `O 1`, `Si 4 — O 8`, or `null` when the loci holds no atom.
|
|
36
|
+
*/
|
|
37
|
+
export declare function atomText(loci: Loci): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* What a site calls one atom of its scene.
|
|
40
|
+
*
|
|
41
|
+
* molstar upper-cases an element symbol on its way in, so the atom it hands
|
|
42
|
+
* back from an `Si` it was given is an `SI`, which is not how anybody writes
|
|
43
|
+
* silicon. The number is which atom of the scene it is, counting from one.
|
|
44
|
+
* @param element - Its element symbol, in any case.
|
|
45
|
+
* @param index - Its place in the file the viewer was handed, from zero.
|
|
46
|
+
* @returns `O 1`, `Si 4`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function atomName(element: string, index: number): string;
|
|
49
|
+
//# sourceMappingURL=hover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../../src/molstar/core/hover.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAO1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGvE;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,GACpC,MAAM,IAAI,CAQZ;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAIlD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAiBlD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI/D"}
|