svn commit: r19202 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/DnDJGraph.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2011-04-08 10:28:48-0700
New Revision: 19202

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/DnDJGraph.java

Log:
Adjust drop position by zoom scale

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/DnDJGraph.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/DnDJGraph.java?view=diff&pathrev=19202&r1=19201&r2=19202
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/DnDJGraph.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/DnDJGraph.java	2011-04-08 10:28:48-0700
@@ -213,11 +213,18 @@
             final MutableGraphModel gm =
                 (MutableGraphModel) diagram.getGraphModel();
             final Point point = dropTargetDropEvent.getLocation();
+            final double scale = editor.getScale();
             
             int dx = getViewPosition().x;
             int dy = getViewPosition().y;
             point.translate(dx, dy);
             
+            double xp = point.getX();
+            double yp = point.getY();
+            point.translate(
+                    (int) Math.round((xp / scale) - point.x),
+                    (int) Math.round((yp / scale) - point.y));
+
             //get the model elements that are being transfered.
             Collection modelElements =
                 (Collection) tr.getTransferData(
@@ -244,9 +251,9 @@
 
             dropTargetDropEvent.getDropTargetContext().dropComplete(true);
         } catch (UnsupportedFlavorException e) {
-            LOG.debug("Exception caught", e);
+            LOG.error("Exception caught", e);
         } catch (IOException e) {
-            LOG.debug("Exception caught", e);
+            LOG.error("Exception caught", e);
         }
     }

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2718165

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.