[Uml-devel] kdesdk/umbrello/umbrello

Jonathan Riddell jri at jriddell.org
Tue Feb 4 11:26:04 UTC 2003


CVS commit by jriddell: 

improved canvas resizing.  Take into account the visible canvas area when
resizing


  M +15 -8     umlview.cpp   1.14


--- kdesdk/umbrello/umbrello/umlview.cpp  #1.13:1.14
@@ -2772,4 +2772,5 @@ void UMLView::setZoom(int zoom) {
 
         m_pData->setZoom( currentZoom() );
+        resizeCanvasToItems();
 }
 
@@ -2806,10 +2807,16 @@ void UMLView::resizeCanvasToItems() {
         int canvasHeight = canvasSize.bottom() + 5;
 
-        if ( canvasWidth < width() ) {
-                canvasWidth = width();
+        //Find out the bottom right visible pixel and size to at least that
+        int contentsX, contentsY;
+        int contentsWMX, contentsWMY;
+        viewportToContents(viewport()->width(), viewport()->height(), contentsX, contentsY);
+        inverseWorldMatrix().map(contentsX, contentsY, &contentsWMX, &contentsWMY);
+
+        if (canvasWidth < contentsWMX) {
+                canvasWidth = contentsWMX;
         }
 
-        if ( canvasHeight < height() ) {
-                canvasHeight = height();
+        if (canvasHeight < contentsWMY) {
+                canvasHeight = contentsWMY;
         }
 






More information about the umbrello-devel mailing list