Bear with me, this is going to be tricky. I'm trying to drag a selection box around multiple elements and select the ones that are entirely contained within the select box. I'm running into problems when the size of the JSVGCanvas changes. Here are the steps: * Draw an element: When I draw an element on the screen, I give it an initial transform of the INVERSE of the JSVGCanvas's viewing transform. This works so that what you see is what is drawn, no matter how the canvas is zoomed, panned, etc. * Draw a select box: The select box is kind of the same way; I create an element based on the JSVGCanvas's current document. What's different is that while the element is created, it's not appended to the canvas. I don't want it there; I just want to use it to calculate the intersections. To transform the select box's points, I use the parent element (which is usually a <g> element or the root <svg> element). I take the parent element's screenCTM and inverse() it, then push the x, y, width, and height attributes through to get my select box in screen coordinates. * Find all intersecting elements using SVGSVGElement.getIntersectionList(...) * Iterate through the intersecting elements to find out which ones are contained in the select box. I'm not sure how to do this if the screen size has changed since I drew the element I'm trying to compare. If I have a 640x480 document and I resize the JSVGCanvas horizontally, I still have a 640x480 document in a bigger window with non-document area on the left and right which is fine. What I'm trying to do is find the dimensions of the element in the CURRENT screen space. selectBox->inverseOfParentScreenCTM == Current screen coordinates. element->inverseOfOldViewingTransform == Document coordinates -> ??? -> Current screen coordinates. Hopefully someone understands this and has a suggestion or two. I've played with the element's CTM, screenCTM, the parent element's CTM and screenCTM, and even both at once. Michael Bishop
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
