[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r3464: Make the "Zoom to Fit" button work again, but with a slightl (vidalia/branches/marble/src/vidalia/network)



Author: edmanm
Date: 2009-01-19 19:54:44 -0500 (Mon, 19 Jan 2009)
New Revision: 3464

Modified:
   vidalia/branches/marble/src/vidalia/network/tormapwidget.cpp
   vidalia/branches/marble/src/vidalia/network/tormapwidget.h
Log:
Make the "Zoom to Fit" button work again, but with a slightly different
meaning.


Modified: vidalia/branches/marble/src/vidalia/network/tormapwidget.cpp
===================================================================
--- vidalia/branches/marble/src/vidalia/network/tormapwidget.cpp	2009-01-19 07:44:02 UTC (rev 3463)
+++ vidalia/branches/marble/src/vidalia/network/tormapwidget.cpp	2009-01-20 00:54:44 UTC (rev 3464)
@@ -208,27 +208,19 @@
   repaint();
 }
  
-/** Zooms to fit all currently displayed circuits on the map. If there are no
- * circuits on the map, the viewport will be returned to its default position
- * (zoomed all the way out and centered). */
+/** Zooms the map to fit entirely within the constraints of the current
+ * viewport size. */
 void
 TorMapWidget::zoomToFit()
 {
-#if 0
-  QRectF rect = circuitBoundingBox();
-  
-  if (rect.isNull()) {
-    /* If there are no circuits, zoom all the way out */
-    resetZoomPoint();
-    zoom(0.0);
-  } else {
-    /* Zoom in on the displayed circuits */
-    float zoomLevel = 1.0 - qMax(rect.height()/float(MAP_HEIGHT),
-                                 rect.width()/float(MAP_WIDTH));
-    
-    zoom(rect.center().toPoint(), zoomLevel+0.2);
-  }
-#endif
+  int width  = size().width();
+  int height = size().height();
+
+  setRadius(qMin(width, height) / 2);
+
+  /* XXX: Calling setRadius() seems to cause Marble to no longer draw the
+   *      atmosphere. So, re-enable it. */
+  setShowAtmosphere(true);
 }
 
 /** Zoom to the circuit on the map with the given <b>circid</b>. */

Modified: vidalia/branches/marble/src/vidalia/network/tormapwidget.h
===================================================================
--- vidalia/branches/marble/src/vidalia/network/tormapwidget.h	2009-01-19 07:44:02 UTC (rev 3463)
+++ vidalia/branches/marble/src/vidalia/network/tormapwidget.h	2009-01-20 00:54:44 UTC (rev 3464)
@@ -59,7 +59,8 @@
   void deselectAll();
   /** Clears the known routers and removes all the data from the map */
   void clear();
-  /** Zooms to fit all currently displayed circuits on the map. */
+  /** Zooms the map to fit entirely within the constraints of the current
+   * viewport size. */
   void zoomToFit();
   /** Zoom to a particular router on the map. */
   void zoomToRouter(const QString &id);