mirror of
https://gitlab.freedesktop.org/pipewire/helvum
synced 2026-03-15 11:36:11 +08:00
First nodes that GraphView::add_node creates, get pushed
to the left side of the screen. So by adding a constant offset, we can avoid having possible links that are partly out of the view just after starting the program
This commit is contained in:
@@ -237,8 +237,8 @@ impl GraphView {
|
|||||||
|
|
||||||
// Place widgets in colums of 4, growing down, then right.
|
// Place widgets in colums of 4, growing down, then right.
|
||||||
// TODO: Make a better positioning algorithm.
|
// TODO: Make a better positioning algorithm.
|
||||||
let x = (private.nodes.borrow().len() / 4) as f32 * 400.0; // This relies on integer division rounding down.
|
let x = ((private.nodes.borrow().len() / 4) as f32 * 400.0) + 20.0; // This relies on integer division rounding down.
|
||||||
let y = private.nodes.borrow().len() as f32 % 4.0 * 100.0;
|
let y = (private.nodes.borrow().len() as f32 % 4.0 * 100.0) + 20.0;
|
||||||
|
|
||||||
self.move_node(&node.clone().upcast(), x, y);
|
self.move_node(&node.clone().upcast(), x, y);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user