1
0
Fork 0
forked from wry/wry

it: test dnd focus change on drop

This commit is contained in:
Julian Orth 2024-04-02 16:52:32 +02:00
parent a39031d4f9
commit c6b34550d8
16 changed files with 421 additions and 9 deletions

View file

@ -0,0 +1,11 @@
use crate::rect::Rect;
pub trait TestRectExt {
fn center(&self) -> (i32, i32);
}
impl TestRectExt for Rect {
fn center(&self) -> (i32, i32) {
((self.x1() + self.x2()) / 2, (self.y1() + self.y2()) / 2)
}
}

View file

@ -1,4 +1,4 @@
use crate::tree::ToplevelNode;
use crate::{it::test_utils::test_rect_ext::TestRectExt, tree::ToplevelNode};
pub trait TestToplevelNodeExt {
fn center(&self) -> (i32, i32);
@ -6,7 +6,6 @@ pub trait TestToplevelNodeExt {
impl TestToplevelNodeExt for dyn ToplevelNode {
fn center(&self) -> (i32, i32) {
let rect = self.node_absolute_position();
((rect.x1() + rect.x2()) / 2, (rect.y1() + rect.y2()) / 2)
self.node_absolute_position().center()
}
}