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
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){

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){
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();
}
}
}