diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-04-28 14:03:31 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-05-20 02:37:49 +0800 |
| commit | 6d092d7599d27748abd8dc50b0c87e7fdba689cd (patch) | |
| tree | 2ef04a225cdc464689690ddc081fd5eb1e0dd7ac /runtime/src/main/java/me/shedaniel | |
| parent | a1d8c20c7b34c12b5d95c1d61131a253cdd8affd (diff) | |
| download | RoughlyEnoughItems-6d092d7599d27748abd8dc50b0c87e7fdba689cd.tar.gz RoughlyEnoughItems-6d092d7599d27748abd8dc50b0c87e7fdba689cd.tar.bz2 RoughlyEnoughItems-6d092d7599d27748abd8dc50b0c87e7fdba689cd.zip | |
REI 8.2
- Display History
- Draggable Component
- Multi Select Filtering Screen
- Better Craftable Filter
- Fix #850
- Fix #845
- Fix #832
- Fix #731
- Fix #839
- Fix #804
- Fix EvilCraft
Diffstat (limited to 'runtime/src/main/java/me/shedaniel')
33 files changed, 1245 insertions, 220 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java index 1189436c2..28f45277b 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java @@ -167,11 +167,11 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { @Override public boolean isCraftableFilterEnabled() { - return appearance.layout.enableCraftableOnlyButton; + return appearance.layout.showCraftableOnlyButton; } public void setCraftableFilterEnabled(boolean enabled) { - appearance.layout.enableCraftableOnlyButton = enabled; + appearance.layout.showCraftableOnlyButton = enabled; } @Override @@ -570,7 +570,7 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { private SearchFieldLocation searchFieldLocation = SearchFieldLocation.CENTER; @Comment("Declares the position of the config button.") @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) private ConfigButtonPosition configButtonLocation = ConfigButtonPosition.LOWER; - @Comment("Declares whether the craftable filter button is enabled.") private boolean enableCraftableOnlyButton = true; + @Comment("Declares whether the craftable filter button is enabled.") private boolean showCraftableOnlyButton = true; } @UsePercentage(min = 0.1, max = 1.0, prefix = "Limit: ") private double horizontalEntriesBoundaries = 1.0; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java index 83490fa16..68751f5d6 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java @@ -45,6 +45,7 @@ import me.shedaniel.rei.impl.client.gui.ScreenOverlayImpl; import me.shedaniel.rei.impl.client.gui.widget.BatchedEntryRendererManager; import me.shedaniel.rei.impl.client.gui.widget.EntryWidget; import me.shedaniel.rei.impl.client.gui.widget.search.OverlaySearchField; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.events.GuiEventListener; @@ -57,9 +58,11 @@ import net.minecraft.util.Mth; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; +import java.util.function.Predicate; import static me.shedaniel.rei.impl.client.gui.widget.entrylist.EntryListWidget.entrySize; @@ -91,8 +94,9 @@ public class FilteringScreen extends Screen { private List<FilteringListEntry> entries = Collections.emptyList(); private List<GuiEventListener> elements = Collections.emptyList(); - private Point selectionPoint = null; - private Point secondPoint = null; + private record PointPair(Point firstPoint, @Nullable Point secondPoint) {} + + private List<PointPair> points = new ArrayList<>(); private OverlaySearchField searchField; private Button selectAllButton; @@ -100,7 +104,7 @@ public class FilteringScreen extends Screen { private Button hideButton; private Button showButton; private Button backButton; - private Rectangle selectionCache; + private Predicate<Rectangle> selectionCache; private SearchFilter lastFilter = SearchFilter.matchAll(); @@ -111,15 +115,14 @@ public class FilteringScreen extends Screen { { Component selectAllText = new TranslatableComponent("config.roughlyenoughitems.filteredEntries.selectAll"); this.selectAllButton = new Button(0, 0, Minecraft.getInstance().font.width(selectAllText) + 10, 20, selectAllText, button -> { - this.selectionPoint = new Point(-Integer.MAX_VALUE / 2, -Integer.MAX_VALUE / 2); - this.secondPoint = new Point(Integer.MAX_VALUE / 2, Integer.MAX_VALUE / 2); + this.points.clear(); + this.points.add(new PointPair(new Point(-Integer.MAX_VALUE / 2, -Integer.MAX_VALUE / 2), new Point(Integer.MAX_VALUE / 2, Integer.MAX_VALUE / 2))); }); } { Component selectNoneText = new TranslatableComponent("config.roughlyenoughitems.filteredEntries.selectNone"); this.selectNoneButton = new Button(0, 0, Minecraft.getInstance().font.width(selectNoneText) + 10, 20, selectNoneText, button -> { - this.selectionPoint = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE); - this.secondPoint = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE); + this.points.clear(); }); } { @@ -268,27 +271,35 @@ public class FilteringScreen extends Screen { } this.font.drawShadow(matrices, this.title.getVisualOrderText(), this.width / 2.0F - this.font.width(this.title) / 2.0F, 12.0F, -1); + Component hint = new TranslatableComponent("config.roughlyenoughitems.filteringRulesScreen.hint").withStyle(ChatFormatting.YELLOW); + this.font.drawShadow(matrices, hint, this.width - this.font.width(hint) - 15, 12.0F, -1); } - private Rectangle getSelection() { + private Predicate<Rectangle> getSelection() { return selectionCache; } private void updateSelectionCache() { - if (selectionPoint != null) { - Point p = secondPoint; - if (p == null) { - p = PointHelper.ofMouse(); - p.translate(0, scrolling.scrollAmountInt()); + if (!points.isEmpty()) { + Predicate<Rectangle> predicate = rect -> false; + for (PointPair pair : points) { + Point firstPoint = pair.firstPoint(); + Point secondPoint = pair.secondPoint(); + if (secondPoint == null) { + secondPoint = PointHelper.ofMouse(); + secondPoint.translate(0, scrolling.scrollAmountInt()); + } + int left = Math.min(firstPoint.x, secondPoint.x); + int top = Math.min(firstPoint.y, secondPoint.y); + int right = Math.max(firstPoint.x, secondPoint.x); + int bottom = Math.max(firstPoint.y, secondPoint.y); + Rectangle rectangle = new Rectangle(left, top - scrolling.scrollAmountInt(), Math.max(1, right - left), Math.max(1, bottom - top)); + predicate = predicate.or(rectangle::intersects); } - int left = Math.min(p.x, selectionPoint.x); - int top = Math.min(p.y, selectionPoint.y); - int right = Math.max(p.x, selectionPoint.x); - int bottom = Math.max(p.y, selectionPoint.y); - selectionCache = new Rectangle(left, top - scrolling.scrollAmountInt(), right - left, bottom - top); + selectionCache = predicate; return; } - selectionCache = new Rectangle(0, 0, 0, 0); + selectionCache = rect -> false; } @Override @@ -349,41 +360,41 @@ public class FilteringScreen extends Screen { } @Override - public boolean mouseClicked(double double_1, double double_2, int int_1) { - if (scrolling.updateDraggingState(double_1, double_2, int_1)) + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (scrolling.updateDraggingState(mouseX, mouseY, button)) return true; - if (getBounds().contains(double_1, double_2)) { - if (searchField.mouseClicked(double_1, double_2, int_1)) { - this.selectionPoint = null; - this.secondPoint = null; + if (getBounds().contains(mouseX, mouseY)) { + if (searchField.mouseClicked(mouseX, mouseY, button)) { + this.points.clear(); return true; - } else if (selectAllButton.mouseClicked(double_1, double_2, int_1)) { + } else if (selectAllButton.mouseClicked(mouseX, mouseY, button)) { return true; - } else if (selectNoneButton.mouseClicked(double_1, double_2, int_1)) { + } else if (selectNoneButton.mouseClicked(mouseX, mouseY, button)) { return true; - } else if (hideButton.mouseClicked(double_1, double_2, int_1)) { + } else if (hideButton.mouseClicked(mouseX, mouseY, button)) { return true; - } else if (showButton.mouseClicked(double_1, double_2, int_1)) { + } else if (showButton.mouseClicked(mouseX, mouseY, button)) { return true; - } - if (int_1 == 0) { - this.selectionPoint = new Point(double_1, double_2 + scrolling.scrollAmount()); - this.secondPoint = null; + } else if (button == 0) { + if (!Screen.hasShiftDown()) { + this.points.clear(); + } + this.points.add(new PointPair(new Point(mouseX, mouseY + scrolling.scrollAmount()), null)); return true; } } - return backButton.mouseClicked(double_1, double_2, int_1); + return backButton.mouseClicked(mouseX, mouseY, button); } @Override public boolean mouseReleased(double mouseX, double mouseY, int button) { - if (selectionPoint != null && button == 0 && secondPoint == null) { - this.secondPoint = new Point(mouseX, mouseY + scrolling.scrollAmount()); - if (secondPoint.equals(selectionPoint)) { - secondPoint.translate(1, 1); + if (button == 0 && !points.isEmpty()) { + PointPair pair = this.points.get(points.size() - 1); + if (pair.secondPoint() == null) { + this.points.set(points.size() - 1, new PointPair(pair.firstPoint(), new Point(mouseX, mouseY + scrolling.scrollAmount()))); + return true; } - return true; } return super.mouseReleased(mouseX, mouseY, button); } @@ -402,8 +413,8 @@ public class FilteringScreen extends Screen { if (element.keyPressed(keyCode, scanCode, modifiers)) return true; if (Screen.isSelectAll(keyCode)) { - this.selectionPoint = new Point(0, 0); - this.secondPoint = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE); + this.points.clear(); + this.points.add(new PointPair(new Point(-Integer.MAX_VALUE / 2, -Integer.MAX_VALUE / 2), new Point(Integer.MAX_VALUE / 2, Integer.MAX_VALUE / 2))); return true; } if (keyCode == 256 && this.shouldCloseOnEsc()) { @@ -469,7 +480,7 @@ public class FilteringScreen extends Screen { } public boolean isSelected() { - return getSelection().intersects(getBounds()); + return getSelection().test(getBounds()); } public boolean isFiltered() { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/RecipeDisplayExporter.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/RecipeDisplayExporter.java index a81f51488..9895def4f 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/RecipeDisplayExporter.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/RecipeDisplayExporter.java @@ -34,15 +34,18 @@ import com.mojang.math.Matrix4f; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.impl.client.gui.toast.ExportRecipeIdentifierToast; +import me.shedaniel.rei.impl.display.DisplaySpec; import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.resources.language.I18n; +import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.ApiStatus; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; +import java.util.Collection; import java.util.Date; import java.util.List; @@ -53,13 +56,19 @@ public final class RecipeDisplayExporter extends Widget { private RecipeDisplayExporter() {} - public static void exportRecipeDisplay(Rectangle rectangle, List<Widget> widgets) { - INSTANCE.exportRecipe(rectangle, widgets); - ExportRecipeIdentifierToast.addToast(I18n.get("msg.rei.exported_recipe"), I18n.get("msg.rei.exported_recipe.desc")); + public static void exportRecipeDisplay(Rectangle rectangle, DisplaySpec display, List<Widget> widgets, boolean toast) { + INSTANCE.exportRecipe(rectangle, display, widgets); + if (toast) { + ExportRecipeIdentifierToast.addToast(I18n.get("msg.rei.exported_recipe"), I18n.get("msg.rei.exported_recipe.desc")); + } } - private static File getExportFilename(File directory) { + private static File getExportFilename(DisplaySpec display, File directory) { + Collection<ResourceLocation> locations = display.provideInternalDisplayIds(); String string = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss").format(new Date()); + if (!locations.isEmpty()) { + string = locations.iterator().next().toString().replace('/', '_'); + } int i = 1; while (true) { @@ -72,7 +81,7 @@ public final class RecipeDisplayExporter extends Widget { } } - private void exportRecipe(Rectangle rectangle, List<Widget> widgets) { + private void exportRecipe(Rectangle rectangle, DisplaySpec display, List<Widget> widgets) { Minecraft client = Minecraft.getInstance(); Window window = client.getWindow(); RenderTarget renderTarget = new TextureTarget(window.getWidth(), window.getHeight(), true, false); @@ -105,9 +114,9 @@ public final class RecipeDisplayExporter extends Widget { } Util.ioPool().execute(() -> { try { - File export = new File(minecraft.gameDirectory, "rei_exports"); + File export = new File(minecraft.gameDirectory, "rei_exports/" + display.provideInternalDisplay().getCategoryIdentifier().toString().replace('/', '_')); export.mkdirs(); - strippedImage.writeToFile(getExportFilename(export)); + strippedImage.writeToFile(getExportFilename(display, export)); } catch (IOException e) { e.printStackTrace(); } finally { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java index b15bae714..3b5aaa3b1 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java @@ -40,9 +40,9 @@ import me.shedaniel.rei.api.client.favorites.FavoriteEntry; import me.shedaniel.rei.api.client.gui.config.DisplayPanelLocation; import me.shedaniel.rei.api.client.gui.config.SearchFieldLocation; import me.shedaniel.rei.api.client.gui.config.SyntaxHighlightingMode; -import me.shedaniel.rei.api.client.gui.drag.DraggableStackProvider; -import me.shedaniel.rei.api.client.gui.drag.DraggableStackVisitor; import me.shedaniel.rei.api.client.gui.drag.DraggingContext; +import me.shedaniel.rei.api.client.gui.drag.component.DraggableComponentProvider; +import me.shedaniel.rei.api.client.gui.drag.component.DraggableComponentVisitor; import me.shedaniel.rei.api.client.gui.screen.DisplayScreen; import me.shedaniel.rei.api.client.gui.widgets.Button; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; @@ -67,7 +67,9 @@ import me.shedaniel.rei.impl.client.gui.dragging.CurrentDraggingStack; import me.shedaniel.rei.impl.client.gui.modules.Menu; import me.shedaniel.rei.impl.client.gui.modules.MenuEntry; import me.shedaniel.rei.impl.client.gui.modules.entries.*; -import me.shedaniel.rei.impl.client.gui.widget.*; +import me.shedaniel.rei.impl.client.gui.widget.DefaultDisplayChoosePageWidget; +import me.shedaniel.rei.impl.client.gui.widget.InternalWidgets; +import me.shedaniel.rei.impl.client.gui.widget.LateRenderable; import me.shedaniel.rei.impl.client.gui.widget.entrylist.EntryListSearchManager; import me.shedaniel.rei.impl.client.gui.widget.entrylist.EntryListWidget; import me.shedaniel.rei.impl.client.gui.widget.favorites.FavoritesListWidget; @@ -233,8 +235,8 @@ public class ScreenOverlayImpl extends ScreenOverlay { } public void init() { - draggingStack.set(DraggableStackProvider.from(() -> ScreenRegistry.getInstance().getDraggableProviders()), - DraggableStackVisitor.from(() -> ScreenRegistry.getInstance().getDraggableVisitors())); + draggingStack.set(DraggableComponentProvider.from(ScreenRegistry.getInstance()::getDraggableComponentProviders), + DraggableComponentVisitor.from(ScreenRegistry.getInstance()::getDraggableComponentVisitors)); this.shouldReload = false; this.shouldReloadSearch = false; @@ -413,7 +415,7 @@ public class ScreenOverlayImpl extends ScreenOverlay { } else if (ClientHelperImpl.getInstance().hasPermissionToUsePackets()) return new TranslatableComponent("text.rei.cheating_enabled"); else - return new TranslatableComponent("text.rei.cheating_limited_enabled"); + return new TranslatableComponent("text.rei.cheating_limited_enabled"); }), new SeparatorMenuEntry(), ToggleMenuEntry.ofDeciding(new TranslatableComponent("text.rei.config.menu.dark_theme"), diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java index df2d8d452..c8b7d4546 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java @@ -29,11 +29,17 @@ import me.shedaniel.clothconfig2.api.animator.ValueAnimator; import me.shedaniel.math.FloatingRectangle; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; -import me.shedaniel.math.impl.PointHelper; import me.shedaniel.rei.RoughlyEnoughItemsCoreClient; -import me.shedaniel.rei.api.client.gui.drag.*; +import me.shedaniel.rei.api.client.gui.drag.DraggableBoundsProvider; +import me.shedaniel.rei.api.client.gui.drag.DraggableStack; +import me.shedaniel.rei.api.client.gui.drag.DraggedAcceptorResult; +import me.shedaniel.rei.api.client.gui.drag.DraggingContext; +import me.shedaniel.rei.api.client.gui.drag.component.DraggableComponent; +import me.shedaniel.rei.api.client.gui.drag.component.DraggableComponentProvider; +import me.shedaniel.rei.api.client.gui.drag.component.DraggableComponentVisitor; import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.impl.client.gui.widget.LateRenderable; +import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; @@ -43,15 +49,16 @@ import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.function.Supplier; +@SuppressWarnings("UnstableApiUsage") public class CurrentDraggingStack extends Widget implements LateRenderable, DraggingContext<Screen> { - private DraggableStackProvider<Screen> provider; - private DraggableStackVisitor<Screen> visitor; + private DraggableComponentProvider<Screen, ?> provider; + private DraggableComponentVisitor<Screen> visitor; @Nullable private DraggableEntry entry; private final List<RenderBackEntry> backToOriginals = new ArrayList<>(); private final Set<ShapeBounds> bounds = new HashSet<>(); - public void set(DraggableStackProvider<Screen> provider, DraggableStackVisitor<Screen> visitor) { + public void set(DraggableComponentProvider<Screen, ?> provider, DraggableComponentVisitor<Screen> visitor) { this.provider = provider; this.visitor = visitor; } @@ -69,16 +76,19 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag if (xDistance * xDistance + yDistance * yDistance > requiredDistance * requiredDistance) { entry.dragging = true; - entry.stack.drag(); + entry.startDragging = Util.getMillis(); + entry.component.drag(); } } - if (!RoughlyEnoughItemsCoreClient.isLeftMousePressed) { - drop(); - } else if (entry.dragging) { + if (entry.dragging) { matrices.pushPose(); matrices.translate(0, 0, 600); - entry.stack.render(matrices, new Rectangle(mouseX - 8, mouseY - 8, 16, 16), mouseX, mouseY, delta); + entry.bounds.update(delta); + int width = entry.component.getWidth(); + int height = entry.component.getHeight(); + entry.bounds.setTo(new FloatingRectangle(mouseX - width / 2, mouseY - height / 2, width, height), Util.getMillis() - entry.startDragging < 100 && width * height > 1000 ? 80 : 10); + entry.component.render(matrices, entry.bounds.value().getBounds(), mouseX, mouseY, delta); matrices.popPose(); VoxelShape shape = entry.getBoundsProvider().bounds(); @@ -87,6 +97,10 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag bounds.add(shapeBounds); hash = shapeBounds.hash; } + + if (!RoughlyEnoughItemsCoreClient.isLeftMousePressed) { + drop(); + } } for (ShapeBounds bound : bounds) { @@ -119,12 +133,12 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag renderBackEntry.update(delta); FloatingRectangle value = renderBackEntry.bounds.value(); FloatingRectangle target = renderBackEntry.bounds.target(); - if (value.width < 2 || value.height < 2 || (Math.abs(value.x - target.x) <= 2 && Math.abs(value.y - target.y) <= 2 && Math.abs(value.width - target.width) <= 1 && Math.abs(value.height - target.height) <= 1)) { + if (value.width < 2 || value.height < 2 || (Math.abs(value.x - target.x) <= 1.3 && Math.abs(value.y - target.y) <= 1.3 && Math.abs(value.width - target.width) <= 1 && Math.abs(value.height - target.height) <= 1)) { iterator.remove(); } else { matrices.pushPose(); matrices.translate(0, 0, 600); - renderBackEntry.stack.render(matrices, value.getBounds(), mouseX, mouseY, delta); + renderBackEntry.component.render(matrices, value.getBounds(), mouseX, mouseY, delta); matrices.popPose(); } } @@ -138,7 +152,7 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { drop(); - DraggableStack hoveredStack = provider.getHoveredStack(this, mouseX, mouseY); + DraggableComponent<?> hoveredStack = provider.getHovered(this, mouseX, mouseY); if (hoveredStack != null) { entry = new DraggableEntry(hoveredStack, new Point(mouseX, mouseY)); } @@ -157,8 +171,8 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag private boolean drop() { if (entry != null && entry.dragging) { - DraggedAcceptorResult result = visitor.acceptDraggedStack(this, entry.stack); - entry.stack.release(result); + DraggedAcceptorResult result = visitor.acceptDragged(this, entry.component); + entry.component.release(result); entry = null; return true; } @@ -175,42 +189,65 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag @Override @Nullable public DraggableStack getCurrentStack() { - return entry != null && entry.dragging ? entry.stack : null; + DraggableComponent<?> dragged = getDragged(); + return dragged instanceof DraggableStack ? (DraggableStack) dragged : null; + } + + @Override + @Nullable + public DraggableComponent<?> getDragged() { + return entry != null && entry.dragging ? entry.component : null; |
