mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-09 13:12:08 +00:00
NComboBox: fix clicking issue
This commit is contained in:
+35
-6
@@ -112,16 +112,45 @@ Item {
|
||||
ListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
|
||||
// Enable clipping to keep content within bounds
|
||||
|
||||
anchors.rightMargin: root.verticalScrollBarActive ? root.handleWidth + 4 : 0
|
||||
clip: true
|
||||
|
||||
// Enable flickable for smooth scrolling
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
flickDeceleration: 1500
|
||||
|
||||
Timer {
|
||||
id: scrollbarActiveTimer
|
||||
interval: 150
|
||||
repeat: false
|
||||
}
|
||||
|
||||
WheelHandler {
|
||||
id: wheelHandler
|
||||
target: listView
|
||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
||||
|
||||
onWheel: function(event) {
|
||||
if (listView.flicking || listView.moving) {
|
||||
listView.cancelFlick();
|
||||
}
|
||||
|
||||
var delta = event.pixelDelta.y !== 0 ? event.pixelDelta.y : (event.angleDelta.y / 8);
|
||||
var newContentY = listView.contentY - delta;
|
||||
newContentY = Math.max(0, Math.min(newContentY, listView.contentHeight - listView.height));
|
||||
listView.contentY = newContentY;
|
||||
|
||||
if (listView.ScrollBar.vertical) {
|
||||
listView.ScrollBar.vertical.active = true;
|
||||
}
|
||||
|
||||
scrollbarActiveTimer.restart();
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
parent: listView
|
||||
x: listView.mirrored ? 0 : listView.width - width
|
||||
parent: root // Position relative to root Item, not listView
|
||||
x: listView.mirrored ? 0 : root.width - width
|
||||
y: 0
|
||||
height: listView.height
|
||||
policy: root.verticalPolicy
|
||||
|
||||
Reference in New Issue
Block a user