From 2aaa86175505814eb84006474bc6fa91328840f7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 3 Nov 2023 18:56:02 -0400 Subject: [PATCH] Fixed #9224 --- core/src/mindustry/input/DesktopInput.java | 2 +- core/src/mindustry/input/InputHandler.java | 29 ++++++++++++++-------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index feea195e29..6030263c0b 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -114,7 +114,7 @@ public class DesktopInput extends InputHandler{ //draw break selection if(mode == breaking){ - drawBreakSelection(selectX, selectY, cursorX, cursorY, !Core.input.keyDown(Binding.schematic_select) ? maxLength : Vars.maxSchematicSize); + drawBreakSelection(selectX, selectY, cursorX, cursorY, !Core.input.keyDown(Binding.schematic_select) ? maxLength : Vars.maxSchematicSize, false); } if(!Core.scene.hasKeyboard() && mode != breaking){ diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index d38f7f9ec2..dedcf105a2 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -1298,6 +1298,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } protected void drawBreakSelection(int x1, int y1, int x2, int y2, int maxLength){ + drawBreakSelection(x1, y1, x2, y2, maxLength, true); + } + + protected void drawBreakSelection(int x1, int y1, int x2, int y2, int maxLength, boolean useSelectPlans){ NormalizeDrawResult result = Placement.normalizeDrawArea(Blocks.air, x1, y1, x2, y2, false, maxLength, 1f); NormalizeResult dresult = Placement.normalizeArea(x1, y1, x2, y2, rotation, false, maxLength); @@ -1316,16 +1320,16 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ Lines.stroke(1f); for(var plan : player.unit().plans()){ - if(plan.breaking) continue; - if(plan.bounds(Tmp.r2).overlaps(Tmp.r1)){ + if(!plan.breaking && plan.bounds(Tmp.r2).overlaps(Tmp.r1)){ drawBreaking(plan); } } - for(var plan : selectPlans){ - if(plan.breaking) continue; - if(plan.bounds(Tmp.r2).overlaps(Tmp.r1)){ - drawBreaking(plan); + if(useSelectPlans){ + for(var plan : selectPlans){ + if(!plan.breaking && plan.bounds(Tmp.r2).overlaps(Tmp.r1)){ + drawBreaking(plan); + } } } @@ -1487,11 +1491,14 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } } - it = selectPlans.iterator(); - while(it.hasNext()){ - var plan = it.next(); - if(!plan.breaking && plan.bounds(Tmp.r2).overlaps(Tmp.r1)){ - it.remove(); + //don't remove plans on desktop, where flushing is false + if(flush){ + it = selectPlans.iterator(); + while(it.hasNext()){ + var plan = it.next(); + if(!plan.breaking && plan.bounds(Tmp.r2).overlaps(Tmp.r1)){ + it.remove(); + } } }