Update: Scroll preferences window content on Drag-and-Drop

Scroll the content of the preferences window on Drag-and-Drop, when the
mouse is in the upper or lower part of the content of the preferences
window.
This helps a user, who has e.g. a lot of items, but the preferences
window with a low height, to easily move any item to any position.
This commit is contained in:
June 2021-07-04 05:16:32 +02:00
commit edfa50f254
No known key found for this signature in database
GPG key ID: 094C2AC34192FA11
3 changed files with 127 additions and 2 deletions

View file

@ -31,7 +31,7 @@ var PrefsBoxOrderItemRow = GObject.registerClass({
Template: Me.dir.get_child("prefs-box-order-item-row.ui").get_uri(),
Children: ["item-name-display-label"]
}, class PrefsBoxOrderItemRow extends Gtk.ListBoxRow {
_init(params = {}) {
_init(params = {}, scrollManager) {
super._init(params);
// Make `this` draggable by creating a drag source and adding it to
@ -41,6 +41,10 @@ var PrefsBoxOrderItemRow = GObject.registerClass({
dragSource.connect("prepare", () => {
return Gdk.ContentProvider.new_for_value(this);
});
// Stop all scrolling, which is due to this DND operation.
dragSource.connect("drag-end", () => {
scrollManager.stopScrollAll();
});
this.add_controller(dragSource);
/// Make `this` accept drops by creating a drop target and adding it to