| 
     
      
      
      From: <fle...@us...> - 2007-02-17 18:14:13
      
     
   | 
Revision: 547
          http://svn.sourceforge.net/magicmap/?rev=547&view=rev
Author:   flederohr
Date:     2007-02-17 10:13:50 -0800 (Sat, 17 Feb 2007)
Log Message:
-----------
fixed annoying behavior (displacement when scrolling) of right click menu in MapView
Modified Paths:
--------------
    trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java	2007-02-17 14:11:46 UTC (rev 546)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java	2007-02-17 18:13:50 UTC (rev 547)
@@ -501,14 +501,17 @@
         return node;
     }
 
+    @Override
     public int getMapOffsetX(){
-        int ox = (getWidth() - graphdraw.getWidth()) / 2;
-        return (ox >= 0 ? ox : 0);
+        if (getWidth() > graphdraw.getWidth()) return (getWidth() - graphdraw.getWidth()) / 2;
+        return -((JScrollPane) this.getContent()).getViewport().getViewPosition().x;
+
     }
 
+    @Override
     public int getMapOffsetY(){
-        int oy = (getHeight() - graphdraw.getHeight()) / 2;
-        return (oy >= 0 ? oy : 0);
+        if (getHeight() > graphdraw.getHeight()) return (getHeight() - graphdraw.getHeight()) / 2;
+        return -((JScrollPane) this.getContent()).getViewport().getViewPosition().y;
     }
 
     /*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |