nmrium 0.30.0 → 0.32.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 (273) hide show
  1. package/lib/component/1d/ApodizationLine.js +3 -1
  2. package/lib/component/1d/FooterBanner.js +20 -11
  3. package/lib/component/1d/IntegralsSeries.js +3 -1
  4. package/lib/component/1d/LinesSeries.js +3 -1
  5. package/lib/component/1d/SpectraTracker.js +1 -1
  6. package/lib/component/1d/Viewer1D.js +3 -1
  7. package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
  8. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  9. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
  10. package/lib/component/1d/peaks/PeakAnnotations.js +3 -1
  11. package/lib/component/1d/peaks/PeaksShapes.js +4 -2
  12. package/lib/component/1d/peaks/usePeakShapesPath.js +7 -3
  13. package/lib/component/1d/ranges/Ranges.js +8 -2
  14. package/lib/component/1d/tool/PeakPointer.js +3 -1
  15. package/lib/component/1d/tool/XLabelPointer.js +3 -1
  16. package/lib/component/2d/Contours.js +4 -2
  17. package/lib/component/2d/FooterBanner.js +3 -1
  18. package/lib/component/2d/Left1DChart.js +1 -1
  19. package/lib/component/2d/Top1DChart.js +1 -1
  20. package/lib/component/2d/Viewer2D.js +4 -4
  21. package/lib/component/2d/XAxis.js +2 -2
  22. package/lib/component/2d/YAxis.js +2 -2
  23. package/lib/component/2d/tools/XYLabelPointer.js +3 -1
  24. package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
  25. package/lib/component/2d/zones/IndicationLines.js +1 -1
  26. package/lib/component/2d/zones/Zones.js +14 -19
  27. package/lib/component/EventsTrackers/BrushTracker.js +30 -21
  28. package/lib/component/NMRium.d.ts +2 -0
  29. package/lib/component/NMRium.js +14 -3
  30. package/lib/component/SplitPaneWrapper.js +1 -1
  31. package/lib/component/elements/EditableColumn.d.ts +3 -1
  32. package/lib/component/elements/EditableColumn.js +18 -3
  33. package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
  34. package/lib/component/elements/popup/Modal/Provider.js +8 -11
  35. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -1
  36. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
  37. package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
  38. package/lib/component/hooks/useExport.d.ts +0 -1
  39. package/lib/component/hooks/useExport.js +1 -17
  40. package/lib/component/hooks/useIntegralPath.js +5 -2
  41. package/lib/component/hooks/useNucleus.js +4 -4
  42. package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
  43. package/lib/component/hooks/useSpectrum.js +3 -1
  44. package/lib/component/loader/DropZone.js +15 -147
  45. package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
  46. package/lib/component/modal/editRange/EditRangeModal.js +1 -1
  47. package/lib/component/modal/setting/GeneralTabContent.js +1 -1
  48. package/lib/component/modal/setting/ToolsTabContent.js +4 -0
  49. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
  50. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  51. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
  52. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  53. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  54. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  55. package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
  56. package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
  57. package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
  58. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
  59. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
  60. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
  61. package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
  62. package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
  63. package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
  64. package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
  65. package/lib/component/reducer/IgnoreActions.js +1 -0
  66. package/lib/component/reducer/Reducer.d.ts +110 -96
  67. package/lib/component/reducer/Reducer.js +45 -41
  68. package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
  69. package/lib/component/reducer/actions/DomainActions.js +12 -9
  70. package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
  71. package/lib/component/reducer/actions/FiltersActions.js +227 -232
  72. package/lib/component/reducer/actions/IntegralsActions.js +14 -8
  73. package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
  74. package/lib/component/reducer/actions/LoadActions.js +19 -34
  75. package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
  76. package/lib/component/reducer/actions/MoleculeActions.js +22 -6
  77. package/lib/component/reducer/actions/PeaksActions.js +19 -12
  78. package/lib/component/reducer/actions/PreferencesActions.js +9 -10
  79. package/lib/component/reducer/actions/RangesActions.d.ts +4 -4
  80. package/lib/component/reducer/actions/RangesActions.js +89 -29
  81. package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
  82. package/lib/component/reducer/actions/SpectrumsActions.js +14 -10
  83. package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
  84. package/lib/component/reducer/actions/ToolsActions.js +44 -27
  85. package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
  86. package/lib/component/reducer/actions/ZonesActions.js +69 -17
  87. package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
  88. package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
  89. package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
  90. package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
  91. package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
  92. package/lib/component/reducer/helper/getSpectrum.js +3 -2
  93. package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
  94. package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
  95. package/lib/component/reducer/types/Types.d.ts +5 -0
  96. package/lib/component/reducer/types/Types.js +5 -0
  97. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +6 -0
  98. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
  99. package/lib/component/tool/FloatMoleculeStructures/index.js +14 -8
  100. package/lib/component/toolbar/BasicToolBar.js +12 -13
  101. package/lib/component/toolbar/FunctionToolBar.js +3 -1
  102. package/lib/component/utility/Export.js +7 -1
  103. package/lib/component/utility/assert.d.ts +1 -0
  104. package/lib/component/utility/assert.js +5 -0
  105. package/lib/component/workspaces/Workspace.d.ts +1 -1
  106. package/lib/component/workspaces/exercise.js +9 -3
  107. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
  108. package/lib/data/Filters.d.ts +1 -2
  109. package/lib/data/Filters.js +1 -2
  110. package/lib/data/SpectraManager.d.ts +0 -4
  111. package/lib/data/SpectraManager.js +2 -87
  112. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
  113. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
  114. package/lib/data/data1d/filter1d/fft.js +11 -0
  115. package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
  116. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
  117. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
  118. package/lib/data/data2d/Processing2D.js +3 -2
  119. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
  120. package/lib/data/molecules/Molecule.d.ts +5 -0
  121. package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
  122. package/lib/data/utilities/calculateSanPlot.js +31 -0
  123. package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
  124. package/lib/versionInfo.js +1 -1
  125. package/lib-cjs/component/1d/ApodizationLine.js +3 -1
  126. package/lib-cjs/component/1d/FooterBanner.js +19 -10
  127. package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
  128. package/lib-cjs/component/1d/LinesSeries.js +3 -1
  129. package/lib-cjs/component/1d/SpectraTracker.js +1 -1
  130. package/lib-cjs/component/1d/Viewer1D.js +3 -1
  131. package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
  132. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  133. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
  134. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +3 -1
  135. package/lib-cjs/component/1d/peaks/PeaksShapes.js +4 -2
  136. package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +7 -3
  137. package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
  138. package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
  139. package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
  140. package/lib-cjs/component/2d/Contours.js +4 -2
  141. package/lib-cjs/component/2d/FooterBanner.js +3 -1
  142. package/lib-cjs/component/2d/Left1DChart.js +1 -1
  143. package/lib-cjs/component/2d/Top1DChart.js +1 -1
  144. package/lib-cjs/component/2d/Viewer2D.js +4 -4
  145. package/lib-cjs/component/2d/XAxis.js +2 -2
  146. package/lib-cjs/component/2d/YAxis.js +2 -2
  147. package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
  148. package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
  149. package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
  150. package/lib-cjs/component/2d/zones/Zones.js +13 -18
  151. package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
  152. package/lib-cjs/component/NMRium.js +14 -3
  153. package/lib-cjs/component/SplitPaneWrapper.js +1 -1
  154. package/lib-cjs/component/elements/EditableColumn.js +18 -3
  155. package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
  156. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -1
  157. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
  158. package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
  159. package/lib-cjs/component/hooks/useExport.js +0 -16
  160. package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
  161. package/lib-cjs/component/hooks/useNucleus.js +4 -4
  162. package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
  163. package/lib-cjs/component/hooks/useSpectrum.js +3 -1
  164. package/lib-cjs/component/loader/DropZone.js +14 -149
  165. package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
  166. package/lib-cjs/component/modal/editRange/EditRangeModal.js +1 -1
  167. package/lib-cjs/component/modal/setting/GeneralTabContent.js +1 -1
  168. package/lib-cjs/component/modal/setting/ToolsTabContent.js +4 -0
  169. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
  170. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  171. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
  172. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  173. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  174. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  175. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
  176. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
  177. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
  178. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
  179. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
  180. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -1
  181. package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
  182. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
  183. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
  184. package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
  185. package/lib-cjs/component/reducer/Reducer.js +48 -43
  186. package/lib-cjs/component/reducer/actions/DomainActions.js +12 -9
  187. package/lib-cjs/component/reducer/actions/FiltersActions.js +228 -233
  188. package/lib-cjs/component/reducer/actions/IntegralsActions.js +14 -8
  189. package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
  190. package/lib-cjs/component/reducer/actions/MoleculeActions.js +23 -6
  191. package/lib-cjs/component/reducer/actions/PeaksActions.js +19 -12
  192. package/lib-cjs/component/reducer/actions/PreferencesActions.js +9 -10
  193. package/lib-cjs/component/reducer/actions/RangesActions.js +89 -29
  194. package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
  195. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -10
  196. package/lib-cjs/component/reducer/actions/ToolsActions.js +44 -27
  197. package/lib-cjs/component/reducer/actions/ZonesActions.js +72 -17
  198. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
  199. package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
  200. package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
  201. package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
  202. package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
  203. package/lib-cjs/component/reducer/types/Types.js +8 -3
  204. package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
  205. package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +14 -8
  206. package/lib-cjs/component/toolbar/BasicToolBar.js +11 -12
  207. package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
  208. package/lib-cjs/component/utility/Export.js +7 -1
  209. package/lib-cjs/component/utility/assert.js +9 -0
  210. package/lib-cjs/component/workspaces/exercise.js +9 -3
  211. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
  212. package/lib-cjs/data/Filters.js +1 -3
  213. package/lib-cjs/data/SpectraManager.js +3 -92
  214. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
  215. package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
  216. package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
  217. package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
  218. package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
  219. package/lib-cjs/data/data2d/Processing2D.js +3 -2
  220. package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
  221. package/lib-cjs/versionInfo.js +1 -1
  222. package/package.json +26 -25
  223. package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
  224. package/lib/component/utility/nmredataToNmrium.js +0 -66
  225. package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
  226. package/lib/component/utility/nmriumToNmredata.js +0 -80
  227. package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
  228. package/lib/component/utility/util/nmredata/addRanges.js +0 -52
  229. package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
  230. package/lib/component/utility/util/nmredata/addSource.js +0 -54
  231. package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
  232. package/lib/component/utility/util/nmredata/addZones.js +0 -41
  233. package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
  234. package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
  235. package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
  236. package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
  237. package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
  238. package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
  239. package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
  240. package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
  241. package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
  242. package/lib/component/utility/util/nmredata/getLabels.js +0 -66
  243. package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
  244. package/lib/component/utility/util/nmredata/getToFix.js +0 -19
  245. package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
  246. package/lib/data/data1d/filter1d/absolute.js +0 -26
  247. package/lib/data/migration/MigrationManager.d.ts +0 -2
  248. package/lib/data/migration/MigrationManager.js +0 -19
  249. package/lib/data/migration/changeKeys.d.ts +0 -1
  250. package/lib/data/migration/changeKeys.js +0 -9
  251. package/lib/data/migration/migrateToVersion1.d.ts +0 -11
  252. package/lib/data/migration/migrateToVersion1.js +0 -32
  253. package/lib/data/migration/migrateToVersion2.d.ts +0 -1
  254. package/lib/data/migration/migrateToVersion2.js +0 -111
  255. package/lib/data/migration/migrateToVersion3.d.ts +0 -1
  256. package/lib/data/migration/migrateToVersion3.js +0 -55
  257. package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
  258. package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
  259. package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
  260. package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
  261. package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -45
  262. package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
  263. package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
  264. package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
  265. package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
  266. package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
  267. package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
  268. package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
  269. package/lib-cjs/data/migration/MigrationManager.js +0 -26
  270. package/lib-cjs/data/migration/changeKeys.js +0 -13
  271. package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
  272. package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
  273. package/lib-cjs/data/migration/migrateToVersion3.js +0 -58
@@ -6,9 +6,12 @@ import { LAYOUT } from '../../2d/utilities/DimensionLayout';
6
6
  import { get2DYScale } from '../../2d/utilities/scale';
7
7
  import { options } from '../../toolbar/ToolTypes';
8
8
  import groupByInfoKey from '../../utility/GroupByInfoKey';
9
+ import { rangeStateInit } from '../Reducer';
9
10
  import { DISPLAYER_MODE, MARGIN } from '../core/Constants';
10
11
  import { setZoom, wheelZoom, ZoomType } from '../helper/Zoom1DManager';
11
12
  import zoomHistoryManager from '../helper/ZoomHistoryManager';
13
+ import { getActiveSpectrum } from '../helper/getActiveSpectrum';
14
+ import { getActiveSpectrumOrFail } from '../helper/getActiveSpectrumOrFail';
12
15
  import { setDomain, setIntegralsYDomain, setMode, } from './DomainActions';
13
16
  import { calculateBaseLineCorrection, resetSpectrumByFilter, setFilterChanges, } from './FiltersActions';
14
17
  import { changeSpectrumVerticalAlignment } from './PreferencesActions';
@@ -40,7 +43,18 @@ function setSelectedTool(draft, action) {
40
43
  if (selectedTool) {
41
44
  // start Range edit mode
42
45
  if (selectedTool === options.editRange.id) {
43
- draft.toolOptions.data.showMultiplicityTrees = true;
46
+ const activeSpectrum = getActiveSpectrumOrFail(draft);
47
+ const range = draft.view.ranges.find((r) => r.spectrumID === activeSpectrum?.id);
48
+ if (range) {
49
+ range.showMultiplicityTrees = true;
50
+ }
51
+ else {
52
+ draft.view.ranges.push({
53
+ spectrumID: activeSpectrum.id,
54
+ ...rangeStateInit,
55
+ showMultiplicityTrees: true,
56
+ });
57
+ }
44
58
  }
45
59
  if (selectedTool !== draft.toolOptions.selectedTool) {
46
60
  resetTool(draft, false);
@@ -99,10 +113,11 @@ function handleDeleteBaseLineZone(draft, id) {
99
113
  calculateBaseLineCorrection(draft);
100
114
  }
101
115
  function handleToggleRealImaginaryVisibility(draft) {
102
- if (draft.activeSpectrum != null) {
103
- const { index } = draft.activeSpectrum;
104
- draft.data[index].display.isRealSpectrumVisible =
105
- !draft.data[index].display.isRealSpectrumVisible;
116
+ const activeSpectrum = getActiveSpectrum(draft);
117
+ if (activeSpectrum != null) {
118
+ const { index } = activeSpectrum;
119
+ const datum = draft.data[index];
120
+ datum.display.isRealSpectrumVisible = !datum.display.isRealSpectrumVisible;
106
121
  setDomain(draft);
107
122
  }
108
123
  }
@@ -116,7 +131,7 @@ function handleBrushEnd(draft, action) {
116
131
  const endY = yScale.invert(action.endY);
117
132
  const domainX = startX > endX ? [endX, startX] : [startX, endX];
118
133
  const domainY = startY > endY ? [endY, startY] : [startY, endY];
119
- const brushHistory = zoomHistoryManager(draft.zoom.history, draft.activeTab);
134
+ const brushHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
120
135
  if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
121
136
  switch (action.trackID) {
122
137
  case LAYOUT.CENTER_2D:
@@ -144,21 +159,25 @@ function handleBrushEnd(draft, action) {
144
159
  }
145
160
  }
146
161
  function setVerticalIndicatorXPosition(draft, position) {
147
- if (draft.activeSpectrum?.id) {
162
+ const activeSpectrum = getActiveSpectrum(draft);
163
+ if (activeSpectrum?.id) {
148
164
  const scaleX = getXScale(draft);
149
165
  const value = scaleX.invert(position);
150
- const datum = draft.data[draft.activeSpectrum.index];
166
+ const datum = draft.data[activeSpectrum.index];
151
167
  const index = xFindClosestIndex(datum.data.x, value);
152
168
  draft.toolOptions.data.pivot = { value, index };
153
169
  }
154
170
  }
155
171
  function getSpectrumID(draft, index) {
156
- const spectrum = draft.tabActiveSpectrum[draft.activeTab.split(',')[index]];
157
- return spectrum?.id ? spectrum.id : null;
172
+ const spectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab.split(',')[index]];
173
+ return spectrum?.id || null;
158
174
  }
159
175
  function handleZoom(draft, action) {
160
176
  const { event, trackID, selectedTool } = action;
161
- const { activeSpectrum, toolOptions: { data: { showRangesIntegrals }, }, displayerMode, } = draft;
177
+ const { view: { ranges: rangeState }, displayerMode, } = draft;
178
+ const activeSpectrum = getActiveSpectrum(draft);
179
+ const { showRangesIntegrals } = rangeState.find((r) => r.spectrumID === activeSpectrum?.id) ||
180
+ rangeStateInit;
162
181
  if (displayerMode === DISPLAYER_MODE.DM_2D) {
163
182
  const index = trackID === LAYOUT.TOP_1D ? 0 : trackID === LAYOUT.LEFT_1D ? 1 : null;
164
183
  if (index !== null) {
@@ -190,7 +209,7 @@ function handleZoom(draft, action) {
190
209
  function zoomOut(draft, action) {
191
210
  if (draft?.data.length > 0) {
192
211
  const { zoomType, trackID } = action;
193
- const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.activeTab);
212
+ const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
194
213
  if (draft.displayerMode === DISPLAYER_MODE.DM_1D) {
195
214
  switch (zoomType) {
196
215
  case ZoomType.HORIZONTAL: {
@@ -233,8 +252,8 @@ function zoomOut(draft, action) {
233
252
  }
234
253
  }
235
254
  function hasAcceptedSpectrum(draft, index) {
236
- const nucleuses = draft.activeTab.split(',');
237
- const activeSpectrum = draft.tabActiveSpectrum[nucleuses[index]];
255
+ const nucleuses = draft.view.spectra.activeTab.split(',');
256
+ const activeSpectrum = draft.view.spectra.activeSpectra[nucleuses[index]];
238
257
  return (activeSpectrum?.id &&
239
258
  !draft.data[activeSpectrum.index].info.isFid);
240
259
  }
@@ -259,7 +278,7 @@ function setMargin(draft) {
259
278
  function processing2DData(draft, data) {
260
279
  if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
261
280
  let _data = {};
262
- for (const datum of data[draft.activeTab]) {
281
+ for (const datum of data[draft.view.spectra.activeTab]) {
263
282
  _data[datum.id] = datum.processingController.drawContours();
264
283
  }
265
284
  draft.contours = _data;
@@ -305,29 +324,26 @@ function setTabActiveSpectrum(draft, dataGroupByTab) {
305
324
  }
306
325
  }
307
326
  }
308
- draft.tabActiveSpectrum = tabActiveSpectrum;
327
+ draft.view.spectra.activeSpectra = tabActiveSpectrum;
309
328
  return tabs2D;
310
329
  }
311
330
  function setTab(draft, dataGroupByTab, tab, refresh = false) {
312
331
  const groupByTab = Object.keys(dataGroupByTab).sort((a, b) => a.split(',').length > b.split(',').length ? -1 : 1);
313
332
  if (JSON.stringify(groupByTab) !==
314
- JSON.stringify(Object.keys(draft.tabActiveSpectrum)) ||
333
+ JSON.stringify(Object.keys(draft.view.spectra.activeSpectra)) ||
315
334
  refresh) {
316
335
  const tabs2D = setTabActiveSpectrum(draft, dataGroupByTab);
317
336
  if (tabs2D.length > 0 && tab == null) {
318
- draft.activeSpectrum = draft.tabActiveSpectrum[tabs2D[0]];
319
- draft.activeTab = tabs2D[0];
337
+ draft.view.spectra.activeTab = tabs2D[0];
320
338
  }
321
339
  else {
322
- draft.activeSpectrum = tab ? draft.tabActiveSpectrum[tab] : tab;
323
- draft.activeTab = tab;
340
+ draft.view.spectra.activeTab = tab;
324
341
  }
325
342
  }
326
343
  else {
327
- draft.activeTab = tab;
328
- draft.activeSpectrum = draft.tabActiveSpectrum[tab];
344
+ draft.view.spectra.activeTab = tab;
329
345
  }
330
- setDisplayerMode(draft, dataGroupByTab[draft.activeTab]);
346
+ setDisplayerMode(draft, dataGroupByTab[draft.view.spectra.activeTab]);
331
347
  setMargin(draft);
332
348
  }
333
349
  function setActiveTab(draft, options) {
@@ -341,7 +357,7 @@ function setActiveTab(draft, options) {
341
357
  processing2DData(draft, dataGroupByNucleus);
342
358
  setDomain(draft, domainOptions);
343
359
  setIntegralsYDomain(draft, dataGroupByNucleus[currentTab]);
344
- const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.activeTab);
360
+ const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
345
361
  const zoomValue = zoomHistory.getLast();
346
362
  if (zoomValue) {
347
363
  draft.xDomain = zoomValue.xDomain;
@@ -355,9 +371,10 @@ function handelSetActiveTab(draft, tab) {
355
371
  }
356
372
  }
357
373
  function levelChangeHandler(draft, { deltaY, shiftKey }) {
374
+ const activeSpectrum = getActiveSpectrum(draft);
358
375
  try {
359
- if (draft.activeSpectrum?.id) {
360
- const { index, id } = draft.activeSpectrum;
376
+ if (activeSpectrum?.id) {
377
+ const { index, id } = activeSpectrum;
361
378
  const processingController = draft.data[index]
362
379
  .processingController;
363
380
  if (shiftKey) {
@@ -12,4 +12,7 @@ declare function handleSetSignalPathLength(draft: Draft<State>, action: any): vo
12
12
  declare function handleUnlinkZone(draft: Draft<State>, action: any): void;
13
13
  declare function handleSetDiaIDZone(draft: Draft<State>, action: any): void;
14
14
  declare function handleSaveEditedZone(draft: Draft<State>, action: any): void;
15
- export { add2dZoneHandler, handleAutoZonesDetection, handleDeleteSignal, handleDeleteZone, changeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, changeZonesFactorHandler, handleAutoSpectraZonesDetection, };
15
+ declare function handleShowZones(draft: Draft<State>, action: any): void;
16
+ declare function handleShowSignals(draft: Draft<State>, action: any): void;
17
+ declare function handleShowPeaks(draft: Draft<State>, action: any): void;
18
+ export { add2dZoneHandler, handleAutoZonesDetection, handleDeleteSignal, handleDeleteZone, changeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, changeZonesFactorHandler, handleAutoSpectraZonesDetection, handleShowZones, handleShowSignals, handleShowPeaks, };
@@ -6,15 +6,18 @@ import * as FiltersManager from '../../../data/FiltersManager';
6
6
  import { DatumKind, SignalKindsToInclude, } from '../../../data/constants/SignalsKinds';
7
7
  import { changeZoneSignal, detectZones, detectZonesManual, updateShift, } from '../../../data/data2d/Spectrum2D';
8
8
  import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/ZoneUtilities';
9
+ import { zoneStateInit } from '../Reducer';
9
10
  import get2DRange from '../helper/get2DRange';
11
+ import { getActiveSpectrum } from '../helper/getActiveSpectrum';
10
12
  import { handleUpdateCorrelations } from './CorrelationsActions';
11
13
  import { setDomain } from './DomainActions';
12
14
  function changeZonesFactorHandler(draft, action) {
13
15
  draft.toolOptions.data.zonesNoiseFactor = action.payload;
14
16
  }
15
17
  function add2dZoneHandler(draft, action) {
16
- if (draft.activeSpectrum?.id) {
17
- const { index } = draft.activeSpectrum;
18
+ const activeSpectrum = getActiveSpectrum(draft);
19
+ if (activeSpectrum?.id) {
20
+ const { index } = activeSpectrum;
18
21
  const drawnZone = get2DRange(draft, action);
19
22
  const datum = draft.data[index];
20
23
  const zones = detectZonesManual(original(datum), {
@@ -27,8 +30,9 @@ function add2dZoneHandler(draft, action) {
27
30
  }
28
31
  }
29
32
  function handleAutoZonesDetection(draft, detectionOptions) {
30
- if (draft.activeSpectrum?.id) {
31
- const { index } = draft.activeSpectrum;
33
+ const activeSpectrum = getActiveSpectrum(draft);
34
+ if (activeSpectrum?.id) {
35
+ const { index } = activeSpectrum;
32
36
  const [fromX, toX] = draft.xDomain;
33
37
  const [fromY, toY] = draft.yDomain;
34
38
  detectionOptions.selectedZone = { fromX, toX, fromY, toY };
@@ -54,8 +58,9 @@ function handleAutoSpectraZonesDetection(draft) {
54
58
  }
55
59
  function changeZoneSignalDelta(draft, action) {
56
60
  const { zoneID, signal } = action.payload;
57
- if (draft.activeSpectrum?.id) {
58
- const { index } = draft.activeSpectrum;
61
+ const activeSpectrum = getActiveSpectrum(draft);
62
+ if (activeSpectrum?.id) {
63
+ const { index } = activeSpectrum;
59
64
  const { xShift, yShift } = changeZoneSignal(draft.data[index], zoneID, signal);
60
65
  let filters = [];
61
66
  if (xShift !== 0) {
@@ -75,8 +80,9 @@ function getZoneIndex(state, spectrumIndex, zoneID) {
75
80
  }
76
81
  function handleChangeZoneSignalKind(draft, action) {
77
82
  const state = original(draft);
78
- if (state.activeSpectrum?.id) {
79
- const { index } = state.activeSpectrum;
83
+ const activeSpectrum = getActiveSpectrum(state);
84
+ if (activeSpectrum?.id) {
85
+ const { index } = activeSpectrum;
80
86
  const { rowData, value } = action.payload;
81
87
  const zoneIndex = getZoneIndex(state, index, rowData.id);
82
88
  const _zone = draft.data[index].zones.values[zoneIndex];
@@ -89,8 +95,9 @@ function handleChangeZoneSignalKind(draft, action) {
89
95
  }
90
96
  function handleDeleteZone(draft, action) {
91
97
  const state = original(draft);
92
- if (state.activeSpectrum?.id) {
93
- const { index } = state.activeSpectrum;
98
+ const activeSpectrum = getActiveSpectrum(state);
99
+ if (activeSpectrum?.id) {
100
+ const { index } = activeSpectrum;
94
101
  const { id, assignmentData } = action.payload;
95
102
  if (id) {
96
103
  const zone = draft.data[index].zones.values.find((zone) => zone.id === id);
@@ -143,8 +150,9 @@ function handleSetSignalPathLength(draft, action) {
143
150
  }
144
151
  function handleUnlinkZone(draft, action) {
145
152
  const state = original(draft);
146
- if (state.activeSpectrum?.id) {
147
- const { index } = state.activeSpectrum;
153
+ const activeSpectrum = getActiveSpectrum(state);
154
+ if (activeSpectrum?.id) {
155
+ const { index } = activeSpectrum;
148
156
  const { zoneData = null, assignmentData, isOnZoneLevel = undefined, signalIndex = -1, axis = undefined, } = action.payload;
149
157
  if (zoneData) {
150
158
  // remove assignments in global state
@@ -165,8 +173,9 @@ function handleUnlinkZone(draft, action) {
165
173
  }
166
174
  function handleSetDiaIDZone(draft, action) {
167
175
  const state = original(draft);
168
- if (state.activeSpectrum?.id) {
169
- const { index } = state.activeSpectrum;
176
+ const activeSpectrum = getActiveSpectrum(state);
177
+ if (activeSpectrum?.id) {
178
+ const { index } = activeSpectrum;
170
179
  const { zoneData, diaIDs, axis, signalIndex, nbAtoms } = action.payload;
171
180
  const getNbAtoms = (input, current = 0) => input + current;
172
181
  const zoneIndex = getZoneIndex(state, index, zoneData.id);
@@ -183,8 +192,9 @@ function handleSetDiaIDZone(draft, action) {
183
192
  }
184
193
  function handleSaveEditedZone(draft, action) {
185
194
  const state = original(draft);
186
- if (state.activeSpectrum?.id) {
187
- const { index } = state.activeSpectrum;
195
+ const activeSpectrum = getActiveSpectrum(state);
196
+ if (activeSpectrum?.id) {
197
+ const { index } = activeSpectrum;
188
198
  const { editedRowData } = action.payload;
189
199
  delete editedRowData.tableMetaInfo;
190
200
  const zoneIndex = getZoneIndex(state, index, editedRowData.id);
@@ -197,7 +207,49 @@ function handleSaveEditedZone(draft, action) {
197
207
  handleOnChangeZonesData(draft);
198
208
  }
199
209
  }
210
+ function handleShowZones(draft, action) {
211
+ const { id } = action.payload;
212
+ const zone = draft.view.zones.find((r) => r.spectrumID === id);
213
+ if (zone) {
214
+ zone.showZones = !zone.showZones;
215
+ }
216
+ else {
217
+ draft.view.zones.push({
218
+ spectrumID: id,
219
+ ...zoneStateInit,
220
+ showZones: !zoneStateInit.showZones,
221
+ });
222
+ }
223
+ }
224
+ function handleShowSignals(draft, action) {
225
+ const { id } = action.payload;
226
+ const zone = draft.view.zones.find((r) => r.spectrumID === id);
227
+ if (zone) {
228
+ zone.showSignals = !zone.showSignals;
229
+ }
230
+ else {
231
+ draft.view.zones.push({
232
+ spectrumID: id,
233
+ ...zoneStateInit,
234
+ showSignals: !zoneStateInit.showSignals,
235
+ });
236
+ }
237
+ }
238
+ function handleShowPeaks(draft, action) {
239
+ const { id } = action.payload;
240
+ const zone = draft.view.zones.find((r) => r.spectrumID === id);
241
+ if (zone) {
242
+ zone.showPeaks = !zone.showPeaks;
243
+ }
244
+ else {
245
+ draft.view.zones.push({
246
+ spectrumID: id,
247
+ ...zoneStateInit,
248
+ showPeaks: !zoneStateInit.showPeaks,
249
+ });
250
+ }
251
+ }
200
252
  function handleOnChangeZonesData(draft) {
201
253
  handleUpdateCorrelations(draft);
202
254
  }
203
- export { add2dZoneHandler, handleAutoZonesDetection, handleDeleteSignal, handleDeleteZone, changeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, changeZonesFactorHandler, handleAutoSpectraZonesDetection, };
255
+ export { add2dZoneHandler, handleAutoZonesDetection, handleDeleteSignal, handleDeleteZone, changeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, changeZonesFactorHandler, handleAutoSpectraZonesDetection, handleShowZones, handleShowSignals, handleShowPeaks, };
@@ -14,7 +14,8 @@ function wheelZoom(event, domain, zoomOptions = {}) {
14
14
  return [min * ratio, max * ratio];
15
15
  }
16
16
  function setZoom(draft, options = {}) {
17
- const { height, margin, activeSpectrum } = draft;
17
+ const { height, margin } = draft;
18
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
18
19
  const { scale = 1, spectrumID = null } = options;
19
20
  if (activeSpectrum === null && spectrumID === null) {
20
21
  const { shareYDomain, yDomain, yDomains } = draft.originDomain;
@@ -0,0 +1,3 @@
1
+ import { Draft } from 'immer';
2
+ import { State } from '../Reducer';
3
+ export declare function getActiveSpectrum(state: Draft<State> | State): import("../Reducer").ActiveSpectrum | null;
@@ -0,0 +1,4 @@
1
+ export function getActiveSpectrum(state) {
2
+ const { activeSpectra, activeTab } = state.view.spectra;
3
+ return activeSpectra[activeTab] || null;
4
+ }
@@ -0,0 +1,3 @@
1
+ import { Draft } from 'immer';
2
+ import { State } from '../Reducer';
3
+ export declare function getActiveSpectrumOrFail(draft: Draft<State>): import("immer/dist/internal").WritableDraft<import("../Reducer").ActiveSpectrum>;
@@ -0,0 +1,6 @@
1
+ import { assert } from '../../utility/assert';
2
+ export function getActiveSpectrumOrFail(draft) {
3
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
4
+ assert(activeSpectrum !== null, 'Active spectrum must have id');
5
+ return activeSpectrum;
6
+ }
@@ -1,7 +1,8 @@
1
1
  export function getSpectrum(state, value) {
2
+ const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
2
3
  if (value === undefined) {
3
- if (state.activeSpectrum?.id) {
4
- const index = state.activeSpectrum.index;
4
+ if (activeSpectrum?.id) {
5
+ const index = activeSpectrum.index;
5
6
  return state.data[index];
6
7
  }
7
8
  }
@@ -1,6 +1,7 @@
1
1
  import { max } from 'd3';
2
2
  export function getStrongestPeak(draft) {
3
- const { activeSpectrum, data } = draft;
3
+ const { data } = draft;
4
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
4
5
  if (activeSpectrum) {
5
6
  const activeData = data[activeSpectrum?.index].data;
6
7
  const strongestPeakValue = max(activeData.re);
@@ -48,7 +48,7 @@ declare const preferencesReducer: (base: {
48
48
  readonly open?: boolean | undefined;
49
49
  } | undefined;
50
50
  readonly hidePanelOnLoad?: boolean | undefined;
51
- readonly initialPanelWidth?: import("analysis-ui-components/lib-esm/components/SplitPane").InitialSeparation | undefined;
51
+ readonly initialPanelWidth?: import("analysis-ui-components").SplitPaneSize | undefined;
52
52
  } | undefined;
53
53
  readonly panels?: {
54
54
  readonly spectraPanel?: {
@@ -127,7 +127,7 @@ declare const preferencesReducer: (base: {
127
127
  } | undefined;
128
128
  };
129
129
  readonly general: {
130
- readonly dimmedSpectraTransparency: number;
130
+ readonly dimmedSpectraOpacity: number;
131
131
  };
132
132
  readonly formatting: {
133
133
  readonly nuclei: {
@@ -12,6 +12,7 @@ export declare const LOAD_NMREDATA_FILE = "LOAD_NMREDATA_FILE";
12
12
  export declare const LOAD_MOL_FILE = "LOAD_MOL_FILE";
13
13
  export declare const LOAD_ZIP_FILE = "LOAD_ZIP_FILE";
14
14
  export declare const LOAD_JDF_FILE = "LOAD_JDF_FILE";
15
+ export declare const LOAD_DROP_FILES = "LOAD_DROP_FILES";
15
16
  export declare const ADD_PEAK = "ADD_PEAK";
16
17
  export declare const ADD_PEAKS = "ADD_PEAKS";
17
18
  export declare const CHANGE_PEAK_SHAPE = "CHANGE_PEAK_SHAPE";
@@ -39,6 +40,7 @@ export declare const ADD_MOLECULE = "ADD_MOLECULE";
39
40
  export declare const SET_MOLECULE = "SET_MOLECULE";
40
41
  export declare const DELETE_MOLECULE = "DELETE_MOLECULE";
41
42
  export declare const FLOAT_MOLECULE_OVER_SPECTRUM = "FLOAT_MOLECULE_OVER_SPECTRUM";
43
+ export declare const CHANGE_FLOAT_MOLECULE_POSITION = "CHANGE_FLOAT_MOLECULE_POSITION";
42
44
  export declare const CHANGE_MOLECULE_LABEL = "CHANGE_MOLECULE_LABEL";
43
45
  export declare const SET_CORRELATION = "SET_CORRELATION";
44
46
  export declare const SET_CORRELATIONS = "SET_CORRELATIONS";
@@ -127,6 +129,9 @@ export declare const SHOW_MULTIPLICTY_TREES = "SHOW_MULTIPLICTY_TREES";
127
129
  export declare const SHOW_RANGES_INTEGRALS = "SHOW_RANGES_INTEGRALS";
128
130
  export declare const AUTO_RANGES_SPECTRA_PICKING = "AUTO_RANGES_SPECTRA_PICKING";
129
131
  export declare const AUTO_ZONES_SPECTRA_PICKING = "AUTO_ZONES_SPECTRA_PICKING";
132
+ export declare const SHOW_ZONES = "SHOW_ZONES";
133
+ export declare const SHOW_ZONES_SIGNALS = "SHOW_ZONES_SIGNALS";
134
+ export declare const SHOW_ZONES_PEAKS = "SHOW_ZONES_PEAKS";
130
135
  export declare const GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = "GENERATE_SPECTRUM_FROM_PUBLICATION_STRING";
131
136
  export declare const RESURRECTING_SPECTRUM_FROM_RANGES = "RESURRECTING_SPECTRUM_FROM_RANGES";
132
137
  export declare const RESURRECTING_SPECTRUM_FROM_JCAMP = "RESURRECTING_SPECTRUM_FROM_JCAMP";
@@ -6,6 +6,7 @@ export const LOAD_NMREDATA_FILE = 'LOAD_NMREDATA_FILE';
6
6
  export const LOAD_MOL_FILE = 'LOAD_MOL_FILE';
7
7
  export const LOAD_ZIP_FILE = 'LOAD_ZIP_FILE';
8
8
  export const LOAD_JDF_FILE = 'LOAD_JDF_FILE';
9
+ export const LOAD_DROP_FILES = 'LOAD_DROP_FILES';
9
10
  export const ADD_PEAK = 'ADD_PEAK';
10
11
  export const ADD_PEAKS = 'ADD_PEAKS';
11
12
  export const CHANGE_PEAK_SHAPE = 'CHANGE_PEAK_SHAPE';
@@ -33,6 +34,7 @@ export const ADD_MOLECULE = 'ADD_MOLECULE';
33
34
  export const SET_MOLECULE = 'SET_MOLECULE';
34
35
  export const DELETE_MOLECULE = 'DELETE_MOLECULE';
35
36
  export const FLOAT_MOLECULE_OVER_SPECTRUM = 'FLOAT_MOLECULE_OVER_SPECTRUM';
37
+ export const CHANGE_FLOAT_MOLECULE_POSITION = 'CHANGE_FLOAT_MOLECULE_POSITION';
36
38
  export const CHANGE_MOLECULE_LABEL = 'CHANGE_MOLECULE_LABEL';
37
39
  export const SET_CORRELATION = 'SET_CORRELATION';
38
40
  export const SET_CORRELATIONS = 'SET_CORRELATIONS';
@@ -121,6 +123,9 @@ export const SHOW_MULTIPLICTY_TREES = 'SHOW_MULTIPLICTY_TREES';
121
123
  export const SHOW_RANGES_INTEGRALS = 'SHOW_RANGES_INTEGRALS';
122
124
  export const AUTO_RANGES_SPECTRA_PICKING = 'AUTO_RANGES_SPECTRA_PICKING';
123
125
  export const AUTO_ZONES_SPECTRA_PICKING = 'AUTO_ZONES_SPECTRA_PICKING';
126
+ export const SHOW_ZONES = 'SHOW_ZONES';
127
+ export const SHOW_ZONES_SIGNALS = 'SHOW_ZONES_SIGNALS';
128
+ export const SHOW_ZONES_PEAKS = 'SHOW_ZONES_PEAKS';
124
129
  export const GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = 'GENERATE_SPECTRUM_FROM_PUBLICATION_STRING';
125
130
  export const RESURRECTING_SPECTRUM_FROM_RANGES = 'RESURRECTING_SPECTRUM_FROM_RANGES';
126
131
  export const RESURRECTING_SPECTRUM_FROM_JCAMP = 'RESURRECTING_SPECTRUM_FROM_JCAMP';
@@ -1,14 +1,20 @@
1
1
  import { StateMoleculeExtended } from '../../../data/molecules/Molecule';
2
2
  import { Ranges } from '../../../data/types/data1d';
3
3
  import { Zones } from '../../../data/types/data2d';
4
+ import { Position } from '../../elements/draggble/useDraggable';
4
5
  import { DISPLAYER_MODE } from '../../reducer/core/Constants';
5
6
  interface DraggableStructureProps {
6
7
  zones: Zones;
7
8
  ranges: Ranges;
8
9
  molecule: StateMoleculeExtended;
10
+ position?: Position;
9
11
  activeTab: string;
10
12
  displayerMode: DISPLAYER_MODE;
11
13
  index?: number;
12
14
  }
15
+ export declare const DRAGGABLE_STRUCTURE_INITIAL_POSITION: {
16
+ x: number;
17
+ y: number;
18
+ };
13
19
  export declare function DraggableStructure(props: DraggableStructureProps): import("@emotion/react/jsx-runtime").JSX.Element;
14
20
  export {};
@@ -9,7 +9,7 @@ import { useGlobal } from '../../context/GlobalContext';
9
9
  import SVGDraggable from '../../elements/draggble/SVGDraggable';
10
10
  import { useMoleculeEditor } from '../../modal/MoleculeStructureEditorModal';
11
11
  import useAtomAssignment from '../../panels/MoleculesPanel/useAtomAssignment';
12
- import { FLOAT_MOLECULE_OVER_SPECTRUM, SET_MOLECULE, } from '../../reducer/types/Types';
12
+ import { CHANGE_FLOAT_MOLECULE_POSITION, FLOAT_MOLECULE_OVER_SPECTRUM, SET_MOLECULE, } from '../../reducer/types/Types';
13
13
  import ActionsButton from './ActionsButton';
14
14
  const style = css `
15
15
  border: 1px solid transparent;
@@ -25,8 +25,9 @@ const style = css `
25
25
  }
26
26
  }
27
27
  `;
28
+ export const DRAGGABLE_STRUCTURE_INITIAL_POSITION = { x: 100, y: 50 };
28
29
  export function DraggableStructure(props) {
29
- const { zones, ranges, molecule, activeTab, displayerMode, index } = props;
30
+ const { zones, ranges, molecule, activeTab, displayerMode, index, position = DRAGGABLE_STRUCTURE_INITIAL_POSITION, } = props;
30
31
  const { viewerRef } = useGlobal();
31
32
  const dispatch = useDispatch();
32
33
  const openMoleculeEditor = useMoleculeEditor();
@@ -37,7 +38,13 @@ export function DraggableStructure(props) {
37
38
  payload: { id: molecule.id },
38
39
  });
39
40
  }, [dispatch, molecule]);
40
- return (_jsx(SVGDraggable, { width: 150, height: 100, initialPosition: { x: 100, y: 50 }, dragHandleClassName: "handle", parentElement: viewerRef, children: (width, height) => (_jsxs("foreignObject", { width: width, height: height + 30, "data-replace-float-structure": "true", css: style, onDoubleClick: () => openMoleculeEditor(molecule), children: [_jsx(ActionsButton, { onFloatBtnClick: floatMoleculeHandler }), _jsx(OCLnmr, { OCL: OCL, autoCrop: true, id: `molSVG${index || ''}`, width: width - 20, height: height, molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
41
+ const dragFloatMoleculeHandler = useCallback((position) => {
42
+ dispatch({
43
+ type: CHANGE_FLOAT_MOLECULE_POSITION,
44
+ payload: { id: molecule.id, position },
45
+ });
46
+ }, [dispatch, molecule]);
47
+ return (_jsx(SVGDraggable, { width: 150, height: 100, initialPosition: position, dragHandleClassName: "handle", parentElement: viewerRef, onEnd: dragFloatMoleculeHandler, children: (width, height) => (_jsxs("foreignObject", { width: width, height: height + 30, "data-replace-float-structure": "true", css: style, onDoubleClick: () => openMoleculeEditor(molecule), children: [_jsx(ActionsButton, { onFloatBtnClick: floatMoleculeHandler }), _jsx(OCLnmr, { OCL: OCL, autoCrop: true, id: `molSVG${index || ''}`, width: width - 20, height: height, molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
41
48
  ? currentDiaIDsToHighlight
42
49
  : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: (molfile) => {
43
50
  dispatch({
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
3
  import { useChartData } from '../../context/ChartContext';
4
4
  import useSpectrum from '../../hooks/useSpectrum';
5
+ import { assert } from '../../utility/assert';
5
6
  import { DraggableStructure } from './DraggableStructure';
6
7
  export function FloatMoleculeStructuresInner(props) {
7
8
  const { zones, ranges, floatingMolecules, molecules, activeTab, displayerMode, } = props;
@@ -9,18 +10,23 @@ export function FloatMoleculeStructuresInner(props) {
9
10
  return null;
10
11
  return (_jsx("g", { children: floatingMolecules
11
12
  .filter((molecule) => molecule.visible)
12
- .map((molecule) => (_jsx(DraggableStructure, { ...{
13
- zones,
14
- ranges,
15
- activeTab,
16
- displayerMode,
17
- molecule: molecules.find((m) => m.id === molecule.id),
18
- } }, molecule.id))) }));
13
+ .map(({ id, position }) => {
14
+ const molecule = molecules.find((m) => m.id === id);
15
+ assert(molecule !== undefined, 'molecule should be defined');
16
+ return (_jsx(DraggableStructure, { ...{
17
+ zones,
18
+ ranges,
19
+ activeTab,
20
+ displayerMode,
21
+ position,
22
+ molecule,
23
+ } }, id));
24
+ }) }));
19
25
  }
20
26
  const MemoizedFloatMoleculeStructures = memo(FloatMoleculeStructuresInner);
21
27
  const emptyData = { ranges: {}, zones: {} };
22
28
  export default function FloatMoleculeStructures() {
23
- const { molecules, displayerMode, activeTab, view: { floatingMolecules }, } = useChartData();
29
+ const { molecules, displayerMode, view: { floatingMolecules, spectra: { activeTab }, }, } = useChartData();
24
30
  const data = useSpectrum(emptyData);
25
31
  const ranges = data?.ranges || {};
26
32
  const zones = data?.zones || {};
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Toolbar } from 'analysis-ui-components';
3
3
  import { SvgNmrRealImag, SvgNmrOverlay3, SvgNmrOverlay3Aligned, SvgNmrAlignBottom, SvgNmrAlignCenter, } from 'cheminfo-font';
4
- import { Fragment, useCallback, memo, useMemo } from 'react';
4
+ import { Fragment, useCallback, memo } from 'react';
5
5
  import { FaDownload, FaFileDownload, FaFileImage, FaCopy, FaFileExport, FaFile, FaFileImport, } from 'react-icons/fa';
6
6
  import { useChartData } from '../context/ChartContext';
7
7
  import { useDispatch } from '../context/DispatchContext';
@@ -16,6 +16,7 @@ import useExport from '../hooks/useExport';
16
16
  import useToolsFunctions from '../hooks/useToolsFunctions';
17
17
  import ImportPublicationStringModal from '../modal/ImportPublicationStringModal';
18
18
  import LoadJCAMPModal from '../modal/LoadJCAMPModal';
19
+ import { useActiveSpectrum, } from '../reducer/Reducer';
19
20
  import { LOAD_JCAMP_FILE, SET_LOADING_FLAG } from '../reducer/types/Types';
20
21
  const IMPORT_MENU = [
21
22
  {
@@ -73,13 +74,14 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
73
74
  const openLoader = useLoader();
74
75
  const isExperimentalFeature = useCheckExperimentalFeature();
75
76
  const isButtonVisible = useCheckToolsVisibility();
76
- const importMenu = useMemo(() => {
77
- return isExperimentalFeature
78
- ? IMPORT_MENU
79
- : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
80
- }, [isExperimentalFeature]);
77
+ const importMenu = isExperimentalFeature
78
+ ? IMPORT_MENU
79
+ : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
80
+ const exportMenu = isExperimentalFeature
81
+ ? EXPORT_MENU
82
+ : EXPORT_MENU.filter((item) => item.id !== 'nmre');
81
83
  const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler, alignSpectrumsVerticallyHandler, } = useToolsFunctions();
82
- const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveAsNMREHandler, saveToClipboardHandler, saveAsHandler, } = useExport();
84
+ const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler, saveAsHandler, } = useExport();
83
85
  const LoadJacmpHandler = useCallback((file) => {
84
86
  if (file) {
85
87
  dispatch({ type: LOAD_JCAMP_FILE, files: [file] });
@@ -127,9 +129,6 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
127
129
  case 'advance_save':
128
130
  void saveAsHandler();
129
131
  break;
130
- case 'nmre':
131
- void saveAsNMREHandler();
132
- break;
133
132
  case 'copy':
134
133
  void saveToClipboardHandler();
135
134
  break;
@@ -141,7 +140,6 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
141
140
  saveAsPNGHandler,
142
141
  saveAsJSONHandler,
143
142
  saveAsHandler,
144
- saveAsNMREHandler,
145
143
  saveToClipboardHandler,
146
144
  ]);
147
145
  return (_jsxs(Fragment, { children: [isButtonVisible('import') && (_jsx(ToolbarMenu, { component: _jsx(FaFileImport, {}), toolTip: "Import", onClick: (element) => {
@@ -150,7 +148,7 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
150
148
  }, items: importMenu })), isButtonVisible('exportAs') && (_jsx(ToolbarMenu, { component: _jsx(FaFileExport, {}), toolTip: "Export As", onClick: (element) => {
151
149
  exportHandler(element);
152
150
  return null;
153
- }, items: EXPORT_MENU })), isButtonVisible('spectraStackAlignments') &&
151
+ }, items: exportMenu })), isButtonVisible('spectraStackAlignments') &&
154
152
  ftCounter > 1 &&
155
153
  (info?.isFt || !activeSpectrum) && (_jsx(Toolbar.Item, { id: "spectra-alignment", className: "cheminfo", title: "Spectra alignment ( Press s )", onClick: changeDisplayViewModeHandler, children: verticalAlign.align === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})) })), isButtonVisible('realImaginary') && info.isComplex && (_jsx(Toolbar.Item, { id: "display", title: isRealSpectrumShown ? 'Display Real ' : 'Display Imaginary', onClick: changeSpectrumViewHandler, className: "cheminfo", children: _jsx(SvgNmrRealImag, {}) })), isButtonVisible('spectraCenterAlignments') &&
156
154
  (ftCounter > 0 || fidCounter > 0) && (_jsx(Toolbar.Item, { id: "baseline-position", title: verticalAlign.align === 'bottom'
@@ -159,7 +157,8 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
159
157
  }
160
158
  const MemoizedBasicToolBar = memo(BasicToolBarInner);
161
159
  export default function BasicToolBar() {
162
- const { activeSpectrum, verticalAlign, displayerMode, activeTab } = useChartData();
160
+ const { verticalAlign, displayerMode, view: { spectra: { activeTab }, }, } = useChartData();
161
+ const activeSpectrum = useActiveSpectrum();
163
162
  const { info, fidCounter, ftCounter } = useDatumWithSpectraStatistics();
164
163
  return (_jsx(MemoizedBasicToolBar, { ...{
165
164
  info,