Author: [EMAIL PROTECTED]
Date: Wed Sep 3 12:34:40 2008
New Revision: 2688
Modified:
trunk/src/ca/sqlpower/architect/swingui/PlayPen.java
trunk/src/ca/sqlpower/architect/swingui/olap/UsageComponentUI.java
Log:
Increased the width and height by 1 when checking against clipping regions
as vertical and horizontal lines have no width or height.
Also return the x position if we are diving by 0 in the usage component to
prevent connection circles from disappearing.
Modified: trunk/src/ca/sqlpower/architect/swingui/PlayPen.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/PlayPen.java (original)
+++ trunk/src/ca/sqlpower/architect/swingui/PlayPen.java Wed Sep 3
12:34:40 2008
@@ -994,13 +994,16 @@
for (int i = contentPane.getComponentCount() - 1; i >= 0; i--) {
PlayPenComponent c = contentPane.getComponent(i);
c.getBounds(bounds);
- if ( g2.hitClip(bounds.x, bounds.y, bounds.width,
bounds.height)) {
+ //expanding width and height by 1 as lines have 0 width or height when
vertical/horizontal
+ if ( g2.hitClip(bounds.x, bounds.y, bounds.width + 1, bounds.height +
1)) {
if (logger.isDebugEnabled()) logger.debug("Painting visible
component "+c); //$NON-NLS-1$
g2.translate(c.getLocation().x,
c.getLocation().y);
c.paint(g2);
g2.setTransform(zoomedOrigin);
} else {
if (logger.isDebugEnabled()) logger.debug("paint: SKIPPING "+c);
//$NON-NLS-1$
+ logger.debug(" skipped bounds are: x=" + bounds.x + " y=" + bounds.y
+ " width=" + bounds.width + " height=" + bounds.height);
+ logger.debug(" clipping rectangle: x=" + g2.getClipBounds().x + " y="
+ g2.getClipBounds().y + " width=" + g2.getClipBounds().width + " height="
+ g2.getClipBounds().height);
}
}
Modified: trunk/src/ca/sqlpower/architect/swingui/olap/UsageComponentUI.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/olap/UsageComponentUI.java
(original)
+++ trunk/src/ca/sqlpower/architect/swingui/olap/UsageComponentUI.java Wed
Sep 3 12:34:40 2008
@@ -227,6 +227,10 @@
* @return The x coordinate of the line at y
*/
public static int x(Point2D p1, Point2D p2, double y) {
+ if (p2.getX() == p1.getX()) {
+ return (int) p2.getX();
+ }
+
double m1 = (p2.getY() - p1.getY()) / (p2.getX() - p1.getX());
double a = -m1 * p1.getX() + p1.getY();