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 ""
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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 ""

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}