mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-03 22:28:11 +08:00
Block the undo shortcut while dragging with a tool (#1675)
Add NOOP message and bind it to CTRL + Z + LMB
This commit is contained in:
@@ -48,6 +48,8 @@ pub fn default_mapping() -> Mapping {
|
|||||||
// NORMAL PRIORITY
|
// NORMAL PRIORITY
|
||||||
// ===============
|
// ===============
|
||||||
//
|
//
|
||||||
|
// Hack to prevent LMB + CTRL (OPTION) + Z combo (this effectively blocks you from making a double undo with AbortTransaction)
|
||||||
|
entry!(KeyDown(KeyZ); modifiers=[Accel, Lmb], action_dispatch=DocumentMessage::Noop),
|
||||||
// NodeGraphMessage
|
// NodeGraphMessage
|
||||||
entry!(KeyDown(Delete); modifiers=[Accel], action_dispatch=NodeGraphMessage::DeleteSelectedNodes { reconnect: false }),
|
entry!(KeyDown(Delete); modifiers=[Accel], action_dispatch=NodeGraphMessage::DeleteSelectedNodes { reconnect: false }),
|
||||||
entry!(KeyDown(Backspace); modifiers=[Accel], action_dispatch=NodeGraphMessage::DeleteSelectedNodes { reconnect: false }),
|
entry!(KeyDown(Backspace); modifiers=[Accel], action_dispatch=NodeGraphMessage::DeleteSelectedNodes { reconnect: false }),
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ impl InputPreprocessorMessageHandler {
|
|||||||
let new_down = new_state.mouse_keys & bit_flag == bit_flag;
|
let new_down = new_state.mouse_keys & bit_flag == bit_flag;
|
||||||
if !old_down && new_down {
|
if !old_down && new_down {
|
||||||
if allow_first_button_down || self.mouse.mouse_keys != MouseKeys::empty() {
|
if allow_first_button_down || self.mouse.mouse_keys != MouseKeys::empty() {
|
||||||
|
self.keyboard.set(key as usize);
|
||||||
responses.add(InputMapperMessage::KeyDown(key));
|
responses.add(InputMapperMessage::KeyDown(key));
|
||||||
} else {
|
} else {
|
||||||
// Required to stop a keyup being emitted for a keydown outside canvas
|
// Required to stop a keyup being emitted for a keydown outside canvas
|
||||||
@@ -117,6 +118,7 @@ impl InputPreprocessorMessageHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if old_down && !new_down {
|
if old_down && !new_down {
|
||||||
|
self.keyboard.unset(key as usize);
|
||||||
responses.add(InputMapperMessage::KeyUp(key));
|
responses.add(InputMapperMessage::KeyUp(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[impl_message(Message, PortfolioMessage, Document)]
|
#[impl_message(Message, PortfolioMessage, Document)]
|
||||||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
|
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
|
||||||
pub enum DocumentMessage {
|
pub enum DocumentMessage {
|
||||||
|
Noop,
|
||||||
// Sub-messages
|
// Sub-messages
|
||||||
#[child]
|
#[child]
|
||||||
Navigation(NavigationMessage),
|
Navigation(NavigationMessage),
|
||||||
|
|||||||
@@ -892,6 +892,7 @@ impl MessageHandler<DocumentMessage, DocumentInputs<'_>> for DocumentMessageHand
|
|||||||
responses.add(NavigationMessage::FitViewportToBounds { bounds, prevent_zoom_past_100: true });
|
responses.add(NavigationMessage::FitViewportToBounds { bounds, prevent_zoom_past_100: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Noop => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1522,6 +1523,7 @@ impl DocumentMessageHandler {
|
|||||||
|
|
||||||
pub fn actions_with_graph_open(&self) -> ActionList {
|
pub fn actions_with_graph_open(&self) -> ActionList {
|
||||||
let mut common = actions!(DocumentMessageDiscriminant;
|
let mut common = actions!(DocumentMessageDiscriminant;
|
||||||
|
Noop,
|
||||||
Undo,
|
Undo,
|
||||||
Redo,
|
Redo,
|
||||||
SelectAllLayers,
|
SelectAllLayers,
|
||||||
|
|||||||
Reference in New Issue
Block a user