Minor fix to graph widget

This commit is contained in:
Luke D. Jones
2024-03-12 22:06:56 +13:00
parent 5fd107df27
commit 69458a0595
3 changed files with 20 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -412,42 +412,42 @@ msgctxt "AuraPowerGroup"
msgid "Shutdown" msgid "Shutdown"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:45 #: rog-control-center/ui/main_window.slint:47
msgctxt "MainWindow" msgctxt "MainWindow"
msgid "ROG" msgid "ROG"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:47 #: rog-control-center/ui/main_window.slint:49
msgctxt "Menu1" msgctxt "Menu1"
msgid "System Control" msgid "System Control"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:48 #: rog-control-center/ui/main_window.slint:50
msgctxt "Menu2" msgctxt "Menu2"
msgid "Keyboard Aura" msgid "Keyboard Aura"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:49 #: rog-control-center/ui/main_window.slint:51
msgctxt "Menu3" msgctxt "Menu3"
msgid "AniMe Matrix" msgid "AniMe Matrix"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:50 #: rog-control-center/ui/main_window.slint:52
msgctxt "Menu4" msgctxt "Menu4"
msgid "Fan Curves" msgid "Fan Curves"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:51 #: rog-control-center/ui/main_window.slint:53
msgctxt "Menu5" msgctxt "Menu5"
msgid "App Settings" msgid "App Settings"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:52 #: rog-control-center/ui/main_window.slint:54
msgctxt "Menu6" msgctxt "Menu6"
msgid "About" msgid "About"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:64 #: rog-control-center/ui/main_window.slint:66
msgctxt "MainWindow" msgctxt "MainWindow"
msgid "Quit" msgid "Quit"
msgstr "" msgstr ""

View File

@@ -38,11 +38,16 @@ export component PageFans inherits VerticalLayout {
y: 150px, y: 150px,
}, },
]; ];
Text {
text: "WORK IN PROGRESS";
}
HorizontalLayout { HorizontalLayout {
Graph { Graph {
// width: root.preferred-width; // width: root.preferred-width;
// height: root.preferred-height; // height: root.preferred-height;
nodes <=> root.nodes; nodes <=> root.nodes;
} }
} }
} }

View File

@@ -3,10 +3,6 @@ import { Palette } from "std-widgets.slint";
export struct Node { x: length, y: length} export struct Node { x: length, y: length}
export component Graph inherits Rectangle { export component Graph inherits Rectangle {
Text {
text: "WORK IN PROGRESS";
}
preferred-height: 100%; preferred-height: 100%;
preferred-width: 100%; preferred-width: 100%;
pure callback verify_positions([Node], length, length) -> [Node]; pure callback verify_positions([Node], length, length) -> [Node];
@@ -56,9 +52,9 @@ export component Graph inherits Rectangle {
n.x = nodes[idx - 1].x + pad; 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; 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; n.y = nodes[idx - 1].y + pad;
} }
} else if idx == 0 { } else if idx == 0 {
@@ -68,9 +64,9 @@ export component Graph inherits Rectangle {
n.x = nodes[idx + 1].x - pad; 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; 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; n.y = nodes[idx + 1].y - pad;
} }
} else if idx == nodes.length - 1 { } else if idx == nodes.length - 1 {
@@ -80,9 +76,9 @@ export component Graph inherits Rectangle {
n.x = nodes[idx - 1].x + pad; 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; 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; n.y = nodes[idx - 1].y + pad;
} }
} }