From c5d38dd22d08ae1e828664788be4b3d258e0ebdc Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 14 Oct 2025 19:47:58 +0200 Subject: Scale diagram idenpendently on axis --- client/gui/menus/book/diagram.gd | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'client') diff --git a/client/gui/menus/book/diagram.gd b/client/gui/menus/book/diagram.gd index f1f19399..abd22a01 100644 --- a/client/gui/menus/book/diagram.gd +++ b/client/gui/menus/book/diagram.gd @@ -75,15 +75,9 @@ func redraw_images() -> void: func scale(bounds: Rect2) -> void: var current := Rect2(Vector2(INF, INF), Vector2(-INF, -INF)) for n: DiagramNode in draw_nodes: - if n.position.x < current.position.x: - current.position.x = n.position.x - if n.position.y < current.position.y: - current.position.y = n.position.y - if n.position.x > current.end.x: - current.end.x = n.position.x - if n.position.y > current.end.y: - current.end.y = n.position.y - var s := bounds.size / current.size + current.position = current.position.min(n.position) + current.end = current.end.max(n.position) + var s = Vector2.ONE.min(bounds.size / current.size) for n: DiagramNode in nodes: var p := n.position p -= current.position -- cgit v1.3