Move frameable unscaled
This commit is contained in:
parent
94d173e2bb
commit
57db78f645
2 changed files with 24 additions and 0 deletions
|
@ -415,6 +415,18 @@ impl Grid {
|
||||||
Ok(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(
|
fn child_position(
|
||||||
&self,
|
&self,
|
||||||
child: &dyn Gridable,
|
child: &dyn Gridable,
|
||||||
|
|
|
@ -430,6 +430,18 @@ impl Framable {
|
||||||
|
|
||||||
Ok(())
|
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<()> {
|
pub fn resize(&self) -> Result<()> {
|
||||||
self.calculate_frame();
|
self.calculate_frame();
|
||||||
|
|
Loading…
Reference in a new issue