[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.gef] Zest: Patch for method fishEye and wrong container size

I think the method fishEye(..) in class GraphNode computes a wrong container size. The calculation is based on a the font size. But few lines late the font size was changed. After that, the text is to big for the container.

Here is my patch:

### Eclipse Workspace Patch 1.0
#P org.eclipse.zest.core
Index: src/org/eclipse/zest/core/widgets/GraphNode.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphNode.java,v
retrieving revision 1.40
diff -u -r1.40 GraphNode.java
--- src/org/eclipse/zest/core/widgets/GraphNode.java 23 Apr 2009 02:41:22 -0000 1.40
+++ src/org/eclipse/zest/core/widgets/GraphNode.java 15 Sep 2009 14:02:38 -0000
@@ -678,6 +678,12 @@
private Font fishEyeFont = null;
private boolean isFisheyeEnabled;


+ /**
+ * @param enable
+ * @param animate
+ * @return
+ * FIXED 09.09.2009 - Reihenfolge des FontData Blocks im Quelltext getauscht.
+ */
protected IFigure fishEye(boolean enable, boolean animate) {
if (isDisposed) {
// If a fisheyed figure is still left on the canvas, we could get
@@ -695,6 +701,12 @@
// Get the current Bounds
Rectangle rectangle = nodeFigure.getBounds().getCopy();


+ // Hier eingefügt
+ FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0];
+// fontData.height = 12;
+ fishEyeFont = new Font(Display.getCurrent(), fontData);
+ fishEyeFigure.setFont(fishEyeFont);
+
// Calculate how much we have to expand the current bounds to get to the new bounds
Dimension newSize = fishEyeFigure.getPreferredSize();
Rectangle currentSize = rectangle.getCopy();
@@ -708,10 +720,7 @@
return null;
}


- FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0];
- fontData.height = 12;
- fishEyeFont = new Font(Display.getCurrent(), fontData);
- fishEyeFigure.setFont(fishEyeFont);
+ // Hier entfernt


//Add the fisheye
this.getGraphModel().fishEye(nodeFigure, fishEyeFigure, rectangle, true);