fix(card_drag): extend drop rects one trailing row so beyond-extent drops land
computeSlotRectsForDrop adds cols slots past maxSlot; classifyCardDrag and drawCardDropTarget use it instead of the render rects. doReorderDrop already accepts any non-negative slot. New tests cover beyond-extent resolves, empty-bank trailing row, gap pixels still miss, empty-cell within-extent works.
This commit is contained in:
@@ -73,6 +73,16 @@ std::vector<SlotCellRect> computeSlotRects(int maxSlot, int panelWidth,
|
||||
return rects;
|
||||
}
|
||||
|
||||
std::vector<SlotCellRect> computeSlotRectsForDrop(int maxSlot, int panelWidth,
|
||||
const GridSpec& spec) {
|
||||
const int cols = columnsForWidth(panelWidth, spec);
|
||||
// One trailing row of slots past the last occupied slot — the drop-target extension.
|
||||
// When maxSlot < 0 (empty bank) the trailing row begins at slot 0.
|
||||
const int firstTrailing = maxSlot + 1;
|
||||
const int newMax = firstTrailing + cols - 1; // fills one full trailing row
|
||||
return computeSlotRects(newMax, panelWidth, spec);
|
||||
}
|
||||
|
||||
int hitTestSlot(int px, int py, const std::vector<SlotCellRect>& rects) {
|
||||
for (const SlotCellRect& r : rects) {
|
||||
// Half-open bounds so adjacent rects never both claim a pixel.
|
||||
|
||||
Reference in New Issue
Block a user