deweese     2003/03/24 16:31:22

  Modified:    sources/org/apache/batik/bridge BridgeEventSupport.java
               sources/org/apache/batik/gvt/event AWTEventDispatcher.java
                        GraphicsNodeMouseEvent.java
  Log:
  1) Fixed bug in text selection (corrected 'error' in
  GraphicsNodeMouseEvent introduced when adding currentScale/Translate
  support).
  
  Revision  Changes    Path
  1.46      +4 -20     
xml-batik/sources/org/apache/batik/bridge/BridgeEventSupport.java
  
  Index: BridgeEventSupport.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/bridge/BridgeEventSupport.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- BridgeEventSupport.java   14 Nov 2002 19:44:49 -0000      1.45
  +++ BridgeEventSupport.java   25 Mar 2003 00:31:22 -0000      1.46
  @@ -213,7 +213,7 @@
           }
   
           public void mouseExited(GraphicsNodeMouseEvent evt) {
  -            Point clientXY = getClientMouseLocation(evt.getPoint2D());
  +            Point clientXY = evt.getClientPoint();
               // Get the 'new' node for the DOM event.
               GraphicsNode node = evt.getRelatedNode();
               Element targetElement = getEventTarget(node, clientXY);
  @@ -232,7 +232,7 @@
           }
   
           public void mouseMoved(GraphicsNodeMouseEvent evt) {
  -            Point clientXY = getClientMouseLocation(evt.getPoint2D());
  +            Point clientXY = evt.getClientPoint();
               GraphicsNode node = evt.getGraphicsNode();
               Element targetElement = getEventTarget(node, clientXY);
               Element holdLTE = lastTargetElement;
  @@ -273,7 +273,7 @@
           protected void dispatchMouseEvent(String eventType,
                                             GraphicsNodeMouseEvent evt,
                                             boolean cancelable) {
  -            Point clientXY = getClientMouseLocation(evt.getPoint2D());
  +            Point clientXY = evt.getClientPoint();
               GraphicsNode node = evt.getGraphicsNode();
               Element targetElement = getEventTarget(node, clientXY);
               Element relatedElement = getRelatedElement(evt);
  @@ -375,22 +375,6 @@
                   button = 2;
               }
               return button;
  -        }
  -
  -        /**
  -         * Returns the client mouse coordinates using the specified
  -         * mouse coordinates in the GVT Tree space.
  -         *
  -         * @param coords the mouse coordinates in the GVT tree space
  -         */
  -        protected Point getClientMouseLocation(Point2D coords) {
  -            AffineTransform transform = ua.getTransform();
  -            Point2D p = coords;
  -            if (transform != null && !transform.isIdentity()) {
  -                p = transform.transform(coords, null);
  -            }
  -            return new Point((int)Math.floor(coords.getX()),
  -                             (int)Math.floor(coords.getY()));
           }
   
           /**
  
  
  
  1.12      +19 -9     
xml-batik/sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
  
  Index: AWTEventDispatcher.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/gvt/event/AWTEventDispatcher.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AWTEventDispatcher.java   24 Feb 2003 18:25:53 -0000      1.11
  +++ AWTEventDispatcher.java   25 Mar 2003 00:31:22 -0000      1.12
  @@ -350,6 +350,8 @@
           Point screenPos = evt.getComponent().getLocationOnScreen();
           screenPos.x += evt.getX();
           screenPos.y += evt.getY();
  +
  +
           if (lastHit != node) {
               // post an MOUSE_EXITED
               if (lastHit != null) {
  @@ -358,8 +360,10 @@
                                                       MOUSE_EXITED,
                                                       evt.getWhen(),
                                                       evt.getModifiers(),
  -                                                    (float)p.getX(),
  -                                                    (float)p.getY(),
  +                                                    (float)gnp.getX(),
  +                                                    (float)gnp.getY(),
  +                                                    (int)Math.floor(p.getX()),
  +                                                    (int)Math.floor(p.getY()),
                                                       screenPos.x,
                                                       screenPos.y,
                                                       evt.getClickCount(),
  @@ -375,8 +379,10 @@
                                                       evt.getWhen(),
                                                       evt.
                                                       getModifiers(),
  -                                                    (float)p.getX(),
  -                                                    (float)p.getY(),
  +                                                    (float)gnp.getX(),
  +                                                    (float)gnp.getY(),
  +                                                    (int)Math.floor(p.getX()),
  +                                                    (int)Math.floor(p.getY()),
                                                       screenPos.x,
                                                       screenPos.y,
                                                       evt.getClickCount(),
  @@ -391,8 +397,10 @@
                                                   evt.getID(),
                                                   evt.getWhen(),
                                                   evt.getModifiers(),
  -                                                (float)p.getX(),
  -                                                (float)p.getY(),
  +                                                (float)gnp.getX(),
  +                                                (float)gnp.getY(),
  +                                                (int)Math.floor(p.getX()),
  +                                                (int)Math.floor(p.getY()),
                                                   screenPos.x,
                                                   screenPos.y,
                                                   evt.getClickCount(),
  @@ -408,8 +416,10 @@
                                                   evt.getID(),
                                                   evt.getWhen(),
                                                   evt.getModifiers(),
  -                                                (float)p.getX(),
  -                                                (float)p.getY(),
  +                                                (float)gnp.getX(),
  +                                                (float)gnp.getY(),
  +                                                (int)Math.floor(p.getX()),
  +                                                (int)Math.floor(p.getY()),
                                                   screenPos.x,
                                                   screenPos.y,
                                                   evt.getClickCount(),
  
  
  
  1.7       +33 -1     
xml-batik/sources/org/apache/batik/gvt/event/GraphicsNodeMouseEvent.java
  
  Index: GraphicsNodeMouseEvent.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/gvt/event/GraphicsNodeMouseEvent.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- GraphicsNodeMouseEvent.java       12 Jun 2002 12:02:51 -0000      1.6
  +++ GraphicsNodeMouseEvent.java       25 Mar 2003 00:31:22 -0000      1.7
  @@ -83,6 +83,10 @@
        */
       float y;
   
  +    int clientX;
  +
  +    int clientY;
  +
       int screenX;
   
       int screenY;
  @@ -114,12 +118,15 @@
       public GraphicsNodeMouseEvent(GraphicsNode source, int id,
                                     long when, int modifiers,
                                     float x, float y, 
  +                                  int clientX, int clientY,
                                     int screenX, int screenY, 
                                     int clickCount,
                                     GraphicsNode relatedNode) {
           super(source, id, when, modifiers);
           this.x = x;
           this.y = y;
  +        this.clientX = clientX;
  +        this.clientY = clientY;
           this.screenX = screenX;
           this.screenY = screenY;
           this.clickCount = clickCount;
  @@ -158,6 +165,23 @@
   
       /**
        * Returns the horizontal x position of the event relative to the
  +     * source graphics node.
  +     * @return x a float indicating horizontal position relative to the node
  +     */
  +    public float getClientX() {
  +        return clientX;
  +    }
  +
  +    /**
  +     * Returns the vertical y position of the event relative to the source node.
  +     * @return y a float indicating vertical position relative to the node
  +     */
  +    public float getClientY() {
  +        return clientY;
  +    }
  +
  +    /**
  +     * Returns the horizontal x position of the event relative to the
        * screen.
        * @return x a float indicating horizontal position relative to the screen
        */
  @@ -179,6 +203,14 @@
        */
       public Point getScreenPoint() {
           return new Point(screenX, screenY);
  +    }
  +
  +    /**
  +     * Returns the (x, y) position of the event relative to the screen.
  +     * @return a Point object containing the x and y coordinates
  +     */
  +    public Point getClientPoint() {
  +        return new Point(clientX, clientY);
       }
   
       /**
  
  
  

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

Reply via email to