From acdaec2bda60ad1afb2d486e74459fcd73f8d5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Prante?= Date: Thu, 10 Nov 2022 15:40:15 +0100 Subject: [PATCH] update to settings API --- .../element/scripting/command/MovepositionCommand.java | 2 +- .../element/scripting/command/TransformCommand.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/MovepositionCommand.java b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/MovepositionCommand.java index 755997a..0aeeeb6 100644 --- a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/MovepositionCommand.java +++ b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/MovepositionCommand.java @@ -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); } } diff --git a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/TransformCommand.java b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/TransformCommand.java index 861e7d7..84a5296 100644 --- a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/TransformCommand.java +++ b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/TransformCommand.java @@ -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); }