From 69458a0595a62c970ef1a382ad27f23e70e2d660 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Tue, 12 Mar 2024 22:06:56 +1300 Subject: [PATCH] Minor fix to graph widget --- .../translations/en/rog-control-center.po | 18 +++++++++--------- rog-control-center/ui/pages/fans.slint | 5 +++++ rog-control-center/ui/widgets/graph.slint | 16 ++++++---------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/rog-control-center/translations/en/rog-control-center.po b/rog-control-center/translations/en/rog-control-center.po index 1490a8f3..0d358769 100644 --- a/rog-control-center/translations/en/rog-control-center.po +++ b/rog-control-center/translations/en/rog-control-center.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-03-11 11:08+0000\n" +"POT-Creation-Date: 2024-03-12 08:33+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -412,42 +412,42 @@ msgctxt "AuraPowerGroup" msgid "Shutdown" msgstr "" -#: rog-control-center/ui/main_window.slint:45 +#: rog-control-center/ui/main_window.slint:47 msgctxt "MainWindow" msgid "ROG" msgstr "" -#: rog-control-center/ui/main_window.slint:47 +#: rog-control-center/ui/main_window.slint:49 msgctxt "Menu1" msgid "System Control" msgstr "" -#: rog-control-center/ui/main_window.slint:48 +#: rog-control-center/ui/main_window.slint:50 msgctxt "Menu2" msgid "Keyboard Aura" msgstr "" -#: rog-control-center/ui/main_window.slint:49 +#: rog-control-center/ui/main_window.slint:51 msgctxt "Menu3" msgid "AniMe Matrix" msgstr "" -#: rog-control-center/ui/main_window.slint:50 +#: rog-control-center/ui/main_window.slint:52 msgctxt "Menu4" msgid "Fan Curves" msgstr "" -#: rog-control-center/ui/main_window.slint:51 +#: rog-control-center/ui/main_window.slint:53 msgctxt "Menu5" msgid "App Settings" msgstr "" -#: rog-control-center/ui/main_window.slint:52 +#: rog-control-center/ui/main_window.slint:54 msgctxt "Menu6" msgid "About" msgstr "" -#: rog-control-center/ui/main_window.slint:64 +#: rog-control-center/ui/main_window.slint:66 msgctxt "MainWindow" msgid "Quit" msgstr "" diff --git a/rog-control-center/ui/pages/fans.slint b/rog-control-center/ui/pages/fans.slint index 887a5b83..aa4f543b 100644 --- a/rog-control-center/ui/pages/fans.slint +++ b/rog-control-center/ui/pages/fans.slint @@ -38,11 +38,16 @@ export component PageFans inherits VerticalLayout { y: 150px, }, ]; + Text { + text: "WORK IN PROGRESS"; + } + HorizontalLayout { Graph { // width: root.preferred-width; // height: root.preferred-height; nodes <=> root.nodes; + } } } diff --git a/rog-control-center/ui/widgets/graph.slint b/rog-control-center/ui/widgets/graph.slint index c9184cbf..974ab7fb 100644 --- a/rog-control-center/ui/widgets/graph.slint +++ b/rog-control-center/ui/widgets/graph.slint @@ -3,10 +3,6 @@ import { Palette } from "std-widgets.slint"; export struct Node { x: length, y: length} export component Graph inherits Rectangle { - Text { - text: "WORK IN PROGRESS"; - } - preferred-height: 100%; preferred-width: 100%; pure callback verify_positions([Node], length, length) -> [Node]; @@ -56,9 +52,9 @@ export component Graph inherits Rectangle { n.x = nodes[idx - 1].x + pad; } - if n.y + self.height / 2 - self.mouse-y - self.pressed-y > nodes[idx + 1].y { + if n.y + self.height - self.mouse-y - self.pressed-y > nodes[idx + 1].y { n.y = nodes[idx + 1].y - pad; - } else if n.y - self.mouse-y - self.pressed-y < nodes[idx - 1].y { + } else if n.y + self.height - self.mouse-y - self.pressed-y < nodes[idx - 1].y { n.y = nodes[idx - 1].y + pad; } } else if idx == 0 { @@ -68,9 +64,9 @@ export component Graph inherits Rectangle { n.x = nodes[idx + 1].x - pad; } - if n.y + self.height / 2 - self.mouse-y - self.pressed-y < 0.0 { + if n.y - self.mouse-y - self.pressed-y < 0.0 { n.y = 1px; - } else if n.y + self.height / 2 - self.mouse-y - self.pressed-y > nodes[idx + 1].y { + } else if n.y + self.height - self.mouse-y - self.pressed-y > nodes[idx + 1].y { n.y = nodes[idx + 1].y - pad; } } else if idx == nodes.length - 1 { @@ -80,9 +76,9 @@ export component Graph inherits Rectangle { n.x = nodes[idx - 1].x + pad; } - if n.y + self.height / 2 - self.mouse-y - self.pressed-y > root.height { + if n.y - self.mouse-y - self.pressed-y > root.height { n.y = root.height - 1px; - } else if n.y + self.height / 2 - self.mouse-y - self.pressed-y < nodes[idx - 1].y { + } else if n.y + self.height - self.mouse-y - self.pressed-y < nodes[idx - 1].y { n.y = nodes[idx - 1].y + pad; } }