homescreens/folio: Improve widget configuring controls

Increase the touch padding for resize handles to make it easier to drag, and shrink the configure button if it doesn't fit
This commit is contained in:
Devin Lin 2023-11-13 20:21:57 -08:00
parent 262a8392a5
commit fcae624d12
3 changed files with 14 additions and 9 deletions

View file

@ -189,6 +189,7 @@ Item {
id: button id: button
icon.name: 'settings-configure' icon.name: 'settings-configure'
text: i18n('Options') text: i18n('Options')
display: (resizeFrame.handleContainer.width > Kirigami.Units.gridUnit * 7) ? PC3.Button.TextBesideIcon : PC3.Button.IconOnly
readonly property var handleContainer: resizeFrame.handleContainer readonly property var handleContainer: resizeFrame.handleContainer
x: Math.round(handleContainer.x + (handleContainer.width / 2) - (width / 2)) x: Math.round(handleContainer.x + (handleContainer.width / 2) - (width / 2))

View file

@ -7,15 +7,17 @@ import '../delegate'
MouseArea { MouseArea {
id: root id: root
height: 10 height: 10 + touchPadding * 2
width: 10 width: 10 + touchPadding * 2
cursorShape: Qt.PointingHandCursor readonly property real touchPadding: 20
property int orientation property int orientation
signal dragEvent(real leftEdgeDelta, real rightEdgeDelta, real topEdgeDelta, real bottomEdgeDelta) signal dragEvent(real leftEdgeDelta, real rightEdgeDelta, real topEdgeDelta, real bottomEdgeDelta)
cursorShape: Qt.PointingHandCursor
drag { drag {
target: root target: root
axis: { axis: {
@ -72,7 +74,9 @@ MouseArea {
} }
Rectangle { Rectangle {
id: rect
anchors.fill: parent anchors.fill: parent
anchors.margins: root.touchPadding
color: 'white' color: 'white'
radius: width / 2 radius: width / 2
@ -85,8 +89,8 @@ MouseArea {
xScale: scaleFactor xScale: scaleFactor
yScale: scaleFactor yScale: scaleFactor
origin.x: root.width / 2 origin.x: rect.width / 2
origin.y: root.height / 2 origin.y: rect.height / 2
} }
} }
} }

View file

@ -187,7 +187,7 @@ Item {
x: resizeOutline.x + Math.round(resizeOutline.width / 2) - Math.round(width / 2) x: resizeOutline.x + Math.round(resizeOutline.width / 2) - Math.round(width / 2)
y: resizeOutline.y - Math.round(height / 2) y: resizeOutline.y - Math.round(height / 2)
width: Math.round(Math.max(height, resizeOutline.width * 0.3)) width: Math.round(Math.max(height, resizeOutline.width * 0.3)) + touchPadding * 2
onPressed: pressedHandler(orientation) onPressed: pressedHandler(orientation)
onDragEvent: (leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) => dragHandler(orientation, leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) onDragEvent: (leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) => dragHandler(orientation, leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta)
@ -201,7 +201,7 @@ Item {
x: resizeOutline.x - (width / 2) x: resizeOutline.x - (width / 2)
y: resizeOutline.y + (resizeOutline.height / 2) - (height / 2) y: resizeOutline.y + (resizeOutline.height / 2) - (height / 2)
height: Math.round(Math.max(width, resizeOutline.height * 0.3)) height: Math.round(Math.max(width, resizeOutline.height * 0.3)) + touchPadding * 2
onPressed: pressedHandler(orientation) onPressed: pressedHandler(orientation)
onDragEvent: (leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) => dragHandler(orientation, leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) onDragEvent: (leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) => dragHandler(orientation, leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta)
@ -215,7 +215,7 @@ Item {
x: resizeOutline.x + resizeOutline.width - (width / 2) x: resizeOutline.x + resizeOutline.width - (width / 2)
y: resizeOutline.y + (resizeOutline.height / 2) - (height / 2) y: resizeOutline.y + (resizeOutline.height / 2) - (height / 2)
height: Math.round(Math.max(width, resizeOutline.height * 0.3)) height: Math.round(Math.max(width, resizeOutline.height * 0.3)) + touchPadding * 2
onPressed: pressedHandler(orientation) onPressed: pressedHandler(orientation)
onDragEvent: (leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) => dragHandler(orientation, leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) onDragEvent: (leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) => dragHandler(orientation, leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta)
@ -229,7 +229,7 @@ Item {
x: resizeOutline.x + (resizeOutline.width / 2) - (width / 2) x: resizeOutline.x + (resizeOutline.width / 2) - (width / 2)
y: resizeOutline.y + resizeOutline.height - (height / 2) y: resizeOutline.y + resizeOutline.height - (height / 2)
width: Math.round(Math.max(height, resizeOutline.width * 0.3)) width: Math.round(Math.max(height, resizeOutline.width * 0.3)) + touchPadding * 2
onPressed: pressedHandler(orientation) onPressed: pressedHandler(orientation)
onDragEvent: (leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) => dragHandler(orientation, leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) onDragEvent: (leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta) => dragHandler(orientation, leftEdgeDelta, rightEdgeDelta, topEdgeDelta, bottomEdgeDelta)