@@ -446,9 +446,13 @@ function rollbackSpectrumByFilter(
446446 const filterIndex = spectrum . filters . findIndex ( ( f ) => f [ searchBy ] === key ) ;
447447 if ( filterIndex === - 1 || reset ) {
448448 if ( draft . tempData ) {
449- const activeFilterIndex = toolData . activeFilterID
450- ? spectrum . filters . findIndex ( ( f ) => f . id === toolData . activeFilterID )
451- : spectrum . filters . length - 1 ;
449+ const activeFilterIndex =
450+ ! reset && toolData . activeFilterID
451+ ? spectrum . filters . findIndex (
452+ ( f ) => f . id === toolData . activeFilterID ,
453+ )
454+ : spectrum . filters . length ;
455+
452456 const filters = spectrum . filters . slice ( 0 , activeFilterIndex ) ;
453457 reapplyFilters ( spectrum , filters ) ;
454458 }
@@ -793,6 +797,8 @@ function handleShiftSpectrumAlongXAxis(
793797 return ;
794798 }
795799
800+ const activeFilterIndex = getActiveFilterIndex ( draft ) ;
801+
796802 //apply filter into the spectrum
797803 const options = action . payload ;
798804
@@ -808,9 +814,14 @@ function handleShiftSpectrumAlongXAxis(
808814 applyFilter : false ,
809815 } ) ;
810816
811- Filters1DManager . applyFilters ( draft . data [ index ] as Spectrum1D , [
812- { name : 'shiftX' , value : { shift } } ,
813- ] ) ;
817+ Filters1DManager . applyFilters (
818+ draft . data [ index ] as Spectrum1D ,
819+ [ { name : 'shiftX' , value : { shift } } ] ,
820+ {
821+ filterIndex : activeFilterIndex ,
822+ forceReapply : activeFilterIndex !== - 1 ,
823+ } ,
824+ ) ;
814825
815826 updateView ( draft , shiftX . domainUpdateRules ) ;
816827 }
@@ -824,9 +835,14 @@ function handleShiftSpectrumAlongXAxis(
824835 searchBy : 'name' ,
825836 applyFilter : false ,
826837 } ) ;
827- Filters2DManager . applyFilters ( draft . data [ index ] as Spectrum2D , [
828- { name : 'shift2DX' , value : { shift : shiftX } } ,
829- ] ) ;
838+ Filters2DManager . applyFilters (
839+ draft . data [ index ] as Spectrum2D ,
840+ [ { name : 'shift2DX' , value : { shift : shiftX } } ] ,
841+ {
842+ filterIndex : activeFilterIndex ,
843+ forceReapply : activeFilterIndex !== - 1 ,
844+ } ,
845+ ) ;
830846 updateView ( draft , shift2DX . domainUpdateRules ) ;
831847 }
832848
@@ -836,9 +852,14 @@ function handleShiftSpectrumAlongXAxis(
836852 searchBy : 'name' ,
837853 applyFilter : false ,
838854 } ) ;
839- Filters2DManager . applyFilters ( draft . data [ index ] as Spectrum2D , [
840- { name : 'shift2DY' , value : { shift : shiftY } } ,
841- ] ) ;
855+ Filters2DManager . applyFilters (
856+ draft . data [ index ] as Spectrum2D ,
857+ [ { name : 'shift2DY' , value : { shift : shiftY } } ] ,
858+ {
859+ filterIndex : activeFilterIndex ,
860+ forceReapply : activeFilterIndex !== - 1 ,
861+ } ,
862+ ) ;
842863
843864 updateView ( draft , shift2DY . domainUpdateRules ) ;
844865 }
0 commit comments