Author: oriol
Date: 2012-03-19 05:08:55 -0700 (Mon, 19 Mar 2012)
New Revision: 28572

Modified:
   
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
Log:
Fix bug #729. Set correctly visual properties for image size by checking when 
updating view if width and height has changed 

Modified: 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
     2012-03-17 00:07:37 UTC (rev 28571)
+++ 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
     2012-03-19 12:08:55 UTC (rev 28572)
@@ -287,6 +287,16 @@
         * Ref to foreground canvas object.
         */
        ArbitraryGraphicsCanvas m_foregroundCanvas;
+       
+       /**
+        * Current image width
+        */
+       int imageWidth = 0;
+       
+       /**
+        * Current image Height
+        */
+       int imageHeight = 0;
 
        /**
         *
@@ -1143,7 +1153,16 @@
                final long start = System.currentTimeMillis();
                cyEventHelper.flushPayloadEvents();
                m_networkCanvas.repaint();
-               logger.debug("Repaint finised in " + 
(System.currentTimeMillis() - start) + " msec.");
+               
+               //Check if image size has changed if so, visual property needs 
to be changed as well
+               if( m_networkCanvas.getWidth() != imageWidth || 
m_networkCanvas.getHeight() != imageHeight)
+               {
+                       imageWidth = m_networkCanvas.getWidth();
+                       imageHeight = m_networkCanvas.getHeight();
+                       
setVisualProperty(BasicVisualLexicon.NETWORK_WIDTH,(double)imageWidth);
+                       
setVisualProperty(BasicVisualLexicon.NETWORK_HEIGHT,(double)imageHeight);
+               }
+               logger.debug("Repaint finished in " + 
(System.currentTimeMillis() - start) + " msec.");
        }
 
        /**

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to