mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 14:43:09 +00:00
homescreen/folio: fix icon drop position misalignment within folder and outside folder view check not accounting for size differences
This fixes an issue with folder app icon drop positions being misaligned. Noticeably causing issues when placing apps within folders when using gesture only mode. Also, this fixes an issue with the outsideView calculation not accounting for folder icon size differences. Causing an issues with some apps still being interactive when outside the current page.
This commit is contained in:
parent
6f3e157df9
commit
3a6a2f78da
3 changed files with 13 additions and 9 deletions
|
|
@ -282,16 +282,17 @@ QPointF ApplicationFolderModel::getDelegatePosition(int index)
|
|||
return {0, 0};
|
||||
}
|
||||
auto delegate = m_folder->m_delegates[index];
|
||||
qreal pageContentWidth = m_folder->m_homeScreen->homeScreenState()->folderPageContentWidth();
|
||||
qreal margin = horizontalPageMargin();
|
||||
qreal pageContentSize = m_folder->m_homeScreen->homeScreenState()->folderPageContentWidth();
|
||||
qreal topMargin = verticalPageMargin();
|
||||
qreal leftMargin = horizontalPageMargin();
|
||||
|
||||
int cellSize = pageContentWidth / numGridLengthOnPage();
|
||||
int cellSize = pageContentSize / numGridLengthOnPage();
|
||||
|
||||
qreal cellWitdhRecenter = (cellSize - m_folder->m_homeScreen->homeScreenState()->pageCellWidth()) / 2;
|
||||
qreal cellHeightRecenter = (cellSize - m_folder->m_homeScreen->homeScreenState()->pageCellHeight()) / 2;
|
||||
|
||||
qreal xPosition = cellWitdhRecenter + margin + delegate.columnIndex * cellSize;
|
||||
qreal yPosition = cellHeightRecenter + delegate.rowIndex * cellSize;
|
||||
qreal xPosition = cellWitdhRecenter + leftMargin + delegate.columnIndex * cellSize;
|
||||
qreal yPosition = cellHeightRecenter + topMargin + delegate.rowIndex * cellSize;
|
||||
|
||||
return {xPosition, yPosition};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -703,8 +703,11 @@ QPointF HomeScreenState::getFolderDelegateScreenPosition(int position)
|
|||
return {0, 0};
|
||||
}
|
||||
auto pos = m_currentFolder->applications()->getDelegatePosition(position);
|
||||
qreal x = pos.x() + (m_viewWidth - m_folderPageWidth) / 2;
|
||||
qreal y = pos.y() + (m_viewHeight - m_folderPageHeight) / 2;
|
||||
|
||||
qreal x = pos.x() + (m_viewWidth - m_viewLeftPadding - m_viewRightPadding - m_folderPageWidth) / 2;
|
||||
qreal y = pos.y() + (m_viewHeight - m_viewTopPadding - m_viewBottomPadding - m_folderPageHeight) / 2;
|
||||
x += m_viewLeftPadding;
|
||||
y += m_viewTopPadding;
|
||||
|
||||
return {x, y};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,8 +177,8 @@ Folio.DelegateTouchArea {
|
|||
readonly property int cellHeight: folio.HomeScreenState.pageCellHeight
|
||||
|
||||
readonly property bool outsideView: {
|
||||
const appPosition = x + folio.HomeScreenState.folderViewX;
|
||||
return (appPosition < -folderCellSize || appPosition > folderBackground.width)
|
||||
const appPosition = x + (cellWidth - folderCellSize) / 2 + folio.HomeScreenState.folderViewX;
|
||||
return (appPosition <= -folderCellSize || appPosition >= folderBackground.width);
|
||||
}
|
||||
|
||||
readonly property var dragState: folio.HomeScreenState.dragState
|
||||
|
|
|
|||
Loading…
Reference in a new issue