Nacho Leon wrote:

I am writing a piece of software with batik that displays an svg image over a canvas. Over that image I add and remove elements adding xml elements.

I am trying now to program a "move element" part, changing the mouse pointer to a MOVE_CURSOR type and selecting a destination point for the object. But by default, when the mouse pointer moves over certain objects, it changes back. For example, when it moves over a text area, it changes to TEXT_CURSOR. I would like to preserve the MOVE_CURSOR type as long as it's needed.

There are many possible ways to do this. I think for your needs you can probably get the desired effect by simply setting the 'cursor' property on the root 'svg' element to 'move':

document.getRootElement().setAttribute("cursor", "move");

   Assuming you have not set the cursor property on other elements.
This will (until you unset the attribute) make the cursor for all
elements the 'move' cursor.

   Another possible solution is to turn off pointer-events for most
of the canvas (once again this can usually be accomplished by setting
pointer-events on the root element).

Another solution would be to introduce a 'glass pane' over the
entire canavs that handles the movement (by setting 'style="fill:none; stroke:none; pointer-events:fill' you can create an invisible
element that will receive events). The draw back of this is that
the target will always be your 'glass pane' - which might interfere
if you want to 'target' another element as the destination of your move.


I guess I will have to modify the default mouse actions on the svg canvas when it moves over certain kind of xml elements. I am pretty lost in the API trying to figure out how. Anyone can help?

I don't think you will need to go to this extent.





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to