This commit is contained in:
Anuken
2023-11-03 18:56:02 -04:00
parent f606589173
commit 2aaa861755
2 changed files with 19 additions and 12 deletions

View File

@@ -114,7 +114,7 @@ public class DesktopInput extends InputHandler{
//draw break selection //draw break selection
if(mode == breaking){ 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){ if(!Core.scene.hasKeyboard() && mode != breaking){

View File

@@ -1298,6 +1298,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
} }
protected void drawBreakSelection(int x1, int y1, int x2, int y2, int maxLength){ 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); NormalizeDrawResult result = Placement.normalizeDrawArea(Blocks.air, x1, y1, x2, y2, false, maxLength, 1f);
NormalizeResult dresult = Placement.normalizeArea(x1, y1, x2, y2, rotation, false, maxLength); 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); Lines.stroke(1f);
for(var plan : player.unit().plans()){ for(var plan : player.unit().plans()){
if(plan.breaking) continue; if(!plan.breaking && plan.bounds(Tmp.r2).overlaps(Tmp.r1)){
if(plan.bounds(Tmp.r2).overlaps(Tmp.r1)){
drawBreaking(plan); drawBreaking(plan);
} }
} }
for(var plan : selectPlans){ if(useSelectPlans){
if(plan.breaking) continue; for(var plan : selectPlans){
if(plan.bounds(Tmp.r2).overlaps(Tmp.r1)){ if(!plan.breaking && plan.bounds(Tmp.r2).overlaps(Tmp.r1)){
drawBreaking(plan); drawBreaking(plan);
}
} }
} }
@@ -1487,11 +1491,14 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
} }
} }
it = selectPlans.iterator(); //don't remove plans on desktop, where flushing is false
while(it.hasNext()){ if(flush){
var plan = it.next(); it = selectPlans.iterator();
if(!plan.breaking && plan.bounds(Tmp.r2).overlaps(Tmp.r1)){ while(it.hasNext()){
it.remove(); var plan = it.next();
if(!plan.breaking && plan.bounds(Tmp.r2).overlaps(Tmp.r1)){
it.remove();
}
} }
} }