You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Alan Deikman <Al...@znyx.com> on 2009/03/17 00:46:19 UTC

Recipe needed: Elements outside the RenderingTransform context

My intuition says that this can be done in a few lines of code, but I 
don't have the Batik proficiency to see how.

What I think is needed for many applications is a way in a JSVGCanvas to 
have controls that do not zoom, pan, and rotate with the rest of the 
picture.   For example, it would be nice to have a "reset" button in a 
corner that stays visible whenever the Component is resized that can 
listen for a mouse click to reset the display to "normal." 

Any suggestions?

-- 
Alan Deikman



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Recipe needed: Elements outside the RenderingTransform context

Posted by Helder Magalhães <he...@gmail.com>.
Hi Alan Deikman,

> What I think is needed for many applications is a way in a JSVGCanvas to
> have controls that do not zoom, pan, and rotate with the rest of the
> picture.
[...]
> Any suggestions?

Something like the following (ECMAScript) might help:

  var iCTM = (document.documentElement.getScreenCTM()).inverse();
  var newMatrix = document.documentElement.createSVGTransformFromMatrix(iCTM);
  var targetElement = document.getElementById("YourElementID");
  targetElement.transform.baseVal.initialize(newMatrix);

It can be used in your "reset" button or similar, or simply attached
to UA events such as zoom, resize, etc. in order to create the
illusion of elements which do not resize. :-)

This should work in current SVG implementations (Batik, Firefox,
Opera, Webkit). I believe ASV and possibly other implementations
require additional trickery in order to work.

Also, it should be fairly easy to adapt this to Java environment. ;-)
Comments and other possible solutions are naturally welcome. :-)

Hope this helps,

  Helder Magalhães

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org