react-cheminfo 0.4.1 → 0.7.0
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/README.md +198 -34
- package/lib/citation/core/index.d.ts +1 -0
- package/lib/citation/core/index.d.ts.map +1 -1
- package/lib/citation/core/index.js +1 -0
- package/lib/citation/core/index.js.map +1 -1
- package/lib/citation/core/platformPaper.d.ts +14 -0
- package/lib/citation/core/platformPaper.d.ts.map +1 -0
- package/lib/citation/core/platformPaper.js +28 -0
- package/lib/citation/core/platformPaper.js.map +1 -0
- package/lib/color/core/index.d.ts +1 -1
- package/lib/color/core/index.d.ts.map +1 -1
- package/lib/color/core/index.js +1 -1
- package/lib/color/core/index.js.map +1 -1
- package/lib/core.d.ts +1 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +1 -0
- package/lib/core.js.map +1 -1
- package/lib/ecosystem/core/sites.d.ts +1 -1
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +15 -5
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +3 -0
- package/lib/ecosystem/ui/glyphs.js.map +1 -1
- package/lib/orbital/core/index.d.ts +1 -1
- package/lib/orbital/core/index.d.ts.map +1 -1
- package/lib/orbital/core/index.js +1 -1
- package/lib/orbital/core/index.js.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalCanvas.d.ts +5 -0
- package/lib/orbital/ui/AtomicOrbitalCanvas.d.ts.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalCanvas.js +4 -3
- package/lib/orbital/ui/AtomicOrbitalCanvas.js.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalViewer.d.ts +5 -0
- package/lib/orbital/ui/AtomicOrbitalViewer.d.ts.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalViewer.js.map +1 -1
- package/lib/orbital/ui/axesGeometry.d.ts +27 -0
- package/lib/orbital/ui/axesGeometry.d.ts.map +1 -0
- package/lib/orbital/ui/axesGeometry.js +74 -0
- package/lib/orbital/ui/axesGeometry.js.map +1 -0
- package/lib/orbital/ui/camera.d.ts +7 -0
- package/lib/orbital/ui/camera.d.ts.map +1 -1
- package/lib/orbital/ui/camera.js +8 -1
- package/lib/orbital/ui/camera.js.map +1 -1
- package/lib/orbital/ui/renderAxes.d.ts +53 -0
- package/lib/orbital/ui/renderAxes.d.ts.map +1 -0
- package/lib/orbital/ui/renderAxes.js +110 -0
- package/lib/orbital/ui/renderAxes.js.map +1 -0
- package/lib/orbital/ui/viewer.d.ts +16 -0
- package/lib/orbital/ui/viewer.d.ts.map +1 -1
- package/lib/orbital/ui/viewer.js +24 -2
- package/lib/orbital/ui/viewer.js.map +1 -1
- package/lib/periodic/core/categories.d.ts +25 -0
- package/lib/periodic/core/categories.d.ts.map +1 -0
- package/lib/periodic/core/categories.js +70 -0
- package/lib/periodic/core/categories.js.map +1 -0
- package/lib/periodic/core/elements.d.ts +49 -0
- package/lib/periodic/core/elements.d.ts.map +1 -0
- package/lib/periodic/core/elements.js +175 -0
- package/lib/periodic/core/elements.js.map +1 -0
- package/lib/periodic/core/index.d.ts +6 -0
- package/lib/periodic/core/index.d.ts.map +1 -0
- package/lib/periodic/core/index.js +4 -0
- package/lib/periodic/core/index.js.map +1 -0
- package/lib/periodic/core/layout.d.ts +73 -0
- package/lib/periodic/core/layout.d.ts.map +1 -0
- package/lib/periodic/core/layout.js +132 -0
- package/lib/periodic/core/layout.js.map +1 -0
- package/lib/periodic/ui/CategoryLegend.d.ts +26 -0
- package/lib/periodic/ui/CategoryLegend.d.ts.map +1 -0
- package/lib/periodic/ui/CategoryLegend.js +53 -0
- package/lib/periodic/ui/CategoryLegend.js.map +1 -0
- package/lib/periodic/ui/ElementCell.d.ts +53 -0
- package/lib/periodic/ui/ElementCell.d.ts.map +1 -0
- package/lib/periodic/ui/ElementCell.js +56 -0
- package/lib/periodic/ui/ElementCell.js.map +1 -0
- package/lib/periodic/ui/PeriodicTable.d.ts +90 -0
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -0
- package/lib/periodic/ui/PeriodicTable.js +77 -0
- package/lib/periodic/ui/PeriodicTable.js.map +1 -0
- package/lib/periodic/ui/PeriodicTableChrome.d.ts +36 -0
- package/lib/periodic/ui/PeriodicTableChrome.d.ts.map +1 -0
- package/lib/periodic/ui/PeriodicTableChrome.js +72 -0
- package/lib/periodic/ui/PeriodicTableChrome.js.map +1 -0
- package/lib/periodic/ui/index.d.ts +7 -0
- package/lib/periodic/ui/index.d.ts.map +1 -0
- package/lib/periodic/ui/index.js +4 -0
- package/lib/periodic/ui/index.js.map +1 -0
- package/lib/seo/core/documentMeta.d.ts +2 -2
- package/lib/seo/core/documentMeta.js +4 -3
- package/lib/seo/core/documentMeta.js.map +1 -1
- package/lib/seo/core/index.d.ts +13 -4
- package/lib/seo/core/index.d.ts.map +1 -1
- package/lib/seo/core/index.js +8 -3
- package/lib/seo/core/index.js.map +1 -1
- package/lib/seo/core/noscript.d.ts +97 -0
- package/lib/seo/core/noscript.d.ts.map +1 -0
- package/lib/seo/core/noscript.js +93 -0
- package/lib/seo/core/noscript.js.map +1 -0
- package/lib/seo/core/pageMeta.d.ts +30 -14
- package/lib/seo/core/pageMeta.d.ts.map +1 -1
- package/lib/seo/core/pageMeta.js +40 -43
- package/lib/seo/core/pageMeta.js.map +1 -1
- package/lib/seo/core/robots.d.ts +55 -0
- package/lib/seo/core/robots.d.ts.map +1 -0
- package/lib/seo/core/robots.js +70 -0
- package/lib/seo/core/robots.js.map +1 -0
- package/lib/seo/core/routes.d.ts +73 -5
- package/lib/seo/core/routes.d.ts.map +1 -1
- package/lib/seo/core/routes.js +142 -16
- package/lib/seo/core/routes.js.map +1 -1
- package/lib/seo/core/siteFiles.d.ts +39 -43
- package/lib/seo/core/siteFiles.d.ts.map +1 -1
- package/lib/seo/core/siteFiles.js +53 -69
- package/lib/seo/core/siteFiles.js.map +1 -1
- package/lib/seo/core/startDocumentMeta.d.ts +44 -0
- package/lib/seo/core/startDocumentMeta.d.ts.map +1 -0
- package/lib/seo/core/startDocumentMeta.js +47 -0
- package/lib/seo/core/startDocumentMeta.js.map +1 -0
- package/lib/seo/core/structuredData.d.ts +48 -0
- package/lib/seo/core/structuredData.d.ts.map +1 -0
- package/lib/seo/core/structuredData.js +41 -0
- package/lib/seo/core/structuredData.js.map +1 -0
- package/lib/seo/core/template.d.ts +48 -0
- package/lib/seo/core/template.d.ts.map +1 -0
- package/lib/seo/core/template.js +53 -0
- package/lib/seo/core/template.js.map +1 -0
- package/lib/seo/vite/ogCard.d.ts +9 -1
- package/lib/seo/vite/ogCard.d.ts.map +1 -1
- package/lib/seo/vite/ogCard.js +14 -4
- package/lib/seo/vite/ogCard.js.map +1 -1
- package/lib/seo/vite/prerender.d.ts +38 -7
- package/lib/seo/vite/prerender.d.ts.map +1 -1
- package/lib/seo/vite/prerender.js +68 -30
- package/lib/seo/vite/prerender.js.map +1 -1
- package/lib/ui.d.ts +1 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +1 -0
- package/lib/ui.js.map +1 -1
- package/package.json +2 -1
- package/src/citation/core/index.ts +1 -0
- package/src/citation/core/platformPaper.ts +32 -0
- package/src/color/core/index.ts +6 -1
- package/src/core.ts +1 -0
- package/src/ecosystem/core/sites.ts +16 -5
- package/src/ecosystem/ui/glyphs.tsx +19 -0
- package/src/orbital/core/index.ts +1 -1
- package/src/orbital/ui/AtomicOrbitalCanvas.tsx +9 -2
- package/src/orbital/ui/AtomicOrbitalViewer.tsx +5 -0
- package/src/orbital/ui/axesGeometry.ts +91 -0
- package/src/orbital/ui/camera.ts +9 -1
- package/src/orbital/ui/renderAxes.ts +190 -0
- package/src/orbital/ui/viewer.ts +32 -2
- package/src/periodic/core/categories.ts +83 -0
- package/src/periodic/core/elements.ts +217 -0
- package/src/periodic/core/index.ts +27 -0
- package/src/periodic/core/layout.ts +183 -0
- package/src/periodic/ui/CategoryLegend.tsx +105 -0
- package/src/periodic/ui/ElementCell.tsx +137 -0
- package/src/periodic/ui/PeriodicTable.tsx +226 -0
- package/src/periodic/ui/PeriodicTableChrome.tsx +170 -0
- package/src/periodic/ui/index.ts +6 -0
- package/src/seo/core/documentMeta.ts +5 -5
- package/src/seo/core/index.ts +19 -12
- package/src/seo/core/noscript.ts +195 -0
- package/src/seo/core/pageMeta.ts +54 -53
- package/src/seo/core/robots.ts +114 -0
- package/src/seo/core/routes.ts +181 -14
- package/src/seo/core/siteFiles.ts +58 -96
- package/src/seo/core/startDocumentMeta.ts +77 -0
- package/src/seo/core/structuredData.ts +80 -0
- package/src/seo/core/template.ts +54 -0
- package/src/seo/vite/ogCard.ts +15 -5
- package/src/seo/vite/prerender.ts +105 -58
- package/src/ui.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prerender.js","sourceRoot":"","sources":["../../../src/seo/vite/prerender.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"prerender.js","sourceRoot":"","sources":["../../../src/seo/vite/prerender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE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EAAE,MAAM,EAAE,MAAM,IAAI,MAAM,EAAE,CAAC,CAAC;AAC7E,CAAC"}
|
package/lib/ui.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './error/ui/index.ts';
|
|
|
11
11
|
export * from './help/ui/index.ts';
|
|
12
12
|
export * from './hooks/ui/index.ts';
|
|
13
13
|
export * from './pedagogy/ui/index.ts';
|
|
14
|
+
export * from './periodic/ui/index.ts';
|
|
14
15
|
export * from './share/ui/index.ts';
|
|
15
16
|
export * from './shared/ui/index.ts';
|
|
16
17
|
export * from './state/ui/index.ts';
|
package/lib/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
package/lib/ui.js
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./error/ui/index.js";
|
|
|
11
11
|
export * from "./help/ui/index.js";
|
|
12
12
|
export * from "./hooks/ui/index.js";
|
|
13
13
|
export * from "./pedagogy/ui/index.js";
|
|
14
|
+
export * from "./periodic/ui/index.js";
|
|
14
15
|
export * from "./share/ui/index.js";
|
|
15
16
|
export * from "./shared/ui/index.js";
|
|
16
17
|
export * from "./state/ui/index.js";
|
package/lib/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cheminfo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Assembled React components shared by the cheminfo sites: a Cite button and an ecosystem menu",
|
|
6
6
|
"author": "Luc Patiny",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@types/react-dom": "^19.2.4",
|
|
55
55
|
"@vitest/coverage-v8": "^4.1.10",
|
|
56
56
|
"@zakodium/tsconfig": "^1.0.5",
|
|
57
|
+
"chemical-elements": "^2.3.2",
|
|
57
58
|
"eslint": "^9.39.5",
|
|
58
59
|
"eslint-config-cheminfo-react": "^20.1.0",
|
|
59
60
|
"eslint-config-cheminfo-typescript": "^22.1.0",
|
|
@@ -12,6 +12,7 @@ export {
|
|
|
12
12
|
citationFilename,
|
|
13
13
|
formatCitation,
|
|
14
14
|
} from './formats.ts';
|
|
15
|
+
export { PLATFORM_PAPER, PLATFORM_WORK } from './platformPaper.ts';
|
|
15
16
|
export type { Reference, ReferenceAuthor } from './reference.ts';
|
|
16
17
|
export { doiUrl } from './reference.ts';
|
|
17
18
|
export type {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Reference } from './reference.ts';
|
|
2
|
+
import type { CitedWork } from './works.ts';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The platform every site of the family runs on: chemical data processed in the
|
|
6
|
+
* browser, which is what makes these applications rather than queues of jobs.
|
|
7
|
+
* One record holds it, so no site can name a different version of it.
|
|
8
|
+
*/
|
|
9
|
+
export const PLATFORM_PAPER: Reference = {
|
|
10
|
+
authors: [{ given: 'L.', family: 'Patiny' }],
|
|
11
|
+
title:
|
|
12
|
+
'Unlocking the Potential of Browser-Based Scientific Data Analysis: A 20-Year Journey of Expertise',
|
|
13
|
+
journal: 'CHIMIA',
|
|
14
|
+
journalAbbreviation: 'Chimia',
|
|
15
|
+
year: 2025,
|
|
16
|
+
volume: '79',
|
|
17
|
+
issue: '1-2',
|
|
18
|
+
firstPage: '66',
|
|
19
|
+
lastPage: '69',
|
|
20
|
+
doi: '10.2533/chimia.2025.66',
|
|
21
|
+
publisher: 'Swiss Chemical Society',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The platform paper as the second work a site asks to be cited, after the work
|
|
26
|
+
* the tool itself implements.
|
|
27
|
+
*/
|
|
28
|
+
export const PLATFORM_WORK: CitedWork = {
|
|
29
|
+
reference: PLATFORM_PAPER,
|
|
30
|
+
what: 'Data processing in the browser',
|
|
31
|
+
note: 'Cite it for the site itself, which runs in the browser.',
|
|
32
|
+
};
|
package/src/color/core/index.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export type { ReadableInkOptions } from './contrast.ts';
|
|
2
2
|
export { contrastRatio, readableInk, relativeLuminance } from './contrast.ts';
|
|
3
3
|
export type { PositionInRangeOptions, Swatch } from './scale.ts';
|
|
4
|
-
export {
|
|
4
|
+
export {
|
|
5
|
+
VIRIDIS_SCALE,
|
|
6
|
+
colorFromScale,
|
|
7
|
+
positionInRange,
|
|
8
|
+
swatchFromScale,
|
|
9
|
+
} from './scale.ts';
|
package/src/core.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './ecosystem/core/index.ts';
|
|
|
8
8
|
export * from './format/core/index.ts';
|
|
9
9
|
export * from './orbital/core/index.ts';
|
|
10
10
|
export * from './pedagogy/core/index.ts';
|
|
11
|
+
export * from './periodic/core/index.ts';
|
|
11
12
|
export * from './router/core/index.ts';
|
|
12
13
|
export * from './seo/core/index.ts';
|
|
13
14
|
export * from './share/core/index.ts';
|
|
@@ -5,6 +5,7 @@ export type SiteId =
|
|
|
5
5
|
| 'smiles'
|
|
6
6
|
| 'chemcalc'
|
|
7
7
|
| 'nmrium'
|
|
8
|
+
| 'derepflow'
|
|
8
9
|
| 'surge'
|
|
9
10
|
| 'tex'
|
|
10
11
|
| 'lcao'
|
|
@@ -106,8 +107,8 @@ export const ECOSYSTEM_SITES: readonly EcosystemSite[] = [
|
|
|
106
107
|
repository: 'https://github.com/cheminfo/chemcalc.org',
|
|
107
108
|
tagline: 'Molecular formula, exact mass and isotopic distribution.',
|
|
108
109
|
brand: '#5b52e0',
|
|
109
|
-
brandAlt: '#
|
|
110
|
-
mark: { plate: '#5b52e0', accent: '#
|
|
110
|
+
brandAlt: '#d63384',
|
|
111
|
+
mark: { plate: '#5b52e0', accent: '#ff8ac2' },
|
|
111
112
|
},
|
|
112
113
|
{
|
|
113
114
|
id: 'nmrium',
|
|
@@ -119,6 +120,16 @@ export const ECOSYSTEM_SITES: readonly EcosystemSite[] = [
|
|
|
119
120
|
brandAlt: '#2b143e',
|
|
120
121
|
mark: { plate: '#2b143e', accent: '#ea580c' },
|
|
121
122
|
},
|
|
123
|
+
{
|
|
124
|
+
id: 'derepflow',
|
|
125
|
+
name: { lead: 'Derep', alt: 'Flow' },
|
|
126
|
+
host: 'derepflow.cheminfo.org',
|
|
127
|
+
repository: 'https://github.com/cheminfo/derepflow',
|
|
128
|
+
tagline: 'Identify the constituents of a mixture from its ¹³C spectrum.',
|
|
129
|
+
brand: '#be185d',
|
|
130
|
+
brandAlt: '#0f766e',
|
|
131
|
+
mark: { plate: '#be185d', accent: '#0d9488' },
|
|
132
|
+
},
|
|
122
133
|
{
|
|
123
134
|
id: 'surge',
|
|
124
135
|
name: { lead: 'surge', alt: 'cheminfo', dot: true },
|
|
@@ -195,9 +206,9 @@ export const ECOSYSTEM_SITES: readonly EcosystemSite[] = [
|
|
|
195
206
|
host: 'polycarp.cheminfo.org',
|
|
196
207
|
repository: 'https://github.com/cheminfo/polycarp.cheminfo.org',
|
|
197
208
|
tagline: 'Predict the microstructure of a radical copolymerisation.',
|
|
198
|
-
brand: '#
|
|
199
|
-
brandAlt: '#
|
|
200
|
-
mark: { plate: '#
|
|
209
|
+
brand: '#701a75',
|
|
210
|
+
brandAlt: '#4d7c0f',
|
|
211
|
+
mark: { plate: '#701a75', accent: '#a3e635' },
|
|
201
212
|
},
|
|
202
213
|
{
|
|
203
214
|
id: '3d',
|
|
@@ -74,6 +74,25 @@ export const GLYPHS: Record<SiteId, (alt: string) => ReactNode> = {
|
|
|
74
74
|
<path d="M23 24V18" stroke="#ffffff" />
|
|
75
75
|
</g>
|
|
76
76
|
),
|
|
77
|
+
// Three peaks of a mixture over the funnel that narrows them to one compound,
|
|
78
|
+
// which is the dereplication this one does.
|
|
79
|
+
derepflow: (alt) => (
|
|
80
|
+
<>
|
|
81
|
+
<g stroke="#ffffff" strokeWidth="4" strokeLinecap="round" fill="none">
|
|
82
|
+
<path d="M7 15.6V9.4" />
|
|
83
|
+
<path d="M16 15.6V4.6" />
|
|
84
|
+
<path d="M25 15.6v-4.6" />
|
|
85
|
+
</g>
|
|
86
|
+
<path
|
|
87
|
+
d="M6.2 20.4 16 27 25.8 20.4"
|
|
88
|
+
stroke={alt}
|
|
89
|
+
strokeWidth="4"
|
|
90
|
+
strokeLinecap="round"
|
|
91
|
+
strokeLinejoin="round"
|
|
92
|
+
fill="none"
|
|
93
|
+
/>
|
|
94
|
+
</>
|
|
95
|
+
),
|
|
77
96
|
// The official NMRium symbol, from `Logo.tsx` of the NMRium sources: the
|
|
78
97
|
// orange half is theirs, and the half their logo sets in plum is set in white
|
|
79
98
|
// here because the plate already is that plum.
|
|
@@ -15,6 +15,7 @@ import { PHASE_PALETTES } from '../core/palette.ts';
|
|
|
15
15
|
import type { AtomicSampler } from '../core/sample.ts';
|
|
16
16
|
import { sampleInProcess } from '../core/sample.ts';
|
|
17
17
|
|
|
18
|
+
import { DEFAULT_SPIN_SPEED } from './camera.ts';
|
|
18
19
|
import type { OrbitalViewer } from './viewer.ts';
|
|
19
20
|
import { createOrbitalViewer } from './viewer.ts';
|
|
20
21
|
|
|
@@ -44,6 +45,11 @@ export interface AtomicOrbitalCanvasProps {
|
|
|
44
45
|
* @default false
|
|
45
46
|
*/
|
|
46
47
|
spinning?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* How fast it turns, in molstar's own spin unit. Lower is slower.
|
|
50
|
+
* @default 0.3
|
|
51
|
+
*/
|
|
52
|
+
spinSpeed?: number;
|
|
47
53
|
/**
|
|
48
54
|
* How the field is produced. Supply a worker-backed sampler to keep the main
|
|
49
55
|
* thread free; the default runs in process.
|
|
@@ -77,6 +83,7 @@ export function AtomicOrbitalCanvas(
|
|
|
77
83
|
palette = PHASE_PALETTES.textbook,
|
|
78
84
|
resolution = DEFAULT_RESOLUTION,
|
|
79
85
|
spinning = false,
|
|
86
|
+
spinSpeed = DEFAULT_SPIN_SPEED,
|
|
80
87
|
sample = sampleInProcess,
|
|
81
88
|
onNodeRadii,
|
|
82
89
|
onError,
|
|
@@ -144,8 +151,8 @@ export function AtomicOrbitalCanvas(
|
|
|
144
151
|
}, [atomicNumber, orbitalId, resolution, palette, sample, wanted]);
|
|
145
152
|
|
|
146
153
|
useEffect(() => {
|
|
147
|
-
void viewerRef.current?.setSpin(spinning);
|
|
148
|
-
}, [spinning]);
|
|
154
|
+
void viewerRef.current?.setSpin(spinning, spinSpeed);
|
|
155
|
+
}, [spinning, spinSpeed]);
|
|
149
156
|
|
|
150
157
|
return (
|
|
151
158
|
<div ref={containerRef} style={CANVAS_STYLE}>
|
|
@@ -56,6 +56,11 @@ export interface AtomicOrbitalViewerProps {
|
|
|
56
56
|
* @default false
|
|
57
57
|
*/
|
|
58
58
|
spinning?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* How fast it turns, in molstar's own spin unit. Lower is slower.
|
|
61
|
+
* @default 0.3
|
|
62
|
+
*/
|
|
63
|
+
spinSpeed?: number;
|
|
59
64
|
/**
|
|
60
65
|
* How the field is produced. Supply a worker-backed sampler to keep the main
|
|
61
66
|
* thread free; the default runs in process.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The geometry of the cartesian frame: three rods through the origin and the
|
|
3
|
+
* three letters that name them.
|
|
4
|
+
*
|
|
5
|
+
* It is arithmetic over positions, which is why it is here rather than in
|
|
6
|
+
* `renderAxes.ts` — that module is about representations, exactly as
|
|
7
|
+
* `volumeField.ts` is to `renderVolume.ts`.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { addCylinder } from 'molstar/lib/mol-geo/geometry/mesh/builder/cylinder.js';
|
|
11
|
+
import { MeshBuilder } from 'molstar/lib/mol-geo/geometry/mesh/mesh-builder.js';
|
|
12
|
+
import type { Mesh } from 'molstar/lib/mol-geo/geometry/mesh/mesh.js';
|
|
13
|
+
import { TextBuilder } from 'molstar/lib/mol-geo/geometry/text/text-builder.js';
|
|
14
|
+
import type { Text } from 'molstar/lib/mol-geo/geometry/text/text.js';
|
|
15
|
+
import { Vec3 } from 'molstar/lib/mol-math/linear-algebra.js';
|
|
16
|
+
|
|
17
|
+
/** How far a rod, and a label, sit from the origin as fractions of the reach. */
|
|
18
|
+
export const ROD_LENGTH = 1.06;
|
|
19
|
+
export const LABEL_SIZE = 0.1;
|
|
20
|
+
|
|
21
|
+
/** Rod radius, as a fraction of the reach. */
|
|
22
|
+
const ROD_RADIUS = 0.006;
|
|
23
|
+
|
|
24
|
+
/** Arrowhead length as a fraction of the rod's half-length. */
|
|
25
|
+
const HEAD_LENGTH = 0.06;
|
|
26
|
+
|
|
27
|
+
/** Arrowhead radius as a multiple of the rod's. */
|
|
28
|
+
const HEAD_FLARE = 4;
|
|
29
|
+
|
|
30
|
+
/** x, y and z, in the order their labels are given in. */
|
|
31
|
+
const AXIS_DIRECTIONS = [
|
|
32
|
+
Vec3.create(1, 0, 0),
|
|
33
|
+
Vec3.create(0, 1, 0),
|
|
34
|
+
Vec3.create(0, 0, 1),
|
|
35
|
+
] as const;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Three rods through the origin, each with an arrowhead on its positive end.
|
|
39
|
+
* @param reach - How far the orbital reaches, in scene units.
|
|
40
|
+
* @returns The mesh, one group per axis.
|
|
41
|
+
*/
|
|
42
|
+
export function buildAxisRods(reach: number): Mesh {
|
|
43
|
+
const state = MeshBuilder.createState(1024, 512);
|
|
44
|
+
const length = reach * ROD_LENGTH;
|
|
45
|
+
const radius = reach * ROD_RADIUS;
|
|
46
|
+
const head = length * HEAD_LENGTH;
|
|
47
|
+
for (const [axis, direction] of AXIS_DIRECTIONS.entries()) {
|
|
48
|
+
state.currentGroup = axis;
|
|
49
|
+
const start = Vec3.scale(Vec3.zero(), direction, -length);
|
|
50
|
+
const neck = Vec3.scale(Vec3.zero(), direction, length - head);
|
|
51
|
+
const tip = Vec3.scale(Vec3.zero(), direction, length);
|
|
52
|
+
addCylinder(state, start, neck, 1, {
|
|
53
|
+
radiusTop: radius,
|
|
54
|
+
radiusBottom: radius,
|
|
55
|
+
topCap: true,
|
|
56
|
+
bottomCap: true,
|
|
57
|
+
radialSegments: 12,
|
|
58
|
+
});
|
|
59
|
+
addCylinder(state, neck, tip, 1, {
|
|
60
|
+
radiusTop: 0,
|
|
61
|
+
radiusBottom: radius * HEAD_FLARE,
|
|
62
|
+
topCap: true,
|
|
63
|
+
bottomCap: true,
|
|
64
|
+
radialSegments: 16,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return MeshBuilder.getMesh(state);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* One label just beyond each arrowhead.
|
|
72
|
+
* @param at - Distance from the origin the labels sit at, in scene units.
|
|
73
|
+
* @param labels - What the axes are called, in x, y, z order.
|
|
74
|
+
* @returns The text geometry, one group per axis.
|
|
75
|
+
*/
|
|
76
|
+
export function buildAxisLabels(at: number, labels: readonly string[]): Text {
|
|
77
|
+
const builder = TextBuilder.create({}, 3, 3);
|
|
78
|
+
for (const [axis, direction] of AXIS_DIRECTIONS.entries()) {
|
|
79
|
+
const position = Vec3.scale(Vec3.zero(), direction, at);
|
|
80
|
+
builder.add(
|
|
81
|
+
labels[axis] ?? '',
|
|
82
|
+
position[0] as number,
|
|
83
|
+
position[1] as number,
|
|
84
|
+
position[2] as number,
|
|
85
|
+
0,
|
|
86
|
+
1,
|
|
87
|
+
axis,
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
return builder.getText();
|
|
91
|
+
}
|
package/src/orbital/ui/camera.ts
CHANGED
|
@@ -10,6 +10,14 @@ import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
|
|
|
10
10
|
/** Transition length used when the caller does not pick one, milliseconds. */
|
|
11
11
|
export const DEFAULT_CAMERA_DURATION = 250;
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Turn rate used when the caller does not pick one, in molstar's own spin unit.
|
|
15
|
+
*
|
|
16
|
+
* A lobe has to stay in one place long enough to be read; molstar's own 1 turns
|
|
17
|
+
* an orbital fast enough that the phases blur into each other.
|
|
18
|
+
*/
|
|
19
|
+
export const DEFAULT_SPIN_SPEED = 0.3;
|
|
20
|
+
|
|
13
21
|
/**
|
|
14
22
|
* Fraction of the bounding sphere kept as breathing room around the orbital.
|
|
15
23
|
*
|
|
@@ -113,7 +121,7 @@ export function frameOrbital(
|
|
|
113
121
|
export function setSpin(
|
|
114
122
|
plugin: PluginContext,
|
|
115
123
|
spinning: boolean,
|
|
116
|
-
speed =
|
|
124
|
+
speed = DEFAULT_SPIN_SPEED,
|
|
117
125
|
): void {
|
|
118
126
|
plugin.canvas3d?.setProps({
|
|
119
127
|
trackball: {
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cartesian frame an atomic orbital is read against.
|
|
3
|
+
*
|
|
4
|
+
* A `3d_xz` is only `3d_xz` because of where its lobes sit relative to x and
|
|
5
|
+
* z, and a lone isosurface on a blank canvas says nothing about that: the
|
|
6
|
+
* student is looking at four identical lobes and has to take the label's word
|
|
7
|
+
* for it. Three labelled axes through the nucleus are what turn the picture
|
|
8
|
+
* back into the diagram their textbook draws.
|
|
9
|
+
*
|
|
10
|
+
* The axes are neutral grey on purpose. The phase palette already owns colour
|
|
11
|
+
* here — blue against red, or blue against amber — so the usual red/green/blue
|
|
12
|
+
* axis convention would compete with the one thing the surface is saying, and
|
|
13
|
+
* the labels tell the three apart anyway.
|
|
14
|
+
*
|
|
15
|
+
* Like the isosurfaces, the representations live outside the state tree and
|
|
16
|
+
* are tracked per plugin.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { Mesh } from 'molstar/lib/mol-geo/geometry/mesh/mesh.js';
|
|
20
|
+
import { Text } from 'molstar/lib/mol-geo/geometry/text/text.js';
|
|
21
|
+
import { Shape } from 'molstar/lib/mol-model/shape.js';
|
|
22
|
+
import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
|
|
23
|
+
import type { Representation } from 'molstar/lib/mol-repr/representation.js';
|
|
24
|
+
// Lowercased on import: it is a factory, not a constructor.
|
|
25
|
+
import { ShapeRepresentation as shapeRepresentation } from 'molstar/lib/mol-repr/shape/representation.js';
|
|
26
|
+
import { Color } from 'molstar/lib/mol-util/color/color.js';
|
|
27
|
+
|
|
28
|
+
import {
|
|
29
|
+
LABEL_SIZE,
|
|
30
|
+
ROD_LENGTH,
|
|
31
|
+
buildAxisLabels,
|
|
32
|
+
buildAxisRods,
|
|
33
|
+
} from './axesGeometry.ts';
|
|
34
|
+
|
|
35
|
+
/** How the cartesian frame is drawn. */
|
|
36
|
+
export interface AxesStyle {
|
|
37
|
+
/**
|
|
38
|
+
* Colour of the three rods, as `#rrggbb`.
|
|
39
|
+
* @default '#64748b'
|
|
40
|
+
*/
|
|
41
|
+
colour?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Colour of the three labels, as `#rrggbb`.
|
|
44
|
+
* @default '#334155'
|
|
45
|
+
*/
|
|
46
|
+
labelColour?: string;
|
|
47
|
+
/**
|
|
48
|
+
* What the axes are called, in x, y, z order.
|
|
49
|
+
* @default ['x', 'y', 'z']
|
|
50
|
+
*/
|
|
51
|
+
labels?: readonly [string, string, string];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Draw a labelled x, y, z frame through the origin, replacing any previous one.
|
|
56
|
+
* @param plugin - The molstar context.
|
|
57
|
+
* @param reach - How far the orbital reaches, in scene units — what
|
|
58
|
+
* `renderSampledVolume` returned.
|
|
59
|
+
* @param style - See {@link AxesStyle}.
|
|
60
|
+
* @returns How far the frame reaches, labels included, in scene units: what a
|
|
61
|
+
* camera has to frame for the whole of it to be on screen.
|
|
62
|
+
* @throws {Error} When the canvas is not ready.
|
|
63
|
+
*/
|
|
64
|
+
export async function renderOrbitalAxes(
|
|
65
|
+
plugin: PluginContext,
|
|
66
|
+
reach: number,
|
|
67
|
+
style: AxesStyle = {},
|
|
68
|
+
): Promise<number> {
|
|
69
|
+
const canvas3d = plugin.canvas3d;
|
|
70
|
+
if (canvas3d === undefined) {
|
|
71
|
+
throw new Error('renderOrbitalAxes: the molstar canvas is not ready.');
|
|
72
|
+
}
|
|
73
|
+
const {
|
|
74
|
+
colour = '#64748b',
|
|
75
|
+
labelColour = '#334155',
|
|
76
|
+
labels = ['x', 'y', 'z'],
|
|
77
|
+
} = style;
|
|
78
|
+
clearOrbitalAxes(plugin);
|
|
79
|
+
if (reach <= 0) return 0;
|
|
80
|
+
|
|
81
|
+
const labelSize = reach * LABEL_SIZE;
|
|
82
|
+
const labelAt = reach * ROD_LENGTH + labelSize;
|
|
83
|
+
const drawn = await Promise.all([
|
|
84
|
+
createRods(plugin, buildAxisRods(reach), colour),
|
|
85
|
+
createLabels(
|
|
86
|
+
plugin,
|
|
87
|
+
buildAxisLabels(labelAt, labels),
|
|
88
|
+
labelColour,
|
|
89
|
+
labelSize,
|
|
90
|
+
),
|
|
91
|
+
]);
|
|
92
|
+
representations.set(plugin, drawn);
|
|
93
|
+
for (const representation of drawn) canvas3d.add(representation);
|
|
94
|
+
// add() only queues; nothing appears until the queue is committed.
|
|
95
|
+
canvas3d.commit();
|
|
96
|
+
return labelAt + labelSize / 2;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Remove the frame, leaving anything else on the canvas.
|
|
101
|
+
* @param plugin - The molstar context.
|
|
102
|
+
*/
|
|
103
|
+
export function clearOrbitalAxes(plugin: PluginContext): void {
|
|
104
|
+
const previous = representations.get(plugin);
|
|
105
|
+
if (previous === undefined) return;
|
|
106
|
+
representations.delete(plugin);
|
|
107
|
+
for (const representation of previous) {
|
|
108
|
+
plugin.canvas3d?.remove(representation);
|
|
109
|
+
}
|
|
110
|
+
plugin.canvas3d?.commit();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The rods, as a representation the canvas can hold.
|
|
115
|
+
* @param plugin - The molstar context.
|
|
116
|
+
* @param mesh - The rod mesh.
|
|
117
|
+
* @param colour - Rod colour, as `#rrggbb`.
|
|
118
|
+
* @returns The representation.
|
|
119
|
+
*/
|
|
120
|
+
async function createRods(
|
|
121
|
+
plugin: PluginContext,
|
|
122
|
+
mesh: Mesh,
|
|
123
|
+
colour: string,
|
|
124
|
+
): Promise<Representation.Any> {
|
|
125
|
+
const value = Color.fromHexStyle(colour);
|
|
126
|
+
const representation = shapeRepresentation(
|
|
127
|
+
(_ctx, data: Mesh) =>
|
|
128
|
+
Shape.create(
|
|
129
|
+
'orbital axes',
|
|
130
|
+
{},
|
|
131
|
+
data,
|
|
132
|
+
() => value,
|
|
133
|
+
() => 1,
|
|
134
|
+
() => 'axis',
|
|
135
|
+
),
|
|
136
|
+
Mesh.Utils,
|
|
137
|
+
);
|
|
138
|
+
await plugin.runTask(
|
|
139
|
+
// Unlit: a shaded rod reads as a cylinder in front of the surface, while a
|
|
140
|
+
// flat one reads as the axis line a textbook draws.
|
|
141
|
+
representation.createOrUpdate({ alpha: 1, ignoreLight: true }, mesh),
|
|
142
|
+
);
|
|
143
|
+
representation.setState({ pickable: false });
|
|
144
|
+
return representation;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* The labels, as a representation the canvas can hold.
|
|
149
|
+
* @param plugin - The molstar context.
|
|
150
|
+
* @param text - The label geometry.
|
|
151
|
+
* @param colour - Label colour, as `#rrggbb`.
|
|
152
|
+
* @param size - Label height, in scene units.
|
|
153
|
+
* @returns The representation.
|
|
154
|
+
*/
|
|
155
|
+
async function createLabels(
|
|
156
|
+
plugin: PluginContext,
|
|
157
|
+
text: Text,
|
|
158
|
+
colour: string,
|
|
159
|
+
size: number,
|
|
160
|
+
): Promise<Representation.Any> {
|
|
161
|
+
const value = Color.fromHexStyle(colour);
|
|
162
|
+
const representation = shapeRepresentation(
|
|
163
|
+
(_ctx, data: Text) =>
|
|
164
|
+
Shape.create(
|
|
165
|
+
'orbital axis labels',
|
|
166
|
+
{},
|
|
167
|
+
data,
|
|
168
|
+
() => value,
|
|
169
|
+
() => 1,
|
|
170
|
+
() => 'axis label',
|
|
171
|
+
),
|
|
172
|
+
Text.Utils,
|
|
173
|
+
);
|
|
174
|
+
await plugin.runTask(
|
|
175
|
+
representation.createOrUpdate(
|
|
176
|
+
{
|
|
177
|
+
sizeFactor: size,
|
|
178
|
+
background: false,
|
|
179
|
+
attachment: 'middle-center',
|
|
180
|
+
fontWeight: 'bold',
|
|
181
|
+
},
|
|
182
|
+
text,
|
|
183
|
+
),
|
|
184
|
+
);
|
|
185
|
+
representation.setState({ pickable: false });
|
|
186
|
+
return representation;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** One frame per plugin, outside the state tree like the isosurfaces. */
|
|
190
|
+
const representations = new WeakMap<PluginContext, Representation.Any[]>();
|
package/src/orbital/ui/viewer.ts
CHANGED
|
@@ -22,7 +22,14 @@ import { Color } from 'molstar/lib/mol-util/color/color.js';
|
|
|
22
22
|
import type { OrbitalGrid } from '../core/grid.ts';
|
|
23
23
|
import type { OrbitalContour } from '../core/isovalue.ts';
|
|
24
24
|
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
DEFAULT_CAMERA_DURATION,
|
|
27
|
+
DEFAULT_SPIN_SPEED,
|
|
28
|
+
frameOrbital,
|
|
29
|
+
setSpin,
|
|
30
|
+
} from './camera.ts';
|
|
31
|
+
import type { AxesStyle } from './renderAxes.ts';
|
|
32
|
+
import { clearOrbitalAxes, renderOrbitalAxes } from './renderAxes.ts';
|
|
26
33
|
import type { VolumeStyle } from './renderVolume.ts';
|
|
27
34
|
import { clearSampledVolume, renderSampledVolume } from './renderVolume.ts';
|
|
28
35
|
|
|
@@ -105,6 +112,29 @@ export class OrbitalViewer {
|
|
|
105
112
|
);
|
|
106
113
|
}
|
|
107
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Draw the labelled x, y, z frame through the origin, replacing any previous
|
|
117
|
+
* one.
|
|
118
|
+
* @param reach - How far the orbital reaches, in scene units, as
|
|
119
|
+
* `showOrbital` returned it.
|
|
120
|
+
* @param style - See {@link AxesStyle}.
|
|
121
|
+
* @returns How far the frame reaches, labels included, for the camera to
|
|
122
|
+
* frame; `undefined` once the viewer has been disposed.
|
|
123
|
+
*/
|
|
124
|
+
showAxes(reach: number, style?: AxesStyle): Promise<number | undefined> {
|
|
125
|
+
return this.#run((plugin) => renderOrbitalAxes(plugin, reach, style));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Remove the frame.
|
|
130
|
+
* @returns Nothing, once the axes are gone.
|
|
131
|
+
*/
|
|
132
|
+
hideAxes(): Promise<void> {
|
|
133
|
+
return this.#run((plugin) => {
|
|
134
|
+
clearOrbitalAxes(plugin);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
108
138
|
/**
|
|
109
139
|
* Remove the isosurface pair.
|
|
110
140
|
* @returns Nothing, once the surfaces are gone.
|
|
@@ -138,7 +168,7 @@ export class OrbitalViewer {
|
|
|
138
168
|
* @param speed - molstar's own spin unit.
|
|
139
169
|
* @returns Nothing, once the spin has been switched.
|
|
140
170
|
*/
|
|
141
|
-
setSpin(spinning: boolean, speed =
|
|
171
|
+
setSpin(spinning: boolean, speed = DEFAULT_SPIN_SPEED): Promise<void> {
|
|
142
172
|
return this.#run((plugin) => {
|
|
143
173
|
setSpin(plugin, spinning, speed);
|
|
144
174
|
});
|