Move frameable unscaled

This commit is contained in:
hodasemi 2024-04-21 08:28:17 +02:00
parent 94d173e2bb
commit 57db78f645
2 changed files with 24 additions and 0 deletions

View file

@ -415,6 +415,18 @@ impl Grid {
Ok(grid)
}
pub fn change_position_unscaled(&self, x: i32, y: i32) -> Result<()> {
self.framable.change_position_unscaled(x, y)?;
if let Some(background) = self.background.read().unwrap().as_ref() {
background.update_frame()?;
}
self.calculate_child_positions()?;
Ok(())
}
fn child_position(
&self,
child: &dyn Gridable,

View file

@ -430,6 +430,18 @@ impl Framable {
Ok(())
}
pub fn change_position_unscaled(&self, x: i32, y: i32) -> Result<()> {
assert!(self.is_framed(), "framable needs to be framed first!");
self.left.store(x, SeqCst);
self.top.store(y, SeqCst);
for (_, callback) in self.resize_callbacks.read().unwrap().iter() {
callback()?;
}
Ok(())
}
pub fn resize(&self) -> Result<()> {
self.calculate_frame();