Merge pull request #244 from zed-industries/mouse-selections
Improve support for selecting text via the mouse
This commit is contained in:
commit
e0bf5337ca
7 changed files with 401 additions and 102 deletions
|
@ -3650,7 +3650,11 @@ mod tests {
|
|||
presenter.borrow_mut().dispatch_event(
|
||||
Event::LeftMouseDown {
|
||||
position: Default::default(),
|
||||
ctrl: false,
|
||||
alt: false,
|
||||
shift: false,
|
||||
cmd: false,
|
||||
click_count: 1,
|
||||
},
|
||||
cx,
|
||||
);
|
||||
|
|
|
@ -14,7 +14,11 @@ pub enum Event {
|
|||
},
|
||||
LeftMouseDown {
|
||||
position: Vector2F,
|
||||
ctrl: bool,
|
||||
alt: bool,
|
||||
shift: bool,
|
||||
cmd: bool,
|
||||
click_count: usize,
|
||||
},
|
||||
LeftMouseUp {
|
||||
position: Vector2F,
|
||||
|
|
|
@ -88,14 +88,17 @@ impl Event {
|
|||
})
|
||||
}
|
||||
NSEventType::NSLeftMouseDown => {
|
||||
let modifiers = native_event.modifierFlags();
|
||||
window_height.map(|window_height| Self::LeftMouseDown {
|
||||
position: vec2f(
|
||||
native_event.locationInWindow().x as f32,
|
||||
window_height - native_event.locationInWindow().y as f32,
|
||||
),
|
||||
cmd: native_event
|
||||
.modifierFlags()
|
||||
.contains(NSEventModifierFlags::NSCommandKeyMask),
|
||||
ctrl: modifiers.contains(NSEventModifierFlags::NSControlKeyMask),
|
||||
alt: modifiers.contains(NSEventModifierFlags::NSAlternateKeyMask),
|
||||
shift: modifiers.contains(NSEventModifierFlags::NSShiftKeyMask),
|
||||
cmd: modifiers.contains(NSEventModifierFlags::NSCommandKeyMask),
|
||||
click_count: native_event.clickCount() as usize,
|
||||
})
|
||||
}
|
||||
NSEventType::NSLeftMouseUp => window_height.map(|window_height| Self::LeftMouseUp {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue