You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by hi...@apache.org on 2001/03/15 15:11:19 UTC

cvs commit: xml-batik/sources/org/apache/batik/swing/gvt AbstractZoomInteractor.java TextSelectionManager.java

hillion     01/03/15 06:11:19

  Modified:    sources/org/apache/batik/swing/gvt
                        AbstractZoomInteractor.java
                        TextSelectionManager.java
  Log:
  - fixed the zoom behavior,
  - clicking on non-selectable shapes clear the selection.
  
  Revision  Changes    Path
  1.2       +15 -3     xml-batik/sources/org/apache/batik/swing/gvt/AbstractZoomInteractor.java
  
  Index: AbstractZoomInteractor.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/gvt/AbstractZoomInteractor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractZoomInteractor.java	2001/03/08 01:21:07	1.1
  +++ AbstractZoomInteractor.java	2001/03/15 14:11:17	1.2
  @@ -27,7 +27,7 @@
    * InteractorAdapter#startInteraction(InputEvent)} method.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: AbstractZoomInteractor.java,v 1.1 2001/03/08 01:21:07 hillion Exp $
  + * @version $Id: AbstractZoomInteractor.java,v 1.2 2001/03/15 14:11:17 hillion Exp $
    */
   public class AbstractZoomInteractor extends InteractorAdapter {
   
  @@ -132,11 +132,23 @@
           if ((xCurrent - xStart) != 0 &&
               (yCurrent - yStart) != 0) {
   
  +            int dx = xCurrent - xStart;
  +            int dy = yCurrent - yStart;
  +            
  +            if (dx < 0) {
  +                dx = -dx;
  +                xStart = xCurrent;
  +            }
  +            if (dy < 0) {
  +                dy = -dy;
  +                yStart = yCurrent;
  +            }
  +
               Dimension size = c.getSize();
   
               // Zoom factor
  -            float scaleX = size.width / (float)(xCurrent - xStart);
  -            float scaleY = size.height / (float)(yCurrent - yStart);
  +            float scaleX = size.width / (float)dx;
  +            float scaleY = size.height / (float)dy;
               float scale = (scaleX < scaleY) ? scaleX : scaleY;
           
               // Zoom translate
  
  
  
  1.2       +7 -1      xml-batik/sources/org/apache/batik/swing/gvt/TextSelectionManager.java
  
  Index: TextSelectionManager.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/gvt/TextSelectionManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TextSelectionManager.java	2001/03/08 01:21:08	1.1
  +++ TextSelectionManager.java	2001/03/15 14:11:17	1.2
  @@ -37,7 +37,7 @@
    * This class represents an object which manage GVT text nodes selection.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: TextSelectionManager.java,v 1.1 2001/03/08 01:21:08 hillion Exp $
  + * @version $Id: TextSelectionManager.java,v 1.2 2001/03/15 14:11:17 hillion Exp $
    */
   public class TextSelectionManager {
   
  @@ -123,6 +123,12 @@
           public void mousePressed(GraphicsNodeMouseEvent evt) {
               if (evt.getSource() instanceof Selectable) {
                   textSelector.mousePressed(evt);
  +            } else {
  +                if (selectionHighlight != null) {
  +                    Rectangle r = getHighlightBounds();
  +                    selectionHighlight = null;
  +                    component.paintImmediately(r);
  +                }
               }
           }
   
  
  
  

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