From 4549ba6ff5aa0837a3789e1b363f80c929dee77b Mon Sep 17 00:00:00 2001 From: "Tom A. Wagner" Date: Sat, 9 Dec 2023 16:01:11 +0100 Subject: [PATCH] ui: Force LTR direction on the nodes port grid and on ports Forces the direction on the nodes internal port grid and on the ports themselves to be always left-to-right (LTR), to avoid the UI becoming messed up when defaulting to right-to-left (RTL). Previously, when using RTL, the side of input and output ports would be swapped, causing the port handles to be inside the node instead of at the edge. --- src/ui/graph/node.rs | 3 +++ src/ui/graph/port.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/ui/graph/node.rs b/src/ui/graph/node.rs index 54d71c6..a3f1afb 100644 --- a/src/ui/graph/node.rs +++ b/src/ui/graph/node.rs @@ -85,6 +85,9 @@ mod imp { fn constructed(&self) { self.parent_constructed(); + // Force left-to-right direction for the ports grid to avoid messed up UI when defaulting to right-to-left + self.port_grid.set_direction(gtk::TextDirection::Ltr); + // Display a grab cursor when the mouse is over the label so the user knows the node can be dragged. self.node_name .set_cursor(gtk::gdk::Cursor::from_name("grab", None).as_ref()); diff --git a/src/ui/graph/port.rs b/src/ui/graph/port.rs index b79e4d7..13a5d9b 100644 --- a/src/ui/graph/port.rs +++ b/src/ui/graph/port.rs @@ -101,6 +101,9 @@ mod imp { fn constructed(&self) { self.parent_constructed(); + // Force left-to-right direction for the ports grid to avoid messed up UI when defaulting to right-to-left + self.obj().set_direction(gtk::TextDirection::Ltr); + // Display a grab cursor when the mouse is over the port so the user knows it can be dragged to another port. self.obj() .set_cursor(gtk::gdk::Cursor::from_name("grab", None).as_ref());