[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/kgeography
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2005-01-03 23:04:34
Message-ID: 20050103230434.0FF561CDDE () office ! kde ! org
[Download RAW message or body]

CVS commit by aacid: 

Fix map dragging when zoomed


  M +3 -0      Changelog   1.30
  M +1 -1      data/Makefile.am   1.9
  M +17 -4     src/mapwidget.cpp   1.15


--- kdenonbeta/kgeography/Changelog  #1.29:1.30
@@ -1,2 +1,5 @@
+2005-01-03 René Martín Rodríguez <agarfu@gulic.org>
+        * Fix map dragging when zoomed
+
 2004-12-28 Albert Astals Cid <tsdgeos@terra.es>
         * Add Norway map

--- kdenonbeta/kgeography/data/Makefile.am  #1.8:1.9
@@ -6,3 +6,3 @@
                   germany.kgm ncamerica.kgm southamerica.kgm spain.kgm usa.kgm \
                   italy.png italy.kgm poland.kgm poland.png austria.kgm austria.png \
                \
-                  norway.kgm norway.png
+                  norway.kgm norway.png 

--- kdenonbeta/kgeography/src/mapwidget.cpp  #1.14:1.15
@@ -129,4 +129,6 @@ void mapWidget::mouseMoveEvent(QMouseEve
         {
                 int oW, oH;
+                int auxX, auxY;
+                bool updatePos = false;
                 
                 // some shortcuts :-D 
@@ -135,6 +137,17 @@ void mapWidget::mouseMoveEvent(QMouseEve
                 
                 // where next x and y will be 
-                p_zoomX += (p_initial.x() - e -> pos().x());
-                p_zoomY += (p_initial.y() - e -> pos().y());
+                auxX = (int) ((p_initial.x() - e -> pos().x()) * p_lastFactorX);
+                if (abs(auxX) > 0)
+                {
+                        p_zoomX += auxX;
+                        updatePos = true;
+                }
+                
+                auxY = (int) ((p_initial.y() - e -> pos().y()) * p_lastFactorY);
+                if (abs(auxY) > 0)
+                {
+                        p_zoomY += auxY;
+                        updatePos = true;
+                }
                 
                 // make sure we don't go out of bounds
@@ -144,5 +157,5 @@ void mapWidget::mouseMoveEvent(QMouseEve
                 if (p_zoomY > oH - height() * p_lastFactorY) p_zoomY = (int)rint(oH \
- height() * p_lastFactorY);  
-                p_initial = e -> pos();
+                if (updatePos) p_initial = e -> pos();
                 
                 updateShownImage();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic