update to settings API

This commit is contained in:
Jörg Prante 2022-11-10 15:40:15 +01:00
parent 271e8228d6
commit acdaec2bda
2 changed files with 6 additions and 6 deletions

View file

@ -14,7 +14,7 @@ public class MovepositionCommand implements Command {
@Override
public void execute(Engine engine, State state, Settings settings) throws IOException {
PositionElement.MovePosition movePosition = PositionElement.createMovePosition(mmToPt(settings.getAsFloat("x", 0f)),
mmToPt(settings.getAsFloat("y", null)));
mmToPt(settings.getAsFloat("y", 0f)));
state.getElements().peek().add(movePosition);
}
}

View file

@ -14,15 +14,15 @@ public class TransformCommand implements Command {
public void execute(Engine engine, State state, Settings settings) throws IOException {
TransformElement element = new TransformElement();
if (settings.containsSetting("scalex") && settings.containsSetting("scaley")) {
element.setScale(settings.getAsFloat("scalex", null), settings.getAsFloat("scaley", null));
element.setScale(settings.getAsFloat("scalex", 1f), settings.getAsFloat("scaley", 1f));
}
if (settings.containsSetting("translatex") && settings.containsSetting("translatey")) {
element.setTranslate(mmToPt(settings.getAsFloat("translatex", null)),
mmToPt(settings.getAsFloat("translatey", null)));
element.setTranslate(mmToPt(settings.getAsFloat("translatex", 0f)),
mmToPt(settings.getAsFloat("translatey", 0f)));
}
if (settings.containsSetting("angle") && settings.containsSetting("rotatex") && settings.containsSetting("rotatey")) {
element.setRotate(settings.getAsFloat("angle", null), mmToPt(settings.getAsFloat("rotatex", null)),
mmToPt(settings.getAsFloat("rotatey", null)));
element.setRotate(settings.getAsFloat("angle", 0f), mmToPt(settings.getAsFloat("rotatex", 0f)),
mmToPt(settings.getAsFloat("rotatey", 0f)));
}
state.getElements().peek().add(element);
}