Commit 629228b9 authored by Nate Graham's avatar Nate Graham
Browse files

[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.
parent 36917308
......@@ -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? : undefined
verticalCenter: menuItem.isTall ? undefined : parent.verticalCenter
source: "DelegateToolButtons.qml"
active: menuItem.ListView.isCurrentItem
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment