Add ShapeMarker starting and ending angles (#9729)
This commit is contained in:
@@ -851,7 +851,7 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
|||||||
|
|
||||||
/** Displays a shape with an outline and color. */
|
/** Displays a shape with an outline and color. */
|
||||||
public static class ShapeMarker extends PosMarker{
|
public static class ShapeMarker extends PosMarker{
|
||||||
public float radius = 8f, rotation = 0f, stroke = 1f;
|
public float radius = 8f, rotation = 0f, stroke = 1f, startAngle = 0f, endAngle = 360f;
|
||||||
public boolean fill = false, outline = true;
|
public boolean fill = false, outline = true;
|
||||||
public int sides = 4;
|
public int sides = 4;
|
||||||
public Color color = Color.valueOf("ffd37f");
|
public Color color = Color.valueOf("ffd37f");
|
||||||
@@ -877,14 +877,18 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
|||||||
if(!fill){
|
if(!fill){
|
||||||
if(outline){
|
if(outline){
|
||||||
Lines.stroke((stroke + 2f) * scaleFactor, Pal.gray);
|
Lines.stroke((stroke + 2f) * scaleFactor, Pal.gray);
|
||||||
Lines.poly(pos.x, pos.y, sides, (radius + 1f) * scaleFactor, rotation);
|
Lines.poly(pos.x, pos.y, sides, (radius + 1f) * scaleFactor, rotation + startAngle, rotation + endAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
Lines.stroke(stroke * scaleFactor, color);
|
Lines.stroke(stroke * scaleFactor, color);
|
||||||
Lines.poly(pos.x, pos.y, sides, (radius + 1f) * scaleFactor, rotation);
|
Lines.poly(pos.x, pos.y, sides, (radius + 1f) * scaleFactor, rotation + startAngle, rotation + endAngle);
|
||||||
}else{
|
}else{
|
||||||
Draw.color(color);
|
Draw.color(color);
|
||||||
Fill.poly(pos.x, pos.y, sides, radius * scaleFactor, rotation);
|
if (startAngle < endAngle){
|
||||||
|
Fill.arc(pos.x, pos.y, radius * scaleFactor, (endAngle - startAngle) / 360f, rotation + startAngle, sides);
|
||||||
|
}else{
|
||||||
|
Fill.arc(pos.x, pos.y, radius * scaleFactor, (startAngle - endAngle) / 360f, rotation + endAngle, sides);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
@@ -901,12 +905,14 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
|||||||
case rotation -> rotation = (float)p1;
|
case rotation -> rotation = (float)p1;
|
||||||
case color -> color.fromDouble(p1);
|
case color -> color.fromDouble(p1);
|
||||||
case shape -> sides = (int)p1;
|
case shape -> sides = (int)p1;
|
||||||
|
case arc -> startAngle = (float)p1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Double.isNaN(p2)){
|
if(!Double.isNaN(p2)){
|
||||||
switch(type){
|
switch(type){
|
||||||
case shape -> fill = !Mathf.equal((float)p2, 0f);
|
case shape -> fill = !Mathf.equal((float)p2, 0f);
|
||||||
|
case arc -> endAngle = (float)p2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public enum LMarkerControl{
|
|||||||
stroke("stroke"),
|
stroke("stroke"),
|
||||||
rotation("rotation"),
|
rotation("rotation"),
|
||||||
shape("sides", "fill", "outline"),
|
shape("sides", "fill", "outline"),
|
||||||
|
arc("start", "end"),
|
||||||
flushText("fetch"),
|
flushText("fetch"),
|
||||||
fontSize("size"),
|
fontSize("size"),
|
||||||
textHeight("height"),
|
textHeight("height"),
|
||||||
|
|||||||
@@ -25,4 +25,4 @@ org.gradle.caching=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
org.gradle.internal.http.socketTimeout=100000
|
org.gradle.internal.http.socketTimeout=100000
|
||||||
org.gradle.internal.http.connectionTimeout=100000
|
org.gradle.internal.http.connectionTimeout=100000
|
||||||
archash=8b6f34c036
|
archash=8a2decd656
|
||||||
|
|||||||
Reference in New Issue
Block a user