if ((evt.BUTTON1_MASK & evt.getModifiers()) != 0)
button = 0;
else
if ((evt.BUTTON3_MASK & evt.getModifiers()) != 0)
button = 2;
MouseEvent mevent =
// DOM Level 2 6.5 cast from Document to DocumentEvent is ok
(MouseEvent)org.apache.batik.dom.events.EventSupport.
createEvent(org.apache.batik.dom.events.EventSupport.
MOUSE_EVENT_TYPE);
// deal with the related node/target
node = evt.getRelatedNode();
EventTarget relatedTarget =
(EventTarget)context.getElement(node);
mevent.initMouseEvent(eventType, true, cancelok, null,
evt.getClickCount(),
screen.x, screen.y,
(int)Math.floor(pos.getX()),
(int)Math.floor(pos.getY()),
evt.isControlDown(), evt.isAltDown(),