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 Peppe <pe...@gmail.com> on 2006/11/16 11:57:03 UTC

select a shape

Hi, when i click on a shape, in my jsvgcanvas, i would that a outlined
perimeter around the shape is visualized and cursor is set to "move"....how
can i do this?    
-- 
View this message in context: http://www.nabble.com/select-a-shape-tf2642201.html#a7375509
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: select a shape

Posted by Peppe <pe...@gmail.com>.
In this way it works but when mouse pointer exit from shape cursor doesn't
return in "default" and stroke too... 

-- 
View this message in context: http://www.nabble.com/select-a-shape-tf2642201.html#a7396708
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: select a shape

Posted by Peppe <pe...@gmail.com>.
I wrote this code but it doesn't works:

SVGElement svgRoot = doc.getRootElement();
EventTarget target = (EventTarget)svgRoot;
target.addEventListener("onclick", new OnMouseClick(), false); 

	 private class OnMouseClick implements EventListener {
	        public void handleEvent(Event evt) {
	        	DOMMouseEvent eleEvt = (DOMMouseEvent)evt;
	                final Element shape = ((Element)eleEvt.getTarget());
	               
svgCanvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new
Runnable() {
	    			public void run() {
	                            shape.setAttributeNS(null,"stroke","red");
	                            shape.setAttributeNS(null,"cursor","move"); 
	    			}
	            });
	        }
	 }




-- 
View this message in context: http://www.nabble.com/select-a-shape-tf2642201.html#a7376796
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: select a shape

Posted by Andreas Neumann <ne...@karto.baug.ethz.ch>.
function highLight(evt) {
    var myShape = evt.target;
    myShape.setAttributeNS(null,"stroke","red");
    myShape.setAttributeNS(null,"cursor","move");
}

would highlight an element by setting it's stroke to red. This could be 
set on mouseover, Than you'd have to set it back onmouseout.

This is javascript syntax but it shouldn't be much different in Java. 
the method names are the same.

Andreas

Peppe wrote:

>Hi, when i click on a shape, in my jsvgcanvas, i would that a outlined
>perimeter around the shape is visualized and cursor is set to "move"....how
>can i do this?    
>  
>


-- 
----------------------------------------------
Andreas Neumann
Institute of Cartography
ETH Zurich
Wolfgang-Paulistrasse 15
CH-8093  Zurich, Switzerland

Phone: ++41-44-633 3031, Fax: ++41-44-633 1153
e-mail: neumann@karto.baug.ethz.ch
www: http://www.carto.net/neumann/
SVG.Open: http://www.svgopen.org/
Carto.net: http://www.carto.net/


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