Markers draw code refactor, minor text marker control changes

This commit is contained in:
ApsZoldat
2023-12-12 22:40:33 +03:00
parent 4802076bf8
commit 5830259e41
6 changed files with 81 additions and 154 deletions
+4 -8
View File
@@ -1987,13 +1987,9 @@ public class LExecutor{
var marker = state.markers.get(exec.numi(id));
if(marker == null) return;
if(type == LMarkerControl.text){
if(exec.bool(p1)){
marker.setText(exec.textBuffer.toString(), exec.bool(p3));
exec.textBuffer.setLength(0);
}else{
marker.setText((exec.obj(p2) != null ? exec.obj(p2).toString() : "null"), exec.bool(p3));
}
if(type == LMarkerControl.flushText){
marker.setText(exec.textBuffer.toString(), exec.bool(p1));
exec.textBuffer.setLength(0);
}else if(type == LMarkerControl.texture){
if(exec.bool(p1)){
marker.setTexture(exec.textBuffer.toString());
@@ -2058,7 +2054,7 @@ public class LExecutor{
public static void updateMarkerText(int id, LMarkerControl type, boolean fetch, String text){
var marker = state.markers.get(id);
if(marker != null){
if(type == LMarkerControl.text){
if(type == LMarkerControl.flushText){
marker.setText(text, fetch);
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ public enum LMarkerControl{
stroke("stroke"),
rotation("rotation"),
shape("sides", "fill", "outline"),
text("printFlush", "text", "fetch"),
flushText("fetch"),
fontSize("size"),
textHeight("height"),
labelFlags("background", "outline"),
@@ -2000,6 +2000,7 @@ public class LStatements{
t.setColor(table.color);
fields(t, type.params[i], i == 0 ? p1 : i == 1 ? p2 : p3, i == 0 ? v -> p1 = v : i == 1 ? v -> p2 = v : v -> p3 = v).width(100f);
if(type == LMarkerControl.color){
col(t, p1, res -> {
p1 = "%" + res.toString().substring(0, res.a >= 1f ? 6 : 8);