Răsfoiți Sursa

resolved an issue that coused the right layouts to sissappear

Kolja Strohm 6 ani în urmă
părinte
comite
19bd014af0
3 a modificat fișierele cu 16 adăugiri și 6 ștergeri
  1. 6 1
      src/animation/PseudoCodeNode.java
  2. 4 4
      src/bk/Combine.java
  3. 6 1
      src/graph/LayeredNode.java

+ 6 - 1
src/animation/PseudoCodeNode.java

@@ -133,7 +133,12 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
                 {
                     bounds.height = (int) (tree.getVisibleRect().height - tree.getVisibleRect().getHeight() / 2);
                     bounds.x = 0;
-                    tree.scrollRectToVisible(bounds);
+                    SwingUtilities.invokeLater( new Runnable() {
+                        @Override
+                        public void run() {
+                            tree.scrollRectToVisible(bounds);
+                        }
+                    });
                 }
             }
             if( controller == null || controller.getStepOption() != 1 || breakPoint )

+ 4 - 4
src/bk/Combine.java

@@ -48,7 +48,7 @@ public class Combine {
                     if( graph.parent() == null )
                         graph.setColor( null, null );
                 });
-                return null;
+                return new ControlFlow( ControlFlow.STEP_OVER );
             }
         }));
         PseudoCodeNode firstLoop = new PseudoCodeNode( "foreach l in ['DOWN_RIGHT', 'DOWN_LEFT', 'UP_RIGHT', 'UP_LEFT'] do", vars, tree, new ForEachLoop<String>( "l" ) {
@@ -89,7 +89,7 @@ public class Combine {
             @Override
             public ControlFlow runForward(Memory m) {
                 String layout = m.read( "l", MemoryType.LOCAL );
-                m.declare( "height[" + layout + "]", m.<Integer>read( "max[" + layout + "]", MemoryType.LOCAL ) - m.<Integer>read( "min[" + layout + "]", MemoryType.LOCAL ), MemoryType.GLOBAL );
+                m.declare( "width[" + layout + "]", m.<Integer>read( "max[" + layout + "]", MemoryType.GLOBAL ) - m.<Integer>read( "min[" + layout + "]", MemoryType.GLOBAL ), MemoryType.GLOBAL );
                 actions.add( (Memory mem) -> {
                     mem.undeclare( "width[" + layout + "]", MemoryType.GLOBAL );
                 });
@@ -130,9 +130,9 @@ public class Combine {
                 String layout = m.read( "l", MemoryType.LOCAL );
                 String lMin = m.read( "l_min", MemoryType.LOCAL );
                 if( layout.contains( "RIGHT" ) )
-                    m.declare( "shift[" + layout + "]", m.<Integer>read( "min[" + lMin + "]", MemoryType.LOCAL ) - m.<Integer>read( "min[" + layout + "]", MemoryType.LOCAL ), MemoryType.GLOBAL );
+                    m.declare( "shift[" + layout + "]", m.<Integer>read( "min[" + lMin + "]", MemoryType.GLOBAL ) - m.<Integer>read( "min[" + layout + "]", MemoryType.GLOBAL ), MemoryType.GLOBAL );
                 else
-                    m.declare( "shift[" + layout + "]", m.<Integer>read( "max[" + lMin + "]", MemoryType.LOCAL ) - m.<Integer>read( "max[" + layout + "]", MemoryType.LOCAL ), MemoryType.GLOBAL );
+                    m.declare( "shift[" + layout + "]", m.<Integer>read( "max[" + lMin + "]", MemoryType.GLOBAL ) - m.<Integer>read( "max[" + layout + "]", MemoryType.GLOBAL ), MemoryType.GLOBAL );
                 actions.add( (Memory mem) -> {
                     mem.undeclare( "shift[" + layout + "]", MemoryType.GLOBAL );
                 });

+ 6 - 1
src/graph/LayeredNode.java

@@ -99,6 +99,7 @@ public class LayeredNode implements LayeredGraphNode {
         layouts = new LayoutInfo[ 4 ];
         for( int i = 0; i < 4; i++ )
             layouts[ i ] = new LayoutInfo();
+        int index = 0;
         for( LayoutInfo l : layouts )
         {
             if( original != null )
@@ -111,8 +112,12 @@ public class LayeredNode implements LayeredGraphNode {
             l.align = this;
             l.root = this;
             l.sink = this;
-            l.shift = Double.POSITIVE_INFINITY;
+            if( index == 0 || index == 2 )
+                l.shift = Double.POSITIVE_INFINITY;
+            else
+                l.shift = Double.NEGATIVE_INFINITY;
             l.xUndef = true;
+            index++;
         }
         dummy = false;
         combined = new CombinedLayoutInfo();