JAL-3451 JalviewJS embedded mode not resizing
[jalview.git] / src / jalview / gui / AlignFrame.java
index 0b84e9b..0271506 100644 (file)
@@ -3393,13 +3393,11 @@ public class AlignFrame extends GAlignFrame
     // undecorated overview with defined size
     frame.setName(Jalview.getAppID("overview"));
     //
-    Dimension dim = (Dimension) Platform.getEmbeddedAttribute(frame,
-            Platform.EMBEDDED_DIM);
+    Dimension dim = Platform.getDimIfEmbedded(frame, -1, -1);
     if (dim != null && dim.width == 0)
     {
       dim = null; // hidden, not embedded
     }
-
     OverviewPanel overview = new OverviewPanel(alignPanel, dim);
 
     frame.setContentPane(overview);
@@ -3778,7 +3776,8 @@ public class AlignFrame extends GAlignFrame
 
     frameTitle += this.title;
 
-    Desktop.addInternalFrame(tp, frameTitle, 600, 500);
+    Dimension dim = Platform.getDimIfEmbedded(tp, 600, 500);
+    Desktop.addInternalFrame(tp, frameTitle, dim.width, dim.height);
   }
 
   /**
@@ -4130,15 +4129,24 @@ public class AlignFrame extends GAlignFrame
       if (nf.getTree() != null)
       {
         tp = new TreePanel(alignPanel, nf, treeTitle, input);
-
-        tp.setSize(w, h);
+        Dimension dim = Platform.getDimIfEmbedded(tp, -1, -1);
+        if (dim == null)
+        {
+          dim = new Dimension(w, h);
+        }
+        else
+        {
+          // no offset, either
+          x = 0;
+        }
+        tp.setSize(dim.width, dim.height);
 
         if (x > 0 && y > 0)
         {
           tp.setLocation(x, y);
         }
 
-        Desktop.addInternalFrame(tp, treeTitle, w, h);
+        Desktop.addInternalFrame(tp, treeTitle, dim.width, dim.height);
       }
     } catch (Exception ex)
     {