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 Uwe Knauer <kn...@sigma.informatik.hu-berlin.de> on 2002/12/17 10:51:57 UTC

Question about linking the DOM and the presentation

Dear Santa (and anyone else who feels in mood to make a little computer 
science student very very happy) 

I am looking for a hint or some piece of code that helps me to understand 
how I can do a simple drag&drop.

I use JSVGCanvas to show a generated SVG-file. Now I want to select 
a shape, e.g. a rectangle, and move it on the screen while updating 
the DOM.

My first idea was simply to update the DOM, but I experienced some 
problems with understanding the link between DOM and GVT-tree and 
how the update mechanism work. 
I think I can use the coordinates and check the nodes of the DOM 
one by one but I hope there is a more beautiful way.

Thanx in advance
Uwe 



===================================================================
EASY and FREE access to your email anywhere: http://Mailreader.com/
===================================================================



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


RE: Question about linking the DOM and the presentation

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "UK" == Uwe Knauer <kn...@sigma.informatik.hu-berlin.de> writes:

UK> Dear Santa (and anyone else who feels in mood to make a little
UK> computer science student very very happy)

UK> I am looking for a hint or some piece of code that helps me to
UK> understand how I can do a simple drag&drop.

UK> I use JSVGCanvas to show a generated SVG-file. Now I want to
UK> select a shape, e.g. a rectangle, and move it on the screen while
UK> updating the DOM.

UK> My first idea was simply to update the DOM, but I experienced some
UK> problems with understanding the link between DOM and GVT-tree and
UK> how the update mechanism work.  I think I can use the coordinates
UK> and check the nodes of the DOM one by one but I hope there is a
UK> more beautiful way.

    I suspect that you can do this essentially entirely from the DOM.
Just attach mouse event listeners to the DOM elements (either in Java
or in JavaScript (in script elements in the SVG document)).  Then when
your listener is called update the DOM.

    The DOM should then (for dynamic documents) automatically update
the GVT tree.  If your original document doesn't look like a dynamic
document (i.e. no script elements) you will need to tell the bridge to
make it dynamic anyways
(JSVGComponent.setDocumentState(ALWAYS_DYNAMIC)).

    You may need to go to the GVT to test if you have dragged on top
of another element (I don't think we implement that part of the SVG
DOM yet).


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