nmrium 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/HorizontalAxis1D.d.ts.map +1 -1
- package/lib/component/1d/HorizontalAxis1D.js +4 -1
- package/lib/component/1d/HorizontalAxis1D.js.map +1 -1
- package/lib/component/1d/SVGContent1D.d.ts.map +1 -1
- package/lib/component/1d/SVGContent1D.js +2 -1
- package/lib/component/1d/SVGContent1D.js.map +1 -1
- package/lib/component/1d/Viewer1D.d.ts.map +1 -1
- package/lib/component/1d/Viewer1D.js +2 -1
- package/lib/component/1d/Viewer1D.js.map +1 -1
- package/lib/component/1d/integral/IntegralResizable.d.ts.map +1 -1
- package/lib/component/1d/integral/IntegralResizable.js +4 -4
- package/lib/component/1d/integral/IntegralResizable.js.map +1 -1
- package/lib/component/1d/peaks/PeakEditionManager.d.ts +1 -1
- package/lib/component/1d/ranges/Range.d.ts.map +1 -1
- package/lib/component/1d/ranges/Range.js +3 -3
- package/lib/component/1d/ranges/Range.js.map +1 -1
- package/lib/component/1d/ranges/Signals.d.ts +2 -0
- package/lib/component/1d/ranges/Signals.d.ts.map +1 -0
- package/lib/component/1d/ranges/Signals.js +16 -0
- package/lib/component/1d/ranges/Signals.js.map +1 -0
- package/lib/component/1d-2d/components/RangeIndicator.d.ts +13 -0
- package/lib/component/1d-2d/components/RangeIndicator.d.ts.map +1 -0
- package/lib/component/1d-2d/components/RangeIndicator.js +52 -0
- package/lib/component/1d-2d/components/RangeIndicator.js.map +1 -0
- package/lib/component/1d-2d/components/Signals1D.d.ts +19 -0
- package/lib/component/1d-2d/components/Signals1D.d.ts.map +1 -0
- package/lib/component/1d-2d/components/Signals1D.js +155 -0
- package/lib/component/1d-2d/components/Signals1D.js.map +1 -0
- package/lib/component/1d-2d/tools/BrushXY.js +6 -6
- package/lib/component/1d-2d/tools/BrushXY.js.map +1 -1
- package/lib/component/1d-2d/tools/CrossLinePointer.d.ts +16 -1
- package/lib/component/1d-2d/tools/CrossLinePointer.d.ts.map +1 -1
- package/lib/component/1d-2d/tools/CrossLinePointer.js +25 -15
- package/lib/component/1d-2d/tools/CrossLinePointer.js.map +1 -1
- package/lib/component/1d-2d/tools/CursorToolIcon.d.ts +9 -0
- package/lib/component/1d-2d/tools/CursorToolIcon.d.ts.map +1 -0
- package/lib/component/1d-2d/tools/CursorToolIcon.js +58 -0
- package/lib/component/1d-2d/tools/CursorToolIcon.js.map +1 -0
- package/lib/component/2d/1d-tracer/Left1DChart.d.ts.map +1 -1
- package/lib/component/2d/1d-tracer/Left1DChart.js +7 -2
- package/lib/component/2d/1d-tracer/Left1DChart.js.map +1 -1
- package/lib/component/2d/1d-tracer/Ranges1D.d.ts +9 -0
- package/lib/component/2d/1d-tracer/Ranges1D.d.ts.map +1 -0
- package/lib/component/2d/1d-tracer/Ranges1D.js +20 -0
- package/lib/component/2d/1d-tracer/Ranges1D.js.map +1 -0
- package/lib/component/2d/1d-tracer/Top1DChart.d.ts.map +1 -1
- package/lib/component/2d/1d-tracer/Top1DChart.js +7 -2
- package/lib/component/2d/1d-tracer/Top1DChart.js.map +1 -1
- package/lib/component/2d/DirectAxis2D.d.ts.map +1 -1
- package/lib/component/2d/DirectAxis2D.js +4 -1
- package/lib/component/2d/DirectAxis2D.js.map +1 -1
- package/lib/component/2d/IndirectAxis2D.d.ts.map +1 -1
- package/lib/component/2d/IndirectAxis2D.js +5 -2
- package/lib/component/2d/IndirectAxis2D.js.map +1 -1
- package/lib/component/2d/Viewer2D.d.ts.map +1 -1
- package/lib/component/2d/Viewer2D.js +2 -1
- package/lib/component/2d/Viewer2D.js.map +1 -1
- package/lib/component/2d/ft/FTContainer.d.ts.map +1 -1
- package/lib/component/2d/ft/FTContainer.js.map +1 -1
- package/lib/component/AnchorSVG.d.ts +36 -0
- package/lib/component/AnchorSVG.d.ts.map +1 -0
- package/lib/component/AnchorSVG.js +140 -0
- package/lib/component/AnchorSVG.js.map +1 -0
- package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
- package/lib/component/EventsTrackers/BrushTracker.js +16 -2
- package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
- package/lib/component/EventsTrackers/MouseTracker.d.ts +3 -0
- package/lib/component/EventsTrackers/MouseTracker.d.ts.map +1 -1
- package/lib/component/EventsTrackers/MouseTracker.js +15 -0
- package/lib/component/EventsTrackers/MouseTracker.js.map +1 -1
- package/lib/component/context/KeyModifierContext.d.ts +2 -0
- package/lib/component/context/KeyModifierContext.d.ts.map +1 -1
- package/lib/component/context/KeyModifierContext.js +26 -6
- package/lib/component/context/KeyModifierContext.js.map +1 -1
- package/lib/component/elements/D3Axis.d.ts.map +1 -1
- package/lib/component/elements/D3Axis.js +4 -3
- package/lib/component/elements/D3Axis.js.map +1 -1
- package/lib/component/elements/DraggableDialog.d.ts.map +1 -1
- package/lib/component/elements/DraggableDialog.js +1 -2
- package/lib/component/elements/DraggableDialog.js.map +1 -1
- package/lib/component/elements/Sections.d.ts +3 -3
- package/lib/component/elements/Sections.d.ts.map +1 -1
- package/lib/component/elements/Sections.js +1 -1
- package/lib/component/elements/Sections.js.map +1 -1
- package/lib/component/elements/export/ExportOptionsModal.js +2 -5
- package/lib/component/elements/export/ExportOptionsModal.js.map +1 -1
- package/lib/component/header/AutoPeakPickingOptionPanel.d.ts.map +1 -1
- package/lib/component/header/AutoPeakPickingOptionPanel.js +59 -31
- package/lib/component/header/AutoPeakPickingOptionPanel.js.map +1 -1
- package/lib/component/header/Header.d.ts.map +1 -1
- package/lib/component/header/Header.js +2 -4
- package/lib/component/header/Header.js.map +1 -1
- package/lib/component/header/RangesPickingOptionPanel.d.ts.map +1 -1
- package/lib/component/header/RangesPickingOptionPanel.js +34 -19
- package/lib/component/header/RangesPickingOptionPanel.js.map +1 -1
- package/lib/component/hooks/useAddMultipletSignal.d.ts +7 -0
- package/lib/component/hooks/useAddMultipletSignal.d.ts.map +1 -0
- package/lib/component/hooks/useAddMultipletSignal.js +28 -0
- package/lib/component/hooks/useAddMultipletSignal.js.map +1 -0
- package/lib/component/hooks/useFilter.d.ts.map +1 -1
- package/lib/component/hooks/useFilter.js.map +1 -1
- package/lib/component/hooks/useSaveSettings.d.ts.map +1 -1
- package/lib/component/hooks/useSaveSettings.js +3 -6
- package/lib/component/hooks/useSaveSettings.js.map +1 -1
- package/lib/component/hooks/useSpectrum.d.ts +3 -1
- package/lib/component/hooks/useSpectrum.d.ts.map +1 -1
- package/lib/component/hooks/useSpectrum.js +1 -1
- package/lib/component/hooks/useSpectrum.js.map +1 -1
- package/lib/component/hooks/useSpectrumWithDataSource.d.ts +1 -1
- package/lib/component/hooks/useSpectrumWithDataSource.d.ts.map +1 -1
- package/lib/component/hooks/useSpectrumWithDataSource.js.map +1 -1
- package/lib/component/hooks/useTempSpectrum.d.ts +1 -1
- package/lib/component/hooks/useTempSpectrum.d.ts.map +1 -1
- package/lib/component/hooks/use_ticks_config.d.ts +1 -4
- package/lib/component/hooks/use_ticks_config.d.ts.map +1 -1
- package/lib/component/hooks/use_ticks_config.js +1 -6
- package/lib/component/hooks/use_ticks_config.js.map +1 -1
- package/lib/component/modal/PublicationStringModal.d.ts +1 -1
- package/lib/component/modal/PublicationStringModal.d.ts.map +1 -1
- package/lib/component/modal/PublicationStringModal.js +4 -8
- package/lib/component/modal/PublicationStringModal.js.map +1 -1
- package/lib/component/modal/SaveAsModal.js +3 -6
- package/lib/component/modal/SaveAsModal.js.map +1 -1
- package/lib/component/modal/aboutUs/AboutUsModal.d.ts.map +1 -1
- package/lib/component/modal/aboutUs/AboutUsModal.js +2 -4
- package/lib/component/modal/aboutUs/AboutUsModal.js.map +1 -1
- package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts.map +1 -1
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js +38 -36
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts +142 -24
- package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts +142 -24
- package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings.js +9 -12
- package/lib/component/modal/setting/tanstack_general_settings/general_settings.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +142 -24
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +20 -4
- package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.js +12 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +120 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.d.ts +22 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.js +15 -2
- package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts +22 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js +1 -1
- package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.d.ts.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -9
- package/lib/component/panels/PeaksPanel/PeaksPanel.js.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.d.ts.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +9 -9
- package/lib/component/panels/PeaksPanel/PeaksTable.js.map +1 -1
- package/lib/component/panels/RangesPanel/RangesPanel.d.ts.map +1 -1
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -3
- package/lib/component/panels/RangesPanel/RangesPanel.js.map +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.d.ts.map +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +10 -12
- package/lib/component/panels/RangesPanel/RangesTableRow.js.map +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts.map +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js.map +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts.map +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +7 -0
- package/lib/component/panels/SummaryPanel/SummaryPanel.js.map +1 -1
- package/lib/component/panels/filtersPanel/FilterPanel.d.ts.map +1 -1
- package/lib/component/panels/filtersPanel/FilterPanel.js +5 -2
- package/lib/component/panels/filtersPanel/FilterPanel.js.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js +1 -1
- package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js.map +1 -1
- package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts +2 -0
- package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts.map +1 -0
- package/lib/component/panels/filtersPanel/processings_sections_panel.js +134 -0
- package/lib/component/panels/filtersPanel/processings_sections_panel.js.map +1 -0
- package/lib/component/panels/hooks/use_processings_mutation.d.ts +10 -0
- package/lib/component/panels/hooks/use_processings_mutation.d.ts.map +1 -0
- package/lib/component/panels/hooks/use_processings_mutation.js +130 -0
- package/lib/component/panels/hooks/use_processings_mutation.js.map +1 -0
- package/lib/component/panels/informationPanel/InformationPanel.js +1 -1
- package/lib/component/panels/informationPanel/InformationPanel.js.map +1 -1
- package/lib/component/reducer/Reducer.d.ts.map +1 -1
- package/lib/component/reducer/Reducer.js +4 -0
- package/lib/component/reducer/Reducer.js.map +1 -1
- package/lib/component/reducer/actions/CorrelationsActions.js +2 -2
- package/lib/component/reducer/actions/CorrelationsActions.js.map +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +2 -0
- package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +1 -1
- package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
- package/lib/component/reducer/actions/MoleculeActions.d.ts +9 -0
- package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +11 -2
- package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/RangesActions.js +36 -29
- package/lib/component/reducer/actions/RangesActions.js.map +1 -1
- package/lib/component/reducer/actions/SpectraActions.d.ts +8 -2
- package/lib/component/reducer/actions/SpectraActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/SpectraActions.js +6 -1
- package/lib/component/reducer/actions/SpectraActions.js.map +1 -1
- package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +5 -17
- package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
- package/lib/component/reducer/helper/getTraceSpectrumID.d.ts +5 -0
- package/lib/component/reducer/helper/getTraceSpectrumID.d.ts.map +1 -0
- package/lib/component/reducer/helper/getTraceSpectrumID.js +14 -0
- package/lib/component/reducer/helper/getTraceSpectrumID.js.map +1 -0
- package/lib/component/reducer/preferences/actions/setPreferences.d.ts +2 -2
- package/lib/component/reducer/preferences/actions/setPreferences.d.ts.map +1 -1
- package/lib/component/reducer/preferences/actions/setPreferences.js +8 -5
- package/lib/component/reducer/preferences/actions/setPreferences.js.map +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
- package/lib/component/toolbar/ToolTypes.d.ts +21 -1
- package/lib/component/toolbar/ToolTypes.d.ts.map +1 -1
- package/lib/component/toolbar/ToolTypes.js +40 -0
- package/lib/component/toolbar/ToolTypes.js.map +1 -1
- package/lib/component/toolbar/nmr_toolbar.d.ts.map +1 -1
- package/lib/component/toolbar/nmr_toolbar.js +12 -36
- package/lib/component/toolbar/nmr_toolbar.js.map +1 -1
- package/lib/component/utility/CoreSlot.d.ts +27 -0
- package/lib/component/utility/CoreSlot.d.ts.map +1 -0
- package/lib/component/utility/CoreSlot.js +56 -0
- package/lib/component/utility/CoreSlot.js.map +1 -0
- package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js +19 -2
- package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +13 -5
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +35 -30
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +1 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +12 -4
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/isSpectrum2D.d.ts +1 -1
- package/lib/data/data2d/Spectrum2D/isSpectrum2D.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/isSpectrum2D.js.map +1 -1
- package/lib/data/utilities/RangeUtilities.d.ts +1 -6
- package/lib/data/utilities/RangeUtilities.d.ts.map +1 -1
- package/lib/data/utilities/RangeUtilities.js +10 -27
- package/lib/data/utilities/RangeUtilities.js.map +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +29 -27
- package/src/component/1d/HorizontalAxis1D.tsx +12 -2
- package/src/component/1d/SVGContent1D.tsx +2 -0
- package/src/component/1d/Viewer1D.tsx +2 -0
- package/src/component/1d/integral/IntegralResizable.tsx +6 -6
- package/src/component/1d/ranges/Range.tsx +6 -6
- package/src/component/1d/ranges/Signals.tsx +28 -0
- package/src/component/1d-2d/components/RangeIndicator.tsx +106 -0
- package/src/component/1d-2d/components/Signals1D.tsx +306 -0
- package/src/component/1d-2d/tools/BrushXY.tsx +8 -8
- package/src/component/1d-2d/tools/CrossLinePointer.tsx +75 -32
- package/src/component/1d-2d/tools/CursorToolIcon.tsx +110 -0
- package/src/component/2d/1d-tracer/Left1DChart.tsx +26 -1
- package/src/component/2d/1d-tracer/Ranges1D.tsx +38 -0
- package/src/component/2d/1d-tracer/Top1DChart.tsx +31 -2
- package/src/component/2d/DirectAxis2D.tsx +12 -3
- package/src/component/2d/IndirectAxis2D.tsx +9 -5
- package/src/component/2d/Viewer2D.tsx +5 -2
- package/src/component/2d/ft/FTContainer.tsx +1 -0
- package/src/component/AnchorSVG.tsx +369 -0
- package/src/component/EventsTrackers/BrushTracker.tsx +25 -5
- package/src/component/EventsTrackers/MouseTracker.tsx +21 -0
- package/src/component/context/KeyModifierContext.tsx +32 -8
- package/src/component/elements/D3Axis.tsx +31 -9
- package/src/component/elements/DraggableDialog.tsx +1 -2
- package/src/component/elements/Sections.tsx +4 -4
- package/src/component/elements/export/ExportOptionsModal.tsx +22 -31
- package/src/component/header/AutoPeakPickingOptionPanel.tsx +173 -102
- package/src/component/header/Header.tsx +2 -4
- package/src/component/header/RangesPickingOptionPanel.tsx +72 -59
- package/src/component/hooks/useAddMultipletSignal.tsx +32 -0
- package/src/component/hooks/useFilter.ts +2 -1
- package/src/component/hooks/useSaveSettings.tsx +4 -15
- package/src/component/hooks/useSpectrum.ts +7 -1
- package/src/component/hooks/useSpectrumWithDataSource.ts +16 -8
- package/src/component/hooks/use_ticks_config.ts +1 -7
- package/src/component/modal/PublicationStringModal.tsx +8 -14
- package/src/component/modal/SaveAsModal.tsx +41 -50
- package/src/component/modal/aboutUs/AboutUsModal.tsx +5 -4
- package/src/component/modal/editRange/forms/components/NewSignalTab.tsx +57 -57
- package/src/component/modal/setting/tanstack_general_settings/general_settings.tsx +23 -29
- package/src/component/modal/setting/tanstack_general_settings/tabs/axis_tab.tsx +76 -12
- package/src/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.ts +16 -2
- package/src/component/panels/MoleculesPanel/hooks/useAtomAssignment.tsx +1 -1
- package/src/component/panels/PeaksPanel/PeaksPanel.tsx +1 -8
- package/src/component/panels/PeaksPanel/PeaksPreferences.tsx +1 -1
- package/src/component/panels/PeaksPanel/PeaksTable.tsx +11 -9
- package/src/component/panels/RangesPanel/RangesPanel.tsx +1 -3
- package/src/component/panels/RangesPanel/RangesTableRow.tsx +10 -12
- package/src/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.tsx +2 -2
- package/src/component/panels/SummaryPanel/SummaryPanel.tsx +13 -11
- package/src/component/panels/filtersPanel/FilterPanel.tsx +10 -0
- package/src/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.tsx +1 -0
- package/src/component/panels/filtersPanel/processings_sections_panel.tsx +307 -0
- package/src/component/panels/hooks/use_processings_mutation.ts +171 -0
- package/src/component/panels/informationPanel/InformationPanel.tsx +1 -1
- package/src/component/reducer/Reducer.ts +4 -0
- package/src/component/reducer/actions/CorrelationsActions.ts +2 -2
- package/src/component/reducer/actions/FiltersActions.ts +1 -1
- package/src/component/reducer/actions/RangesActions.ts +53 -30
- package/src/component/reducer/actions/SpectraActions.ts +20 -1
- package/src/component/reducer/actions/ToolsActions.ts +5 -21
- package/src/component/reducer/helper/getTraceSpectrumID.tsx +25 -0
- package/src/component/reducer/preferences/actions/setPreferences.ts +18 -10
- package/src/component/reducer/preferences/preferencesReducer.ts +1 -1
- package/src/component/toolbar/ToolTypes.ts +92 -1
- package/src/component/toolbar/nmr_toolbar.tsx +15 -71
- package/src/component/utility/CoreSlot.tsx +126 -0
- package/src/component/workspaces/workspaceDefaultProperties.ts +19 -2
- package/src/data/data1d/Spectrum1D/initiateDatum1D.ts +14 -8
- package/src/data/data1d/Spectrum1D/peaks/autoPeakPicking.ts +1 -0
- package/src/data/data1d/Spectrum1D/peaks/optimizePeaks.ts +35 -30
- package/src/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.ts +1 -0
- package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +12 -4
- package/src/data/data2d/Spectrum2D/isSpectrum2D.ts +1 -1
- package/src/data/utilities/RangeUtilities.ts +12 -36
- package/src/versionInfo.ts +1 -1
- package/lib/component/1d/integral/IntegralIndicator.d.ts +0 -9
- package/lib/component/1d/integral/IntegralIndicator.d.ts.map +0 -1
- package/lib/component/1d/integral/IntegralIndicator.js +0 -22
- package/lib/component/1d/integral/IntegralIndicator.js.map +0 -1
- package/lib/component/utility/renderCoreSlot.d.ts +0 -11
- package/lib/component/utility/renderCoreSlot.d.ts.map +0 -1
- package/lib/component/utility/renderCoreSlot.js +0 -13
- package/lib/component/utility/renderCoreSlot.js.map +0 -1
- package/src/component/1d/integral/IntegralIndicator.tsx +0 -43
- package/src/component/utility/renderCoreSlot.tsx +0 -21
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { Spectrum1D } from '@zakodium/nmrium-core';
|
|
2
|
-
import { memo } from 'react';
|
|
2
|
+
import { memo, useRef } from 'react';
|
|
3
3
|
|
|
4
|
+
import { Signals1D } from '../../1d-2d/components/Signals1D.tsx';
|
|
4
5
|
import { useChartData } from '../../context/ChartContext.js';
|
|
5
6
|
import useXYReduce from '../../hooks/useXYReduce.js';
|
|
6
7
|
import { PathBuilder } from '../../utility/PathBuilder.js';
|
|
7
8
|
import { use1DTraceYScale, useScale2DX } from '../utilities/scale.js';
|
|
8
9
|
|
|
10
|
+
import { Ranges1D } from './Ranges1D.tsx';
|
|
11
|
+
|
|
9
12
|
interface Top1DChartProps {
|
|
10
13
|
verticalMargin?: number;
|
|
11
14
|
data: Spectrum1D;
|
|
@@ -37,8 +40,11 @@ function usePath(spectrum: Spectrum1D, options: UsePathOptions) {
|
|
|
37
40
|
function Top1DChart({ verticalMargin = 10, data: spectrum }: Top1DChartProps) {
|
|
38
41
|
const { width, margin, displayerKey } = useChartData();
|
|
39
42
|
const height = margin.top;
|
|
43
|
+
const svgRef = useRef<SVGSVGElement>(null);
|
|
44
|
+
const scale = useScale2DX();
|
|
40
45
|
|
|
41
46
|
const path = usePath(spectrum, { height, verticalMargin });
|
|
47
|
+
const ranges = spectrum.ranges.values;
|
|
42
48
|
|
|
43
49
|
if (!width || !height) {
|
|
44
50
|
return null;
|
|
@@ -46,11 +52,20 @@ function Top1DChart({ verticalMargin = 10, data: spectrum }: Top1DChartProps) {
|
|
|
46
52
|
|
|
47
53
|
const innerWidth = width - margin.left - margin.right;
|
|
48
54
|
return (
|
|
49
|
-
<svg
|
|
55
|
+
<svg
|
|
56
|
+
ref={svgRef}
|
|
57
|
+
viewBox={`0 0 ${width} ${height}`}
|
|
58
|
+
width={width}
|
|
59
|
+
height={height}
|
|
60
|
+
style={{ overflow: 'visible' }}
|
|
61
|
+
>
|
|
50
62
|
<defs>
|
|
51
63
|
<clipPath id={`${displayerKey}clip-top`}>
|
|
52
64
|
<rect width={innerWidth} height={height} x={margin.left} y="0" />
|
|
53
65
|
</clipPath>
|
|
66
|
+
<clipPath id={`${displayerKey}clip-top-ranges`}>
|
|
67
|
+
<rect width={innerWidth} height={height + 20} x={margin.left} y="0" />
|
|
68
|
+
</clipPath>
|
|
54
69
|
</defs>
|
|
55
70
|
<g clipPath={`url(#${displayerKey}clip-top)`}>
|
|
56
71
|
<path
|
|
@@ -61,6 +76,20 @@ function Top1DChart({ verticalMargin = 10, data: spectrum }: Top1DChartProps) {
|
|
|
61
76
|
d={path}
|
|
62
77
|
/>
|
|
63
78
|
</g>
|
|
79
|
+
<g clipPath={`url(#${displayerKey}clip-top-ranges)`}>
|
|
80
|
+
<Ranges1D
|
|
81
|
+
ranges={ranges}
|
|
82
|
+
orientation="horizontal"
|
|
83
|
+
spectrumId={spectrum.id}
|
|
84
|
+
/>
|
|
85
|
+
<Signals1D
|
|
86
|
+
ranges={ranges}
|
|
87
|
+
orientation="horizontal"
|
|
88
|
+
spectrumId={spectrum.id}
|
|
89
|
+
scale={scale}
|
|
90
|
+
position={margin.top}
|
|
91
|
+
/>
|
|
92
|
+
</g>
|
|
64
93
|
</svg>
|
|
65
94
|
);
|
|
66
95
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { memo, useRef } from 'react';
|
|
2
2
|
import { useLinearPrimaryTicks } from 'react-d3-utils';
|
|
3
|
+
import { SVGStyledText } from 'react-science/ui';
|
|
3
4
|
|
|
4
5
|
import { useIsInset } from '../1d/inset/InsetProvider.tsx';
|
|
5
6
|
import { AxisUnitPicker } from '../1d-2d/components/axis_unit_picker.tsx';
|
|
@@ -8,6 +9,7 @@ import { D3Axis } from '../elements/D3Axis.js';
|
|
|
8
9
|
import { useCheckExportStatus } from '../hooks/useViewportSize.tsx';
|
|
9
10
|
import { axisUnitToLabel, useDirectAxisUnit } from '../hooks/use_axis_unit.ts';
|
|
10
11
|
import { useGridline2DConfig } from '../hooks/use_gridlines_config.ts';
|
|
12
|
+
import { useTicksConfig } from '../hooks/use_ticks_config.ts';
|
|
11
13
|
|
|
12
14
|
import { useScale2DX } from './utilities/scale.js';
|
|
13
15
|
|
|
@@ -93,11 +95,18 @@ interface UnitLabelProps {
|
|
|
93
95
|
}
|
|
94
96
|
function UnitLabel(props: UnitLabelProps) {
|
|
95
97
|
const { width, children } = props;
|
|
96
|
-
|
|
98
|
+
const { labelStyle } = useTicksConfig();
|
|
97
99
|
return (
|
|
98
|
-
<
|
|
100
|
+
<SVGStyledText
|
|
101
|
+
fill="black"
|
|
102
|
+
x={width - 60}
|
|
103
|
+
y="20"
|
|
104
|
+
dy="0.71em"
|
|
105
|
+
textAnchor="end"
|
|
106
|
+
{...labelStyle}
|
|
107
|
+
>
|
|
99
108
|
{children}
|
|
100
|
-
</
|
|
109
|
+
</SVGStyledText>
|
|
101
110
|
);
|
|
102
111
|
}
|
|
103
112
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { memo, useRef } from 'react';
|
|
2
2
|
import { useLinearPrimaryTicks } from 'react-d3-utils';
|
|
3
|
+
import { SVGStyledText } from 'react-science/ui';
|
|
3
4
|
|
|
4
5
|
import { useIsInset } from '../1d/inset/InsetProvider.tsx';
|
|
5
6
|
import { AxisUnitPicker } from '../1d-2d/components/axis_unit_picker.tsx';
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
useIndirectAxisUnit,
|
|
14
15
|
} from '../hooks/use_axis_unit.ts';
|
|
15
16
|
import { useGridline2DConfig } from '../hooks/use_gridlines_config.ts';
|
|
17
|
+
import { useTicksConfig } from '../hooks/use_ticks_config.ts';
|
|
16
18
|
|
|
17
19
|
import { useScale2DY } from './utilities/scale.js';
|
|
18
20
|
|
|
@@ -108,8 +110,8 @@ interface UnitLabelProps {
|
|
|
108
110
|
}
|
|
109
111
|
function UnitLabel(props: UnitLabelProps) {
|
|
110
112
|
const { children } = props;
|
|
111
|
-
|
|
112
|
-
const { getTextWidth } = useTextMetrics({ labelSize:
|
|
113
|
+
const { labelStyle } = useTicksConfig();
|
|
114
|
+
const { getTextWidth } = useTextMetrics({ labelSize: labelStyle.fontSize });
|
|
113
115
|
const labelHeight = getTextWidth(children);
|
|
114
116
|
|
|
115
117
|
return (
|
|
@@ -124,14 +126,16 @@ function UnitLabel(props: UnitLabelProps) {
|
|
|
124
126
|
y={-5}
|
|
125
127
|
opacity={0.8}
|
|
126
128
|
/>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
|
|
130
|
+
<SVGStyledText
|
|
131
|
+
fill="black"
|
|
129
132
|
transform="rotate(-90)"
|
|
130
133
|
dominantBaseline="middle"
|
|
131
134
|
textAnchor="end"
|
|
135
|
+
{...labelStyle}
|
|
132
136
|
>
|
|
133
137
|
{children}
|
|
134
|
-
</
|
|
138
|
+
</SVGStyledText>
|
|
135
139
|
</>
|
|
136
140
|
);
|
|
137
141
|
}
|
|
@@ -5,6 +5,7 @@ import { SVGRootContainer } from '../1d-2d/components/SVGRootContainer.js';
|
|
|
5
5
|
import { ViewerResponsiveWrapper } from '../1d-2d/components/ViewerResponsiveWrapper.js';
|
|
6
6
|
import BrushXY from '../1d-2d/tools/BrushXY.js';
|
|
7
7
|
import CrossLinePointer from '../1d-2d/tools/CrossLinePointer.js';
|
|
8
|
+
import { CursorToolIcon } from '../1d-2d/tools/CursorToolIcon.tsx';
|
|
8
9
|
import { MouseTracker } from '../EventsTrackers/MouseTracker.js';
|
|
9
10
|
import { useChartData } from '../context/ChartContext.js';
|
|
10
11
|
import Spinner from '../loader/Spinner.js';
|
|
@@ -60,8 +61,10 @@ function Viewer2D(props: Viewer2DProps) {
|
|
|
60
61
|
selectedTool === options.phaseCorrectionTwoDimensions.id && (
|
|
61
62
|
<PhaseTraces />
|
|
62
63
|
)}
|
|
63
|
-
|
|
64
|
-
<CrossLinePointer />
|
|
64
|
+
<CursorToolIcon />
|
|
65
|
+
<CrossLinePointer axis="X" dimensionBorder={DIMENSION.TOP} />
|
|
66
|
+
<CrossLinePointer axis="Y" dimensionBorder={DIMENSION.LEFT} />
|
|
67
|
+
<CrossLinePointer axis="XY" dimensionBorder={DIMENSION.MAIN} />
|
|
65
68
|
<XYLabelPointer data1D={spectrumData} layout={DIMENSION} />
|
|
66
69
|
|
|
67
70
|
<>
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import type { CSSProperties, KeyboardEvent, MouseEvent } from 'react';
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
type CursorOrientation = 'horizontal' | 'vertical';
|
|
5
|
+
|
|
6
|
+
const CUR_MOVE = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='12' viewBox='0 0 22 12'%3E%3Cpath d='M1 6h20M1 6l4-4M1 6l4 4M21 6l-4-4M21 6l-4 4' fill='none' stroke='black' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 11 6, ew-resize`;
|
|
7
|
+
const CUR_MOVE_VERTICAL = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='22' viewBox='0 0 12 22'%3E%3Cpath d='M6 1v20M6 1l-4 4M6 1l4 4M6 21l-4-4M6 21l4-4' fill='none' stroke='black' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 6 11, ns-resize`;
|
|
8
|
+
type AnchorShape = 'diamond' | 'circle' | 'square' | 'triangle';
|
|
9
|
+
|
|
10
|
+
interface AnchorStyle {
|
|
11
|
+
size?: number;
|
|
12
|
+
hoverSize?: number;
|
|
13
|
+
dragSize?: number;
|
|
14
|
+
fill?: string;
|
|
15
|
+
stroke?: string;
|
|
16
|
+
hoverFill?: string;
|
|
17
|
+
hoverStroke?: string;
|
|
18
|
+
dragFill?: string;
|
|
19
|
+
dragStroke?: string;
|
|
20
|
+
strokeWidth?: number;
|
|
21
|
+
guideColor?: string;
|
|
22
|
+
guideDragColor?: string;
|
|
23
|
+
guideStyle?: 'solid' | 'dashed' | 'dotted';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface AnchorPosition {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface AnchorProps {
|
|
32
|
+
position: AnchorPosition;
|
|
33
|
+
shape?: AnchorShape;
|
|
34
|
+
svgHeight: number;
|
|
35
|
+
anchorStyle?: AnchorStyle;
|
|
36
|
+
restoreFocusOnLeave?: boolean;
|
|
37
|
+
onDragMove?: (newPosition: AnchorPosition) => void;
|
|
38
|
+
onDragEnd?: (lastPosition: AnchorPosition) => void;
|
|
39
|
+
onDragStart?: (position: AnchorPosition) => void;
|
|
40
|
+
onDelete?: () => void;
|
|
41
|
+
cursorOrientation?: CursorOrientation;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface DragState {
|
|
45
|
+
startX: number;
|
|
46
|
+
startY: number;
|
|
47
|
+
startAnchorX: number;
|
|
48
|
+
startAnchorY: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type InteractionState = 'idle' | 'hovered' | 'dragging';
|
|
52
|
+
|
|
53
|
+
interface VisualTokens {
|
|
54
|
+
fill: string;
|
|
55
|
+
stroke: string;
|
|
56
|
+
cursor: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function resolveVisuals(
|
|
60
|
+
state: InteractionState,
|
|
61
|
+
idleFill: string,
|
|
62
|
+
idleStroke: string,
|
|
63
|
+
hoverFill: string,
|
|
64
|
+
hoverStroke: string,
|
|
65
|
+
dragFill: string,
|
|
66
|
+
dragStroke: string,
|
|
67
|
+
cursorOrientation: CursorOrientation,
|
|
68
|
+
): VisualTokens {
|
|
69
|
+
const cursor =
|
|
70
|
+
cursorOrientation === 'horizontal' ? CUR_MOVE : CUR_MOVE_VERTICAL;
|
|
71
|
+
if (state === 'dragging') {
|
|
72
|
+
return {
|
|
73
|
+
fill: dragFill,
|
|
74
|
+
stroke: dragStroke,
|
|
75
|
+
cursor,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (state === 'hovered') {
|
|
80
|
+
return {
|
|
81
|
+
fill: hoverFill,
|
|
82
|
+
stroke: hoverStroke,
|
|
83
|
+
cursor,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
fill: idleFill,
|
|
89
|
+
stroke: idleStroke,
|
|
90
|
+
cursor: 'default',
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function clientToSvg(
|
|
95
|
+
event: MouseEvent<SVGGElement>,
|
|
96
|
+
svg: SVGSVGElement | null,
|
|
97
|
+
): { x: number; y: number } {
|
|
98
|
+
const { clientX, clientY } = event;
|
|
99
|
+
if (!svg) return { x: clientX, y: clientY };
|
|
100
|
+
|
|
101
|
+
const pt = svg.createSVGPoint();
|
|
102
|
+
pt.x = clientX;
|
|
103
|
+
pt.y = clientY;
|
|
104
|
+
|
|
105
|
+
const ctm = svg.getScreenCTM();
|
|
106
|
+
|
|
107
|
+
if (!ctm) return { x: clientX, y: clientY };
|
|
108
|
+
|
|
109
|
+
return pt.matrixTransform(ctm.inverse());
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface ShapeRendererProps {
|
|
113
|
+
shape?: AnchorShape;
|
|
114
|
+
fill: string;
|
|
115
|
+
stroke: string;
|
|
116
|
+
strokeWidth: number;
|
|
117
|
+
size: number;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function ShapeRenderer({
|
|
121
|
+
shape,
|
|
122
|
+
fill,
|
|
123
|
+
stroke,
|
|
124
|
+
strokeWidth,
|
|
125
|
+
size,
|
|
126
|
+
}: ShapeRendererProps) {
|
|
127
|
+
const half = size / 2;
|
|
128
|
+
const inset = strokeWidth / 2;
|
|
129
|
+
|
|
130
|
+
const common: CSSProperties = {
|
|
131
|
+
filter: 'drop-shadow(0 2px 4px rgba(0,0,0,.14))',
|
|
132
|
+
pointerEvents: 'all',
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
if (shape === 'circle') {
|
|
136
|
+
return (
|
|
137
|
+
<circle
|
|
138
|
+
cx={0}
|
|
139
|
+
cy={0}
|
|
140
|
+
r={half - inset}
|
|
141
|
+
fill={fill}
|
|
142
|
+
stroke={stroke}
|
|
143
|
+
strokeWidth={strokeWidth}
|
|
144
|
+
style={common}
|
|
145
|
+
/>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (shape === 'diamond') {
|
|
150
|
+
return (
|
|
151
|
+
<polygon
|
|
152
|
+
points={`
|
|
153
|
+
0,-${half - inset}
|
|
154
|
+
${half - inset},0
|
|
155
|
+
0,${half - inset}
|
|
156
|
+
-${half - inset},0
|
|
157
|
+
`}
|
|
158
|
+
fill={fill}
|
|
159
|
+
stroke={stroke}
|
|
160
|
+
strokeWidth={strokeWidth}
|
|
161
|
+
strokeLinejoin="round"
|
|
162
|
+
style={common}
|
|
163
|
+
/>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (shape === 'triangle') {
|
|
168
|
+
return (
|
|
169
|
+
<polygon
|
|
170
|
+
points={`
|
|
171
|
+
0,-${half - inset}
|
|
172
|
+
${half - inset},${half - inset}
|
|
173
|
+
-${half - inset},${half - inset}
|
|
174
|
+
`}
|
|
175
|
+
fill={fill}
|
|
176
|
+
stroke={stroke}
|
|
177
|
+
strokeWidth={strokeWidth}
|
|
178
|
+
strokeLinejoin="round"
|
|
179
|
+
style={common}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<rect
|
|
186
|
+
x={-half + inset}
|
|
187
|
+
y={-half + inset}
|
|
188
|
+
width={size - strokeWidth}
|
|
189
|
+
height={size - strokeWidth}
|
|
190
|
+
rx={1}
|
|
191
|
+
fill={fill}
|
|
192
|
+
stroke={stroke}
|
|
193
|
+
strokeWidth={strokeWidth}
|
|
194
|
+
style={common}
|
|
195
|
+
/>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function Anchor(props: AnchorProps) {
|
|
200
|
+
const {
|
|
201
|
+
position,
|
|
202
|
+
shape,
|
|
203
|
+
svgHeight,
|
|
204
|
+
anchorStyle = {},
|
|
205
|
+
restoreFocusOnLeave = false,
|
|
206
|
+
onDragStart,
|
|
207
|
+
onDragMove,
|
|
208
|
+
onDragEnd,
|
|
209
|
+
onDelete,
|
|
210
|
+
cursorOrientation = 'horizontal',
|
|
211
|
+
} = props;
|
|
212
|
+
const {
|
|
213
|
+
size = 16,
|
|
214
|
+
hoverSize = size,
|
|
215
|
+
dragSize = size,
|
|
216
|
+
fill: idleFill = '#ffffff',
|
|
217
|
+
stroke: idleStroke = '#d1d5db',
|
|
218
|
+
hoverFill = '#f3f4f6',
|
|
219
|
+
hoverStroke = '#9ca3af',
|
|
220
|
+
dragFill = '#f3f4f6',
|
|
221
|
+
dragStroke = '#6b7280',
|
|
222
|
+
strokeWidth = 1,
|
|
223
|
+
guideColor = 'rgba(156,163,175,0.6)',
|
|
224
|
+
guideDragColor = 'rgba(107,114,128,0.8)',
|
|
225
|
+
guideStyle = 'solid',
|
|
226
|
+
} = anchorStyle;
|
|
227
|
+
|
|
228
|
+
const [hovered, setHovered] = useState(false);
|
|
229
|
+
const [dragging, setDragging] = useState(false);
|
|
230
|
+
|
|
231
|
+
const dragState = useRef<DragState | null>(null);
|
|
232
|
+
const prevFocus = useRef<Element | null>(null);
|
|
233
|
+
|
|
234
|
+
const interactionState: InteractionState = dragging
|
|
235
|
+
? 'dragging'
|
|
236
|
+
: hovered
|
|
237
|
+
? 'hovered'
|
|
238
|
+
: 'idle';
|
|
239
|
+
|
|
240
|
+
const { fill, stroke, cursor } = resolveVisuals(
|
|
241
|
+
interactionState,
|
|
242
|
+
idleFill,
|
|
243
|
+
idleStroke,
|
|
244
|
+
hoverFill,
|
|
245
|
+
hoverStroke,
|
|
246
|
+
dragFill,
|
|
247
|
+
dragStroke,
|
|
248
|
+
cursorOrientation,
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
function handleMouseDown(e: MouseEvent<SVGGElement>) {
|
|
252
|
+
e.preventDefault();
|
|
253
|
+
setDragging(true);
|
|
254
|
+
|
|
255
|
+
const svg = e.currentTarget.ownerSVGElement;
|
|
256
|
+
|
|
257
|
+
const { x, y } = clientToSvg(e, svg);
|
|
258
|
+
dragState.current = {
|
|
259
|
+
startX: x,
|
|
260
|
+
startY: y,
|
|
261
|
+
startAnchorX: position.x,
|
|
262
|
+
startAnchorY: position.y,
|
|
263
|
+
};
|
|
264
|
+
onDragStart?.(position);
|
|
265
|
+
const onMove = (e: globalThis.MouseEvent) => {
|
|
266
|
+
const current = dragState.current;
|
|
267
|
+
if (!current) return;
|
|
268
|
+
const { x, y } = clientToSvg(
|
|
269
|
+
e as unknown as MouseEvent<SVGGElement>,
|
|
270
|
+
svg,
|
|
271
|
+
);
|
|
272
|
+
const newX = current.startAnchorX + x - current.startX;
|
|
273
|
+
const newY = current.startAnchorY + y - current.startY;
|
|
274
|
+
|
|
275
|
+
onDragMove?.({ x: newX, y: newY });
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const onUp = () => {
|
|
279
|
+
setDragging(false);
|
|
280
|
+
dragState.current = null;
|
|
281
|
+
onDragEnd?.({ x: position.x, y: position.y });
|
|
282
|
+
|
|
283
|
+
window.removeEventListener('mousemove', onMove);
|
|
284
|
+
window.removeEventListener('mouseup', onUp);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
window.addEventListener('mousemove', onMove);
|
|
288
|
+
window.addEventListener('mouseup', onUp);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function handleKeyDown(e: KeyboardEvent<SVGGElement>) {
|
|
292
|
+
if (e.key === 'Delete' || e.key === 'Backspace') {
|
|
293
|
+
e.preventDefault();
|
|
294
|
+
onDelete?.();
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function handleMouseEnter(e: MouseEvent<SVGGElement>) {
|
|
299
|
+
setHovered(true);
|
|
300
|
+
prevFocus.current = document.activeElement;
|
|
301
|
+
e.currentTarget.focus();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function handleMouseLeave(e: MouseEvent<SVGGElement>) {
|
|
305
|
+
setHovered(false);
|
|
306
|
+
|
|
307
|
+
if (restoreFocusOnLeave && prevFocus.current instanceof HTMLElement) {
|
|
308
|
+
prevFocus.current.focus();
|
|
309
|
+
} else {
|
|
310
|
+
e.currentTarget.blur();
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
prevFocus.current = null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return (
|
|
317
|
+
<>
|
|
318
|
+
{(hovered || dragging) && (
|
|
319
|
+
<line
|
|
320
|
+
x1={position.x}
|
|
321
|
+
y1={0}
|
|
322
|
+
x2={position.x}
|
|
323
|
+
y2={svgHeight}
|
|
324
|
+
stroke={dragging ? guideDragColor : guideColor}
|
|
325
|
+
strokeWidth={1}
|
|
326
|
+
strokeDasharray={
|
|
327
|
+
guideStyle === 'dashed'
|
|
328
|
+
? '6 4'
|
|
329
|
+
: guideStyle === 'dotted'
|
|
330
|
+
? '1 3'
|
|
331
|
+
: undefined
|
|
332
|
+
}
|
|
333
|
+
pointerEvents="none"
|
|
334
|
+
/>
|
|
335
|
+
)}
|
|
336
|
+
|
|
337
|
+
<g
|
|
338
|
+
transform={`translate(${position.x} ${position.y})`}
|
|
339
|
+
style={{
|
|
340
|
+
cursor,
|
|
341
|
+
outline: 'none',
|
|
342
|
+
}}
|
|
343
|
+
tabIndex={0}
|
|
344
|
+
data-self-control="true"
|
|
345
|
+
onMouseDown={handleMouseDown}
|
|
346
|
+
onMouseEnter={handleMouseEnter}
|
|
347
|
+
onMouseLeave={handleMouseLeave}
|
|
348
|
+
onKeyDown={handleKeyDown}
|
|
349
|
+
>
|
|
350
|
+
{(hovered || dragging) && (
|
|
351
|
+
<circle
|
|
352
|
+
r={(hovered ? hoverSize : dragSize) * 1.5}
|
|
353
|
+
fill={stroke}
|
|
354
|
+
opacity={dragging ? 0.2 : 0.15}
|
|
355
|
+
pointerEvents="none"
|
|
356
|
+
/>
|
|
357
|
+
)}
|
|
358
|
+
|
|
359
|
+
<ShapeRenderer
|
|
360
|
+
shape={shape}
|
|
361
|
+
fill={fill}
|
|
362
|
+
stroke={stroke}
|
|
363
|
+
strokeWidth={strokeWidth}
|
|
364
|
+
size={hovered ? hoverSize : dragging ? dragSize : size}
|
|
365
|
+
/>
|
|
366
|
+
</g>
|
|
367
|
+
</>
|
|
368
|
+
);
|
|
369
|
+
}
|
|
@@ -134,7 +134,9 @@ interface BrushTrackerProps {
|
|
|
134
134
|
brushDetectionOptions?: BaseDetectBrushingOptions;
|
|
135
135
|
clickTriggerMode?: 'native' | 'debounced';
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
function isSelfControlledTarget(target: EventTarget) {
|
|
138
|
+
return (target as Element).closest('[data-self-control="true"]') !== null;
|
|
139
|
+
}
|
|
138
140
|
function getMouseXY(event: MouseEvent, currentTarget?: Element) {
|
|
139
141
|
const boundingRect = (
|
|
140
142
|
currentTarget ?? event.currentTarget
|
|
@@ -169,6 +171,7 @@ export function BrushTracker(options: BrushTrackerProps) {
|
|
|
169
171
|
const boundingRectRef = useRef<DOMRect | null>(null);
|
|
170
172
|
const startPositionRef = useRef<Position>({ x: 0, y: 0 });
|
|
171
173
|
const lastRef = useRef<Position>({ x: 0, y: 0 });
|
|
174
|
+
const isSelfControlledRef = useRef(false);
|
|
172
175
|
|
|
173
176
|
const handleClickWithDebounce = useCallback(
|
|
174
177
|
(event: MouseEvent, currentTarget: Element) => {
|
|
@@ -199,22 +202,39 @@ export function BrushTracker(options: BrushTrackerProps) {
|
|
|
199
202
|
);
|
|
200
203
|
|
|
201
204
|
function handleClick(event: MouseEvent) {
|
|
202
|
-
if (
|
|
205
|
+
if (
|
|
206
|
+
isDraggingRef.current ||
|
|
207
|
+
clickTriggerMode !== 'native' ||
|
|
208
|
+
isSelfControlledRef.current
|
|
209
|
+
) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
203
213
|
const { x, y } = getMouseXY(event);
|
|
204
214
|
onClick({ ...event, x, y });
|
|
205
215
|
}
|
|
206
216
|
|
|
207
217
|
function handleDoubleClick(event: MouseEvent) {
|
|
208
|
-
if (
|
|
209
|
-
|
|
218
|
+
if (
|
|
219
|
+
isDraggingRef.current ||
|
|
220
|
+
clickTriggerMode !== 'native' ||
|
|
221
|
+
isSelfControlledRef.current
|
|
222
|
+
) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
210
225
|
const { x, y } = getMouseXY(event);
|
|
211
226
|
onDoubleClick({ ...event, x, y });
|
|
212
227
|
}
|
|
213
|
-
|
|
214
228
|
const pointerDownHandler = useCallback(
|
|
215
229
|
(event: PointerEvent) => {
|
|
216
230
|
event.persist();
|
|
217
231
|
const currentTarget = event.currentTarget;
|
|
232
|
+
isSelfControlledRef.current = isSelfControlledTarget(event.target);
|
|
233
|
+
|
|
234
|
+
if (isSelfControlledRef.current) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
|
|
218
238
|
isDraggingRef.current = false; // Reset dragging flag
|
|
219
239
|
|
|
220
240
|
//check that the right or left mouse button pressed
|
|
@@ -23,12 +23,33 @@ interface MouseTrackerProps {
|
|
|
23
23
|
noPropagation?: boolean;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
const disableMouseAttribute = 'data-disable-mouse-tracking' as const;
|
|
27
|
+
|
|
28
|
+
function isMouseTrackingDisabled(target: EventTarget) {
|
|
29
|
+
return (
|
|
30
|
+
(target as Element).closest(`[${CSS.escape(disableMouseAttribute)}]`) !==
|
|
31
|
+
null
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const disableMouseTrackingProps = {
|
|
36
|
+
[disableMouseAttribute]: true,
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
26
39
|
export function MouseTracker(props: MouseTrackerProps) {
|
|
27
40
|
const { children, className, style, noPropagation } = props;
|
|
28
41
|
const [mouseTrackerState, setMouseTrackerState] =
|
|
29
42
|
useState<MouseTrackerData | null>(null);
|
|
30
43
|
const mouseMoveHandler = useCallback(
|
|
31
44
|
(event: MouseEvent) => {
|
|
45
|
+
if (isMouseTrackingDisabled(event.target)) {
|
|
46
|
+
setMouseTrackerState(null);
|
|
47
|
+
if (noPropagation) {
|
|
48
|
+
event.stopPropagation();
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
32
53
|
const boundingRect = event.currentTarget.getBoundingClientRect();
|
|
33
54
|
const x = event.clientX - boundingRect.x;
|
|
34
55
|
const y = event.clientY - boundingRect.y;
|