Fix initial shivering on desktop while dragging building plan. (#9334)
Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
@@ -162,6 +162,7 @@ Gabriel "red" Fondato
|
|||||||
CoCo Snow
|
CoCo Snow
|
||||||
summoner
|
summoner
|
||||||
OpalSoPL
|
OpalSoPL
|
||||||
|
apollovy
|
||||||
BalaM314
|
BalaM314
|
||||||
Redstonneur1256
|
Redstonneur1256
|
||||||
ApsZoldat
|
ApsZoldat
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ public class DesktopInput extends InputHandler{
|
|||||||
/** Time of most recent control group selection */
|
/** Time of most recent control group selection */
|
||||||
public long lastCtrlGroupSelectMillis;
|
public long lastCtrlGroupSelectMillis;
|
||||||
|
|
||||||
|
private final Vec2 buildPlanMouseOffsetPX = new Vec2();
|
||||||
|
|
||||||
boolean showHint(){
|
boolean showHint(){
|
||||||
return ui.hudfrag.shown && Core.settings.getBool("hints") && selectPlans.isEmpty() && !player.dead() &&
|
return ui.hudfrag.shown && Core.settings.getBool("hints") && selectPlans.isEmpty() && !player.dead() &&
|
||||||
(!isBuilding && !Core.settings.getBool("buildautopause") || player.unit().isBuilding() || !player.dead() && !player.unit().spawnedByCore());
|
(!isBuilding && !Core.settings.getBool("buildautopause") || player.unit().isBuilding() || !player.dead() && !player.unit().spawnedByCore());
|
||||||
@@ -639,11 +641,10 @@ public class DesktopInput extends InputHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(splan != null){
|
if(splan != null){
|
||||||
float offset = ((splan.block.size + 2) % 2) * tilesize / 2f;
|
float x = Core.input.mouseWorld().x + buildPlanMouseOffsetPX.x;
|
||||||
float x = Core.input.mouseWorld().x + offset;
|
float y = Core.input.mouseWorld().y + buildPlanMouseOffsetPX.y;
|
||||||
float y = Core.input.mouseWorld().y + offset;
|
splan.x = Math.round(x / tilesize);
|
||||||
splan.x = (int)(x / tilesize);
|
splan.y = Math.round(y / tilesize);
|
||||||
splan.y = (int)(y / tilesize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(block == null || mode != placing){
|
if(block == null || mode != placing){
|
||||||
@@ -687,6 +688,8 @@ public class DesktopInput extends InputHandler{
|
|||||||
updateLine(selectX, selectY);
|
updateLine(selectX, selectY);
|
||||||
}else if(plan != null && !plan.breaking && mode == none && !plan.initialized && plan.progress <= 0f){
|
}else if(plan != null && !plan.breaking && mode == none && !plan.initialized && plan.progress <= 0f){
|
||||||
splan = plan;
|
splan = plan;
|
||||||
|
buildPlanMouseOffsetPX.x = splan.x * tilesize - Core.input.mouseWorld().x;
|
||||||
|
buildPlanMouseOffsetPX.y = splan.y * tilesize - Core.input.mouseWorld().y;
|
||||||
}else if(plan != null && plan.breaking){
|
}else if(plan != null && plan.breaking){
|
||||||
deleting = true;
|
deleting = true;
|
||||||
}else if(commandMode){
|
}else if(commandMode){
|
||||||
|
|||||||
Reference in New Issue
Block a user