react-cheminfo 0.135.0 → 0.137.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 +1 -1
- package/lib/crystal/core/cellAtoms.d.ts +43 -0
- package/lib/crystal/core/cellAtoms.d.ts.map +1 -0
- package/lib/crystal/core/cellAtoms.js +70 -0
- package/lib/crystal/core/cellAtoms.js.map +1 -0
- package/lib/crystal/core/index.d.ts +2 -0
- package/lib/crystal/core/index.d.ts.map +1 -1
- package/lib/crystal/core/index.js +1 -0
- package/lib/crystal/core/index.js.map +1 -1
- package/lib/crystal/core/molecules.d.ts.map +1 -1
- package/lib/crystal/core/molecules.js +6 -40
- package/lib/crystal/core/molecules.js.map +1 -1
- package/lib/crystal3d/core/cellClip.d.ts +46 -0
- package/lib/crystal3d/core/cellClip.d.ts.map +1 -0
- package/lib/crystal3d/core/cellClip.js +198 -0
- package/lib/crystal3d/core/cellClip.js.map +1 -0
- package/lib/crystal3d/core/cellGeometry.d.ts +63 -0
- package/lib/crystal3d/core/cellGeometry.d.ts.map +1 -0
- package/lib/crystal3d/core/cellGeometry.js +153 -0
- package/lib/crystal3d/core/cellGeometry.js.map +1 -0
- package/lib/crystal3d/core/cellStack.d.ts +51 -0
- package/lib/crystal3d/core/cellStack.d.ts.map +1 -0
- package/lib/crystal3d/core/cellStack.js +79 -0
- package/lib/crystal3d/core/cellStack.js.map +1 -0
- package/lib/crystal3d/core/crystalView.d.ts +81 -0
- package/lib/crystal3d/core/crystalView.d.ts.map +1 -0
- package/lib/crystal3d/core/crystalView.js +55 -0
- package/lib/crystal3d/core/crystalView.js.map +1 -0
- package/lib/crystal3d/core/drawingSet.d.ts +31 -0
- package/lib/crystal3d/core/drawingSet.d.ts.map +1 -0
- package/lib/crystal3d/core/drawingSet.js +63 -0
- package/lib/crystal3d/core/drawingSet.js.map +1 -0
- package/lib/crystal3d/core/elementDrawing.d.ts +50 -0
- package/lib/crystal3d/core/elementDrawing.d.ts.map +1 -0
- package/lib/crystal3d/core/elementDrawing.js +100 -0
- package/lib/crystal3d/core/elementDrawing.js.map +1 -0
- package/lib/crystal3d/core/elementExtent.d.ts +42 -0
- package/lib/crystal3d/core/elementExtent.d.ts.map +1 -0
- package/lib/crystal3d/core/elementExtent.js +56 -0
- package/lib/crystal3d/core/elementExtent.js.map +1 -0
- package/lib/crystal3d/core/elementLabels.d.ts +31 -0
- package/lib/crystal3d/core/elementLabels.d.ts.map +1 -0
- package/lib/crystal3d/core/elementLabels.js +99 -0
- package/lib/crystal3d/core/elementLabels.js.map +1 -0
- package/lib/crystal3d/core/elementShapes.d.ts +43 -0
- package/lib/crystal3d/core/elementShapes.d.ts.map +1 -0
- package/lib/crystal3d/core/elementShapes.js +115 -0
- package/lib/crystal3d/core/elementShapes.js.map +1 -0
- package/lib/crystal3d/core/frame.d.ts +36 -0
- package/lib/crystal3d/core/frame.d.ts.map +1 -0
- package/lib/crystal3d/core/frame.js +35 -0
- package/lib/crystal3d/core/frame.js.map +1 -0
- package/lib/crystal3d/core/framing.d.ts +41 -0
- package/lib/crystal3d/core/framing.d.ts.map +1 -0
- package/lib/crystal3d/core/framing.js +79 -0
- package/lib/crystal3d/core/framing.js.map +1 -0
- package/lib/crystal3d/core/index.d.ts +42 -0
- package/lib/crystal3d/core/index.d.ts.map +1 -0
- package/lib/crystal3d/core/index.js +29 -0
- package/lib/crystal3d/core/index.js.map +1 -0
- package/lib/crystal3d/core/labelText.d.ts +19 -0
- package/lib/crystal3d/core/labelText.d.ts.map +1 -0
- package/lib/crystal3d/core/labelText.js +42 -0
- package/lib/crystal3d/core/labelText.js.map +1 -0
- package/lib/crystal3d/core/latticeBasis.d.ts +49 -0
- package/lib/crystal3d/core/latticeBasis.d.ts.map +1 -0
- package/lib/crystal3d/core/latticeBasis.js +89 -0
- package/lib/crystal3d/core/latticeBasis.js.map +1 -0
- package/lib/crystal3d/core/mat3.d.ts +68 -0
- package/lib/crystal3d/core/mat3.d.ts.map +1 -0
- package/lib/crystal3d/core/mat3.js +146 -0
- package/lib/crystal3d/core/mat3.js.map +1 -0
- package/lib/crystal3d/core/operationMatrix.d.ts +44 -0
- package/lib/crystal3d/core/operationMatrix.d.ts.map +1 -0
- package/lib/crystal3d/core/operationMatrix.js +172 -0
- package/lib/crystal3d/core/operationMatrix.js.map +1 -0
- package/lib/crystal3d/core/orientation.d.ts +62 -0
- package/lib/crystal3d/core/orientation.d.ts.map +1 -0
- package/lib/crystal3d/core/orientation.js +166 -0
- package/lib/crystal3d/core/orientation.js.map +1 -0
- package/lib/crystal3d/core/palette.d.ts +24 -0
- package/lib/crystal3d/core/palette.d.ts.map +1 -0
- package/lib/crystal3d/core/palette.js +34 -0
- package/lib/crystal3d/core/palette.js.map +1 -0
- package/lib/crystal3d/core/primitives.d.ts +133 -0
- package/lib/crystal3d/core/primitives.d.ts.map +1 -0
- package/lib/crystal3d/core/primitives.js +80 -0
- package/lib/crystal3d/core/primitives.js.map +1 -0
- package/lib/crystal3d/core/structureText.d.ts +20 -0
- package/lib/crystal3d/core/structureText.d.ts.map +1 -0
- package/lib/crystal3d/core/structureText.js +37 -0
- package/lib/crystal3d/core/structureText.js.map +1 -0
- package/lib/crystal3d/core/supercell.d.ts +20 -0
- package/lib/crystal3d/core/supercell.d.ts.map +1 -0
- package/lib/crystal3d/core/supercell.js +35 -0
- package/lib/crystal3d/core/supercell.js.map +1 -0
- package/lib/crystal3d/core/types.d.ts +166 -0
- package/lib/crystal3d/core/types.d.ts.map +1 -0
- package/lib/crystal3d/core/types.js +10 -0
- package/lib/crystal3d/core/types.js.map +1 -0
- package/lib/crystal3d/core/vec3.d.ts +75 -0
- package/lib/crystal3d/core/vec3.d.ts.map +1 -0
- package/lib/crystal3d/core/vec3.js +119 -0
- package/lib/crystal3d/core/vec3.js.map +1 -0
- package/lib/crystal3d/ui/CrystalCanvas3D.d.ts +52 -0
- package/lib/crystal3d/ui/CrystalCanvas3D.d.ts.map +1 -0
- package/lib/crystal3d/ui/CrystalCanvas3D.js +250 -0
- package/lib/crystal3d/ui/CrystalCanvas3D.js.map +1 -0
- package/lib/crystal3d/ui/CrystalStructureView.d.ts +17 -0
- package/lib/crystal3d/ui/CrystalStructureView.d.ts.map +1 -0
- package/lib/crystal3d/ui/CrystalStructureView.js +79 -0
- package/lib/crystal3d/ui/CrystalStructureView.js.map +1 -0
- package/lib/crystal3d/ui/CrystalStructureViewer.d.ts +22 -0
- package/lib/crystal3d/ui/CrystalStructureViewer.d.ts.map +1 -0
- package/lib/crystal3d/ui/CrystalStructureViewer.js +29 -0
- package/lib/crystal3d/ui/CrystalStructureViewer.js.map +1 -0
- package/lib/crystal3d/ui/CrystalViewControls.d.ts +29 -0
- package/lib/crystal3d/ui/CrystalViewControls.d.ts.map +1 -0
- package/lib/crystal3d/ui/CrystalViewControls.js +24 -0
- package/lib/crystal3d/ui/CrystalViewControls.js.map +1 -0
- package/lib/crystal3d/ui/CrystalViewer3D.d.ts +72 -0
- package/lib/crystal3d/ui/CrystalViewer3D.d.ts.map +1 -0
- package/lib/crystal3d/ui/CrystalViewer3D.js +70 -0
- package/lib/crystal3d/ui/CrystalViewer3D.js.map +1 -0
- package/lib/crystal3d/ui/crystalScene.d.ts +97 -0
- package/lib/crystal3d/ui/crystalScene.d.ts.map +1 -0
- package/lib/crystal3d/ui/crystalScene.js +10 -0
- package/lib/crystal3d/ui/crystalScene.js.map +1 -0
- package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts +52 -0
- package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts.map +1 -0
- package/lib/crystal3d/ui/crystalStructureViewerProps.js +2 -0
- package/lib/crystal3d/ui/crystalStructureViewerProps.js.map +1 -0
- package/lib/crystal3d/ui/index.d.ts +16 -0
- package/lib/crystal3d/ui/index.d.ts.map +1 -0
- package/lib/crystal3d/ui/index.js +12 -0
- package/lib/crystal3d/ui/index.js.map +1 -0
- package/lib/crystal3d/ui/useCrystalCaption.d.ts +14 -0
- package/lib/crystal3d/ui/useCrystalCaption.d.ts.map +1 -0
- package/lib/crystal3d/ui/useCrystalCaption.js +32 -0
- package/lib/crystal3d/ui/useCrystalCaption.js.map +1 -0
- package/lib/crystal3d/viewer/animate.d.ts +49 -0
- package/lib/crystal3d/viewer/animate.d.ts.map +1 -0
- package/lib/crystal3d/viewer/animate.js +83 -0
- package/lib/crystal3d/viewer/animate.js.map +1 -0
- package/lib/crystal3d/viewer/camera.d.ts +44 -0
- package/lib/crystal3d/viewer/camera.d.ts.map +1 -0
- package/lib/crystal3d/viewer/camera.js +103 -0
- package/lib/crystal3d/viewer/camera.js.map +1 -0
- package/lib/crystal3d/viewer/index.d.ts +13 -0
- package/lib/crystal3d/viewer/index.d.ts.map +1 -0
- package/lib/crystal3d/viewer/index.js +8 -0
- package/lib/crystal3d/viewer/index.js.map +1 -0
- package/lib/crystal3d/viewer/layerRegistry.d.ts +24 -0
- package/lib/crystal3d/viewer/layerRegistry.d.ts.map +1 -0
- package/lib/crystal3d/viewer/layerRegistry.js +39 -0
- package/lib/crystal3d/viewer/layerRegistry.js.map +1 -0
- package/lib/crystal3d/viewer/meshPrimitives.d.ts +13 -0
- package/lib/crystal3d/viewer/meshPrimitives.d.ts.map +1 -0
- package/lib/crystal3d/viewer/meshPrimitives.js +76 -0
- package/lib/crystal3d/viewer/meshPrimitives.js.map +1 -0
- package/lib/crystal3d/viewer/plugin.d.ts +133 -0
- package/lib/crystal3d/viewer/plugin.d.ts.map +1 -0
- package/lib/crystal3d/viewer/plugin.js +181 -0
- package/lib/crystal3d/viewer/plugin.js.map +1 -0
- package/lib/crystal3d/viewer/renderCell.d.ts +43 -0
- package/lib/crystal3d/viewer/renderCell.d.ts.map +1 -0
- package/lib/crystal3d/viewer/renderCell.js +53 -0
- package/lib/crystal3d/viewer/renderCell.js.map +1 -0
- package/lib/crystal3d/viewer/renderElements.d.ts +54 -0
- package/lib/crystal3d/viewer/renderElements.d.ts.map +1 -0
- package/lib/crystal3d/viewer/renderElements.js +77 -0
- package/lib/crystal3d/viewer/renderElements.js.map +1 -0
- package/lib/crystal3d/viewer/renderStructure.d.ts +80 -0
- package/lib/crystal3d/viewer/renderStructure.d.ts.map +1 -0
- package/lib/crystal3d/viewer/renderStructure.js +143 -0
- package/lib/crystal3d/viewer/renderStructure.js.map +1 -0
- package/lib/crystal3d/viewer/sceneParts.d.ts +32 -0
- package/lib/crystal3d/viewer/sceneParts.d.ts.map +1 -0
- package/lib/crystal3d/viewer/sceneParts.js +77 -0
- package/lib/crystal3d/viewer/sceneParts.js.map +1 -0
- package/lib/crystal3d/viewer/shapeLayer.d.ts +41 -0
- package/lib/crystal3d/viewer/shapeLayer.d.ts.map +1 -0
- package/lib/crystal3d/viewer/shapeLayer.js +57 -0
- package/lib/crystal3d/viewer/shapeLayer.js.map +1 -0
- package/lib/crystal3d/viewer/textLayer.d.ts +21 -0
- package/lib/crystal3d/viewer/textLayer.d.ts.map +1 -0
- package/lib/crystal3d/viewer/textLayer.js +59 -0
- package/lib/crystal3d/viewer/textLayer.js.map +1 -0
- package/lib/crystal3d/viewer/viewer.d.ts +119 -0
- package/lib/crystal3d/viewer/viewer.d.ts.map +1 -0
- package/lib/crystal3d/viewer/viewer.js +172 -0
- package/lib/crystal3d/viewer/viewer.js.map +1 -0
- package/lib/crystal3d.d.ts +12 -0
- package/lib/crystal3d.d.ts.map +1 -0
- package/lib/crystal3d.js +12 -0
- package/lib/crystal3d.js.map +1 -0
- package/lib/download/core/croppedMarkup.d.ts.map +1 -1
- package/lib/download/core/croppedMarkup.js +16 -40
- package/lib/download/core/croppedMarkup.js.map +1 -1
- package/lib/download/core/dataUrl.d.ts +27 -0
- package/lib/download/core/dataUrl.d.ts.map +1 -0
- package/lib/download/core/dataUrl.js +54 -0
- package/lib/download/core/dataUrl.js.map +1 -0
- package/lib/download/core/index.d.ts +3 -0
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +2 -0
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/core/svgMarkup.d.ts +39 -0
- package/lib/download/core/svgMarkup.d.ts.map +1 -0
- package/lib/download/core/svgMarkup.js +100 -0
- package/lib/download/core/svgMarkup.js.map +1 -0
- package/lib/drawing/ui/movingFigure.d.ts.map +1 -1
- package/lib/drawing/ui/movingFigure.js +4 -30
- package/lib/drawing/ui/movingFigure.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/locales/de.json +26 -1
- package/lib/locales/en.json +26 -1
- package/lib/locales/es.json +26 -1
- package/lib/locales/fr.json +26 -1
- package/lib/locales/it.json +26 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js +16 -27
- package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
- package/lib/molstar/bonds/bondRule.d.ts +16 -0
- package/lib/molstar/bonds/bondRule.d.ts.map +1 -0
- package/lib/molstar/bonds/bondRule.js +23 -0
- package/lib/molstar/bonds/bondRule.js.map +1 -0
- package/lib/molstar/bonds/index.d.ts +9 -0
- package/lib/molstar/bonds/index.d.ts.map +1 -0
- package/lib/molstar/bonds/index.js +9 -0
- package/lib/molstar/bonds/index.js.map +1 -0
- package/lib/molstar/ui/MolstarToolbar.d.ts +47 -0
- package/lib/molstar/ui/MolstarToolbar.d.ts.map +1 -0
- package/lib/molstar/ui/MolstarToolbar.js +28 -0
- package/lib/molstar/ui/MolstarToolbar.js.map +1 -0
- package/lib/molstar/ui/index.d.ts +10 -0
- package/lib/molstar/ui/index.d.ts.map +1 -0
- package/lib/molstar/ui/index.js +8 -0
- package/lib/molstar/ui/index.js.map +1 -0
- package/lib/molstar/ui/useMolstarTools.d.ts +63 -0
- package/lib/molstar/ui/useMolstarTools.d.ts.map +1 -0
- package/lib/molstar/ui/useMolstarTools.js +36 -0
- package/lib/molstar/ui/useMolstarTools.js.map +1 -0
- package/package.json +2 -1
- package/src/crystal/core/cellAtoms.ts +106 -0
- package/src/crystal/core/index.ts +2 -0
- package/src/crystal/core/molecules.ts +7 -44
- package/src/crystal3d/core/cellClip.ts +229 -0
- package/src/crystal3d/core/cellGeometry.ts +193 -0
- package/src/crystal3d/core/cellStack.ts +87 -0
- package/src/crystal3d/core/crystalView.ts +131 -0
- package/src/crystal3d/core/drawingSet.ts +71 -0
- package/src/crystal3d/core/elementDrawing.ts +147 -0
- package/src/crystal3d/core/elementExtent.ts +81 -0
- package/src/crystal3d/core/elementLabels.ts +130 -0
- package/src/crystal3d/core/elementShapes.ts +141 -0
- package/src/crystal3d/core/frame.ts +56 -0
- package/src/crystal3d/core/framing.ts +101 -0
- package/src/crystal3d/core/index.ts +134 -0
- package/src/crystal3d/core/labelText.ts +44 -0
- package/src/crystal3d/core/latticeBasis.ts +110 -0
- package/src/crystal3d/core/mat3.ts +163 -0
- package/src/crystal3d/core/operationMatrix.ts +255 -0
- package/src/crystal3d/core/orientation.ts +229 -0
- package/src/crystal3d/core/palette.ts +43 -0
- package/src/crystal3d/core/primitives.ts +183 -0
- package/src/crystal3d/core/structureText.ts +43 -0
- package/src/crystal3d/core/supercell.ts +40 -0
- package/src/crystal3d/core/types.ts +186 -0
- package/src/crystal3d/core/vec3.ts +127 -0
- package/src/crystal3d/ui/CrystalCanvas3D.tsx +393 -0
- package/src/crystal3d/ui/CrystalStructureView.tsx +153 -0
- package/src/crystal3d/ui/CrystalStructureViewer.tsx +39 -0
- package/src/crystal3d/ui/CrystalViewControls.tsx +129 -0
- package/src/crystal3d/ui/CrystalViewer3D.tsx +183 -0
- package/src/crystal3d/ui/crystalScene.ts +106 -0
- package/src/crystal3d/ui/crystalStructureViewerProps.ts +54 -0
- package/src/crystal3d/ui/index.ts +20 -0
- package/src/crystal3d/ui/useCrystalCaption.ts +38 -0
- package/src/crystal3d/viewer/animate.ts +113 -0
- package/src/crystal3d/viewer/camera.ts +139 -0
- package/src/crystal3d/viewer/index.ts +13 -0
- package/src/crystal3d/viewer/layerRegistry.ts +47 -0
- package/src/crystal3d/viewer/meshPrimitives.ts +102 -0
- package/src/crystal3d/viewer/plugin.ts +258 -0
- package/src/crystal3d/viewer/renderCell.ts +98 -0
- package/src/crystal3d/viewer/renderElements.ts +121 -0
- package/src/crystal3d/viewer/renderStructure.ts +209 -0
- package/src/crystal3d/viewer/sceneParts.ts +119 -0
- package/src/crystal3d/viewer/shapeLayer.ts +108 -0
- package/src/crystal3d/viewer/textLayer.ts +85 -0
- package/src/crystal3d/viewer/viewer.ts +223 -0
- package/src/crystal3d.ts +12 -0
- package/src/download/core/croppedMarkup.ts +16 -42
- package/src/download/core/dataUrl.ts +59 -0
- package/src/download/core/index.ts +3 -0
- package/src/download/core/svgMarkup.ts +113 -0
- package/src/drawing/ui/movingFigure.ts +4 -28
- package/src/locales/de.json +26 -1
- package/src/locales/en.json +26 -1
- package/src/locales/es.json +26 -1
- package/src/locales/fr.json +26 -1
- package/src/locales/it.json +26 -1
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +45 -71
- package/src/molstar/bonds/bondRule.ts +34 -0
- package/src/molstar/bonds/index.ts +9 -0
- package/src/molstar/ui/MolstarToolbar.tsx +103 -0
- package/src/molstar/ui/index.ts +14 -0
- package/src/molstar/ui/useMolstarTools.ts +98 -0
- package/styles/chrome.css +90 -0
package/src/locales/fr.json
CHANGED
|
@@ -1085,5 +1085,30 @@
|
|
|
1085
1085
|
"send.label": "Envoyer vers",
|
|
1086
1086
|
"send.heading": "Envoyer {what} vers",
|
|
1087
1087
|
"send.none": "Rien sur cette page ne peut encore être envoyé à un autre outil.",
|
|
1088
|
-
"send.blocked": "Le navigateur a bloqué le nouvel onglet : autorisez les fenêtres pour ce site, puis envoyez à nouveau."
|
|
1088
|
+
"send.blocked": "Le navigateur a bloqué le nouvel onglet : autorisez les fenêtres pour ce site, puis envoyez à nouveau.",
|
|
1089
|
+
"crystal3d.draw": "Dessiner",
|
|
1090
|
+
"crystal3d.cells": "Mailles",
|
|
1091
|
+
"crystal3d.packing.molecules": "Molécules entières",
|
|
1092
|
+
"crystal3d.packing.moleculesHelp": "Chaque molécule entière, dans la maille où tombe son centre.",
|
|
1093
|
+
"crystal3d.packing.cell": "Atomes de la maille",
|
|
1094
|
+
"crystal3d.packing.cellHelp": "Chaque atome à l'intérieur de la maille, coupé là où ses faces le coupent.",
|
|
1095
|
+
"crystal3d.unitCell": "Maille",
|
|
1096
|
+
"crystal3d.unitCellHelp": "Le contour de la maille élémentaire.",
|
|
1097
|
+
"crystal3d.bonds": "Liaisons",
|
|
1098
|
+
"crystal3d.bonds.all": "Toutes",
|
|
1099
|
+
"crystal3d.bonds.allHelp": "Chaque liaison entre atomes assez proches pour être liés.",
|
|
1100
|
+
"crystal3d.bonds.noMetal": "Sans liaisons au métal",
|
|
1101
|
+
"crystal3d.bonds.noMetalHelp": "Les liaisons en pointillé vers les atomes métalliques sont masquées.",
|
|
1102
|
+
"crystal3d.bonds.none": "Aucune",
|
|
1103
|
+
"crystal3d.bonds.noneHelp": "Les atomes seuls, sans aucune liaison.",
|
|
1104
|
+
"crystal3d.caption.molecules.one": "1 molécule par maille",
|
|
1105
|
+
"crystal3d.caption.molecules.other": "{count} molécules par maille",
|
|
1106
|
+
"crystal3d.caption.atoms.one": "1 atome par maille",
|
|
1107
|
+
"crystal3d.caption.atoms.other": "{count} atomes par maille",
|
|
1108
|
+
"crystal3d.caption.cells.one": "1×1×1 maille",
|
|
1109
|
+
"crystal3d.caption.cells.other": "{count}×{count}×{count} mailles",
|
|
1110
|
+
"crystal3d.caption.cellsCapped": "{count}×{count}×{count} mailles, car {asked}×{asked}×{asked} contiendraient trop d'atomes",
|
|
1111
|
+
"crystal3d.unreadable": "Ce fichier n'a pas pu être lu",
|
|
1112
|
+
"crystal3d.tooLarge": "Cette maille contient {count} atomes, plus que la visionneuse n'en dessine.",
|
|
1113
|
+
"crystal3d.unsupported": "Pas de 3D sur cette machine"
|
|
1089
1114
|
}
|
package/src/locales/it.json
CHANGED
|
@@ -1085,5 +1085,30 @@
|
|
|
1085
1085
|
"send.label": "Invia a",
|
|
1086
1086
|
"send.heading": "Invia {what} a",
|
|
1087
1087
|
"send.none": "Nulla di questa pagina può ancora essere inviato a un altro strumento.",
|
|
1088
|
-
"send.blocked": "Il browser ha bloccato la nuova scheda: consenti i pop-up per questo sito, poi invia di nuovo."
|
|
1088
|
+
"send.blocked": "Il browser ha bloccato la nuova scheda: consenti i pop-up per questo sito, poi invia di nuovo.",
|
|
1089
|
+
"crystal3d.draw": "Disegna",
|
|
1090
|
+
"crystal3d.cells": "Celle",
|
|
1091
|
+
"crystal3d.packing.molecules": "Molecole intere",
|
|
1092
|
+
"crystal3d.packing.moleculesHelp": "Ogni molecola intera, nella cella in cui cade il suo centro.",
|
|
1093
|
+
"crystal3d.packing.cell": "Atomi della cella",
|
|
1094
|
+
"crystal3d.packing.cellHelp": "Ogni atomo dentro la cella, tagliato dove lo tagliano le sue pareti.",
|
|
1095
|
+
"crystal3d.unitCell": "Cella elementare",
|
|
1096
|
+
"crystal3d.unitCellHelp": "Il contorno della cella elementare.",
|
|
1097
|
+
"crystal3d.bonds": "Legami",
|
|
1098
|
+
"crystal3d.bonds.all": "Tutti",
|
|
1099
|
+
"crystal3d.bonds.allHelp": "Ogni legame tra atomi abbastanza vicini da unirsi.",
|
|
1100
|
+
"crystal3d.bonds.noMetal": "Senza legami metallici",
|
|
1101
|
+
"crystal3d.bonds.noMetalHelp": "I legami tratteggiati verso gli atomi metallici sono nascosti.",
|
|
1102
|
+
"crystal3d.bonds.none": "Nessuno",
|
|
1103
|
+
"crystal3d.bonds.noneHelp": "Solo gli atomi, senza alcun legame.",
|
|
1104
|
+
"crystal3d.caption.molecules.one": "1 molecola per cella",
|
|
1105
|
+
"crystal3d.caption.molecules.other": "{count} molecole per cella",
|
|
1106
|
+
"crystal3d.caption.atoms.one": "1 atomo per cella",
|
|
1107
|
+
"crystal3d.caption.atoms.other": "{count} atomi per cella",
|
|
1108
|
+
"crystal3d.caption.cells.one": "1×1×1 cella",
|
|
1109
|
+
"crystal3d.caption.cells.other": "{count}×{count}×{count} celle",
|
|
1110
|
+
"crystal3d.caption.cellsCapped": "{count}×{count}×{count} celle, perché {asked}×{asked}×{asked} conterrebbero troppi atomi",
|
|
1111
|
+
"crystal3d.unreadable": "Non è stato possibile leggere quel file",
|
|
1112
|
+
"crystal3d.tooLarge": "Questa cella contiene {count} atomi, più di quanti il visualizzatore ne disegni.",
|
|
1113
|
+
"crystal3d.unsupported": "Niente 3D su questo computer"
|
|
1089
1114
|
}
|
|
@@ -11,18 +11,17 @@ import { useEffect, useState } from 'react';
|
|
|
11
11
|
|
|
12
12
|
import { useChromeT } from '../../i18n/ui/useT.ts';
|
|
13
13
|
import { DEFAULT_SPIN_SPEED } from '../../molstar/core/index.ts';
|
|
14
|
+
import { MolstarToolbar } from '../../molstar/ui/MolstarToolbar.tsx';
|
|
15
|
+
import { useMolstarTools } from '../../molstar/ui/useMolstarTools.ts';
|
|
14
16
|
import { DEFAULT_FRAMES_PER_SECOND } from '../core/animatedPng.ts';
|
|
15
17
|
import type { Molecule3DHighlight } from '../core/highlight.ts';
|
|
16
|
-
import type { MeasurementKind } from '../core/measurement.ts';
|
|
17
18
|
import {
|
|
18
19
|
normalizeMolecule3DSettings,
|
|
19
20
|
resolveMolecule3DTools,
|
|
20
21
|
} from '../core/settings.ts';
|
|
21
22
|
|
|
22
|
-
import { Molecule3DExport } from './Molecule3DExport.tsx';
|
|
23
23
|
import { Molecule3DOptions } from './Molecule3DOptions.tsx';
|
|
24
24
|
import { Molecule3DStage } from './Molecule3DStage.tsx';
|
|
25
|
-
import { Molecule3DToolbar } from './Molecule3DToolbar.tsx';
|
|
26
25
|
import { highlightColorOf } from './highlightColor.ts';
|
|
27
26
|
import { moleculeFileAtoms } from './moleculeFileFormats.ts';
|
|
28
27
|
import type { MoleculeViewer3DProps } from './moleculeViewer3DProps.ts';
|
|
@@ -85,18 +84,12 @@ export function MoleculeCanvas3D(props: MoleculeCanvas3DProps): ReactElement {
|
|
|
85
84
|
initialSettings,
|
|
86
85
|
onSettingsChange,
|
|
87
86
|
);
|
|
88
|
-
const [spinning, setSpinning] = useControlledState(
|
|
89
|
-
spinningProp,
|
|
90
|
-
defaultSpinning,
|
|
91
|
-
onSpinningChange,
|
|
92
|
-
);
|
|
93
87
|
const {
|
|
94
88
|
measurements,
|
|
95
89
|
add: addMeasurement,
|
|
96
90
|
remove: removeMeasurement,
|
|
97
91
|
clear: clearMeasurements,
|
|
98
92
|
} = useMeasurementList(measurementsProp, onMeasurementsChange);
|
|
99
|
-
const [measureKind, setMeasureKind] = useState<MeasurementKind | null>(null);
|
|
100
93
|
const [frameCount, setFrameCount] = useState(0);
|
|
101
94
|
const polarSurfaceArea = usePolarSurfaceArea(
|
|
102
95
|
molfile,
|
|
@@ -117,18 +110,18 @@ export function MoleculeCanvas3D(props: MoleculeCanvas3DProps): ReactElement {
|
|
|
117
110
|
tools.measure && molfile !== null ? removeMeasurement : undefined,
|
|
118
111
|
);
|
|
119
112
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
const controls = useMolstarTools(viewerRef, container, {
|
|
114
|
+
spinning: spinningProp,
|
|
115
|
+
defaultSpinning,
|
|
116
|
+
onSpinningChange,
|
|
117
|
+
spinSpeed,
|
|
118
|
+
});
|
|
119
|
+
const { spinning } = controls;
|
|
123
120
|
|
|
124
121
|
useEffect(() => {
|
|
125
122
|
void viewerRef.current?.frames.play(playing, framesPerSecond);
|
|
126
123
|
}, [container, viewerRef, playing, framesPerSecond]);
|
|
127
124
|
|
|
128
|
-
useEffect(() => {
|
|
129
|
-
void viewerRef.current?.setMeasureKind(measureKind);
|
|
130
|
-
}, [container, viewerRef, measureKind]);
|
|
131
|
-
|
|
132
125
|
// Kept out of the scene: a new highlight repaints the model, never redraws it.
|
|
133
126
|
useEffect(() => {
|
|
134
127
|
void viewerRef.current?.setHighlights(
|
|
@@ -150,8 +143,13 @@ export function MoleculeCanvas3D(props: MoleculeCanvas3DProps): ReactElement {
|
|
|
150
143
|
camera: props,
|
|
151
144
|
});
|
|
152
145
|
|
|
153
|
-
const
|
|
154
|
-
|
|
146
|
+
const imageExport = useImageExport(
|
|
147
|
+
container,
|
|
148
|
+
viewerRef,
|
|
149
|
+
fileName,
|
|
150
|
+
framesPerSecond,
|
|
151
|
+
);
|
|
152
|
+
const { capture } = imageExport;
|
|
155
153
|
|
|
156
154
|
useEffect(() => {
|
|
157
155
|
if (onCapture === undefined || container === null) return;
|
|
@@ -171,47 +169,35 @@ export function MoleculeCanvas3D(props: MoleculeCanvas3DProps): ReactElement {
|
|
|
171
169
|
data-testid="molecule3d"
|
|
172
170
|
/>
|
|
173
171
|
{molfile !== null && (
|
|
174
|
-
<
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
<Molecule3DExport
|
|
204
|
-
getSize={canvasSize}
|
|
205
|
-
onExport={exportImage}
|
|
206
|
-
onCopy={copyImage}
|
|
207
|
-
writeFile={imageFile}
|
|
208
|
-
frameCount={frameCount}
|
|
209
|
-
molfile={molfile}
|
|
210
|
-
fileName={fileName}
|
|
211
|
-
/>
|
|
212
|
-
}
|
|
213
|
-
/>
|
|
214
|
-
</div>
|
|
172
|
+
<MolstarToolbar
|
|
173
|
+
controls={controls}
|
|
174
|
+
tools={tools}
|
|
175
|
+
fullscreen={fullscreen}
|
|
176
|
+
measurementCount={measurements.length}
|
|
177
|
+
onClearMeasurements={clearMeasurements}
|
|
178
|
+
showSurface={settings.showSurface}
|
|
179
|
+
onShowSurfaceChange={(showSurface) => {
|
|
180
|
+
setSettings({ ...settings, showSurface });
|
|
181
|
+
}}
|
|
182
|
+
onResetView={resetView}
|
|
183
|
+
options={
|
|
184
|
+
<Molecule3DOptions
|
|
185
|
+
settings={settings}
|
|
186
|
+
onChange={setSettings}
|
|
187
|
+
polarSurfaceArea={polarSurfaceArea}
|
|
188
|
+
defaults={initialSettings}
|
|
189
|
+
/>
|
|
190
|
+
}
|
|
191
|
+
exportLabel={
|
|
192
|
+
moleculeFileAtoms(molfile, frameCount) > 0
|
|
193
|
+
? t('molecule3d.exportImageOrMolfile')
|
|
194
|
+
: undefined
|
|
195
|
+
}
|
|
196
|
+
imageExport={imageExport}
|
|
197
|
+
frameCount={frameCount}
|
|
198
|
+
molfile={molfile}
|
|
199
|
+
fileName={fileName}
|
|
200
|
+
/>
|
|
215
201
|
)}
|
|
216
202
|
</>
|
|
217
203
|
)}
|
|
@@ -231,15 +217,3 @@ const STAGE_STYLE: CSSProperties = {
|
|
|
231
217
|
|
|
232
218
|
/** molstar inserts its canvas here, which therefore has a size of its own. */
|
|
233
219
|
const CANVAS_STYLE: CSSProperties = { position: 'absolute', inset: 0 };
|
|
234
|
-
|
|
235
|
-
const OVERLAY_STYLE: CSSProperties = {
|
|
236
|
-
position: 'absolute',
|
|
237
|
-
top: 8,
|
|
238
|
-
bottom: 8,
|
|
239
|
-
left: 8,
|
|
240
|
-
zIndex: 2,
|
|
241
|
-
display: 'flex',
|
|
242
|
-
alignItems: 'flex-start',
|
|
243
|
-
gap: 8,
|
|
244
|
-
pointerEvents: 'none',
|
|
245
|
-
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The longest bond molstar draws between two elements.
|
|
3
|
+
*
|
|
4
|
+
* Molecules are completed across the cell walls by this rule, so what the
|
|
5
|
+
* viewer draws as one molecule is exactly what the packing kept together. It
|
|
6
|
+
* is one molstar module with no imports of its own, so a page reading it pays
|
|
7
|
+
* for a table of thresholds, not for the 2.8 MB viewer.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { ElementSymbol } from 'molstar/lib/mol-model/structure/model/types.js';
|
|
11
|
+
import {
|
|
12
|
+
getElementIdx,
|
|
13
|
+
getElementThreshold,
|
|
14
|
+
getPairingThreshold,
|
|
15
|
+
isHydrogen,
|
|
16
|
+
} from 'molstar/lib/mol-model/structure/structure/unit/bonds/common.js';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The longest distance at which molstar bonds two atoms.
|
|
20
|
+
* @param a - One element symbol, e.g. `C`.
|
|
21
|
+
* @param b - The other.
|
|
22
|
+
* @returns The distance in ångström, or 0 for a pair it never bonds (H–H).
|
|
23
|
+
*/
|
|
24
|
+
export function bondLimit(a: string, b: string): number {
|
|
25
|
+
const first = getElementIdx(a as ElementSymbol);
|
|
26
|
+
const second = getElementIdx(b as ElementSymbol);
|
|
27
|
+
if (isHydrogen(first) && isHydrogen(second)) return 0;
|
|
28
|
+
return getPairingThreshold(
|
|
29
|
+
first,
|
|
30
|
+
second,
|
|
31
|
+
getElementThreshold(first),
|
|
32
|
+
getElementThreshold(second),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The longest bond molstar draws between two elements.
|
|
3
|
+
*
|
|
4
|
+
* Its own path because it is one small molstar module: a page that fills a
|
|
5
|
+
* crystal's cell before the viewer has loaded completes its molecules by the
|
|
6
|
+
* rule the viewer will join them by, without downloading the viewer.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export { bondLimit } from './bondRule.ts';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The toolbars every 3D view of the family floats over its canvas: reset,
|
|
3
|
+
* spin, export, full screen and help, then the measuring tools.
|
|
4
|
+
*
|
|
5
|
+
* It is `Molecule3DToolbar` placed in the top-left corner of the stage and fed
|
|
6
|
+
* from `useMolstarTools` and `useImageExport`, so a site drawing its own
|
|
7
|
+
* scene — orbitals, a crystal — gets the controls `<MoleculeViewer3D>` has
|
|
8
|
+
* without wiring them a second time.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
12
|
+
|
|
13
|
+
import type { Molecule3DFile } from '../../molecule3d/core/file.ts';
|
|
14
|
+
import { Molecule3DExport } from '../../molecule3d/ui/Molecule3DExport.tsx';
|
|
15
|
+
import type { Molecule3DToolbarProps } from '../../molecule3d/ui/Molecule3DToolbar.tsx';
|
|
16
|
+
import { Molecule3DToolbar } from '../../molecule3d/ui/Molecule3DToolbar.tsx';
|
|
17
|
+
import type { ImageExport } from '../../molecule3d/ui/useImageExport.ts';
|
|
18
|
+
|
|
19
|
+
import type { MolstarTools } from './useMolstarTools.ts';
|
|
20
|
+
|
|
21
|
+
/** Props of {@link MolstarToolbar}. */
|
|
22
|
+
export interface MolstarToolbarProps extends Omit<
|
|
23
|
+
Molecule3DToolbarProps,
|
|
24
|
+
| 'measureKind'
|
|
25
|
+
| 'onMeasureKindChange'
|
|
26
|
+
| 'spinning'
|
|
27
|
+
| 'onSpinningChange'
|
|
28
|
+
| 'exportPanel'
|
|
29
|
+
> {
|
|
30
|
+
/** The state `useMolstarTools` keeps. */
|
|
31
|
+
controls: MolstarTools;
|
|
32
|
+
/**
|
|
33
|
+
* The pictures the export tool saves and copies; the tool is left out
|
|
34
|
+
* without them.
|
|
35
|
+
* @default undefined
|
|
36
|
+
*/
|
|
37
|
+
imageExport?: ImageExport;
|
|
38
|
+
/**
|
|
39
|
+
* Base name of what the export tool saves, extension excluded.
|
|
40
|
+
* @default 'molecule'
|
|
41
|
+
*/
|
|
42
|
+
fileName?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The file on screen, offered beside the pictures; say so in `exportLabel`.
|
|
45
|
+
* @default undefined — only pictures are offered
|
|
46
|
+
*/
|
|
47
|
+
molfile?: Molecule3DFile | null;
|
|
48
|
+
/**
|
|
49
|
+
* How many frames the scene holds. Above one, a PNG may hold them all.
|
|
50
|
+
* @default 1
|
|
51
|
+
*/
|
|
52
|
+
frameCount?: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The toolbars, in the top-left corner of a positioned stage.
|
|
57
|
+
* @param props - See {@link MolstarToolbarProps}.
|
|
58
|
+
* @returns The toolbars.
|
|
59
|
+
*/
|
|
60
|
+
export function MolstarToolbar(props: MolstarToolbarProps): ReactElement {
|
|
61
|
+
const { controls, imageExport, fileName, molfile, frameCount, ...toolbar } =
|
|
62
|
+
props;
|
|
63
|
+
return (
|
|
64
|
+
<div style={OVERLAY_STYLE}>
|
|
65
|
+
<Molecule3DToolbar
|
|
66
|
+
{...toolbar}
|
|
67
|
+
measureKind={controls.measureKind}
|
|
68
|
+
onMeasureKindChange={controls.setMeasureKind}
|
|
69
|
+
spinning={controls.spinning}
|
|
70
|
+
onSpinningChange={controls.setSpinning}
|
|
71
|
+
exportPanel={
|
|
72
|
+
imageExport === undefined ? undefined : (
|
|
73
|
+
<Molecule3DExport
|
|
74
|
+
getSize={imageExport.canvasSize}
|
|
75
|
+
onExport={imageExport.exportImage}
|
|
76
|
+
onCopy={imageExport.copyImage}
|
|
77
|
+
writeFile={imageExport.imageFile}
|
|
78
|
+
frameCount={frameCount}
|
|
79
|
+
molfile={molfile}
|
|
80
|
+
fileName={fileName}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* `pointerEvents` is off here and back on inside the toolbars, so the empty
|
|
91
|
+
* column beside them does not swallow a drag of the scene.
|
|
92
|
+
*/
|
|
93
|
+
const OVERLAY_STYLE: CSSProperties = {
|
|
94
|
+
position: 'absolute',
|
|
95
|
+
top: 8,
|
|
96
|
+
bottom: 8,
|
|
97
|
+
left: 8,
|
|
98
|
+
zIndex: 2,
|
|
99
|
+
display: 'flex',
|
|
100
|
+
alignItems: 'flex-start',
|
|
101
|
+
gap: 8,
|
|
102
|
+
pointerEvents: 'none',
|
|
103
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The controls of a molstar canvas, for a site drawing a scene of its own:
|
|
3
|
+
* the toolbars `<MoleculeViewer3D>` floats over its canvas, and the state they
|
|
4
|
+
* keep on the viewer.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type { MolstarToolbarProps } from './MolstarToolbar.tsx';
|
|
8
|
+
export { MolstarToolbar } from './MolstarToolbar.tsx';
|
|
9
|
+
export type {
|
|
10
|
+
MolstarTools,
|
|
11
|
+
MolstarToolsOptions,
|
|
12
|
+
MolstarToolsViewer,
|
|
13
|
+
} from './useMolstarTools.ts';
|
|
14
|
+
export { useMolstarTools } from './useMolstarTools.ts';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the toolbar over a molstar canvas changes on the viewer: whether the
|
|
3
|
+
* scene turns, and what a click on an atom measures.
|
|
4
|
+
*
|
|
5
|
+
* Every 3D view of the family keeps its own viewer class — a molecule, its
|
|
6
|
+
* orbitals, a crystal — but all of them turn and measure the same way, so the
|
|
7
|
+
* state and the two effects that hand it to the viewer are written once here.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { RefObject } from 'react';
|
|
11
|
+
import { useEffect, useState } from 'react';
|
|
12
|
+
|
|
13
|
+
import type { MeasurementKind } from '../../molecule3d/core/measurement.ts';
|
|
14
|
+
import { useControlledState } from '../../molecule3d/ui/useControlledState.ts';
|
|
15
|
+
import { DEFAULT_SPIN_SPEED } from '../core/camera.ts';
|
|
16
|
+
|
|
17
|
+
/** What a viewer offers the toolbar; each method resolves once it is done. */
|
|
18
|
+
export interface MolstarToolsViewer {
|
|
19
|
+
/** Turn the automatic spin on or off, at `speed`. */
|
|
20
|
+
setSpin: (spinning: boolean, speed?: number) => Promise<void>;
|
|
21
|
+
/** Make clicks on atoms build this measurement, or give them back. */
|
|
22
|
+
setMeasureKind: (kind: MeasurementKind | null) => Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Options of {@link useMolstarTools}. */
|
|
26
|
+
export interface MolstarToolsOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Whether the scene turns, when the parent owns it.
|
|
29
|
+
* @default undefined
|
|
30
|
+
*/
|
|
31
|
+
spinning?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the scene turns at first, when the toolbar owns it.
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
defaultSpinning?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Called with every change of the spin.
|
|
39
|
+
* @default undefined
|
|
40
|
+
*/
|
|
41
|
+
onSpinningChange?: (spinning: boolean) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Turn rate, in molstar's own spin unit.
|
|
44
|
+
* @default DEFAULT_SPIN_SPEED
|
|
45
|
+
*/
|
|
46
|
+
spinSpeed?: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The toolbar's state, and its setters. */
|
|
50
|
+
export interface MolstarTools {
|
|
51
|
+
/** The measurement a click on an atom builds, or `null`. */
|
|
52
|
+
measureKind: MeasurementKind | null;
|
|
53
|
+
setMeasureKind: (kind: MeasurementKind | null) => void;
|
|
54
|
+
/** Whether the scene turns. */
|
|
55
|
+
spinning: boolean;
|
|
56
|
+
setSpinning: (spinning: boolean) => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Keep the viewer turning and measuring as the toolbar says.
|
|
61
|
+
*
|
|
62
|
+
* Call it after the viewer is created, in the same component: effects run in
|
|
63
|
+
* the order they are declared, so a viewer created by an earlier effect is
|
|
64
|
+
* there when these run.
|
|
65
|
+
* @param viewerRef - The viewer, `null` while there is none.
|
|
66
|
+
* @param container - The element the viewer draws in; a new one is a new
|
|
67
|
+
* viewer, which is handed the state again.
|
|
68
|
+
* @param options - See {@link MolstarToolsOptions}.
|
|
69
|
+
* @returns See {@link MolstarTools}.
|
|
70
|
+
*/
|
|
71
|
+
export function useMolstarTools(
|
|
72
|
+
viewerRef: RefObject<MolstarToolsViewer | null>,
|
|
73
|
+
container: HTMLElement | null,
|
|
74
|
+
options: MolstarToolsOptions = {},
|
|
75
|
+
): MolstarTools {
|
|
76
|
+
const {
|
|
77
|
+
spinning: spinningProp,
|
|
78
|
+
defaultSpinning = false,
|
|
79
|
+
onSpinningChange,
|
|
80
|
+
spinSpeed = DEFAULT_SPIN_SPEED,
|
|
81
|
+
} = options;
|
|
82
|
+
const [measureKind, setMeasureKind] = useState<MeasurementKind | null>(null);
|
|
83
|
+
const [spinning, setSpinning] = useControlledState(
|
|
84
|
+
spinningProp,
|
|
85
|
+
defaultSpinning,
|
|
86
|
+
onSpinningChange,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
void viewerRef.current?.setSpin(spinning, spinSpeed);
|
|
91
|
+
}, [viewerRef, container, spinning, spinSpeed]);
|
|
92
|
+
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
void viewerRef.current?.setMeasureKind(measureKind);
|
|
95
|
+
}, [viewerRef, container, measureKind]);
|
|
96
|
+
|
|
97
|
+
return { measureKind, setMeasureKind, spinning, setSpinning };
|
|
98
|
+
}
|
package/styles/chrome.css
CHANGED
|
@@ -3327,3 +3327,93 @@ button.empty-guide__figure:focus-visible .empty-guide__label {
|
|
|
3327
3327
|
animation-name: none;
|
|
3328
3328
|
}
|
|
3329
3329
|
}
|
|
3330
|
+
|
|
3331
|
+
/* ── Chips: the toggles under a figure ─────────────────────────────────────── */
|
|
3332
|
+
|
|
3333
|
+
/*
|
|
3334
|
+
* A toggle is a chip, whatever it switches: same height, same radius, same
|
|
3335
|
+
* type. Off carries an edge, so it still reads as pressable — a borderless
|
|
3336
|
+
* "minimal" button reads as a line of prose. On takes the brand wash the header
|
|
3337
|
+
* already uses for the current page, so the one coloured thing in a row is the
|
|
3338
|
+
* state and never the affordance.
|
|
3339
|
+
*/
|
|
3340
|
+
.chip-bar {
|
|
3341
|
+
display: flex;
|
|
3342
|
+
flex-direction: column;
|
|
3343
|
+
gap: 6px;
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3346
|
+
/* A caption column, so the rows line up and each one says what it is for.
|
|
3347
|
+
Without it the bar is twelve chips in a row and the reader has to guess
|
|
3348
|
+
which ones are the same question. */
|
|
3349
|
+
.chip-row {
|
|
3350
|
+
display: flex;
|
|
3351
|
+
gap: 8px;
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
.chip-row__label {
|
|
3355
|
+
width: 4.25rem;
|
|
3356
|
+
flex: none;
|
|
3357
|
+
padding-top: 7px;
|
|
3358
|
+
color: var(--text-faint);
|
|
3359
|
+
font-size: 0.6875rem;
|
|
3360
|
+
font-weight: 700;
|
|
3361
|
+
letter-spacing: 0.04em;
|
|
3362
|
+
line-height: 1;
|
|
3363
|
+
text-transform: uppercase;
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
.chip-row__chips {
|
|
3367
|
+
display: flex;
|
|
3368
|
+
min-width: 0;
|
|
3369
|
+
flex-wrap: wrap;
|
|
3370
|
+
align-items: center;
|
|
3371
|
+
gap: 4px;
|
|
3372
|
+
}
|
|
3373
|
+
|
|
3374
|
+
.chip {
|
|
3375
|
+
display: inline-flex;
|
|
3376
|
+
height: 1.625rem;
|
|
3377
|
+
align-items: center;
|
|
3378
|
+
padding: 0 0.55rem;
|
|
3379
|
+
border: 1px solid var(--border);
|
|
3380
|
+
border-radius: 8px;
|
|
3381
|
+
background: var(--surface);
|
|
3382
|
+
color: var(--text-muted);
|
|
3383
|
+
font-size: 0.8125rem;
|
|
3384
|
+
font-weight: 600;
|
|
3385
|
+
gap: 0.35rem;
|
|
3386
|
+
white-space: nowrap;
|
|
3387
|
+
cursor: pointer;
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
.chip:hover {
|
|
3391
|
+
border-color: var(--border-strong);
|
|
3392
|
+
background: var(--surface-sunken);
|
|
3393
|
+
color: var(--text);
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
.chip[aria-pressed='true'],
|
|
3397
|
+
.chip[aria-pressed='true']:hover {
|
|
3398
|
+
border-color: color-mix(in oklab, var(--accent) 30%, white);
|
|
3399
|
+
background: color-mix(in oklab, var(--accent) 12%, white);
|
|
3400
|
+
color: var(--accent);
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3403
|
+
/* An action rather than a state, so it carries no edge: an outlined "show all"
|
|
3404
|
+
beside eight outlined layers reads as a ninth layer that is switched off. */
|
|
3405
|
+
.chip--action,
|
|
3406
|
+
.chip--action:hover {
|
|
3407
|
+
border-color: transparent;
|
|
3408
|
+
background: none;
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
.chip--action:hover {
|
|
3412
|
+
color: var(--text);
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3415
|
+
.chip--action:disabled,
|
|
3416
|
+
.chip--action:disabled:hover {
|
|
3417
|
+
color: var(--text-faint);
|
|
3418
|
+
cursor: default;
|
|
3419
|
+
}
|