/** * Returns the x coordinate of the bottom right position. * * @return the x coordinate of the bottom right position */ public float getMaxX() { return getX() + getWidth(); }
private float computeDefaultScaling(CanvasSize cs) { float ratioWidth = width / cs.getWidth(); float ratioHeight = height / cs.getHeight(); return ratioWidth < ratioHeight ? ratioWidth : ratioHeight; }
private CanvasSize getSheetCanvasSize(PreviewModel m) { CanvasSize cs = m.getGraphicsCanvasSize(); float marginPercentage = m.getProperties() .getFloatValue(PreviewProperty.MARGIN); float marginWidth = cs.getWidth() * marginPercentage / 100F; float marginHeight = cs.getHeight() * marginPercentage / 100F; return new CanvasSize( cs.getX() - marginWidth, cs.getY() - marginHeight, cs.getWidth() + 2F * marginWidth, cs.getHeight() + 2F * marginHeight); }
if (cs.getWidth() > cs.getHeight()) { ss = new SupportSize( cs.getWidth() * ss.getHeightFloat() / cs.getHeight(), ss.getHeightFloat(), LengthUnit.PIXELS); } else if (cs.getHeight() > cs.getWidth()) { ss = new SupportSize( ss.getWidthFloat(), cs.getHeight() * ss.getWidthFloat() / cs.getWidth(), LengthUnit.PIXELS); svgRoot.setAttributeNS(null, "width", cs.getWidth() + ""); svgRoot.setAttributeNS(null, "height", cs.getHeight() + ""); svgRoot.setAttributeNS(null, "version", "1.1"); cs.getX(), cs.getY(), cs.getWidth(), cs.getHeight())); scaleRatio = ss.getWidthFloat() / cs.getWidth();
private void fit(CanvasSize cs) { Vector box = new Vector(cs.getWidth(), cs.getHeight()); Vector semiBox = Vector.div(box, 2F); Vector topLeft = new Vector(cs.getX(), cs.getY()); Vector center = new Vector(width / 2F, height / 2F); Vector scaledCenter = Vector.add(topLeft, semiBox); trans.set(center); trans.sub(scaledCenter); } }