change: drag dpi
This commit is contained in:
parent
a65120a159
commit
024fb88cd1
@ -48,8 +48,8 @@ impl Render {
|
||||
let pointer_location_detecture = gtk::EventControllerMotion::new();
|
||||
pointer_location_detecture.connect_motion(
|
||||
clone!( @weak this as r => move |_context, x, y| {
|
||||
r.update_status(|s| {
|
||||
let dpi = r.scale_factor();
|
||||
r.update_status(|s| {
|
||||
let (_,h) = s.window_size.unwrap();
|
||||
s.pointer_location = (x as f32 * dpi as f32, h as f32 - y as f32 * dpi as f32);
|
||||
});
|
||||
@ -73,8 +73,9 @@ impl Render {
|
||||
drag_detecture.connect_drag_update(clone!(
|
||||
@weak this as r => move |this, _, _| {
|
||||
let (ox, oy) = this.offset().unwrap_or((0.0,0.0));
|
||||
let dpi = r.scale_factor() as f32;
|
||||
r.update_status(|s| {
|
||||
s.translate = Some((-ox as f32 * 1.35, oy as f32 * 1.35));
|
||||
s.translate = Some((-ox as f32 * dpi , oy as f32 * dpi));
|
||||
s.motion = RenderMotion::Translate;
|
||||
});
|
||||
r.queue_render();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user