View Javadoc

1   package org.vectomatic.svg.edit.client;
2   
3   import org.vectomatic.dom.svg.OMSVGMatrix;
4   import org.vectomatic.dom.svg.OMSVGPoint;
5   import org.vectomatic.dom.svg.OMSVGRect;
6   import org.vectomatic.dom.svg.utils.SVGConstants;
7   
8   import com.google.gwt.core.client.GWT;
9   
10  public class SVGWindowWebkit extends SVGWindow {
11  	public SVGWindowWebkit() {
12  		super();
13  		GWT.log("SVGWindowWebkit");
14  	}
15  	@Override
16  	public void setRotation(float angle) {
17  		this.angle = angle;
18  		OMSVGRect rect = svg.getViewBox().getBaseVal();
19  		OMSVGPoint center = svg.createSVGPoint(rect.getCenterX(), rect.getCenterY());
20  		OMSVGMatrix m1 = svg.createSVGMatrix().translate(center.getX(), center.getY());
21      	OMSVGMatrix m2 = svg.createSVGMatrix().rotate(this.angle);
22      	OMSVGMatrix m3 = svg.createSVGMatrix().translate(-center.getX(), -center.getY());
23      	OMSVGMatrix m = m1.multiply(m2).multiply(m3);
24      	String value = SVGConstants.SVG_MATRIX_VALUE + "(" + m.getA() + "," + m.getB() + "," + m.getC() + "," + m.getD() + "," + m.getE() + "," + m.getF() + ")";
25      	GWT.log("xform=" + value);
26      	xformGroup.setAttribute(SVGConstants.SVG_TRANSFORM_ATTRIBUTE, value);
27  	}
28  }