Refactor using Fable

This commit is contained in:
Agel committed 2026-07-31 17:31:02 +02:00
1 parent 1a60a6b93c
commit 83968646c6
90 files changed
+2080 -2267

No files matched your search

+13 -9
View File
@@ -5,6 +5,9 @@ import Asteria
Rectangle {
focus: true
// Width reserved for the vertical scrollbar on the right edge.
readonly property int scrollbarWidth: 18
property bool contentReady: false
property bool resizing: false
property bool restoreReady: false
@@ -60,7 +63,7 @@ Rectangle {
}
function updateContentWidth() {
book.setContentWidth(chunkListView.width - 18 - 2 * readingPreferences.horizontalMargin)
book.setContentWidth(chunkListView.width - scrollbarWidth - 2 * readingPreferences.horizontalMargin)
}
Component.onCompleted: updateContentWidth()
@@ -104,7 +107,7 @@ Rectangle {
}
Text {
id: contentText
width: parent.width - 18 // subtract scrollbar
width: parent.width - scrollbarWidth
leftPadding: readingPreferences.horizontalMargin
rightPadding: readingPreferences.horizontalMargin
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
@@ -115,8 +118,8 @@ Rectangle {
text: model.content
visible: model.content !== ""
onImplicitHeightChanged: {
if (model.pixelHeight > 0 && implicitHeight > 0) {
var diff = model.pixelHeight - implicitHeight
if (isDebugBuild && model.pixelHeight > 0 && implicitHeight > 0) {
const diff = model.pixelHeight - implicitHeight
if (Math.abs(diff) > 1) {
console.warn("Chunk", model.index,
"height mismatch: measured=" + model.pixelHeight,
@@ -136,19 +139,19 @@ Rectangle {
policy: ScrollBar.AsNeeded
padding: 0
contentItem: Rectangle {
implicitWidth: 18
implicitWidth: scrollbarWidth
radius: 3
color: ThemeManager.currentTheme.scrollbarThumb
}
background: Rectangle {
implicitWidth: 18
implicitWidth: scrollbarWidth
color: ThemeManager.currentTheme.scrollbarTrack
}
}
MouseArea {
anchors.fill: parent
anchors.rightMargin: 18
anchors.rightMargin: scrollbarWidth
z: 1
onClicked: clickDebounce.restart()
onDoubleClicked: {
@@ -162,7 +165,7 @@ Rectangle {
interval: 150
onTriggered: {
window.barsVisible = !window.barsVisible
window.sidebarOpen = !window.sidebarOpen
uiState.sidebarOpen = !uiState.sidebarOpen
}
}
}
@@ -210,7 +213,8 @@ Rectangle {
interval: 1
repeat: false
onTriggered: {
console.info("Restoring contentHeight:", chunkListView.contentHeight, "originY:", chunkListView.originY, "chunkIndex:", initialIndex, "intraOffset:", initialOffset)
if (isDebugBuild)
console.info("Restoring contentHeight:", chunkListView.contentHeight, "originY:", chunkListView.originY, "chunkIndex:", initialIndex, "intraOffset:", initialOffset)
chunkListView.positionViewAtIndex(initialIndex, ListView.Beginning)
chunkListView.contentY += initialOffset
restoreReady = true