From 97f9fe70fa7b1e2f348e864af5162eca23fb70b0 Mon Sep 17 00:00:00 2001 From: APTX Date: Mon, 21 Feb 2022 22:46:53 +0900 Subject: [PATCH] Alternate position of chapter titles --- .../ui_desktop_qml_default/qml/SeekSlider.qml | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/uiplugins/ui_desktop_qml_default/qml/SeekSlider.qml b/uiplugins/ui_desktop_qml_default/qml/SeekSlider.qml index b1b828d..6bf9064 100644 --- a/uiplugins/ui_desktop_qml_default/qml/SeekSlider.qml +++ b/uiplugins/ui_desktop_qml_default/qml/SeekSlider.qml @@ -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 } } -- 2.52.0