From 81232b3ed7c5d2d253a161a7cce134fe0330befe Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Tue, 13 Jan 2026 21:57:13 -0500 Subject: [PATCH] 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. --- containments/homescreens/folio/dragstate.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/containments/homescreens/folio/dragstate.cpp b/containments/homescreens/folio/dragstate.cpp index 972b2378..bc0d6771 100644 --- a/containments/homescreens/folio/dragstate.cpp +++ b/containments/homescreens/folio/dragstate.cpp @@ -407,12 +407,12 @@ void DragState::onDelegateDragPositionOverPageViewChanged() 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) - row = (delegateY - pageVerticalMargin) / m_state->pageCellHeight(); - column = (delegateX - pageHorizontalMargin) / m_state->pageCellWidth(); + row = (delegateY - pageVerticalMargin - m_state->viewTopPadding()) / m_state->pageCellHeight(); + column = (delegateX - pageHorizontalMargin - m_state->viewLeftPadding()) / m_state->pageCellWidth(); } else { // otherwise, we base it on the pointer position - row = (y - pageVerticalMargin) / m_state->pageCellHeight(); - column = (x - pageHorizontalMargin) / m_state->pageCellWidth(); + row = (y - pageVerticalMargin - m_state->viewTopPadding()) / m_state->pageCellHeight(); + column = (x - pageHorizontalMargin - m_state->viewLeftPadding()) / m_state->pageCellWidth(); } // ensure it's in bounds