1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

Updates to scrolling logic

This commit is contained in:
purian23
2025-08-06 23:18:30 -04:00
parent 633927da9a
commit 722fd36c0a
13 changed files with 102 additions and 129 deletions

View File

@@ -433,27 +433,20 @@ DankModal {
ListView {
id: clipboardListView
property real wheelMultiplier: 1.8
property int wheelBaseStep: 160
anchors.fill: parent
anchors.margins: Theme.spacingS
clip: true
model: filteredClipboardModel
spacing: Theme.spacingXS
WheelHandler {
target: null
onWheel: (ev) => {
let dy = ev.pixelDelta.y !== 0 ? ev.pixelDelta.y : (ev.angleDelta.y / 120) * clipboardListView.wheelBaseStep;
if (ev.inverted)
dy = -dy;
const maxY = Math.max(0, clipboardListView.contentHeight - clipboardListView.height);
clipboardListView.contentY = Math.max(0, Math.min(maxY, clipboardListView.contentY - dy * clipboardListView.wheelMultiplier));
ev.accepted = true;
}
}
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
interactive: true
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
boundsBehavior: Flickable.DragAndOvershootBounds
boundsMovement: Flickable.FollowBoundsBehavior
pressDelay: 0
flickableDirection: Flickable.VerticalFlick
StyledText {
text: "No clipboard entries found"

View File

@@ -203,24 +203,14 @@ DankModal {
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
ScrollBar.horizontal: ScrollBar { policy: ScrollBar.AlwaysOff }
property real wheelMultiplier: 1.8
property int wheelBaseStep: 160
WheelHandler {
target: null
onWheel: (ev) => {
let dy = ev.pixelDelta.y !== 0
? ev.pixelDelta.y
: (ev.angleDelta.y / 120) * fileGrid.wheelBaseStep;
if (ev.inverted) dy = -dy;
const maxY = Math.max(0, fileGrid.contentHeight - fileGrid.height);
fileGrid.contentY = Math.max(0, Math.min(maxY,
fileGrid.contentY - dy * fileGrid.wheelMultiplier));
ev.accepted = true;
}
}
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
interactive: true
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
boundsBehavior: Flickable.DragAndOvershootBounds
boundsMovement: Flickable.FollowBoundsBehavior
pressDelay: 0
flickableDirection: Flickable.VerticalFlick
delegate: StyledRect {
id: delegateRoot

View File

@@ -90,27 +90,20 @@ DankModal {
}
Flickable {
property real wheelMultiplier: 1.8
property int wheelBaseStep: 160
width: parent.width
height: parent.height - 140
clip: true
contentWidth: width
contentHeight: detailsRect.height
WheelHandler {
target: null
onWheel: (ev) => {
let dy = ev.pixelDelta.y !== 0 ? ev.pixelDelta.y : (ev.angleDelta.y / 120) * parent.wheelBaseStep;
if (ev.inverted)
dy = -dy;
const maxY = Math.max(0, parent.contentHeight - parent.height);
parent.contentY = Math.max(0, Math.min(maxY, parent.contentY - dy * parent.wheelMultiplier));
ev.accepted = true;
}
}
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
interactive: true
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
boundsBehavior: Flickable.DragAndOvershootBounds
boundsMovement: Flickable.FollowBoundsBehavior
pressDelay: 0
flickableDirection: Flickable.VerticalFlick
Rectangle {
id: detailsRect

View File

@@ -114,9 +114,16 @@ Rectangle {
opacity: hasEvents ? 1 : 0
clip: true
spacing: Theme.spacingS
boundsMovement: Flickable.StopAtBounds
boundsBehavior: Flickable.StopAtBounds
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
interactive: true
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
boundsMovement: Flickable.FollowBoundsBehavior
pressDelay: 0
flickableDirection: Flickable.VerticalFlick
ScrollBar.vertical: ScrollBar {
policy: eventsList.contentHeight > eventsList.height ? ScrollBar.AsNeeded : ScrollBar.AlwaysOff
}

View File

@@ -114,8 +114,9 @@ Column {
contentWidth: width
contentHeight: spanningNetworksColumn.height
boundsBehavior: Flickable.DragAndOvershootBounds
flickDeceleration: 8000
maximumFlickVelocity: 15000
// Enhanced native kinetic scrolling - Qt handles touch vs mouse automatically
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
Column {
id: spanningNetworksColumn

View File

@@ -84,8 +84,9 @@ Item {
contentWidth: width
contentHeight: wifiContent.height
boundsBehavior: Flickable.DragAndOvershootBounds
flickDeceleration: 8000
maximumFlickVelocity: 15000
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
Column {
id: wifiContent
@@ -115,8 +116,9 @@ Item {
contentWidth: width
contentHeight: ethernetContent.height
boundsBehavior: Flickable.StopAtBounds
flickDeceleration: 8000
maximumFlickVelocity: 15000
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
Column {
id: ethernetContent

View File

@@ -19,8 +19,13 @@ ListView {
spacing: Theme.spacingL
interactive: true
boundsBehavior: Flickable.StopAtBounds
flickDeceleration: 1500
maximumFlickVelocity: 2000
// Enhanced native kinetic scrolling - Qt handles touch vs mouse automatically
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
boundsMovement: Flickable.FollowBoundsBehavior
pressDelay: 0
flickableDirection: Flickable.VerticalFlick
cacheBuffer: 1000
onMovementStarted: isUserScrolling = true
onMovementEnded: {

View File

@@ -234,8 +234,6 @@ Column {
property real stableY: 0
property bool isUserScrolling: false
property bool isScrollBarDragging: false
property real wheelMultiplier: 1.8
property int wheelBaseStep: 160
property string keyRoleName: "pid"
property var _anchorKey: undefined
property real _anchorOffset: 0
@@ -278,39 +276,30 @@ Column {
spacing: 4
model: SysMonitorService.processes
boundsBehavior: Flickable.StopAtBounds
flickDeceleration: 1500
maximumFlickVelocity: 2000
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
interactive: true
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
boundsMovement: Flickable.FollowBoundsBehavior
pressDelay: 0
flickableDirection: Flickable.VerticalFlick
onMovementStarted: isUserScrolling = true
onMovementEnded: {
isUserScrolling = false;
if (contentY > 40)
stableY = contentY;
}
onContentYChanged: {
if (!isUserScrolling && !isScrollBarDragging && visible && stableY > 40 && Math.abs(contentY - stableY) > 10)
contentY = stableY;
}
onModelChanged: {
if (model && model.length > 0 && !isUserScrolling && stableY > 40)
Qt.callLater(function() {
contentY = stableY;
});
}
WheelHandler {
target: null
onWheel: (ev) => {
let dy = ev.pixelDelta.y !== 0 ? ev.pixelDelta.y : (ev.angleDelta.y / 120) * processListView.wheelBaseStep;
if (ev.inverted)
dy = -dy;
const maxY = Math.max(0, processListView.contentHeight - processListView.height);
processListView.contentY = Math.max(0, Math.min(maxY, processListView.contentY - dy * processListView.wheelMultiplier));
ev.accepted = true;
}
}
delegate: ProcessListItem {

View File

@@ -272,27 +272,20 @@ Rectangle {
ListView {
id: listView
property real wheelMultiplier: 1.8
property int wheelBaseStep: 160
width: parent.width
height: parent.height - (root.enableFuzzySearch ? searchContainer.height + Theme.spacingXS : 0)
clip: true
model: filteredOptions
spacing: 2
WheelHandler {
target: null
onWheel: (ev) => {
let dy = ev.pixelDelta.y !== 0 ? ev.pixelDelta.y : (ev.angleDelta.y / 120) * parent.wheelBaseStep;
if (ev.inverted)
dy = -dy;
const maxY = Math.max(0, parent.contentHeight - parent.height);
parent.contentY = Math.max(0, Math.min(maxY, parent.contentY - dy * parent.wheelMultiplier));
ev.accepted = true;
}
}
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
interactive: true
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
boundsBehavior: Flickable.DragAndOvershootBounds
boundsMovement: Flickable.FollowBoundsBehavior
pressDelay: 0
flickableDirection: Flickable.VerticalFlick
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AsNeeded

View File

@@ -18,8 +18,6 @@ GridView {
property int minIconSize: 32
property bool hoverUpdatesSelection: true
property bool keyboardNavigationActive: false
property real wheelMultiplier: 1.8
property int wheelBaseStep: 160
property int baseCellWidth: adaptiveColumns ? Math.max(minCellWidth, Math.min(maxCellWidth, width / columns)) : (width - Theme.spacingS * 2) / columns
property int baseCellHeight: baseCellWidth + 20
property int actualColumns: adaptiveColumns ? Math.floor(width / cellWidth) : columns
@@ -55,21 +53,14 @@ GridView {
rightMargin: leftMargin
focus: true
interactive: true
flickDeceleration: 300
maximumFlickVelocity: 30000
WheelHandler {
target: null
onWheel: (ev) => {
let dy = ev.pixelDelta.y !== 0 ? ev.pixelDelta.y : (ev.angleDelta.y / 120) * gridView.wheelBaseStep;
if (ev.inverted)
dy = -dy;
const maxY = Math.max(0, gridView.contentHeight - gridView.height);
gridView.contentY = Math.max(0, Math.min(maxY, gridView.contentY - dy * gridView.wheelMultiplier));
ev.accepted = true;
}
}
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
boundsBehavior: Flickable.DragAndOvershootBounds
boundsMovement: Flickable.FollowBoundsBehavior
pressDelay: 0
flickableDirection: Flickable.VerticalFlick
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AsNeeded

View File

@@ -13,8 +13,6 @@ ListView {
property int itemSpacing: Theme.spacingS
property bool hoverUpdatesSelection: true
property bool keyboardNavigationActive: false
property real wheelMultiplier: 1.8
property int wheelBaseStep: 160
signal keyboardNavigationReset()
signal itemClicked(int index, var modelData)
@@ -36,28 +34,21 @@ ListView {
onCurrentIndexChanged: {
if (keyboardNavigationActive)
ensureVisible(currentIndex);
}
clip: true
anchors.margins: itemSpacing
spacing: itemSpacing
focus: true
interactive: true
flickDeceleration: 600
maximumFlickVelocity: 30000
WheelHandler {
target: null
onWheel: (ev) => {
let dy = ev.pixelDelta.y !== 0 ? ev.pixelDelta.y : (ev.angleDelta.y / 120) * wheelBaseStep;
if (ev.inverted)
dy = -dy;
const maxY = Math.max(0, contentHeight - height);
contentY = Math.max(0, Math.min(maxY, contentY - dy * wheelMultiplier));
ev.accepted = true;
}
}
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
boundsBehavior: Flickable.DragAndOvershootBounds
boundsMovement: Flickable.FollowBoundsBehavior
pressDelay: 0
flickableDirection: Flickable.VerticalFlick
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AlwaysOn

View File

@@ -258,6 +258,15 @@ Item {
model: searchResultsModel
spacing: 2
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
interactive: true
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
boundsBehavior: Flickable.DragAndOvershootBounds
boundsMovement: Flickable.FollowBoundsBehavior
pressDelay: 0
flickableDirection: Flickable.VerticalFlick
delegate: StyledRect {
width: searchResultsList.width
height: 36

View File

@@ -102,6 +102,15 @@ Popup {
spacing: Theme.spacingS
model: root.allWidgets
// Enhanced native kinetic scrolling - faster for both touchpad and mouse
interactive: true
flickDeceleration: 1000 // Lower = more momentum, longer scrolling
maximumFlickVelocity: 8000 // Higher = faster maximum scroll speed
boundsBehavior: Flickable.DragAndOvershootBounds
boundsMovement: Flickable.FollowBoundsBehavior
pressDelay: 0
flickableDirection: Flickable.VerticalFlick
delegate: Rectangle {
width: widgetList.width
height: 60