]> Some of my projects - aniplayer.git/commitdiff
Alternate position of chapter titles
authorAPTX <marek321@gmail.com>
Mon, 21 Feb 2022 13:46:53 +0000 (22:46 +0900)
committerAPTX <marek321@gmail.com>
Mon, 21 Feb 2022 13:46:53 +0000 (22:46 +0900)
uiplugins/ui_desktop_qml_default/qml/SeekSlider.qml

index b1b828d1b8d7297ffe3a62efa9ae355788819ae6..6bf906428381cf63cddec58c58f2d078bbc536f9 100644 (file)
@@ -5,6 +5,8 @@ Item {
     id: seekSlider
     property double duration: 0
     property double position: 0
+    property int chaperlineWidth: 2
+    property int chaperlineTextSpacing: 2
 
     signal seekRequested(double position)
 
@@ -37,13 +39,29 @@ Item {
     Repeater {
         model: player.chapterModel
         anchors.fill: parent
-        delegate: Text {
+        delegate: Rectangle {
+            id: chapterline
+            height: seekSlider.height
+            width: chaperlineWidth
+            color: "yellow"
             y: 0
+            x: toPixels(startTime - 0)
+        }
+    }
+
+    Repeater {
+        model: player.chapterModel
+        anchors.fill: parent
+        delegate: Text {
+            y: (index % Math.floor(seekSlider.height / height)) * 15
             x: {
                 console.log("CHAPTER", title, 0, toPixels(startTime - 0), startTime);
-                return toPixels(startTime - 0);
+                var x = toPixels(startTime - 0) + chaperlineWidth + chaperlineTextSpacing;
+                if ((x + width) > seekSlider.width) {
+                    x = toPixels(startTime - 0) - width - chaperlineWidth - chaperlineTextSpacing;
+                }
+                return x;
             }
-            width: toPixels(endTime - startTime)
             text: title
         }
     }