Close expired menus and cancel noneditable sequence gestures
This commit is contained in:
@@ -1452,6 +1452,11 @@ impl App {
|
||||
|| menu.request.canvas.is_some())
|
||||
&& (menu.token != *token || !menu.valid(self))
|
||||
{
|
||||
// Consume an expired menu's own packet without touching a newer
|
||||
// menu or crossing source/selection boundaries.
|
||||
if menu.token == *token {
|
||||
self.model_menu = None;
|
||||
}
|
||||
return Task::none();
|
||||
}
|
||||
if self.scenario_group_selected()
|
||||
|
||||
@@ -2071,15 +2071,15 @@ impl canvas::Program<Message> for Scene {
|
||||
}
|
||||
}
|
||||
state.bounds = Some(bounds);
|
||||
if !editable {
|
||||
state.group_press = None;
|
||||
}
|
||||
if (!editable || !self.coordinate_input)
|
||||
&& matches!(state.press, Some(SequencePress::Spacing { .. }))
|
||||
&& let Some(cancelled) = state.cancel_spacing()
|
||||
{
|
||||
return Some(cancelled);
|
||||
}
|
||||
if !editable {
|
||||
state.cancel();
|
||||
}
|
||||
// The viewport masks input outside its visible canvas bounds.
|
||||
let visible = cursor.position().is_some();
|
||||
if !visible
|
||||
|
||||
@@ -328,7 +328,10 @@ fn state_group_delete_and_escape_respect_held_gesture_and_full_set() {
|
||||
let mut state = State::default();
|
||||
use keyboard::key::Named;
|
||||
assert!(matches!(group_key(&canvas, &mut state, Named::Delete, keyboard::Modifiers::empty()), Some(Event::Selection(SelectionEvent::Hide(_)))));
|
||||
assert!(matches!(group_key(&canvas, &mut state, Named::Delete, keyboard::Modifiers::SHIFT), Some(Event::Selection(SelectionEvent::Refuse(_, _)))));
|
||||
let Some(Event::ModelRemoval(removal)) = group_key(&canvas, &mut state, Named::Delete, keyboard::Modifiers::SHIFT) else {
|
||||
panic!("Shift+Delete must capture the complete model-removal group");
|
||||
};
|
||||
assert!(matches!(*removal, crate::app::saved_removal::Event::Begin { snapshot, .. } if snapshot.targets() == selection.targets()));
|
||||
let at = screen(&canvas, header(&canvas, f.a));
|
||||
motion(&canvas, &mut state, at, at);
|
||||
input(&canvas, &mut state, mouse::Event::ButtonPressed(mouse::Button::Left), at);
|
||||
|
||||
Reference in New Issue
Block a user