|
|
@ -8,10 +8,10 @@ use glutin::{
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use skia_safe::Rect;
|
|
|
|
use skia_safe::Rect;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use super::keyboard_manager::KeyboardManager;
|
|
|
|
use crate::bridge::UiCommand;
|
|
|
|
use crate::bridge::UiCommand;
|
|
|
|
use crate::channel_utils::LoggingTx;
|
|
|
|
use crate::channel_utils::LoggingTx;
|
|
|
|
use crate::renderer::{Renderer, WindowDrawDetails};
|
|
|
|
use crate::renderer::{Renderer, WindowDrawDetails};
|
|
|
|
use super::keyboard_manager::KeyboardManager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn clamp_position(
|
|
|
|
fn clamp_position(
|
|
|
|
position: PhysicalPosition<f32>,
|
|
|
|
position: PhysicalPosition<f32>,
|
|
|
@ -178,7 +178,12 @@ impl MouseManager {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn handle_pointer_transition(&mut self, mouse_button: &MouseButton, down: bool, keyboard_manager: &KeyboardManager) {
|
|
|
|
fn handle_pointer_transition(
|
|
|
|
|
|
|
|
&mut self,
|
|
|
|
|
|
|
|
mouse_button: &MouseButton,
|
|
|
|
|
|
|
|
down: bool,
|
|
|
|
|
|
|
|
keyboard_manager: &KeyboardManager,
|
|
|
|
|
|
|
|
) {
|
|
|
|
// For some reason pointer down is handled differently from pointer up and drag.
|
|
|
|
// For some reason pointer down is handled differently from pointer up and drag.
|
|
|
|
// Floating windows: relative coordinates are great.
|
|
|
|
// Floating windows: relative coordinates are great.
|
|
|
|
// Non floating windows: rather than global coordinates, relative are needed
|
|
|
|
// Non floating windows: rather than global coordinates, relative are needed
|
|
|
@ -210,7 +215,7 @@ impl MouseManager {
|
|
|
|
|
|
|
|
|
|
|
|
self.dragging = Some(button_text);
|
|
|
|
self.dragging = Some(button_text);
|
|
|
|
|
|
|
|
|
|
|
|
if !self.dragging.is_some() {
|
|
|
|
if self.dragging.is_none() {
|
|
|
|
self.has_moved = false;
|
|
|
|
self.has_moved = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -284,7 +289,8 @@ impl MouseManager {
|
|
|
|
self.handle_line_scroll(
|
|
|
|
self.handle_line_scroll(
|
|
|
|
pixel_x / font_width as f32,
|
|
|
|
pixel_x / font_width as f32,
|
|
|
|
pixel_y / font_height as f32,
|
|
|
|
pixel_y / font_height as f32,
|
|
|
|
keyboard_manager);
|
|
|
|
keyboard_manager,
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn handle_event(
|
|
|
|
pub fn handle_event(
|
|
|
@ -331,7 +337,8 @@ impl MouseManager {
|
|
|
|
} => self.handle_pointer_transition(
|
|
|
|
} => self.handle_pointer_transition(
|
|
|
|
button,
|
|
|
|
button,
|
|
|
|
state == &ElementState::Pressed,
|
|
|
|
state == &ElementState::Pressed,
|
|
|
|
keyboard_manager),
|
|
|
|
keyboard_manager,
|
|
|
|
|
|
|
|
),
|
|
|
|
_ => {}
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|