Author: ggrekhov
Date: Fri Aug 31 09:08:38 2012
New Revision: 1379375

URL: http://svn.apache.org/viewvc?rev=1379375&view=rev
Log:
Improve arrange functionality

Modified:
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/commonVideoViewContentSWF10.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/video/baseVideoObject.lzx

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/commonVideoViewContentSWF10.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/commonVideoViewContentSWF10.lzx?rev=1379375&r1=1379374&r2=1379375&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/commonVideoViewContentSWF10.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/commonVideoViewContentSWF10.lzx
 Fri Aug 31 09:08:38 2012
@@ -540,53 +540,60 @@
     </method>
      -->
 
-       <!-- works only for 1 or 2 windows -->
+       <!-- arranges video pods -->
        <method name="arrangeWindows">
        <![CDATA[
                if ($debug) Debug.write("arrangeWindows");
                var windowsList = this.subviews;
-               if (windowsList.length > 2 || 0 == windowsList.length) {
-                       if ($debug) Debug.write("arrangeWindows:: invalid 
windows count: ", windowsList);
-                       return;
+
+               if (0 == windowsList.length) {
+            return;
                }
-               
+
+        windowsList.sort(this.sortFunction);
+
                var offsetInPx = 40;
-               //calculate new sizes of every window
-               var windowWidth = canvas.width / windowsList.length - 
offsetInPx;
-               var windowHeight = canvas.height - offsetInPx;
-               if (windowHeight <= 0 || windowWidth <= 0) {
-                       if ($debug) Debug.write("arrangeWindows:: invalid 
dimentions: ", windowHeight, windowWidth);
-                       return;
-               }
-               
-               //calculate a new position of the first window
-               var xPos = offsetInPx / 2;
-               var yPos = offsetInPx / 2;
-               if (windowHeight > windowWidth) {
-                       yPos = (this.height / 2) - windowWidth/2;
-                       windowHeight = windowWidth;
-               } else {
-                       xPos = xPos + (windowWidth/2) - (windowHeight/2);
-                       windowWidth = windowHeight;
-               }
-               
-               // arrange windows with new positions and sizes
+               var initX = 20;
+               var initY = 20;
+               var xPos = initX;
+               var yPos = initY;
+               var rowHeight = windowsList[0].height;
+
+               // arrange windows with new positions
                for (var winIdx = 0; winIdx < windowsList.length; winIdx++) {
                        var window = windowsList[winIdx];
+                       if (canvas.width < xPos + window.width) {
+                yPos += rowHeight + offsetInPx;
+                xPos = initX;
+                rowHeight = window.height;
+                       }
+                       if (canvas.height < yPos) {
+                           initX += 10;
+                           initY += 10;
+                           xPos = initX;
+                           yPos = initY;
+                       }
                        window.setAttribute("x", xPos);
                        window.setAttribute("y", yPos);
-                       window.setAttribute("width", windowWidth);
-                       window.setAttribute("height", windowHeight);
-                       
-                       if (window.minimized) {
-                               window.setAttribute("initialHeight", 
windowHeight);
-                               window._toolbar._maximize2.onclick.sendEvent();
-                       }
-                       
-                       xPos = xPos + windowWidth + offsetInPx;
+                       window.bringToFront();
+
+                       xPos += window.width + offsetInPx;
                }
        ]]>
        </method>
+
+    <!-- @keyword private -->
+    <method name="sortFunction" args="el1, el2">
+        <![CDATA[
+            if (el1.height > el2.height) {
+                return -1;
+            } else if (el1.height < el2.height) {
+                return 1;
+            }
+            return 0;
+        ]]>
+    </method>
+
 </class>
 
 </library>

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/video/baseVideoObject.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/video/baseVideoObject.lzx?rev=1379375&r1=1379374&r2=1379375&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/video/baseVideoObject.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/video/baseVideoObject.lzx
 Fri Aug 31 09:08:38 2012
@@ -582,7 +582,7 @@
        </handler> 
     
     <dragstate name="dragger" />
-    <resizestatemin name="rs" resize_min_width="${70}" 
resize_min_height="${70}"/>
+    <resizestatemin name="rs" resize_min_width="70" resize_min_height="70"/>
     <dragHelper name="dragHelper"/>
     
     <animator name="_minimizeZoom" attribute="height" 


Reply via email to