Switch Eyedropper/Fill tools from Rmb to Shift+Lmb
This commit is contained in:
parent
d780602ecd
commit
9f84661fac
|
|
@ -122,11 +122,12 @@ pub fn default_mapping() -> Mapping {
|
|||
entry!(KeyUp(Mmb); action_dispatch=NavigateToolMessage::TransformCanvasEnd),
|
||||
//
|
||||
// EyedropperToolMessage
|
||||
entry!(KeyDown(Lmb); action_dispatch=EyedropperToolMessage::SamplePrimaryColorBegin),
|
||||
entry!(KeyDown(Lmb); modifiers=[Shift], action_dispatch=EyedropperToolMessage::SampleSecondaryColorBegin),
|
||||
entry!(KeyUp(Lmb); action_dispatch=EyedropperToolMessage::SamplePrimaryColorEnd),
|
||||
entry!(KeyUp(Lmb); modifiers=[Shift], action_dispatch=EyedropperToolMessage::SampleSecondaryColorEnd),
|
||||
entry!(PointerMove; action_dispatch=EyedropperToolMessage::PointerMove),
|
||||
entry!(KeyDown(Lmb); action_dispatch=EyedropperToolMessage::LeftPointerDown),
|
||||
entry!(KeyDown(Rmb); action_dispatch=EyedropperToolMessage::RightPointerDown),
|
||||
entry!(KeyUp(Lmb); action_dispatch=EyedropperToolMessage::LeftPointerUp),
|
||||
entry!(KeyUp(Rmb); action_dispatch=EyedropperToolMessage::RightPointerUp),
|
||||
entry!(KeyDown(Rmb); action_dispatch=EyedropperToolMessage::Abort),
|
||||
entry!(KeyDown(Escape); action_dispatch=EyedropperToolMessage::Abort),
|
||||
//
|
||||
// TextToolMessage
|
||||
|
|
@ -244,8 +245,8 @@ pub fn default_mapping() -> Mapping {
|
|||
entry!(KeyDown(Enter); action_dispatch=SplineToolMessage::Confirm),
|
||||
//
|
||||
// FillToolMessage
|
||||
entry!(KeyDown(Lmb); action_dispatch=FillToolMessage::LeftPointerDown),
|
||||
entry!(KeyDown(Rmb); action_dispatch=FillToolMessage::RightPointerDown),
|
||||
entry!(KeyDown(Lmb); action_dispatch=FillToolMessage::FillPrimaryColor),
|
||||
entry!(KeyDown(Lmb); modifiers=[Shift], action_dispatch=FillToolMessage::FillSecondaryColor),
|
||||
//
|
||||
// BrushToolMessage
|
||||
entry!(PointerMove; action_dispatch=BrushToolMessage::PointerMove),
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ pub enum EyedropperToolMessage {
|
|||
Abort,
|
||||
|
||||
// Tool-specific messages
|
||||
LeftPointerDown,
|
||||
LeftPointerUp,
|
||||
SamplePrimaryColorBegin,
|
||||
SamplePrimaryColorEnd,
|
||||
PointerMove,
|
||||
RightPointerDown,
|
||||
RightPointerUp,
|
||||
SampleSecondaryColorBegin,
|
||||
SampleSecondaryColorEnd,
|
||||
}
|
||||
|
||||
impl ToolMetadata for EyedropperTool {
|
||||
|
|
@ -45,11 +45,11 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionHandlerData<'a>> for Eyedrop
|
|||
}
|
||||
|
||||
advertise_actions!(EyedropperToolMessageDiscriminant;
|
||||
LeftPointerDown,
|
||||
LeftPointerUp,
|
||||
SamplePrimaryColorBegin,
|
||||
SamplePrimaryColorEnd,
|
||||
SampleSecondaryColorBegin,
|
||||
SampleSecondaryColorEnd,
|
||||
PointerMove,
|
||||
RightPointerDown,
|
||||
RightPointerUp,
|
||||
Abort,
|
||||
);
|
||||
}
|
||||
|
|
@ -87,10 +87,10 @@ impl Fsm for EyedropperToolFsmState {
|
|||
};
|
||||
match (self, event) {
|
||||
// Ready -> Sampling
|
||||
(EyedropperToolFsmState::Ready, mouse_down) if matches!(mouse_down, EyedropperToolMessage::LeftPointerDown | EyedropperToolMessage::RightPointerDown) => {
|
||||
(EyedropperToolFsmState::Ready, mouse_down) if matches!(mouse_down, EyedropperToolMessage::SamplePrimaryColorBegin | EyedropperToolMessage::SampleSecondaryColorBegin) => {
|
||||
update_cursor_preview(responses, input, global_tool_data, None);
|
||||
|
||||
if mouse_down == EyedropperToolMessage::LeftPointerDown {
|
||||
if mouse_down == EyedropperToolMessage::SamplePrimaryColorBegin {
|
||||
EyedropperToolFsmState::SamplingPrimary
|
||||
} else {
|
||||
EyedropperToolFsmState::SamplingSecondary
|
||||
|
|
@ -107,7 +107,7 @@ impl Fsm for EyedropperToolFsmState {
|
|||
self
|
||||
}
|
||||
// Sampling -> Ready
|
||||
(EyedropperToolFsmState::SamplingPrimary, EyedropperToolMessage::LeftPointerUp) | (EyedropperToolFsmState::SamplingSecondary, EyedropperToolMessage::RightPointerUp) => {
|
||||
(EyedropperToolFsmState::SamplingPrimary, EyedropperToolMessage::SamplePrimaryColorEnd) | (EyedropperToolFsmState::SamplingSecondary, EyedropperToolMessage::SampleSecondaryColorEnd) => {
|
||||
let set_color_choice = if self == EyedropperToolFsmState::SamplingPrimary { "Primary" } else { "Secondary" }.to_string();
|
||||
update_cursor_preview(responses, input, global_tool_data, Some(set_color_choice));
|
||||
disable_cursor_preview(responses);
|
||||
|
|
@ -129,9 +129,11 @@ impl Fsm for EyedropperToolFsmState {
|
|||
let hint_data = match self {
|
||||
EyedropperToolFsmState::Ready => HintData(vec![HintGroup(vec![
|
||||
HintInfo::mouse(MouseMotion::Lmb, "Sample to Primary"),
|
||||
HintInfo::mouse(MouseMotion::Rmb, "Sample to Secondary"),
|
||||
HintInfo::keys_and_mouse([Key::Shift], MouseMotion::Lmb, "Sample to Secondary"),
|
||||
])]),
|
||||
EyedropperToolFsmState::SamplingPrimary | EyedropperToolFsmState::SamplingSecondary => HintData(vec![HintGroup(vec![HintInfo::keys([Key::Escape], "Cancel")])]),
|
||||
EyedropperToolFsmState::SamplingPrimary | EyedropperToolFsmState::SamplingSecondary => {
|
||||
HintData(vec![HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()])])
|
||||
}
|
||||
};
|
||||
|
||||
responses.add(FrontendMessage::UpdateInputHints { hint_data });
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ pub struct FillTool {
|
|||
#[derive(PartialEq, Eq, Clone, Debug, Hash, Serialize, Deserialize, specta::Type)]
|
||||
pub enum FillToolMessage {
|
||||
// Tool-specific messages
|
||||
LeftPointerDown,
|
||||
RightPointerDown,
|
||||
FillPrimaryColor,
|
||||
FillSecondaryColor,
|
||||
}
|
||||
|
||||
impl ToolMetadata for FillTool {
|
||||
|
|
@ -39,8 +39,8 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionHandlerData<'a>> for FillToo
|
|||
}
|
||||
|
||||
advertise_actions!(FillToolMessageDiscriminant;
|
||||
LeftPointerDown,
|
||||
RightPointerDown,
|
||||
FillPrimaryColor,
|
||||
FillSecondaryColor,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -72,8 +72,8 @@ impl Fsm for FillToolFsmState {
|
|||
return self;
|
||||
};
|
||||
let color = match event {
|
||||
FillToolMessage::LeftPointerDown => global_tool_data.primary_color,
|
||||
FillToolMessage::RightPointerDown => global_tool_data.secondary_color,
|
||||
FillToolMessage::FillPrimaryColor => global_tool_data.primary_color,
|
||||
FillToolMessage::FillSecondaryColor => global_tool_data.secondary_color,
|
||||
};
|
||||
let fill = Fill::Solid(color);
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ impl Fsm for FillToolFsmState {
|
|||
let hint_data = match self {
|
||||
FillToolFsmState::Ready => HintData(vec![HintGroup(vec![
|
||||
HintInfo::mouse(MouseMotion::Lmb, "Fill with Primary"),
|
||||
HintInfo::mouse(MouseMotion::Rmb, "Fill with Secondary"),
|
||||
HintInfo::keys_and_mouse([Key::Shift], MouseMotion::Lmb, "Fill with Secondary"),
|
||||
])]),
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue