> Well the easiest thing is to just make it part of your > document. If you want to draw it in say an Overlay you could > use getScreenCTM in place of getTransformToElement.
This is what I'd rather do. This really will never be part of the document; just a visual representation of which element the user has currently selected. If I getScreenCTM from the "selected" element, I get an SVGMatrix which is what I expect, looking back at the drag and drop code. What I don't get is how to apply that matrix to either the Graphics class responsible for drawing the SVGRect on the glass pane or the actual SVGRect itself. Michael Bishop -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, November 28, 2005 4:38 PM To: [email protected] Subject: RE: Element -> Bounding Box? Hi Michael, "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on 11/28/2005 03:11:18 PM: > OK, yeah, that sounds complicated. To draw those circles, I have to > know about all these points. And it is different based on the element > type. Let's just stick with the basic bounding box. Well for 'path' there is getPathSegList which provides this information fairly convieniently. You would still have to fake something similar for other element types however. > I have a double problem. Remember how I'm using translations to move > elements around the canvas? Translate information isn't stored in a > bounding box, so when I draw a bounding box, I have to apply translation > information. Not terribly hard (I don't think). The second problem is > screen coordinates. I have to face the issue of drawing a bounding box > of a translated element on a zoomed canvas. This is like the opposite > of drawing on a zoomed canvas. I have to tell the glass pane how to > draw properly based on the state of the canvas, not render to the canvas > based on the glass pane. I think most of these issues can be solved fairly easily with the 'e1.getTransformToElement(e2)' call. This will give you the transformation from the local coordinate system of 'e1' to the local coordinate system of 'e2'. If you use your element to highlight as 'e1', the bbox is given in the local coordinate system of 'e1'. Then I would use a 'g' representing a glass pane 'layer' as my 'e2'. You can then use the SVGMatrix methods to map the corners of the bbox to e2's coordinate system where you can easily construct a path. > What's the best approach of drawing a translated element to a zoomed > in/out canvas? Which should be applied first? I'm just trying to find > a starting point for going down this trail. Well the easiest thing is to just make it part of your document. If you want to draw it in say an Overlay you could use getScreenCTM in place of getTransformToElement. > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Monday, November 28, 2005 2:19 PM > To: [email protected] > Subject: RE: Element -> Bounding Box? > > Hi Michael, > > "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on > > 11/28/2005 02:12:25 PM: > > > OK, here's a slightly more complicated question. Is there a way to > make > > "points" on an element respond to a mouse event? > > No, you could create new geometry (say small circles) that sit on top > of the rect element's geometry. > > > Say I draw some kind of polygon. Then I "select" it, so I know which > > > element it belongs to. Now I'd like to grab one of the points in the > > polygon and "move" that point, altering its shape. > > Adding the circles could be part of the 'highlighting'. > > > For example, taking a rectangle and dragging two of its points > > to form a trapezoid. Is this possible with existing tools? > > Well this brings up another point which is that once you drag one > of the point's it is no longer a rect so you will need to be able > to generalize geometry 'on the fly'. > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Monday, November 28, 2005 1:24 PM > > To: [email protected] > > Subject: Re: Element -> Bounding Box? > > > > Hi Michael, > > > > Check out SVGLocatable.getBBox(). > > > > "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote > on > > > > 11/28/2005 11:16:24 AM: > > > > > Is there a way to do this? Citing the old drag and drop approach, I > > can > > > > > select an Element by clicking on it. Now I'd like to "outline" that > > > Element > > > to show it's been selected. I see it can be done with other > objects, > > but is > > > there a way to get from Element to bounding box? > > > > All of the SVG graphical elements (g, svg, rect, path, ellipse, > text, > > > > use, etc) implement this interface. > > Of course not every 'Element' implements this interface as even in SVG > > > many do not have a > > reasonable BBox (think gradient), and of course it's even harder to > > imagine what one would return for > > elements in other namespaces. > > > > --------------------------------------------------------------------- > > 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] > --------------------------------------------------------------------- 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]
