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 Patrick Egan <pa...@greshamticket.com> on 2006/01/30 10:02:54 UTC

DOM level 3 MouseEvent

Hello,
I am using code from trunk.
Neither getAltKey or getModifierState seem to work with DOM level 3 
MouseEvent.
Regards,
Patrick


Important - This e-mail and the information that it contains may be
confidential, legally privileged and protected by law.  Access by the
intended recipient only is authorised.  Any liability (in negligence or
otherwise) arising from any third party acting, or refraining from acting,
on any information contained in this e-mail is hereby excluded.  If you are
not the intended recipient, please notify the sender immediately and do not
disclose the contents to any other person, use it for any purpose, or store
or copy the information in any medium.  Copyright in this e-mail and
attachments created by us belongs to the author and
also asserts the right to be identified as such and object to any misuse.

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


AbstractImageZoomInteractor

Posted by Urs Reupke <ur...@gmx.net>.
Hello,
it seems to me that there is a small mistake in the 
AbstractImageZoomInteractor class:
The value dy is calculated, then modified to guarantee for a minimum 
value of |dy|>15.
There are two cases to this, dy less than 0 or dy greater than 0, 
however, in the former case dy is set to 15 instead of -15 if dy>-5 (and 
of course dy < 0.
To sum things up: I believe line 117 should read
	dy = (dy > -5) ?  -15 : dy - 10;
instead of
	dy = (dy > -5) ? 15 : dy - 10;

Regards
-Urs

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


Re: DOM level 3 MouseEvent

Posted by Cameron McCormack <ca...@aka.mcc.id.au>.
Hi Patrick.

Patrick Egan:
> Just tried the code in SVN and I still not able to detect the modifier
> keys.
>
>  I have tried both getAltKey() and casting to 
> org.apache.batik.dom.events.DOMMouseEvent to use getModifierState().

Here is some complete code that works for me, using Shift rather than
Alt.  (Alt clicking is captured by my window manager.)  Change the file
in the setURI call and let me know if it works.

  // t.java
  import org.apache.batik.swing.JSVGCanvas;
  import org.apache.batik.swing.gvt.GVTTreeRendererAdapter;
  import org.apache.batik.swing.gvt.GVTTreeRendererEvent;
  import org.apache.batik.dom.events.*;
  import javax.swing.*;
  import org.w3c.dom.*;
  import org.w3c.dom.events.*;
  
  public class t {
      public static void main(String[] args) {
          JFrame f = new JFrame();
          final JSVGCanvas s = new JSVGCanvas();
          s.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
          f.getContentPane().add(s);
          f.setSize(400, 400);
          s.setURI("file:/tmp/t/t.svg");
          f.show();
          s.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
              public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
                  Document d = s.getSVGDocument();
                  EventTarget c = (EventTarget) d.getElementById("c");
                  c.addEventListener("click", new L(), false);
              }
          });
      }
      protected static class L implements EventListener {
          public void handleEvent(Event evt) {
              DOMMouseEvent mevt = (DOMMouseEvent) evt;
              System.err.println("Shift: " + mevt.getShiftKey());
          }
      }
  }

-- 
 Cameron McCormack			ICQ: 26955922
 cam (at) mcc.id.au			MSN: cam (at) mcc.id.au
 http://mcc.id.au/			JBR: heycam (at) jabber.org

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


Re: DOM level 3 MouseEvent

Posted by Cameron McCormack <ca...@aka.mcc.id.au>.
Hi Patrick.

Patrick Egan:
> I am using code from trunk.
> Neither getAltKey or getModifierState seem to work with DOM level 3 
> MouseEvent.

This should be fixed in SVN now.

Thanks,

Cameron

-- 
 Cameron McCormack			ICQ: 26955922
 cam (at) mcc.id.au			MSN: cam (at) mcc.id.au
 http://mcc.id.au/			JBR: heycam (at) jabber.org

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