File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
invokeai/frontend/web/src/features/gallery Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 4
4
comparedImagesSwapped ,
5
5
comparisonFitChanged ,
6
6
comparisonModeChanged ,
7
+ comparisonModeCycled ,
7
8
imageToCompareChanged ,
8
9
} from 'features/gallery/store/gallerySlice' ;
9
10
import { memo , useCallback } from 'react' ;
@@ -36,6 +37,10 @@ export const CompareToolbar = memo(() => {
36
37
dispatch ( imageToCompareChanged ( null ) ) ;
37
38
} , [ dispatch ] ) ;
38
39
useHotkeys ( 'esc' , exitCompare , [ exitCompare ] ) ;
40
+ const nextMode = useCallback ( ( ) => {
41
+ dispatch ( comparisonModeCycled ( ) ) ;
42
+ } , [ dispatch ] ) ;
43
+ useHotkeys ( 'm' , nextMode , [ nextMode ] ) ;
39
44
40
45
return (
41
46
< Flex w = "full" gap = { 2 } >
Original file line number Diff line number Diff line change @@ -46,6 +46,19 @@ export const gallerySlice = createSlice({
46
46
comparisonModeChanged : ( state , action : PayloadAction < ComparisonMode > ) => {
47
47
state . comparisonMode = action . payload ;
48
48
} ,
49
+ comparisonModeCycled : ( state ) => {
50
+ switch ( state . comparisonMode ) {
51
+ case 'slider' :
52
+ state . comparisonMode = 'side-by-side' ;
53
+ break ;
54
+ case 'side-by-side' :
55
+ state . comparisonMode = 'hover' ;
56
+ break ;
57
+ case 'hover' :
58
+ state . comparisonMode = 'slider' ;
59
+ break ;
60
+ }
61
+ } ,
49
62
shouldAutoSwitchChanged : ( state , action : PayloadAction < boolean > ) => {
50
63
state . shouldAutoSwitch = action . payload ;
51
64
} ,
@@ -143,6 +156,7 @@ export const {
143
156
comparisonModeChanged,
144
157
comparedImagesSwapped,
145
158
comparisonFitChanged,
159
+ comparisonModeCycled,
146
160
} = gallerySlice . actions ;
147
161
148
162
const isAnyBoardDeleted = isAnyOf (
You can’t perform that action at this time.
0 commit comments