Hi Michael, "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on 11/22/2005 02:15:48 PM:
> - Load any SVG document. > - Drag an element around the JSVGCanvas by updating its transform > however it's represented. I guess it doesn't matter really if the > representation of the transform changes as long as it acts the same for > the rest of the attribute. If I change the "translate" portion, I want > to keep shear, scale, skew, rotate, etc. intact. So the simplest thing to do is to 'prepend' a translate to the transform. The only problem with this is that in general every time an element is dragged it will 'accumulate' additional translate entries in it's transform. There are a number of potential solutions like looking to see if the first entry in the transform is a translate and if so update that part rather than prepending a new one. I think the parser classes I point you to earlier can be used to do this with some additional logic in the handler class. The other approach to use is that for all transforms if you reduce them to a matrix (you can get this from the SVG DOM) the transform is essentially just 'tacked on' at the end of everything else. So with a bit of care it would be possible to just update the transform portion of the matrix representation of the matrix. The tricky part is that many of the SVG DOM interfaces will be problematic in this case since you need to map points using the 'original' value for the matrix rather than the matrix that is actually on the element. You might be able to get the screen CTM for the element once at the start and use it until the drag completes. > > Michael Bishop > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 26, 2005 9:23 PM > To: [email protected] > Cc: [email protected] > Subject: Re: Conversion for AffineTransform? > > Hi Michael, > > "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on > > 10/26/2005 02:47:33 PM: > > > I?m looking for something similar to SVGColor.toSVG() or > SVGShape.toSVG(). I > > see there?s an SVGOMMatrix that takes an AffineTransform as a > constructor > > argument, but I don?t see a way to create the ?transform=???? from it. > > It's trivial to construct if you are willing to use the 'matrix()' > form. You can also have a 'translate(tx, ty) matrix(sx, shy, shx, sy, > 0, > 0)' > so the transform is pulled out (sx = scaleX, shx = shearX, etc). > If you don't want to use matrix then it depends on you knowing the > form of your affine. > > > Does one exist? Similarly, is there one to go from a ?transform=???? > back to some > > object? I?m doing it with string parsing and it?s kinda ugly. > > You can use the parser classes from Batik: > batik.parser.TransformListParser > batik.parser.AWTTransformProducer > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
