mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 18:18:11 +08:00
Add shaking input gesture to disconnect a node being dragged (#2889)
* Add shaking input gesture to disconnect a node being dragged * Improve shake detection algorithm * Fix reconnection * Improve shake reconnect logic * Fix history --------- Co-authored-by: Adam <adamgerhant@gmail.com>
This commit is contained in:
@@ -384,6 +384,17 @@ impl EditorHandle {
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Mouse shaken
|
||||
#[wasm_bindgen(js_name = onMouseShake)]
|
||||
pub fn on_mouse_shake(&self, x: f64, y: f64, mouse_keys: u8, modifiers: u8) {
|
||||
let editor_mouse_state = EditorMouseState::from_keys_and_editor_position(mouse_keys, (x, y).into());
|
||||
|
||||
let modifier_keys = ModifierKeys::from_bits(modifiers).expect("Invalid modifier keys");
|
||||
|
||||
let message = InputPreprocessorMessage::PointerShake { editor_mouse_state, modifier_keys };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Mouse double clicked
|
||||
#[wasm_bindgen(js_name = onDoubleClick)]
|
||||
pub fn on_double_click(&self, x: f64, y: f64, mouse_keys: u8, modifiers: u8) {
|
||||
|
||||
Reference in New Issue
Block a user