Merge pull request #601 from capilkey/misc-layout-fixes

made a bunch of layout changes, still doesn't work 100% correct
This commit is contained in:
Richard Alam 2015-04-08 16:54:55 -04:00
commit 8199bed31d
3 changed files with 23 additions and 90 deletions

View File

@ -71,17 +71,6 @@ package org.bigbluebutton.modules.layout.managers
private var _layoutModel:LayoutModel = LayoutModel.getInstance();
/**
* If (sync) affects viewers only.
*/
private var _viewersOnly:Boolean = false;
/**
* If we sync automatically with other users while the action (move, resize) is done on the
* window.
*/
private var _autoSync:Boolean = false;
private var _eventsToDelay:Array = new Array(MDIManagerEvent.WINDOW_RESTORE,
MDIManagerEvent.WINDOW_MINIMIZE,
MDIManagerEvent.WINDOW_MAXIMIZE);
@ -95,9 +84,7 @@ package org.bigbluebutton.modules.layout.managers
});
_sendCurrentLayoutUpdateTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
//trace(LOG + "Applying layout due to window resize");
if (_autoSync)
//trace(LOG + "Applying layout on autoSync");
sendLayoutUpdate(updateCurrentLayout(_currentLayout));
sendLayoutUpdate(updateCurrentLayout(null));
});
}
@ -315,22 +302,20 @@ package org.bigbluebutton.modules.layout.managers
_applyCurrentLayoutTimer.start();
}
private function onActionOverWindowFinished(e:MDIManagerEvent):void {
private function onActionOverWindowFinished(e:MDIManagerEvent):void {
if (LayoutDefinition.ignoreWindow(e.window))
return;
checkPermissionsOverWindow(e.window);
//trace(LOG + "Window is being resized. Event=[" + e.type + "]");
updateCurrentLayout(_currentLayout);
/*
* some events related to animated actions must be delayed because if it's not, the
* current layout doesn't get properly updated
*/
if (_eventsToDelay.indexOf(e.type) != -1) {
_sendCurrentLayoutUpdateTimer.reset();
_sendCurrentLayoutUpdateTimer.start();
}
}
//updateCurrentLayout(null);
/*
* All events must be delayed because the window doesn't actually
* change size until after the animation has finished.
*/
_sendCurrentLayoutUpdateTimer.reset();
_sendCurrentLayoutUpdateTimer.start();
}
private function updateCurrentLayout(layout:LayoutDefinition):LayoutDefinition {
//trace(LOG + "updateCurrentLayout");

View File

@ -16,13 +16,16 @@
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.modules.layout.model {
package org.bigbluebutton.modules.layout.model {
public class LayoutDefinition {
import flash.utils.Dictionary;
import flash.utils.getQualifiedClassName;
import flexlib.mdi.containers.MDICanvas;
import flexlib.mdi.containers.MDIWindow;
import flexlib.mdi.containers.MDIWindow;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.common.Role;
import org.bigbluebutton.core.managers.UserManager;
@ -126,62 +129,9 @@ package org.bigbluebutton.modules.layout.model {
return xml;
}
/*
* 0 if there's no order
* 1 if "a" should appears after "b"
* -1 if "a" should appears before "b"
*/
private function sortWindows(a:Object, b:Object):int {
// ignored windows are positioned in front
if (a.ignored && b.ignored) return 0;
if (a.ignored) return 1;
if (b.ignored) return -1;
// then comes the windows that has no layout definition
if (!a.hasLayoutDefinition && !b.hasLayoutDefinition) return 0;
if (!a.hasLayoutDefinition) return 1;
if (!b.hasLayoutDefinition) return -1;
// then the focus order is used to sort
if (a.order == b.order) return 0;
if (a.order == -1) return 1;
if (b.order == -1) return -1;
return (a.order < b.order? 1: -1);
}
private function adjustWindowsOrder(canvas:MDICanvas):void {
var orderedList:Array = new Array();
var type:String;
var order:int;
var ignored:Boolean;
var hasLayoutDefinition:Boolean;
// LogUtil.debug("=> Before sort");
for each (var window:MDIWindow in canvas.windowManager.windowList) {
type = WindowLayout.getType(window);
hasLayoutDefinition = myLayout.hasOwnProperty(type);
if (hasLayoutDefinition)
order = myLayout[type].order;
else
order = -1;
ignored = ignoreWindowByType(type);
var item:Object = { window:window, order:order, type:type, ignored:ignored, hasLayoutDefinition:hasLayoutDefinition };
orderedList.push(item);
// LogUtil.debug("===> type: " + item.type + " ignored? " + item.ignored + " hasLayoutDefinition? " + item.hasLayoutDefinition + " order? " + item.order);
}
orderedList.sort(this.sortWindows);
// LogUtil.debug("=> After sort");
for each (var obj:Object in orderedList) {
// LogUtil.debug("===> type: " + obj.type + " ignored? " + obj.ignored + " hasLayoutDefinition? " + obj.hasLayoutDefinition + " order? " + obj.order);
if (!obj.ignored)
OrderManager.getInstance().bringToFront(obj.window);
canvas.windowManager.bringToFront(obj.window);
}
}
public function applyToCanvas(canvas:MDICanvas):void {
if (canvas == null)
return;
adjustWindowsOrder(canvas);
var windows:Array = canvas.windowManager.windowList;
// LogUtil.traceObject(myLayout);
@ -189,14 +139,14 @@ package org.bigbluebutton.modules.layout.model {
var type:String;
for each (var window:MDIWindow in windows) {
type = WindowLayout.getType(window);
//trace(LOG + "Determine if we need to apply layout [" + name + "] for window [" + type + "]");
type = WindowLayout.getType(window);
//trace(LOG + "Determine if we need to apply layout [" + name + "] for window [" + type + "]");
if (!ignoreWindowByType(type)) {
//trace(LOG + "Applying layout [" + name + "] to window [" + type + "]");
//trace(LOG + "Applying layout [" + name + "] to window [" + type + "]");
WindowLayout.setLayout(canvas, window, transformedLayout[type]);
} else {
//trace(LOG + "Ignoring layout [" + name + "] to window [" + type + "]");
}
} else {
//trace(LOG + "Ignoring layout [" + name + "] to window [" + type + "]");
}
}
}

View File

@ -30,7 +30,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
showCloseButton="false" layout="absolute"
verticalScrollPolicy="off"
horizontalScrollPolicy="off"
showControls="true" resize="maximizeHandler()"
showControls="true" resize="resizeHandler()"
styleNameFocus="presentationWindowStyleFocus"
styleNameNoFocus="presentationWindowStyleNoFocus"
implements="org.bigbluebutton.common.IBbbModuleWindow"
@ -239,11 +239,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
focusManager.setFocus(titleBarOverlay);
}
private function maximizeHandler():void {
private function resizeHandler():void {
// When the window is maximized, we want to resize the slide maintaining the aspect ratio.
fitSlideToWindowMaintainingAspectRatio();
//Remove focus from the maximize button in case the user presses the space bar, the window doesn't get maximized again.
stage.focus = this;
}
private function onResizeEndEvent(event:MDIWindowEvent):void {