mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
homescreens/folio: Make it easier to click on delegate context menus without starting drag
Dragging delegates on the homescreen involves holding onto it until the context menu pops up, and then dragging. We currently suppress swipe detection (physically swipe a few pixels before the swipe gets registered) when dragging a delegate so that dragging can start immediately. However, this doesn't make sense if a context menu gets involved, because it can be hard to "let go" to tap the context menu without accidentally triggering the drag action and closing the context menu. This MR re-enables swipe detection if a context menu is involved with delegate dragging.
This commit is contained in:
parent
92965bd8ec
commit
1570ac24c8
3 changed files with 9 additions and 4 deletions
|
|
@ -91,7 +91,7 @@ MobileShell.GridView {
|
|||
height: root.cellHeight
|
||||
|
||||
onPressAndHold: {
|
||||
const mappedCoords = root.homeScreen.prepareStartDelegateDrag(model.delegate, appDelegate.delegateItem);
|
||||
const mappedCoords = root.homeScreen.prepareStartDelegateDrag(model.delegate, appDelegate.delegateItem, true);
|
||||
folio.HomeScreenState.closeAppDrawer();
|
||||
|
||||
// we need to adjust because app drawer delegates have a different size than regular homescreen delegates
|
||||
|
|
|
|||
|
|
@ -45,8 +45,13 @@ Item {
|
|||
|
||||
// called by any delegates when starting drag
|
||||
// returns the mapped coordinates to be used in the home screen state
|
||||
function prepareStartDelegateDrag(delegate, item) {
|
||||
swipeArea.setSkipSwipeThreshold(true);
|
||||
function prepareStartDelegateDrag(delegate, item, skipSwipeThreshold) {
|
||||
|
||||
// If the user is prompted with a context menu, they may want to let go, and so we keep the detect swipe threshold.
|
||||
// Otherwise, we want to skip detecting a swipe because we know we immediately go into delegate dragging.
|
||||
if (skipSwipeThreshold) {
|
||||
swipeArea.setSkipSwipeThreshold(true);
|
||||
}
|
||||
|
||||
if (delegate) {
|
||||
delegateDragItem.delegate = delegate;
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ MouseArea {
|
|||
root.requestClose();
|
||||
folio.HomeScreenState.closeSettingsView();
|
||||
|
||||
let mappedCoords = root.homeScreen.prepareStartDelegateDrag(null, delegate);
|
||||
let mappedCoords = root.homeScreen.prepareStartDelegateDrag(null, delegate, true);
|
||||
const widthOffset = folio.HomeScreenState.pageCellWidth / 2;
|
||||
const heightOffset = folio.HomeScreenState.pageCellHeight / 2;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue