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 Chandra Srinivasan <ch...@infowayconsulting.net> on 2004/12/29 04:26:50 UTC

disable scripting on svg file

Hi

Iam writing an app wherein i drag and drop elements within 
JSVGCanvas object. While dragging the element (which is an 
image icon) I want to change the cursor shape to be that of 
the image. I did that by doing svgCanvas.setCursor
(customCursor). but when i start moving the mouse the cursor 
reverts back to default. I fixed it by setting pointer-
events attribute to "none" on the svg root element. but 
again if child elements had mouseover or any other script 
functon calls then the cursor was getting reset. 

I found in the archives that Thomas had suggested using 
CursorManager class to set the DEFAULT_CURSOR. I tried 
extending CursorManager and added get/set method but I am 
struck as to how to update the CursorManager the proper way!!
any ideas/code snippet?
or is there a way i can disable scripting on the svg 
document before doing the drap and drop and later enable 
scripting 
after the drop.

Thanks in advance for your help
Chandra

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


Re: disable scripting on svg file

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Chandra & Tonny,

Tonny Kohar wrote:

>> or is there a way i can disable scripting on the svg 
>> document before doing the drap and drop and later enable 
>> scripting after the drop.
> 
> I am not sure if this work, but you can set the
> JSVGCanvas.setDocumentState() to ALWAYS_DYNAMIC, STATIC, DYNAMIC.

    This will turn off scripting for then entire document permanently
(and must be done before the document is associated with the canvas).

    What you could do is suspend the UpdateManager.  The only problem
is that this will turn off _all_ scripting in the SVG (including
probably your Java Scripting that is doing the DnD operation).  So
this probably isn't what you want really.

    The next suggestion would be to add a 'glass pane' to the SVG
document to capture all mouse events.  This can be done by
adding a very large rectangle as the last element in the document
(document.getRootElement().appendchild(glassPane)).  This is a very
good technique for just moving elements around the canvas as it
solves the pointer falling off the element problem at the same
time.

    The only problem with this solution is if you need to know
what elements are 'under' the pointer (which is likely to be
needed for a Drag and Drop operation).  So, the other possible
solution would be to add an event listener to the root SVG element
on the 'capture' phase.  Then you can call 'stopPropagation'
on the DOMEvent object and thus keep the event from reaching any other
event listeners.

    I hope one of these helps you!

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


Re: disable scripting on svg file

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

> or is there a way i can disable scripting on the svg 
> document before doing the drap and drop and later enable 
> scripting 
> after the drop.

I am not sure if this work, but you can set the
JSVGCanvas.setDocumentState() to ALWAYS_DYNAMIC, STATIC, DYNAMIC.

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



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