Skip to content

Commit

Permalink
Improve vertical scroll bar animation
Browse files Browse the repository at this point in the history
  • Loading branch information
nuttyartist committed Oct 27, 2023
1 parent ce6aaa6 commit 04c84d1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/noteeditorlogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void NoteEditorLogic::showNotesInEditor(const QVector<NodeData> &notes)
// set text and date
// bool isTextChanged = content != m_textEdit->toPlainText();
// if (isTextChanged) {
// m_textEdit->setText(content);
m_textEdit->setText(content);
m_blockModel->loadText(content);
// }
// m_blockModel->loadText(content);
Expand Down
18 changes: 17 additions & 1 deletion src/qml/CustomVerticalScrollBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ScrollBar {
height: parent.availableHeight
minimumSize: 0.08
property var themeData: {{theme: "Light"}}
property bool isDarkGray: true // Deterimnes wether the scrollbar color in Dark mode should be grayish or darkish
property bool isDarkGray: true // Determines wether the scrollbar color in Dark mode should be grayish or darkish
property bool showBackground: false

background: Rectangle {
Expand All @@ -30,10 +30,26 @@ ScrollBar {
opacity: scrollBarControl.policy === ScrollBar.AlwaysOn || (scrollBarControl.active && scrollBarControl.size < 1.0) ? 0.75 : 0

Behavior on opacity {
enabled: opacityDelayTimer.running // Sync the animation's running state with the timer's
NumberAnimation {
duration: 250
}
}

Timer {
id: opacityDelayTimer
interval: 1200
repeat: false

onTriggered: {
parent.opacity = scrollBarControl.policy === ScrollBar.AlwaysOn || (scrollBarControl.active && scrollBarControl.size < 1.0) ? 0.75 : 0
}
}
onOpacityChanged: {
if (!opacityDelayTimer.running) {
opacityDelayTimer.start()
}
}
}

function keepActive () {
Expand Down
2 changes: 1 addition & 1 deletion src/qml/OptionItemButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MouseArea {
property bool isContainingMouse: optionItemMouseArea.containsMouse
property bool checked: false
property var themeData: {{thme: "Light"}}
property bool enabled: true
// property bool isEnabled: true
property int pointSizeOffset: -4

hoverEnabled: true
Expand Down

0 comments on commit 04c84d1

Please sign in to comment.