svn commit: r16666 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigTextGroup.java

Dave Thompson <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: dthompson
Date: 2009-01-20 12:29:46-0800
New Revision: 16666

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigTextGroup.java

Log:
Issue 5620: FigTextGroup now registers boolean mouse hits for anything within it's bounding rectangle rather than requiring the click point to exactly hit a sub fig.

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigTextGroup.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigTextGroup.java?view=diff&pathrev=16666&r1=16665&r2=16666
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigTextGroup.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigTextGroup.java	2009-01-20 12:29:46-0800
@@ -24,6 +24,7 @@
 
 package org.argouml.uml.diagram.ui;
 
+import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
@@ -209,4 +210,41 @@
         // necessary.
         me.consume();
     }
+    
+    /**
+     * Checks to see if the given click point (Rectangle) hits
+     * the FigTextGroup.
+     * This overrides the FigGroup implementation of hit where the hit 
+     * rectangle must hit a sub fig.
+     * Now, we count a hit if the user clicks anywhere within the outer 
+     * bounds of the FigTextGroup, see issue 5620.
+     * This method is important for registering double clicks to edit text 
+     * boxes in a FigTextGroup.
+     * @param r The hit rectangle.
+     * @return True if the given hit rectangle intersects or is contained by
+     * the outer limits of this FigTextGroup.
+     * @see org.tigris.gef.presentation.FigGroup#hit(java.awt.Rectangle)
+     */
+    public boolean hit(Rectangle r) {
+        return this.intersects(r);
+    }
+    
+    /** 
+     * Returns true if the bounds of the group contain the given point. 
+     * Used to check if a mouse click occurs within the FigTextGroup.
+     * Overrides the FigGroup implementation of contains where the
+     * x, y point must hit a sub fig.
+     * Now we count a hit if the user clicks anywhere within the outer
+     * bounds of the FigTextGroup, see issue 5620.
+     * This method is important for handling mousePressed events including
+     * the start of mouse drags.
+     * @param x The x coordinate of the point to test.
+     * @param y The y coordinate of the point to test.
+     * @return True if the given point is within the outer limits of this
+     * FigTextGroup.
+     * @see org.tigris.gef.presentation.FigGroup#contains(int, int)
+     */
+    public boolean contains(int x, int y) {
+        return (_x <= x) && (x <= _x + _w) && (_y <= y) && (y <= _y + _h);
+    }
 }

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1039018

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.