mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-28 23:34:46 +00:00
folio: Fix delegate drop placement not accounting for view padding
This is exacerbated now that we have device-specific view margins (to deal with notches and the like), which caused the drag and drop positions to be wildly inaccurate.
This commit is contained in:
parent
f8fc2afa10
commit
81232b3ed7
1 changed files with 4 additions and 4 deletions
|
|
@ -407,12 +407,12 @@ void DragState::onDelegateDragPositionOverPageViewChanged()
|
||||||
|
|
||||||
if (m_dropDelegate && m_dropDelegate->type() == FolioDelegate::Widget) {
|
if (m_dropDelegate && m_dropDelegate->type() == FolioDelegate::Widget) {
|
||||||
// for widgets, we use their top left position to determine where they are placed (since they are larger than one cell)
|
// for widgets, we use their top left position to determine where they are placed (since they are larger than one cell)
|
||||||
row = (delegateY - pageVerticalMargin) / m_state->pageCellHeight();
|
row = (delegateY - pageVerticalMargin - m_state->viewTopPadding()) / m_state->pageCellHeight();
|
||||||
column = (delegateX - pageHorizontalMargin) / m_state->pageCellWidth();
|
column = (delegateX - pageHorizontalMargin - m_state->viewLeftPadding()) / m_state->pageCellWidth();
|
||||||
} else {
|
} else {
|
||||||
// otherwise, we base it on the pointer position
|
// otherwise, we base it on the pointer position
|
||||||
row = (y - pageVerticalMargin) / m_state->pageCellHeight();
|
row = (y - pageVerticalMargin - m_state->viewTopPadding()) / m_state->pageCellHeight();
|
||||||
column = (x - pageHorizontalMargin) / m_state->pageCellWidth();
|
column = (x - pageHorizontalMargin - m_state->viewLeftPadding()) / m_state->pageCellWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure it's in bounds
|
// ensure it's in bounds
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue