1
0
Fork 0
forked from wry/wry

autocommit 2022-01-28 03:35:35 CET

This commit is contained in:
Julian Orth 2022-01-28 03:35:35 +01:00
parent c340df0d08
commit a5573b8a3a
36 changed files with 3046 additions and 114 deletions

View file

@ -113,7 +113,11 @@ impl ContainerNode {
}
pub fn add_child_after(self: &Rc<Self>, prev: &dyn Node, new: Rc<dyn Node>) {
let node = self.child_nodes.borrow().get(&prev.id()).map(|n| n.to_ref());
let node = self
.child_nodes
.borrow()
.get(&prev.id())
.map(|n| n.to_ref());
if let Some(node) = node {
self.add_child_after_(&node, new);
return;
@ -185,7 +189,9 @@ impl ContainerNode {
body_size = body_size.min(remaining_content_size);
remaining_content_size -= body_size;
let (x1, y1, width, height) = match split {
ContainerSplit::Horizontal => (pos, CONTAINER_TITLE_HEIGHT, body_size, other_content_size),
ContainerSplit::Horizontal => {
(pos, CONTAINER_TITLE_HEIGHT, body_size, other_content_size)
}
_ => (0, pos, other_content_size, body_size),
};
let body = Rect::new_sized(x1, y1, width, height).unwrap();
@ -209,7 +215,13 @@ impl ContainerNode {
let (x1, y1, width, height, size) = match split {
ContainerSplit::Horizontal => {
let width = body.width() + add;
(pos, CONTAINER_TITLE_HEIGHT, width, other_content_size, width)
(
pos,
CONTAINER_TITLE_HEIGHT,
width,
other_content_size,
width,
)
}
_ => {
let height = body.height() + add;

View file

@ -238,7 +238,8 @@ impl Node for OutputNode {
}
fn change_size(self: Rc<Self>, width: i32, height: i32) {
self.position.set(Rect::new_sized(0, 0, width, height).unwrap());
self.position
.set(Rect::new_sized(0, 0, width, height).unwrap());
if let Some(c) = self.workspace.get() {
c.change_size(width, height);
}
@ -294,6 +295,7 @@ impl Node for FloatNode {
fn child_size_changed(&self, _child: &dyn Node, width: i32, height: i32) {
let pos = self.position.get();
self.position.set(Rect::new_sized(pos.x1(), pos.x2(), width, height).unwrap());
self.position
.set(Rect::new_sized(pos.x1(), pos.x2(), width, height).unwrap());
}
}