nmrium 0.39.0 → 0.41.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.
Files changed (306) hide show
  1. package/lib/component/1d/FooterBanner.js +5 -4
  2. package/lib/component/1d/Viewer1D.js +121 -104
  3. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  4. package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +1 -1
  5. package/lib/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  6. package/lib/component/1d/multiplicityTree/TreeColors.d.ts +1 -1
  7. package/lib/component/1d/multiplicityTree/TreeColors.js +1 -6
  8. package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +1 -1
  9. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  10. package/lib/component/1d/tool/BaseLineZones.js +7 -4
  11. package/lib/component/1d/tool/PeakPointer.js +1 -1
  12. package/lib/component/1d/utilities/scale.js +1 -3
  13. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
  14. package/lib/component/1d-2d/tools/BrushXY.js +10 -7
  15. package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
  16. package/lib/component/2d/FooterBanner.js +3 -2
  17. package/lib/component/2d/Viewer2D.js +51 -29
  18. package/lib/component/2d/XAxis.js +1 -1
  19. package/lib/component/2d/YAxis.js +1 -1
  20. package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
  21. package/lib/component/2d/utilities/scale.d.ts +5 -5
  22. package/lib/component/2d/zones/Signal.js +1 -2
  23. package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
  24. package/lib/component/EventsTrackers/BrushTracker.js +21 -6
  25. package/lib/component/NMRium.d.ts +2 -2
  26. package/lib/component/NMRium.js +39 -26
  27. package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
  28. package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
  29. package/lib/component/context/LoggerContext.js +11 -6
  30. package/lib/component/elements/InputRange.js +1 -1
  31. package/lib/component/elements/MenuButton.d.ts +1 -1
  32. package/lib/component/elements/MoleculeSelection.d.ts +1 -1
  33. package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
  34. package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
  35. package/lib/component/elements/ToolbarMenu.d.ts +1 -1
  36. package/lib/component/elements/accordion/Accordion.d.ts +1 -1
  37. package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
  38. package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
  39. package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
  40. package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
  41. package/lib/component/elements/formik/SelectBox.d.ts +1 -1
  42. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +8 -0
  43. package/lib/component/elements/popup/Alert/AlertBlock.js +30 -0
  44. package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
  45. package/lib/component/elements/popup/Alert/Context.js +6 -2
  46. package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
  47. package/lib/component/elements/popup/Alert/Provider.js +5 -23
  48. package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
  49. package/lib/component/elements/popup/Modal/ConfirmDialog.js +2 -1
  50. package/lib/component/elements/popup/Modal/Provider.js +3 -1
  51. package/lib/component/elements/popup/options.d.ts +22 -19
  52. package/lib/component/elements/resizer/Resizer.d.ts +2 -2
  53. package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
  54. package/lib/component/elements/toggle/ToggleButton.js +1 -1
  55. package/lib/component/header/Header.js +2 -2
  56. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
  57. package/lib/component/highlight/index.d.ts +1 -1
  58. package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
  59. package/lib/component/hooks/useExport.js +2 -1
  60. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  61. package/lib/component/hooks/usePanelPreferences.js +2 -2
  62. package/lib/component/hooks/useXScale.d.ts +1 -1
  63. package/lib/component/hooks/useXYReduce.d.ts +2 -2
  64. package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
  65. package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
  66. package/lib/component/modal/AboutUsModal.js +4 -2
  67. package/lib/component/modal/AlignSpectraModal.js +11 -1
  68. package/lib/component/modal/LogsHistoryModal.d.ts +6 -0
  69. package/lib/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +6 -4
  70. package/lib/component/modal/MultipletAnalysisModal.js +2 -1
  71. package/lib/component/modal/PredictSpectraModal.d.ts +1 -2
  72. package/lib/component/modal/PredictSpectraModal.js +25 -28
  73. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  74. package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  75. package/lib/component/modal/editZone/SignalsForm.js +1 -1
  76. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  77. package/lib/component/modal/setting/GeneralSettings.js +28 -27
  78. package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  79. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  80. package/lib/component/modal/setting/settingsValidation.js +2 -2
  81. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
  82. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
  83. package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  84. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
  85. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +19 -19
  86. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
  87. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  88. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
  89. package/lib/component/panels/Panels.js +13 -0
  90. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  91. package/lib/component/panels/RangesPanel/RangesHeader.js +9 -15
  92. package/lib/component/panels/RangesPanel/RangesPanel.js +7 -10
  93. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
  94. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  95. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  96. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
  97. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  98. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
  99. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
  100. package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
  101. package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
  102. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  103. package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  104. package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
  105. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  106. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
  107. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
  108. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
  109. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
  110. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
  111. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
  112. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
  113. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
  114. package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
  115. package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
  116. package/lib/component/reducer/Reducer.d.ts +13 -12
  117. package/lib/component/reducer/Reducer.js +251 -239
  118. package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
  119. package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
  120. package/lib/component/reducer/actions/DatabaseActions.js +2 -1
  121. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  122. package/lib/component/reducer/actions/DomainActions.js +30 -1
  123. package/lib/component/reducer/actions/FiltersActions.js +4 -4
  124. package/lib/component/reducer/actions/LoadActions.js +1 -1
  125. package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -0
  126. package/lib/component/reducer/actions/MoleculeActions.js +51 -2
  127. package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
  128. package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
  129. package/lib/component/reducer/actions/ToolsActions.js +2 -2
  130. package/lib/component/reducer/actions/ZonesActions.js +1 -1
  131. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
  132. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  133. package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
  134. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  135. package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
  136. package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
  137. package/lib/component/toolbar/ToolTypes.d.ts +4 -4
  138. package/lib/component/utility/export.d.ts +5 -4
  139. package/lib/component/utility/export.js +33 -61
  140. package/lib/component/utility/getSpectraObjectPaths.js +1 -1
  141. package/lib/component/utility/getUniqueNuclei.js +1 -1
  142. package/lib/component/utility/jpathToArray.js +1 -1
  143. package/lib/component/workspaces/index.d.ts +1 -0
  144. package/lib/component/workspaces/index.js +2 -0
  145. package/lib/component/workspaces/simulation.d.ts +2 -0
  146. package/lib/component/workspaces/simulation.js +68 -0
  147. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
  148. package/lib/data/PredictionManager.d.ts +8 -7
  149. package/lib/data/PredictionManager.js +95 -22
  150. package/lib/data/SpectraManager.js +1 -1
  151. package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
  152. package/lib/data/constants/SignalsKinds.d.ts +2 -2
  153. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  154. package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  155. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
  156. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  157. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  158. package/lib/data/data1d/database.d.ts +5 -5
  159. package/lib/data/data1d/database.js +3 -3
  160. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
  161. package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
  162. package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
  163. package/lib/data/data1d/spectrumSimulation.js +53 -0
  164. package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
  165. package/lib/data/data2d/Spectrum2D/contours.js +7 -1
  166. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  167. package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
  168. package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
  169. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  170. package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
  171. package/lib/data/matrixGeneration.js +1 -1
  172. package/lib/data/molecules/MoleculeManager.d.ts +1 -1
  173. package/lib/data/molecules/MoleculeManager.js +7 -7
  174. package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
  175. package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
  176. package/lib/data/utilities/FindUtilities.js +4 -4
  177. package/lib/data/utilities/RangeUtilities.d.ts +1 -1
  178. package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
  179. package/lib/data/utilities/calculateSanPlot.js +3 -3
  180. package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
  181. package/lib/utils/clipboard/clipboard.d.ts +12 -0
  182. package/lib/utils/clipboard/clipboard.js +15 -0
  183. package/lib/utils/clipboard/clipboardComponents.d.ts +45 -0
  184. package/lib/utils/clipboard/clipboardComponents.js +150 -0
  185. package/lib/utils/clipboard/clipboardHooks.d.ts +94 -0
  186. package/lib/utils/clipboard/clipboardHooks.js +142 -0
  187. package/lib/utils/clipboard/types.d.ts +1 -0
  188. package/lib/utils/clipboard/types.js +1 -0
  189. package/lib/versionInfo.js +1 -1
  190. package/lib-cjs/component/1d/FooterBanner.js +5 -4
  191. package/lib-cjs/component/1d/Viewer1D.js +120 -103
  192. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  193. package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  194. package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
  195. package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
  196. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  197. package/lib-cjs/component/1d/utilities/scale.js +1 -3
  198. package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
  199. package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
  200. package/lib-cjs/component/2d/FooterBanner.js +3 -2
  201. package/lib-cjs/component/2d/Viewer2D.js +50 -28
  202. package/lib-cjs/component/2d/XAxis.js +1 -1
  203. package/lib-cjs/component/2d/YAxis.js +1 -1
  204. package/lib-cjs/component/2d/zones/Signal.js +1 -2
  205. package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
  206. package/lib-cjs/component/NMRium.js +37 -24
  207. package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
  208. package/lib-cjs/component/context/LoggerContext.js +10 -5
  209. package/lib-cjs/component/elements/InputRange.js +1 -1
  210. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
  211. package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +36 -0
  212. package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
  213. package/lib-cjs/component/elements/popup/Alert/Provider.js +4 -22
  214. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +2 -1
  215. package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
  216. package/lib-cjs/component/header/Header.js +2 -2
  217. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
  218. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
  219. package/lib-cjs/component/hooks/useExport.js +2 -1
  220. package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
  221. package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
  222. package/lib-cjs/component/modal/AboutUsModal.js +4 -2
  223. package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
  224. package/lib-cjs/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +8 -6
  225. package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
  226. package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
  227. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
  228. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  229. package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
  230. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  231. package/lib-cjs/component/modal/setting/GeneralSettings.js +28 -27
  232. package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  233. package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  234. package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
  235. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  236. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +18 -18
  237. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  238. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
  239. package/lib-cjs/component/panels/Panels.js +13 -0
  240. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  241. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +9 -15
  242. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -10
  243. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
  244. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  245. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  246. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  247. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
  248. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
  249. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  250. package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  251. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
  252. package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  253. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
  254. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
  255. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
  256. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
  257. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
  258. package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
  259. package/lib-cjs/component/reducer/Reducer.js +251 -239
  260. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
  261. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
  262. package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
  263. package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
  264. package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
  265. package/lib-cjs/component/reducer/actions/MoleculeActions.js +54 -2
  266. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
  267. package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
  268. package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
  269. package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  270. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
  271. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
  272. package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
  273. package/lib-cjs/component/utility/export.js +33 -63
  274. package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
  275. package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
  276. package/lib-cjs/component/utility/jpathToArray.js +1 -1
  277. package/lib-cjs/component/workspaces/index.js +2 -0
  278. package/lib-cjs/component/workspaces/simulation.js +71 -0
  279. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -0
  280. package/lib-cjs/data/PredictionManager.js +96 -22
  281. package/lib-cjs/data/SpectraManager.js +1 -1
  282. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  283. package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  284. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  285. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  286. package/lib-cjs/data/data1d/database.js +3 -3
  287. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
  288. package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
  289. package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
  290. package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  291. package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
  292. package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
  293. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  294. package/lib-cjs/data/matrixGeneration.js +1 -1
  295. package/lib-cjs/data/molecules/MoleculeManager.js +7 -7
  296. package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
  297. package/lib-cjs/data/utilities/FindUtilities.js +4 -4
  298. package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
  299. package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
  300. package/lib-cjs/utils/clipboard/clipboard.js +23 -0
  301. package/lib-cjs/utils/clipboard/clipboardComponents.js +158 -0
  302. package/lib-cjs/utils/clipboard/clipboardHooks.js +147 -0
  303. package/lib-cjs/utils/clipboard/types.js +2 -0
  304. package/lib-cjs/versionInfo.js +1 -1
  305. package/package.json +26 -25
  306. package/lib/component/header/LogsHistory.d.ts +0 -1
@@ -76,8 +76,8 @@ const styles = css `
76
76
  }
77
77
  `;
78
78
  function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, activeTab, }) {
79
- let position = useMouseTracker();
80
- const { startX, endX, step } = useBrushTracker();
79
+ const position = useMouseTracker();
80
+ const { startX, endX, step, mouseButton } = useBrushTracker();
81
81
  const { scaleX } = useScaleChecked();
82
82
  const format = useFormatNumberByNucleus(activeTab);
83
83
  if (!position ||
@@ -102,8 +102,9 @@ function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, ac
102
102
  }
103
103
  return 1;
104
104
  }
105
- return (_jsxs("div", { css: styles, children: [_jsx(BsCursor, {}), _jsxs("div", { children: [_jsx("span", { className: "label", children: " \uD835\uDEC5: " }), _jsx("span", { className: "value", children: format(scaleX().invert(position.x)) }), _jsx("span", { className: "unit", children: "ppm" }), activeSpectrum && spectrum?.info?.originFrequency && (_jsxs(_Fragment, { children: [_jsxs("span", { className: "value", children: ["\u00A0(", format(scaleX().invert(position.x) * spectrum?.info?.originFrequency, 'hz')] }), _jsx("span", { className: "unit", children: "Hz" }), _jsx("span", { className: "value", children: ") " }), _jsxs("span", { className: "small-width-none", children: [_jsx("span", { children: "," }), _jsx("span", { className: "label", children: " Index: " }), _jsx("span", { className: "value", children: getXIndex(position.x) })] })] }))] }), step === 'brushing' && (_jsxs("div", { className: "flex-row small-width-none", children: [_jsx("span", { className: "label", children: " \u0394ppm: " }), _jsx("span", { className: "value", children: (scaleX().invert(startX) - scaleX().invert(endX)).toPrecision(6) })] })), activeSpectrum && (_jsxs("div", { className: " flex-row small-width-none", children: [spectrum?.info?.originFrequency && step === 'brushing' && (_jsxs("div", { children: [_jsx("span", { className: "label", children: " \u0394Hz: " }), _jsx("span", { className: "value", children: ((scaleX().invert(startX) - scaleX().invert(endX)) *
106
- spectrum?.info?.originFrequency).toPrecision(5) })] })), step === 'brushing' && (_jsxs("div", { children: [_jsx("span", { className: "label", children: " ratio :" }), _jsxs("span", { className: "value", children: [((getYValue(startX) / (getYValue(endX) || Number.MIN_VALUE)) *
105
+ const isBrushing = step === 'brushing' && mouseButton === 'main';
106
+ return (_jsxs("div", { css: styles, children: [_jsx(BsCursor, {}), _jsxs("div", { children: [_jsx("span", { className: "label", children: " \uD835\uDEC5: " }), _jsx("span", { className: "value", children: format(scaleX().invert(position.x)) }), _jsx("span", { className: "unit", children: "ppm" }), activeSpectrum && spectrum?.info?.originFrequency && (_jsxs(_Fragment, { children: [_jsxs("span", { className: "value", children: ["\u00A0(", format(scaleX().invert(position.x) * spectrum?.info?.originFrequency, 'hz')] }), _jsx("span", { className: "unit", children: "Hz" }), _jsx("span", { className: "value", children: ") " }), _jsxs("span", { className: "small-width-none", children: [_jsx("span", { children: "," }), _jsx("span", { className: "label", children: " Index: " }), _jsx("span", { className: "value", children: getXIndex(position.x) })] })] }))] }), isBrushing && (_jsxs("div", { className: "flex-row small-width-none", children: [_jsx("span", { className: "label", children: " \u0394ppm: " }), _jsx("span", { className: "value", children: (scaleX().invert(startX) - scaleX().invert(endX)).toPrecision(6) })] })), activeSpectrum && (_jsxs("div", { className: " flex-row small-width-none", children: [spectrum?.info?.originFrequency && isBrushing && (_jsxs("div", { children: [_jsx("span", { className: "label", children: " \u0394Hz: " }), _jsx("span", { className: "value", children: ((scaleX().invert(startX) - scaleX().invert(endX)) *
107
+ spectrum?.info?.originFrequency).toPrecision(5) })] })), isBrushing && (_jsxs("div", { children: [_jsx("span", { className: "label", children: " ratio :" }), _jsxs("span", { className: "value", children: [((getYValue(startX) / (getYValue(endX) || Number.MIN_VALUE)) *
107
108
  100).toFixed(2), "%"] })] }))] })), activeSpectrum && (_jsxs("div", { className: "flex-row small-width-none", children: [_jsx("div", { className: "separator" }), _jsx(IoPulseSharp, {}), _jsxs("div", { children: [_jsx("span", { className: "label", children: "Intensity: " }), _jsx("span", { className: "value y-value", children: format(getYValue(position.x)) })] })] }))] }));
108
109
  }
109
110
  const MemoizedFooterBanner = memo(FooterBannerInner);
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { xGetFromToIndex } from 'ml-spectra-processing';
3
- import { useCallback, useEffect, useReducer } from 'react';
3
+ import { useCallback, useEffect, useReducer, useRef } from 'react';
4
4
  import { ResponsiveChart } from 'react-d3-utils';
5
5
  import { MAX_LENGTH } from '../../data/data1d/Spectrum1D/ranges/detectSignal';
6
6
  import BrushXY, { BRUSH_TYPE } from '../1d-2d/tools/BrushXY';
@@ -28,9 +28,11 @@ import FooterBanner from './FooterBanner';
28
28
  import PeakPointer from './tool/PeakPointer';
29
29
  import VerticalIndicator from './tool/VerticalIndicator';
30
30
  import XLabelPointer from './tool/XLabelPointer';
31
+ import { getXScale } from './utilities/scale';
31
32
  function Viewer1D({ emptyText = undefined }) {
32
33
  const state = useChartData();
33
34
  const { toolOptions: { selectedTool }, isLoading, data, mode, width: widthProp, height: heightProp, margin, xDomain, xDomains, yDomain, yDomains, displayerKey, view: { spectra: { activeTab }, }, } = state;
35
+ const brushStartRef = useRef(null);
34
36
  const verticalAlign = useVerticalAlign();
35
37
  const activeSpectrum = useActiveSpectrum();
36
38
  const dispatch = useDispatch();
@@ -66,123 +68,138 @@ function Viewer1D({ emptyText = undefined }) {
66
68
  yDomain,
67
69
  yDomains,
68
70
  ]);
69
- const handelBrushEnd = useCallback((brushData) => {
70
- const propagateEvent = () => {
71
- if (!scaleState.scaleX || !scaleState.scaleY)
72
- return;
73
- const { startX, endX } = brushData;
74
- const startXPPM = scaleState.scaleX().invert(startX);
75
- const endXPPM = scaleState.scaleX().invert(endX);
76
- Events.emit('brushEnd', {
77
- ...brushData,
78
- range: [startXPPM, endXPPM].sort((a, b) => a - b),
79
- });
80
- };
81
- if (brushData.altKey) {
82
- switch (selectedTool) {
83
- case options.rangePicking.id: {
84
- modal.show(_jsx(MultipletAnalysisModal, { data: data, activeSpectrum: activeSpectrum, scaleX: scaleState.scaleX, ...brushData }), {
85
- onClose: () => {
86
- modal.close();
87
- },
88
- });
89
- break;
90
- }
91
- default:
92
- break;
71
+ function handelBrush(brushData) {
72
+ const { startX: startXInPixel, endX: endXInPixel, mouseButton } = brushData;
73
+ if (mouseButton === 'secondary') {
74
+ const scaleX = getXScale(state);
75
+ if (!brushStartRef.current) {
76
+ brushStartRef.current = scaleX.invert(startXInPixel);
93
77
  }
78
+ const shiftX = scaleX.invert(endXInPixel) - brushStartRef.current;
79
+ dispatch({ type: 'MOVE', payload: { shiftX, shiftY: 0 } });
94
80
  }
95
- else if (brushData.shiftKey) {
96
- switch (selectedTool) {
97
- case options.integral.id:
98
- dispatch({
99
- type: 'ADD_INTEGRAL',
100
- payload: brushData,
101
- });
102
- break;
103
- case options.rangePicking.id: {
104
- const [from, to] = getRange(state, {
105
- startX: brushData.startX,
106
- endX: brushData.endX,
107
- });
108
- if (!activeSpectrum)
81
+ }
82
+ const handelBrushEnd = useCallback((brushData) => {
83
+ //reset the brush start
84
+ brushStartRef.current = null;
85
+ if (brushData.mouseButton === 'main') {
86
+ const propagateEvent = () => {
87
+ if (!scaleState.scaleX || !scaleState.scaleY)
88
+ return;
89
+ const { startX, endX } = brushData;
90
+ const startXPPM = scaleState.scaleX().invert(startX);
91
+ const endXPPM = scaleState.scaleX().invert(endX);
92
+ Events.emit('brushEnd', {
93
+ ...brushData,
94
+ range: [startXPPM, endXPPM].sort((a, b) => a - b),
95
+ });
96
+ };
97
+ if (brushData.altKey) {
98
+ switch (selectedTool) {
99
+ case options.rangePicking.id: {
100
+ modal.show(_jsx(MultipletAnalysisModal, { data: data, activeSpectrum: activeSpectrum, scaleX: scaleState.scaleX, ...brushData }), {
101
+ onClose: () => {
102
+ modal.close();
103
+ },
104
+ });
109
105
  break;
110
- const { data: { x }, } = data[activeSpectrum.index];
111
- const { fromIndex, toIndex } = xGetFromToIndex(x, { from, to });
112
- if (toIndex - fromIndex <= MAX_LENGTH) {
106
+ }
107
+ default:
108
+ break;
109
+ }
110
+ }
111
+ else if (brushData.shiftKey) {
112
+ switch (selectedTool) {
113
+ case options.integral.id:
113
114
  dispatch({
114
- type: 'ADD_RANGE',
115
+ type: 'ADD_INTEGRAL',
115
116
  payload: brushData,
116
117
  });
118
+ break;
119
+ case options.rangePicking.id: {
120
+ const [from, to] = getRange(state, {
121
+ startX: brushData.startX,
122
+ endX: brushData.endX,
123
+ });
124
+ if (!activeSpectrum)
125
+ break;
126
+ const { data: { x }, } = data[activeSpectrum.index];
127
+ const { fromIndex, toIndex } = xGetFromToIndex(x, { from, to });
128
+ if (toIndex - fromIndex <= MAX_LENGTH) {
129
+ dispatch({
130
+ type: 'ADD_RANGE',
131
+ payload: brushData,
132
+ });
133
+ }
134
+ else {
135
+ alert.error(`Advanced peak picking only available for area up to ${MAX_LENGTH} points`);
136
+ }
137
+ break;
117
138
  }
118
- else {
119
- alert.error(`Advanced peak picking only available for area up to ${MAX_LENGTH} points`);
120
- }
121
- break;
122
- }
123
- case options.multipleSpectraAnalysis.id:
124
- if (scaleState.scaleX) {
125
- const { startX, endX } = brushData;
126
- const start = scaleState.scaleX().invert(startX);
127
- const end = scaleState.scaleX().invert(endX);
139
+ case options.multipleSpectraAnalysis.id:
140
+ if (scaleState.scaleX) {
141
+ const { startX, endX } = brushData;
142
+ const start = scaleState.scaleX().invert(startX);
143
+ const end = scaleState.scaleX().invert(endX);
144
+ dispatchPreferences({
145
+ type: 'ANALYZE_SPECTRA',
146
+ payload: {
147
+ start,
148
+ end,
149
+ nucleus: activeTab,
150
+ },
151
+ });
152
+ }
153
+ break;
154
+ case options.peakPicking.id:
155
+ dispatch({
156
+ type: 'ADD_PEAKS',
157
+ payload: brushData,
158
+ });
159
+ break;
160
+ case options.baselineCorrection.id:
161
+ dispatch({
162
+ type: 'ADD_BASE_LINE_ZONE',
163
+ payload: {
164
+ startX: brushData.startX,
165
+ endX: brushData.endX,
166
+ },
167
+ });
168
+ break;
169
+ case options.exclusionZones.id:
170
+ dispatch({
171
+ type: 'ADD_EXCLUSION_ZONE',
172
+ payload: { startX: brushData.startX, endX: brushData.endX },
173
+ });
174
+ break;
175
+ case options.matrixGenerationExclusionZones.id: {
176
+ const [from, to] = getRange(state, {
177
+ startX: brushData.startX,
178
+ endX: brushData.endX,
179
+ });
128
180
  dispatchPreferences({
129
- type: 'ANALYZE_SPECTRA',
181
+ type: 'ADD_MATRIX_GENERATION_EXCLUSION_ZONE',
130
182
  payload: {
131
- start,
132
- end,
183
+ zone: { from, to },
133
184
  nucleus: activeTab,
185
+ range: { from: xDomain[0], to: xDomain[1] },
134
186
  },
135
187
  });
188
+ break;
136
189
  }
137
- break;
138
- case options.peakPicking.id:
139
- dispatch({
140
- type: 'ADD_PEAKS',
141
- payload: brushData,
142
- });
143
- break;
144
- case options.baselineCorrection.id:
145
- dispatch({
146
- type: 'ADD_BASE_LINE_ZONE',
147
- payload: {
148
- startX: brushData.startX,
149
- endX: brushData.endX,
150
- },
151
- });
152
- break;
153
- case options.exclusionZones.id:
154
- dispatch({
155
- type: 'ADD_EXCLUSION_ZONE',
156
- payload: { startX: brushData.startX, endX: brushData.endX },
157
- });
158
- break;
159
- case options.matrixGenerationExclusionZones.id: {
160
- const [from, to] = getRange(state, {
161
- startX: brushData.startX,
162
- endX: brushData.endX,
163
- });
164
- dispatchPreferences({
165
- type: 'ADD_MATRIX_GENERATION_EXCLUSION_ZONE',
166
- payload: {
167
- zone: { from, to },
168
- nucleus: activeTab,
169
- range: { from: xDomain[0], to: xDomain[1] },
170
- },
171
- });
172
- break;
190
+ default:
191
+ propagateEvent();
192
+ break;
173
193
  }
174
- default:
175
- propagateEvent();
176
- break;
177
194
  }
178
- }
179
- else {
180
- switch (selectedTool) {
181
- default:
182
- if (selectedTool != null) {
183
- dispatch({ type: 'BRUSH_END', payload: brushData });
184
- }
185
- break;
195
+ else {
196
+ switch (selectedTool) {
197
+ default:
198
+ if (selectedTool != null) {
199
+ dispatch({ type: 'BRUSH_END', payload: brushData });
200
+ }
201
+ break;
202
+ }
186
203
  }
187
204
  }
188
205
  }, [
@@ -249,7 +266,7 @@ function Viewer1D({ emptyText = undefined }) {
249
266
  return (_jsx(ScaleProvider, { value: scaleState, children: _jsx(ResponsiveChart, { children: ({ height, width }) => (_jsx(ViewerResponsiveWrapper, { height: height, width: width, children: _jsxs("div", { style: { height: '100%', position: 'relative' }, children: [_jsx(Spinner, { isLoading: isLoading, emptyText: emptyText }), scaleState.scaleX &&
250
267
  scaleState.scaleY &&
251
268
  data &&
252
- data.length > 0 && (_jsx(BrushTracker, { onBrush: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
269
+ data.length > 0 && (_jsx(BrushTracker, { onBrush: handelBrush, onBrushEnd: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
253
270
  width: '100%',
254
271
  height: '100%',
255
272
  margin: 'auto',
@@ -24,7 +24,7 @@ function ResurrectedDatabaseRanges() {
24
24
  const blockHight = fullHeight / 4;
25
25
  const translateY = fullHeight - blockHight - marginBottom;
26
26
  const { ranges = [] } = highlight.sourceData.extra || {};
27
- let yDomain = [0, 0];
27
+ const yDomain = [0, 0];
28
28
  const spectra = ranges.map((range) => {
29
29
  const { from, to } = range;
30
30
  const diff = Math.abs(from - to) / 2;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ScaleLinear } from 'd3';
3
3
  interface JGraphState {
4
- scaleY: ScaleLinear<number, number, never> | null;
4
+ scaleY: ScaleLinear<number, number> | null;
5
5
  height: number;
6
6
  maxValue: number;
7
7
  }
@@ -10,7 +10,7 @@ export default function JsCouplingLinks(props) {
10
10
  if (!scaleY)
11
11
  return '';
12
12
  const { from, to, couplings } = link;
13
- let paths = [];
13
+ const paths = [];
14
14
  for (const coupling of couplings) {
15
15
  paths.push(`M${scaleX()(from)},${scaleY(coupling.coupling)} L${scaleX()(to)},${scaleY(coupling.coupling)}`);
16
16
  }
@@ -1 +1 @@
1
- export declare const TREE_LEVEL_COLORS: Array<string>;
1
+ export declare const TREE_LEVEL_COLORS: string[];
@@ -1,6 +1 @@
1
- export const TREE_LEVEL_COLORS = [
2
- 'red',
3
- 'green',
4
- 'blue',
5
- 'magenta',
6
- ];
1
+ export const TREE_LEVEL_COLORS = ['red', 'green', 'blue', 'magenta'];
@@ -11,7 +11,7 @@ interface TreeNodesProps {
11
11
  startY: number;
12
12
  signalID: string;
13
13
  levelHeight: number;
14
- nodesData: Array<NodeData>;
14
+ nodesData: NodeData[];
15
15
  labelOptions: {
16
16
  distance: number;
17
17
  fontSize: CSSProperties['fontSize'];
@@ -1,2 +1,2 @@
1
- declare function BaseLineZones(): import("@emotion/react/jsx-runtime").JSX.Element;
1
+ declare function BaseLineZones(): import("@emotion/react/jsx-runtime").JSX.Element | null;
2
2
  export default BaseLineZones;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
4
  import { useChartData } from '../../context/ChartContext';
@@ -26,13 +26,16 @@ const styles = css `
26
26
  }
27
27
  `;
28
28
  function BaseLineZones() {
29
- const { toolOptions } = useChartData();
29
+ const { toolOptions: { selectedTool, data: { baselineCorrection }, }, } = useChartData();
30
30
  const { scaleX } = useScaleChecked();
31
31
  const dispatch = useDispatch();
32
32
  const deleteRangeHandler = (id) => {
33
33
  dispatch({ type: 'DELETE_BASE_LINE_ZONE', payload: { id } });
34
34
  };
35
- const baseLineZones = toolOptions.data.baselineCorrection.zones;
36
- return (_jsx(_Fragment, { children: baseLineZones.length > 0 && (_jsx("g", { children: baseLineZones.map((zone) => (_jsxs("g", { transform: `translate(${scaleX()(zone.to)},0)`, css: styles, children: [_jsx(DeleteButton, { x: -20, y: 10, onDelete: () => deleteRangeHandler(zone.id) }), _jsx("rect", { x: "0", width: `${scaleX()(zone.from) - scaleX()(zone.to)}`, className: "zone-area" })] }, zone.id))) })) }));
35
+ const baseLineZones = baselineCorrection.zones;
36
+ if (selectedTool !== 'baselineCorrection' || baseLineZones.length === 0) {
37
+ return null;
38
+ }
39
+ return (_jsx("g", { children: baselineCorrection.zones.map((zone) => (_jsxs("g", { transform: `translate(${scaleX()(zone.to)},0)`, css: styles, children: [_jsx(DeleteButton, { x: -20, y: 10, onDelete: () => deleteRangeHandler(zone.id) }), _jsx("rect", { x: "0", width: `${scaleX()(zone.from) - scaleX()(zone.to)}`, className: "zone-area" })] }, zone.id))) }));
37
40
  }
38
41
  export default BaseLineZones;
@@ -19,7 +19,7 @@ function PeakPointer() {
19
19
  const { height, width, margin, data, mode, toolOptions: { selectedTool }, } = useChartData();
20
20
  const { scaleX, scaleY, shiftY } = useScaleChecked();
21
21
  const activeSpectrum = useActiveSpectrum();
22
- let position = useMouseTracker();
22
+ const position = useMouseTracker();
23
23
  const brushState = useBrushTracker();
24
24
  const [closePeakPosition, setPosition] = useState();
25
25
  useEffect(() => {
@@ -23,9 +23,7 @@ function getYScale(state, spectrumId = null) {
23
23
  function getIntegralYScale(state) {
24
24
  const { height, margin, verticalAlign, integralsYDomains, activeSpectrum } = state;
25
25
  const _height = verticalAlign === 'center' ? height / 2 : height;
26
- return scaleLinear(activeSpectrum?.id &&
27
- integralsYDomains &&
28
- integralsYDomains[activeSpectrum?.id]
26
+ return scaleLinear(activeSpectrum?.id && integralsYDomains?.[activeSpectrum?.id]
29
27
  ? integralsYDomains[activeSpectrum?.id]
30
28
  : [0, 0], [_height * 0.3, margin.top + _height * 0.1]);
31
29
  }
@@ -4,7 +4,7 @@ import { DISPLAYER_MODE } from '../../../reducer/core/Constants';
4
4
  interface FloatMoleculeStructuresProps {
5
5
  zones: Zones;
6
6
  ranges: Ranges;
7
- molecules: Array<StateMoleculeExtended>;
7
+ molecules: StateMoleculeExtended[];
8
8
  moleculesView: MoleculesView;
9
9
  activeTab: string;
10
10
  displayerMode: DISPLAYER_MODE;
@@ -38,10 +38,13 @@ const defaultDimensionBorder = {
38
38
  startY: 0,
39
39
  };
40
40
  export default function BrushXY({ brushType = BRUSH_TYPE.XY, dimensionBorder = defaultDimensionBorder, width: widthProps, height: heightProps, }) {
41
- let { width, height, toolOptions: { selectedTool }, } = useChartData();
42
- let { startX, endX, startY, endY, step } = useBrushTracker();
41
+ const { width, height, toolOptions: { selectedTool }, } = useChartData();
42
+ const brushTracker = useBrushTracker();
43
+ const { step, mouseButton } = brushTracker;
44
+ let { startX, endX, startY, endY } = brushTracker;
43
45
  if (!allowTools.has(selectedTool) ||
44
46
  step !== 'brushing' ||
47
+ mouseButton !== 'main' ||
45
48
  !dimensionBorder ||
46
49
  (dimensionBorder.startX && startX < dimensionBorder.startX) ||
47
50
  (dimensionBorder.startY && startY < dimensionBorder.startY) ||
@@ -55,8 +58,8 @@ export default function BrushXY({ brushType = BRUSH_TYPE.XY, dimensionBorder = d
55
58
  : endY < dimensionBorder.startY))) {
56
59
  return null;
57
60
  }
58
- width = widthProps || width;
59
- height = heightProps || height;
61
+ const finalWidth = widthProps || width;
62
+ const finalHeight = heightProps || height;
60
63
  endX =
61
64
  dimensionBorder.endX && endX > dimensionBorder.endX
62
65
  ? dimensionBorder.endX
@@ -70,12 +73,12 @@ export default function BrushXY({ brushType = BRUSH_TYPE.XY, dimensionBorder = d
70
73
  ? dimensionBorder.startY
71
74
  : endY;
72
75
  const scaleX = brushType === BRUSH_TYPE.X || brushType === BRUSH_TYPE.XY
73
- ? (endX - startX) / width
76
+ ? (endX - startX) / finalWidth
74
77
  : 1;
75
78
  startX =
76
79
  brushType === BRUSH_TYPE.X || brushType === BRUSH_TYPE.XY ? startX : 0;
77
80
  const scaleY = brushType === BRUSH_TYPE.Y || brushType === BRUSH_TYPE.XY
78
- ? (endY - startY) / height
81
+ ? (endY - startY) / finalHeight
79
82
  : 1;
80
83
  startY =
81
84
  brushType === BRUSH_TYPE.Y || brushType === BRUSH_TYPE.XY ? startY : 0;
@@ -83,5 +86,5 @@ export default function BrushXY({ brushType = BRUSH_TYPE.XY, dimensionBorder = d
83
86
  ...styles.container,
84
87
  transform: `translate(${startX}px, ${startY}px) scale(${scaleX},${scaleY})`,
85
88
  willChange: 'transform',
86
- }, children: _jsx("svg", { width: width, height: height, children: _jsx("rect", { x: "0", y: "0", width: width, height: height, fill: "gray", opacity: "0.2" }) }) }));
89
+ }, children: _jsx("svg", { width: finalWidth, height: finalHeight, children: _jsx("rect", { x: "0", y: "0", width: finalWidth, height: finalHeight, fill: "gray", opacity: "0.2" }) }) }));
87
90
  }
@@ -29,7 +29,7 @@ const allowTools = new Set([
29
29
  ]);
30
30
  function CrossLinePointer() {
31
31
  const { height, width, margin, toolOptions: { selectedTool }, } = useChartData();
32
- let position = useMouseTracker();
32
+ const position = useMouseTracker();
33
33
  const brushState = useBrushTracker();
34
34
  if (!allowTools.has(selectedTool) ||
35
35
  brushState.step === 'brushing' ||
@@ -56,7 +56,7 @@ const styles = css `
56
56
  `;
57
57
  function FooterBanner({ layout, data1D }) {
58
58
  const position = useMouseTracker();
59
- const { startX, endX, startY, endY, step } = useBrushTracker();
59
+ const { startX, endX, startY, endY, step, mouseButton } = useBrushTracker();
60
60
  const { margin, width, height, xDomain, yDomain, yDomains, view: { spectra: { activeTab }, }, data, toolOptions: { selectedTool }, } = useChartData();
61
61
  const activeSpectrum = useActiveSpectrum();
62
62
  const trackID = position &&
@@ -212,6 +212,7 @@ function FooterBanner({ layout, data1D }) {
212
212
  }
213
213
  return 0;
214
214
  };
215
- return (_jsxs("div", { css: styles, children: [_jsxs("div", { children: [_jsxs("span", { className: "label", children: [getLabel('F2', 'X', nuclei[0]), " :"] }), _jsx("span", { className: "value", children: formatX(getXValue()) }), _jsx("span", { className: "unit", children: "ppm" })] }), _jsxs("div", { children: [_jsxs("span", { className: "label", children: [getLabel('F1', 'Y', nuclei[1]), " :"] }), _jsx("span", { className: "value", children: formatY(getYValue()) }), _jsx("span", { className: "unit", children: "ppm" })] }), _jsxs("div", { className: "small-width-none", children: [_jsx("span", { className: "label", children: "Intensity :" }), _jsx("span", { className: "value", children: getZValue() })] }), step === 'brushing' && (_jsxs("div", { className: "small-width-none", children: [_jsx("span", { className: "label", children: " \u0394ppm :" }), _jsx("span", { className: "value", children: getDeltaX() })] })), step === 'brushing' && (_jsxs("div", { className: "small-width-none", children: [_jsx("span", { className: "label", children: " ratio :" }), _jsxs("span", { className: "value", children: [getRation(), "%"] })] }))] }));
215
+ const isBrushing = step === 'brushing' && mouseButton === 'main';
216
+ return (_jsxs("div", { css: styles, children: [_jsxs("div", { children: [_jsxs("span", { className: "label", children: [getLabel('F2', 'X', nuclei[0]), " :"] }), _jsx("span", { className: "value", children: formatX(getXValue()) }), _jsx("span", { className: "unit", children: "ppm" })] }), _jsxs("div", { children: [_jsxs("span", { className: "label", children: [getLabel('F1', 'Y', nuclei[1]), " :"] }), _jsx("span", { className: "value", children: formatY(getYValue()) }), _jsx("span", { className: "unit", children: "ppm" })] }), _jsxs("div", { className: "small-width-none", children: [_jsx("span", { className: "label", children: "Intensity :" }), _jsx("span", { className: "value", children: getZValue() })] }), isBrushing && (_jsxs("div", { className: "small-width-none", children: [_jsx("span", { className: "label", children: " \u0394ppm :" }), _jsx("span", { className: "value", children: getDeltaX() })] })), isBrushing && (_jsxs("div", { className: "small-width-none", children: [_jsx("span", { className: "label", children: " ratio :" }), _jsxs("span", { className: "value", children: [getRation(), "%"] })] }))] }));
216
217
  }
217
218
  export default FooterBanner;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useMemo } from 'react';
2
+ import { useCallback, useEffect, useMemo, useRef } from 'react';
3
3
  import { ResponsiveChart } from 'react-d3-utils';
4
4
  import BrushXY, { BRUSH_TYPE } from '../1d-2d/tools/BrushXY';
5
5
  import CrossLinePointer from '../1d-2d/tools/CrossLinePointer';
@@ -15,10 +15,12 @@ import FooterBanner from './FooterBanner';
15
15
  import SlicingView from './SlicingView';
16
16
  import XYLabelPointer from './tools/XYLabelPointer';
17
17
  import { get2DDimensionLayout, getLayoutID } from './utilities/DimensionLayout';
18
+ import { get2DXScale, get2DYScale } from './utilities/scale';
18
19
  function Viewer2D({ emptyText = undefined }) {
19
20
  const state = useChartData();
20
21
  const { toolOptions: { selectedTool }, isLoading, data, margin, view: { spectra: { activeSpectra, activeTab }, }, } = state;
21
22
  const dispatch = useDispatch();
23
+ const brushStartRef = useRef(null);
22
24
  const spectrumData = useMemo(() => {
23
25
  const nuclei = activeTab.split(',');
24
26
  return nuclei.map((nucleus) => {
@@ -33,36 +35,56 @@ function Viewer2D({ emptyText = undefined }) {
33
35
  });
34
36
  }, [activeTab, data, activeSpectra]);
35
37
  const DIMENSION = get2DDimensionLayout(state);
38
+ function handelBrush(brushData) {
39
+ const { startX: startXInPixel, endX: endXInPixel, startY: startYInPixel, endY: endYInPixel, mouseButton, } = brushData;
40
+ if (mouseButton === 'secondary') {
41
+ const scaleX = get2DXScale(state);
42
+ const scaleY = get2DYScale(state);
43
+ if (!brushStartRef.current) {
44
+ const x = scaleX.invert(startXInPixel);
45
+ const y = scaleY.invert(startYInPixel);
46
+ brushStartRef.current = { x, y };
47
+ }
48
+ const { x, y } = brushStartRef.current;
49
+ const shiftX = scaleX.invert(endXInPixel) - x;
50
+ const shiftY = scaleY.invert(endYInPixel) - y;
51
+ dispatch({ type: 'MOVE', payload: { shiftX, shiftY } });
52
+ }
53
+ }
36
54
  const handelBrushEnd = useCallback((brushData) => {
37
- const trackID = getLayoutID(DIMENSION, brushData);
38
- if (trackID) {
39
- if (brushData.altKey) {
40
- switch (selectedTool) {
41
- default:
42
- break;
55
+ //reset the brush start
56
+ brushStartRef.current = null;
57
+ if (brushData.mouseButton === 'main') {
58
+ const trackID = getLayoutID(DIMENSION, brushData);
59
+ if (trackID) {
60
+ if (brushData.altKey) {
61
+ switch (selectedTool) {
62
+ default:
63
+ break;
64
+ }
43
65
  }
44
- }
45
- else if (brushData.shiftKey) {
46
- switch (selectedTool) {
47
- case options.zonePicking.id:
48
- dispatch({ type: 'ADD_2D_ZONE', payload: brushData });
49
- break;
50
- default:
51
- break;
66
+ else if (brushData.shiftKey) {
67
+ switch (selectedTool) {
68
+ case options.zonePicking.id:
69
+ dispatch({ type: 'ADD_2D_ZONE', payload: brushData });
70
+ break;
71
+ default:
72
+ break;
73
+ }
52
74
  }
53
- }
54
- else {
55
- switch (selectedTool) {
56
- default:
57
- if (selectedTool != null) {
58
- return dispatch({
59
- type: 'BRUSH_END',
60
- payload: {
61
- ...brushData,
62
- trackID: getLayoutID(DIMENSION, brushData),
63
- },
64
- });
65
- }
75
+ else {
76
+ switch (selectedTool) {
77
+ default:
78
+ if (selectedTool != null) {
79
+ return dispatch({
80
+ type: 'BRUSH_END',
81
+ payload: {
82
+ ...brushData,
83
+ trackID: getLayoutID(DIMENSION, brushData),
84
+ },
85
+ });
86
+ }
87
+ }
66
88
  }
67
89
  }
68
90
  }
@@ -94,7 +116,7 @@ function Viewer2D({ emptyText = undefined }) {
94
116
  break;
95
117
  }
96
118
  }, [selectedTool]);
97
- return (_jsx(ResponsiveChart, { children: ({ width, height }) => (_jsxs(ViewerResponsiveWrapper, { width: width, height: height, children: [_jsx(Spinner, { isLoading: isLoading, emptyText: emptyText }), data && data.length > 0 && (_jsx(BrushTracker, { onBrush: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
119
+ return (_jsx(ResponsiveChart, { children: ({ width, height }) => (_jsxs(ViewerResponsiveWrapper, { width: width, height: height, children: [_jsx(Spinner, { isLoading: isLoading, emptyText: emptyText }), data && data.length > 0 && (_jsx(BrushTracker, { onBrush: handelBrush, onBrushEnd: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
98
120
  width: '100%',
99
121
  height: '100%',
100
122
  margin: 'auto',
@@ -27,7 +27,7 @@ function XAxis(props) {
27
27
  useEffect(() => {
28
28
  if (!show)
29
29
  return;
30
- let scaleX = get2DXScale({
30
+ const scaleX = get2DXScale({
31
31
  width,
32
32
  margin,
33
33
  xDomain,
@@ -27,7 +27,7 @@ function YAxis(props) {
27
27
  useEffect(() => {
28
28
  if (!show || !yDomain)
29
29
  return;
30
- let scaleY = get2DYScale({ height, yDomain, margin }, !!spectrum?.info?.isFid);
30
+ const scaleY = get2DYScale({ height, yDomain, margin }, !!spectrum?.info?.isFid);
31
31
  const axis = d3.axisRight(scaleY).ticks(8).tickFormat(d3.format('0'));
32
32
  // @ts-expect-error well typed
33
33
  d3.select(refAxis.current).call(axis);