@@ -14,11 +14,11 @@ pub enum EyedropperToolMessage {
14
14
Abort ,
15
15
16
16
// Tool-specific messages
17
- LeftPointerDown ,
18
- LeftPointerUp ,
17
+ SamplePrimaryColorBegin ,
18
+ SamplePrimaryColorEnd ,
19
19
PointerMove ,
20
- RightPointerDown ,
21
- RightPointerUp ,
20
+ SampleSecondaryColorBegin ,
21
+ SampleSecondaryColorEnd ,
22
22
}
23
23
24
24
impl ToolMetadata for EyedropperTool {
@@ -45,11 +45,11 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionHandlerData<'a>> for Eyedrop
45
45
}
46
46
47
47
advertise_actions ! ( EyedropperToolMessageDiscriminant ;
48
- LeftPointerDown ,
49
- LeftPointerUp ,
48
+ SamplePrimaryColorBegin ,
49
+ SamplePrimaryColorEnd ,
50
+ SampleSecondaryColorBegin ,
51
+ SampleSecondaryColorEnd ,
50
52
PointerMove ,
51
- RightPointerDown ,
52
- RightPointerUp ,
53
53
Abort ,
54
54
) ;
55
55
}
@@ -87,10 +87,10 @@ impl Fsm for EyedropperToolFsmState {
87
87
} ;
88
88
match ( self , event) {
89
89
// Ready -> Sampling
90
- ( EyedropperToolFsmState :: Ready , mouse_down) if matches ! ( mouse_down, EyedropperToolMessage :: LeftPointerDown | EyedropperToolMessage :: RightPointerDown ) => {
90
+ ( EyedropperToolFsmState :: Ready , mouse_down) if matches ! ( mouse_down, EyedropperToolMessage :: SamplePrimaryColorBegin | EyedropperToolMessage :: SampleSecondaryColorBegin ) => {
91
91
update_cursor_preview ( responses, input, global_tool_data, None ) ;
92
92
93
- if mouse_down == EyedropperToolMessage :: LeftPointerDown {
93
+ if mouse_down == EyedropperToolMessage :: SamplePrimaryColorBegin {
94
94
EyedropperToolFsmState :: SamplingPrimary
95
95
} else {
96
96
EyedropperToolFsmState :: SamplingSecondary
@@ -107,7 +107,7 @@ impl Fsm for EyedropperToolFsmState {
107
107
self
108
108
}
109
109
// Sampling -> Ready
110
- ( EyedropperToolFsmState :: SamplingPrimary , EyedropperToolMessage :: LeftPointerUp ) | ( EyedropperToolFsmState :: SamplingSecondary , EyedropperToolMessage :: RightPointerUp ) => {
110
+ ( EyedropperToolFsmState :: SamplingPrimary , EyedropperToolMessage :: SamplePrimaryColorEnd ) | ( EyedropperToolFsmState :: SamplingSecondary , EyedropperToolMessage :: SampleSecondaryColorEnd ) => {
111
111
let set_color_choice = if self == EyedropperToolFsmState :: SamplingPrimary { "Primary" } else { "Secondary" } . to_string ( ) ;
112
112
update_cursor_preview ( responses, input, global_tool_data, Some ( set_color_choice) ) ;
113
113
disable_cursor_preview ( responses) ;
@@ -129,9 +129,11 @@ impl Fsm for EyedropperToolFsmState {
129
129
let hint_data = match self {
130
130
EyedropperToolFsmState :: Ready => HintData ( vec ! [ HintGroup ( vec![
131
131
HintInfo :: mouse( MouseMotion :: Lmb , "Sample to Primary" ) ,
132
- HintInfo :: mouse ( MouseMotion :: Rmb , "Sample to Secondary" ) ,
132
+ HintInfo :: keys_and_mouse ( [ Key :: Shift ] , MouseMotion :: Lmb , "Sample to Secondary" ) ,
133
133
] ) ] ) ,
134
- EyedropperToolFsmState :: SamplingPrimary | EyedropperToolFsmState :: SamplingSecondary => HintData ( vec ! [ HintGroup ( vec![ HintInfo :: keys( [ Key :: Escape ] , "Cancel" ) ] ) ] ) ,
134
+ EyedropperToolFsmState :: SamplingPrimary | EyedropperToolFsmState :: SamplingSecondary => {
135
+ HintData ( vec ! [ HintGroup ( vec![ HintInfo :: mouse( MouseMotion :: Rmb , "" ) , HintInfo :: keys( [ Key :: Escape ] , "Cancel" ) . prepend_slash( ) ] ) ] )
136
+ }
135
137
} ;
136
138
137
139
responses. add ( FrontendMessage :: UpdateInputHints { hint_data } ) ;
0 commit comments