Exemplo n.º 1
0
  public String[] optimizeTransform() {
    String[] changedAttrs = null;
    SVGMatrix tfm = getTransform();

    if (tfm != null && PerseusController.isIdentityTransform(tfm, true)) {
      float xCoord = getFloatTrait(SVGConstants.SVG_X_ATTRIBUTE) + tfm.getComponent(4);
      float yCoord = getFloatTrait(SVGConstants.SVG_Y_ATTRIBUTE) + tfm.getComponent(5);

      changedAttrs =
          new String[] {
            SVGConstants.SVG_Y_ATTRIBUTE, String.valueOf(yCoord),
            SVGConstants.SVG_X_ATTRIBUTE, String.valueOf(xCoord),
            SVGConstants.SVG_TRANSFORM_ATTRIBUTE, null
          };
    }

    return changedAttrs;
  }
Exemplo n.º 2
0
 public static NaviPoint getLocalPointFromDomElement(Element element, float x, float y) {
   SVGMatrix mat = ((SVGLocatable) element).getScreenCTM();
   SVGMatrix imat = mat.inverse(); // screen -> elem
   NaviPoint pt = new NaviPoint(x, y);
   return pt.matrixTransform(imat);
 }