Logic canvas fixes

This commit is contained in:
Anuken
2025-02-10 16:21:51 -05:00
parent 0db7c1e36a
commit 5622b295e6

View File

@@ -673,7 +673,7 @@ public class LCanvas extends Table{
drawCurve(r.x, r.y, t.x, t.y); drawCurve(r.x, r.y, t.x, t.y);
float s = button.getWidth(); float s = button.getWidth();
Draw.color(button.color); Draw.color(button.color, parentAlpha);
Tex.logicNode.draw(t.x + s * 0.75f, t.y - s / 2f, -s, s); Tex.logicNode.draw(t.x + s * 0.75f, t.y - s / 2f, -s, s);
Draw.reset(); Draw.reset();
} }
@@ -681,23 +681,31 @@ public class LCanvas extends Table{
public void drawCurve(float x, float y, float x2, float y2){ public void drawCurve(float x, float y, float x2, float y2){
Lines.stroke(Scl.scl(4f), button.color); Lines.stroke(Scl.scl(4f), button.color);
Draw.alpha(parentAlpha); Draw.alpha(parentAlpha);
Draw.color(button.color);
// exponential smoothing // exponential smoothing
uiHeight = Mathf.lerp( uiHeight = Mathf.lerp(
60f + 20f * (float) predHeight, Scl.scl(Core.graphics.isPortrait() ? 20f : 40f) + Scl.scl(Core.graphics.isPortrait() ? 8f : 10f) * (float) predHeight,
uiHeight, uiHeight,
dynamicJumpHeights ? Mathf.pow(0.9f, Time.delta) : 0 dynamicJumpHeights ? Mathf.pow(0.9f, Time.delta) : 0
); );
//trapezoidal jumps //trapezoidal jumps
float dy = (y2 == y ? 0f : y2 > y ? 1f : -1f) * uiHeight * 0.5f; float dy = (y2 == y ? 0f : y2 > y ? 1f : -1f) * uiHeight * 0.5f;
Lines.beginLine(); //there's absolutely a better way to detect invalid trapezoids, but this probably isn't *that* slow and I don't care to fix it right now
Lines.linePoint(x, y); if(Intersector.intersectSegments(x, y, x + uiHeight, y + dy, x2, y2, x + uiHeight, y2 - dy, Tmp.v3)){
Lines.linePoint(x + uiHeight, y + dy); Lines.beginLine();
Lines.linePoint(x + uiHeight, y2 - dy); Lines.linePoint(x, y);
Lines.linePoint(x2, y2); Lines.linePoint(Tmp.v3.x, Tmp.v3.y);
Lines.endLine(); Lines.linePoint(x2, y2);
Lines.endLine();
}else{
Lines.beginLine();
Lines.linePoint(x, y);
Lines.linePoint(x + uiHeight, y + dy);
Lines.linePoint(x + uiHeight, y2 - dy);
Lines.linePoint(x2, y2);
Lines.endLine();
}
} }
public void prepareHeight(){ public void prepareHeight(){
@@ -706,7 +714,7 @@ public class LCanvas extends Table{
this.predHeight = 0; this.predHeight = 0;
this.flipped = false; this.flipped = false;
this.jumpUIBegin = this.jumpUIEnd = invalidJump; this.jumpUIBegin = this.jumpUIEnd = invalidJump;
} else { }else{
this.markedDone = false; this.markedDone = false;
int i = this.button.elem.index; int i = this.button.elem.index;
int j = this.button.to.get().index; int j = this.button.to.get().index;