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 "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> on 2006/02/03 18:41:33 UTC

"Drag" selection box...how to?

Hello,

     I've worked with listeners to drag and drop elements around a
JSVGCanvas.  This method works primarily by registering which elements
receive the mouse up/down events.  What I want to do is implement a
selection "box" where you drag a box around a number of elements and it
will select all the elements that fall within that box.  I need some way
to translate screen coordinates to document coordinates which is a known
problem.  What I don't know how to do is ask the document "Which
elements fall inside this box?"

 

Michael Bishop


Re: "Drag" selection box...how to?

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

On Tue, 2006-02-07 at 12:41 +1100, Cameron McCormack wrote:
> Tonny Kohar:
> > We have similar problem for our Sketsa SVG Graphics Editor.
> > We solve the problem by
> > 1) Traverse or Iterate the DOM tree
> > 2) compare each element bbox with the selection box
> 
> You could also use SVGSVGElement.getIntersectionList, which currently
> uses just the same approach.

Yup, this is good idea. 
Previously, this method SVGSVGElement.getIntersectionList is not
available only stub. I think since batik 1.5 (not sure) this method is implemented.

I think I am gonna change my code to use this method instead :)

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


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


Re: "Drag" selection box...how to?

Posted by Cameron McCormack <ca...@aka.mcc.id.au>.
Tonny Kohar:
> We have similar problem for our Sketsa SVG Graphics Editor.
> We solve the problem by
> 1) Traverse or Iterate the DOM tree
> 2) compare each element bbox with the selection box

You could also use SVGSVGElement.getIntersectionList, which currently
uses just the same approach.

-- 
 Cameron McCormack			ICQ: 26955922
 cam (at) mcc.id.au			MSN: cam (at) mcc.id.au
 http://mcc.id.au/			JBR: heycam (at) jabber.org

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


Re: "Drag" selection box...how to?

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

On Fri, 2006-02-03 at 12:41 -0500, Bishop, Michael W. CONTR J9C880
wrote:
>      I’ve worked with listeners to drag and drop elements around a
> JSVGCanvas.  This method works primarily by registering which elements
> receive the mouse up/down events.  What I want to do is implement a
> selection “box” where you drag a box around a number of elements and
> it will select all the elements that fall within that box.  I need
> some way to translate screen coordinates to document coordinates which
> is a known problem.  What I don’t know how to do is ask the document
> “Which elements fall inside this box?”

We have similar problem for our Sketsa SVG Graphics Editor.
We solve the problem by
1) Traverse or Iterate the DOM tree
2) compare each element bbox with the selection box

The draw back of this methods, is that the bigger the dom tree, the
longer it will take to traverse/iterate the whole DOM tree

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


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