Skip to content
Snippets Groups Projects
Commit 1aab2c6c authored by Fatih Uzunoğlu's avatar Fatih Uzunoğlu Committed by Jean-Baptiste Kempf
Browse files

qml: ViewDragAutoScrollHandler don't scroll backward at beginning or forward at end

parent bc303ae4
No related branches found
No related tags found
1 merge request!3210qml: don't initiate auto scroll backward at beginning or forward at end
Pipeline #315967 passed with stages
in 36 minutes and 16 seconds
......@@ -71,22 +71,30 @@ QtObject {
root.dragItem.x,
root.dragItem.y)
var size, mark
var size, mark, atBeginning, atEnd
if (root.orientation === Qt.Vertical) {
size = root.view.height
mark = pos.y
atBeginning = root.view.atYBeginning
atEnd = root.view.atYEnd
} else {
size = root.view.width
mark = pos.x
atBeginning = root.view.atXBeginning
atEnd = root.view.atXEnd
}
if (size < root.margin * 2.5)
return ViewDragAutoScrollHandler.Direction.None
if (mark < root.margin)
return ViewDragAutoScrollHandler.Direction.Backward
return !atBeginning ? ViewDragAutoScrollHandler.Direction.Backward
: ViewDragAutoScrollHandler.Direction.None
else if (mark > (size - root.margin))
return ViewDragAutoScrollHandler.Direction.Forward
return !atEnd ? ViewDragAutoScrollHandler.Direction.Forward
: ViewDragAutoScrollHandler.Direction.None
else
return ViewDragAutoScrollHandler.Direction.None
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment