Fix moving frameable

This commit is contained in:
hodasemi 2024-04-21 08:33:15 +02:00
parent 57db78f645
commit bb27a8cda0

View file

@ -433,8 +433,18 @@ impl Framable {
pub fn change_position_unscaled(&self, x: i32, y: i32) -> Result<()> { pub fn change_position_unscaled(&self, x: i32, y: i32) -> Result<()> {
assert!(self.is_framed(), "framable needs to be framed first!"); assert!(self.is_framed(), "framable needs to be framed first!");
let left = self.left.load(SeqCst);
let top = self.top.load(SeqCst);
let bottom = self.bottom.load(SeqCst);
let right = self.right.load(SeqCst);
let width = right - left;
let height = bottom - top;
self.left.store(x, SeqCst); self.left.store(x, SeqCst);
self.top.store(y, SeqCst); self.top.store(y, SeqCst);
self.right.store(x + width, SeqCst);
self.bottom.store(y + height, SeqCst);
for (_, callback) in self.resize_callbacks.read().unwrap().iter() { for (_, callback) in self.resize_callbacks.read().unwrap().iter() {
callback()?; callback()?;