From 629228b9b14816bc16d7f59bb595646d8d3496b4 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Thu, 1 Apr 2021 14:10:44 -0600 Subject: [PATCH] [applets/clipboard] Improve Fitts' law following when deleting multiple items When you delete multiple items individually, you can keep clicking without moving your mouse because the delete button doesn't change its position (except for when the scrollbar hides, but this is inevitable). However this ceases to be true for tall entries containing files, images, URLs, or previews, because the buttons are always centered vertically in the item. So you have to re-position your mouse to click on the delete button in its new position, and then do so again to account for the height of the next item, and so forth. This commit fixed that problem by top-aligning the row of hover buttons, but only for tall items. For default-height items, they remain vertically centered. --- applets/clipboard/contents/ui/ClipboardItemDelegate.qml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/applets/clipboard/contents/ui/ClipboardItemDelegate.qml b/applets/clipboard/contents/ui/ClipboardItemDelegate.qml index 93fa7b936..472ce9f1b 100644 --- a/applets/clipboard/contents/ui/ClipboardItemDelegate.qml +++ b/applets/clipboard/contents/ui/ClipboardItemDelegate.qml @@ -31,6 +31,11 @@ PlasmaExtras.ListItem { property bool supportsBarcodes property int maximumNumberOfPreviews: Math.floor(width / (PlasmaCore.Units.gridUnit * 4 + PlasmaCore.Units.smallSpacing)) readonly property real gradientThreshold: (label.width - toolButtonsLoader.width) / label.width + // Consider tall to be > about 1.5x the default height for purposes of top-aligning + // the buttons to preserve Fitts' Law when deleting multiple items in a row, + // or else the top-alignment doesn't look deliberate enough and people will think + // it's a bug + readonly property bool isTall: height > Math.round(PlasmaCore.Units.gridUnit * 2.5) signal itemSelected(string uuid) signal remove(string uuid) @@ -110,9 +115,11 @@ PlasmaExtras.ListItem { Loader { id: toolButtonsLoader + anchors { right: label.right - verticalCenter: parent.verticalCenter + top: menuItem.isTall? parent.top : undefined + verticalCenter: menuItem.isTall ? undefined : parent.verticalCenter } source: "DelegateToolButtons.qml" active: menuItem.ListView.isCurrentItem