mirror of
https://github.com/darksaid98/draggable_lists.git
synced 2026-12-01 14:38:47 +00:00
Correct some calculations and duck typing
This commit is contained in:
2 files changed
+4
-8
No files matched your search
@@ -95,11 +95,8 @@ public class DragManager<T, E extends ObjectSelectionList.Entry<?>> {
|
||||
int rowTop = dragList.draggable_lists$getRowTop(renderRow);
|
||||
int rowBottom = dragList.draggable_lists$getRowBottom(renderRow);
|
||||
if (rowBottom >= dragList.draggable_lists$getY() && rowTop <= dragList.draggable_lists$getBottom()) {
|
||||
if (i == draggingIndex) {
|
||||
|
||||
} else {
|
||||
int outTop = rowTop - (int) dragList.draggable_lists$getScrollAmount();
|
||||
dragList.draggable_lists$renderItem(guiGraphics, mouseX, mouseY, tickDelta, i, rowLeft, outTop, rowWidth, rowHeight);
|
||||
if (i != draggingIndex) {
|
||||
dragList.draggable_lists$renderItem(guiGraphics, mouseX, mouseY, tickDelta, i, rowLeft, rowTop, rowWidth, rowHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,7 +162,7 @@ public class DragManager<T, E extends ObjectSelectionList.Entry<?>> {
|
||||
}
|
||||
|
||||
private int getIndexFromMouseY(double mouseY) {
|
||||
int m = Mth.floor(mouseY - (double) dragList.draggable_lists$getY()) - dragList.draggable_lists$getHeaderHeight() - (int) dragList.draggable_lists$getScrollAmount() - 4;
|
||||
int m = Mth.floor(mouseY - (double) dragList.draggable_lists$getY()) - dragList.draggable_lists$getHeaderHeight() + (int) dragList.draggable_lists$getScrollAmount() - 4;
|
||||
return m / dragList.draggable_lists$getItemHeight();
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -134,8 +134,7 @@ public abstract class TransferableSelectionListMixin extends ObjectSelectionList
|
||||
|
||||
@Override
|
||||
public void draggable_lists$moveEntry(DragItem<PackSelectionModel.Entry, TransferableSelectionList.PackEntry> item, int n) {
|
||||
TransferableSelectionList.PackEntry pack = item.draggable_lists$getUnderlyingEntry();
|
||||
if (pack instanceof AbstractPackDuckProvider duckProvider) {
|
||||
if (item.draggable_lists$getUnderlyingData() instanceof AbstractPackDuckProvider duckProvider) {
|
||||
duckProvider.draggable_lists$moveTo(n);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user