This commit is contained in:
neveix 2026-08-14 16:10:41 +05:00
parent 1a2f0f4868
commit cedeaa68ad
2 changed files with 16 additions and 0 deletions

View file

@ -500,6 +500,19 @@ void SlotView::performRightClick(ItemStack& stack, ItemStack& grabbed) {
); );
} }
void SlotView::performMiddleClick(ItemStack& stack, ItemStack& grabbed) {
auto indices = *content->getIndices();
if (!grabbed.isEmpty()) {
if (stack.isEmpty()) {
stack.set(grabbed);
stack.maximizeCount(indices);
}
return;
}
grabbed.set(stack);
grabbed.maximizeCount(indices);
}
void SlotView::clicked(Mousecode button) { void SlotView::clicked(Mousecode button) {
if (bound == nullptr) return; if (bound == nullptr) return;
auto exchangeSlot = auto exchangeSlot =
@ -514,6 +527,8 @@ void SlotView::clicked(Mousecode button) {
performLeftClick(stack, grabbed); performLeftClick(stack, grabbed);
} else if (button == Mousecode::BUTTON_2) { } else if (button == Mousecode::BUTTON_2) {
performRightClick(stack, grabbed); performRightClick(stack, grabbed);
} else if (button == Mousecode::BUTTON_3) {
performMiddleClick(stack, grabbed);
} }
if (layout.updateFunc) { if (layout.updateFunc) {

View file

@ -67,6 +67,7 @@ namespace gui {
void performLeftClick(ItemStack& stack, ItemStack& grabbed); void performLeftClick(ItemStack& stack, ItemStack& grabbed);
void performRightClick(ItemStack& stack, ItemStack& grabbed); void performRightClick(ItemStack& stack, ItemStack& grabbed);
void performMiddleClick(ItemStack& stack, ItemStack& grabbed);
void drawItemIcon( void drawItemIcon(
Batch2D& batch, Batch2D& batch,