Hi,
There currently seems to be no way to replace the "default" cursor in the canvas; it can be replaced temporarily via UserAgent.setSVGCursor(), but the BridgeContext will replace it when the mouse crosses another SVG element. Some discussion of this can be found in this thread:
http://koala.ilog.fr/batik/mlists/batik-users/archives/msg05498.html
I've included a patch below that allows the user to (re)define the cursor mappings in CursorManager. Also since BridgeContext was hardcoded to use the constants in CursorManager, there is a small modification for that class as well.
Thomas, would you consider accepting this patch? I think I have followed the "spirit" of the current sources with this patch, but if not, of course feel free to make whatever changes you see fit.
Thanks.
Index: BridgeContext.java =================================================================== RCS file: /home/cvspublic/xml-batik/sources/org/apache/batik/bridge/BridgeContext.java,v retrieving revision 1.80 diff -u -r1.80 BridgeContext.java --- BridgeContext.java 15 Dec 2004 10:50:29 -0000 1.80 +++ BridgeContext.java 6 Feb 2005 22:50:00 -0000 @@ -1178,12 +1178,12 @@ public void handleEvent(Event evt) { MouseEvent me = (MouseEvent)evt; Element newTarget = (Element)me.getRelatedTarget(); - Cursor cursor = CursorManager.DEFAULT_CURSOR; + Cursor cursor = null; if (newTarget != null) cursor = CSSUtilities.convertCursor (newTarget, BridgeContext.this); - if (cursor == null) - cursor = CursorManager.DEFAULT_CURSOR; + if (cursor == null) + cursor = cursorManager.getPredefinedCursor(SVGConstants.SVG_DEFAULT_VALUE);
userAgent.setSVGCursor(cursor); } Index: CursorManager.java =================================================================== RCS file: /home/cvspublic/xml-batik/sources/org/apache/batik/bridge/CursorManager.java,v retrieving revision 1.13 diff -u -r1.13 CursorManager.java --- CursorManager.java 20 Aug 2004 19:29:46 -0000 1.13 +++ CursorManager.java 6 Feb 2005 22:50:01 -0000 @@ -158,6 +158,14 @@ return (Cursor)cursorMap.get(cursorName); } + /** + * Define (or replace) the named cursor. To replace the "default" + * cursor, use SVG_DEFAULT_VALUE as the cursorName. + */ + public void defineCursor(String cursorName, Cursor c) { + cursorMap.put(cursorName, c); + } + /** * Returns the Cursor corresponding to the input element's cursor property *
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]