Fix #2898: Up and Down change the corner kind while dragging a widget

Squashed from #5090 onto main.
This commit is contained in:
Don Omondi
2026-11-02 14:36:12 +07:00
committed by bflatastic
parent 9299c64d42
commit 62f133fa0b
8 changed files with 199 additions and 7 deletions
+5
View File
@@ -617,6 +617,10 @@ impl Tool for SelectionTool {
/// is left, and the tool waits for the next press. With the pointer loaded with text, Escape
/// drops the text.
fn key(&mut self, _cx: &ToolContext, key: ToolKey, _mods: Mods) -> Vec<Action> {
// Up and Down while a corner widget is pressed: the corners' kind (#2898).
if let (ToolKey::Up | ToolKey::Down, State::Corner(c)) = (key, &mut self.state) {
return c.step_kind(key == ToolKey::Up);
}
if key == ToolKey::Letter('e')
&& let State::Marquee { enclosed, .. } = &mut self.state
{
@@ -652,6 +656,7 @@ impl Tool for SelectionTool {
fn claims_key(&self, _cx: &ToolContext, key: ToolKey) -> bool {
match self.state {
State::Marquee { .. } => key == ToolKey::Letter('e'),
State::Corner(_) => matches!(key, ToolKey::Up | ToolKey::Down),
State::Loaded { .. } | State::Mirror(_) | State::GridRepeat(_) => key == ToolKey::Escape,
_ => false,
}