macOS: Support click-dragging out of a window (#1607)

* macos: Support click-dragging out of a window

* macos: Use NSEvent::pressedMouseButtons for click-dragging

* macos: Click-dragging: Move pressedMouseButtons inside
This commit is contained in:
Andrey Lesnikov 2020-06-20 03:42:19 +03:00 committed by GitHub
parent bf62103417
commit 2191e9ecd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -915,9 +915,12 @@ fn mouse_motion(this: &Object, event: id) {
|| view_point.x > view_rect.size.width || view_point.x > view_rect.size.width
|| view_point.y > view_rect.size.height || view_point.y > view_rect.size.height
{ {
// Point is outside of the client area (view) let mouse_buttons_down: NSInteger = msg_send![class!(NSEvent), pressedMouseButtons];
if mouse_buttons_down == 0 {
// Point is outside of the client area (view) and no buttons are pressed
return; return;
} }
}
let x = view_point.x as f64; let x = view_point.x as f64;
let y = view_rect.size.height as f64 - view_point.y as f64; let y = view_rect.size.height as f64 - view_point.y as f64;