some other improvements on the resize window feature. still blinking sometimes
This commit is contained in:
parent
859176db78
commit
bcbb108536
@ -60,8 +60,13 @@
|
||||
private var _bResizePossible:Boolean = true;
|
||||
private var _nAspectRatio:Number = 1;
|
||||
|
||||
private var _nSavedVideoWidth:Number;
|
||||
private var _nSavedVideoHeight:Number;
|
||||
private var _minWidth:int = 166;
|
||||
private var _minHeight:int = 149;
|
||||
|
||||
private var _nSavedVideoWidth:Number = 0;
|
||||
private var _nSavedVideoHeight:Number = 0;
|
||||
private var _nOldWindowWidth:Number = 0;
|
||||
private var _nOldWindowHeight:Number = 0;
|
||||
|
||||
private function init():void{
|
||||
currentState = "dispVideoOptionsControlBar";
|
||||
@ -75,8 +80,8 @@
|
||||
addEventListener(MDIWindowEvent.MAXIMIZE, onMaximize);
|
||||
addEventListener(MDIWindowEvent.RESTORE, onRestore);
|
||||
|
||||
this.minWidth = 166;
|
||||
this.minHeight = 149;
|
||||
this.minWidth = _minWidth;
|
||||
this.minHeight = _minHeight;
|
||||
maximizeRestoreBtn.visible = false;
|
||||
this.resizable = false;
|
||||
}
|
||||
@ -191,7 +196,29 @@
|
||||
videoHolder.width = video.width;
|
||||
videoHolder.height = video.height;
|
||||
this.width = video.width + 6;
|
||||
this.height = video.height + 29;
|
||||
this.height = video.height + 29;
|
||||
|
||||
// prevent to show a video window bigger than the parent window
|
||||
if (this.width > this.parent.width) {
|
||||
video.width = this.parent.width - 6;
|
||||
video.height = Math.floor(video.width / _nAspectRatio);
|
||||
adjustWindowSize();
|
||||
}
|
||||
if (this.height > this.parent.height) {
|
||||
video.height = this.parent.height - 29;
|
||||
video.width = Math.floor(video.height * _nAspectRatio);
|
||||
adjustWindowSize();
|
||||
}
|
||||
if (this.width < _minWidth) {
|
||||
video.width = _minWidth - 6;
|
||||
video.height = Math.floor(video.width / _nAspectRatio);
|
||||
adjustWindowSize();
|
||||
}
|
||||
if (this.height < _minHeight) {
|
||||
video.height = _minHeight - 29;
|
||||
video.width = Math.floor(video.height * _nAspectRatio);
|
||||
adjustWindowSize();
|
||||
}
|
||||
}
|
||||
|
||||
public function onResizeEvent(event:MDIWindowEvent):void {
|
||||
@ -203,30 +230,29 @@
|
||||
_bResizePossible = true;
|
||||
}
|
||||
} else if (event.type == MDIWindowEvent.RESIZE_END) {
|
||||
if (this.width > this.parent.width) {
|
||||
this.width = this.parent.width;
|
||||
this.height = Math.floor((this.width - 6) / _nAspectRatio) + 29;
|
||||
}
|
||||
if (this.height > this.parent.height) {
|
||||
this.height = this.parent.height;
|
||||
this.width = (this.height - 29) * _nAspectRatio + 6;
|
||||
}
|
||||
|
||||
// make sure the size of the window is correct
|
||||
resizeWindow();
|
||||
adjustWindowSize();
|
||||
}
|
||||
}
|
||||
|
||||
private function resizeWindow():void {
|
||||
// recalc size of video based on the width and height of the window
|
||||
// make sure the video has a correct aspect ratio to avoid tall or flat faces
|
||||
private function resizeWindow():void {
|
||||
// prevent the window for blinking
|
||||
if (this.width == _nOldWindowWidth && this.height == _nOldWindowHeight) {
|
||||
adjustWindowSize();
|
||||
return;
|
||||
}
|
||||
|
||||
_nOldWindowWidth = this.width;
|
||||
_nOldWindowHeight = this.height;
|
||||
|
||||
if (this.width == video.width + 6) {
|
||||
// if it's a vertical resizing
|
||||
video.height = this.height - 29;
|
||||
video.width = video.height * _nAspectRatio;
|
||||
} else {
|
||||
// if it's a horizontal resizing
|
||||
video.width = this.width - 6;
|
||||
video.height = Math.floor (video.width / _nAspectRatio);
|
||||
}
|
||||
}
|
||||
adjustWindowSize();
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
creationComplete="init()"
|
||||
implements="org.bigbluebutton.common.IBbbModuleWindow"
|
||||
resizable="true" xmlns:mate="http://mate.asfusion.com/">
|
||||
xmlns:mate="http://mate.asfusion.com/">
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
@ -51,8 +51,14 @@
|
||||
|
||||
private var _bResizePossible:Boolean = true;
|
||||
private var _nAspectRatio:Number = 1;
|
||||
private var _nSavedVideoWidth:Number;
|
||||
private var _nSavedVideoHeight:Number;
|
||||
|
||||
private var _minWidth:int = 166;
|
||||
private var _minHeight:int = 149;
|
||||
|
||||
private var _nSavedVideoWidth:Number = 0;
|
||||
private var _nSavedVideoHeight:Number = 0;
|
||||
private var _nOldWindowWidth:Number = 0;
|
||||
private var _nOldWindowHeight:Number = 0;
|
||||
|
||||
private var _xPosition:int;
|
||||
private var _yPosition:int;
|
||||
@ -63,7 +69,7 @@
|
||||
videoHolder = new UIComponent();
|
||||
videoHolder.addChild(video);
|
||||
this.addChild(videoHolder);
|
||||
maximizeRestoreBtn.visible = true;
|
||||
|
||||
addEventListener(MDIWindowEvent.RESIZE_END, onResizeEvent);
|
||||
addEventListener(MDIWindowEvent.RESIZE, onResizeEvent);
|
||||
addEventListener(MDIWindowEvent.MAXIMIZE, onMaximize);
|
||||
@ -72,8 +78,8 @@
|
||||
|
||||
globalDispatcher = new Dispatcher();
|
||||
|
||||
this.minWidth = 166;
|
||||
this.minHeight = 149;
|
||||
this.minWidth = _minWidth;
|
||||
this.minHeight = _minHeight;
|
||||
maximizeRestoreBtn.visible = true;
|
||||
this.resizable = true;
|
||||
}
|
||||
@ -100,10 +106,10 @@
|
||||
video.height = this.height;
|
||||
video.attachNetStream(ns);
|
||||
ns.play(stream);
|
||||
this.stream = stream;
|
||||
|
||||
this.width = video.width + 6;
|
||||
this.height = video.height + 29;
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
private function setVideoResolution(stream:String):void{
|
||||
@ -164,7 +170,29 @@
|
||||
videoHolder.width = video.width;
|
||||
videoHolder.height = video.height;
|
||||
this.width = video.width + 6;
|
||||
this.height = video.height + 29;
|
||||
this.height = video.height + 29;
|
||||
|
||||
// prevent to show a video window bigger than the parent window
|
||||
if (this.width > this.parent.width) {
|
||||
video.width = this.parent.width - 6;
|
||||
video.height = Math.floor(video.width / _nAspectRatio);
|
||||
adjustWindowSize();
|
||||
}
|
||||
if (this.height > this.parent.height) {
|
||||
video.height = this.parent.height - 29;
|
||||
video.width = Math.floor(video.height * _nAspectRatio);
|
||||
adjustWindowSize();
|
||||
}
|
||||
if (this.width < _minWidth) {
|
||||
video.width = _minWidth - 6;
|
||||
video.height = Math.floor(video.width / _nAspectRatio);
|
||||
adjustWindowSize();
|
||||
}
|
||||
if (this.height < _minHeight) {
|
||||
video.height = _minHeight - 29;
|
||||
video.width = Math.floor(video.height * _nAspectRatio);
|
||||
adjustWindowSize();
|
||||
}
|
||||
}
|
||||
|
||||
public function onResizeEvent(event:MDIWindowEvent):void {
|
||||
@ -176,30 +204,30 @@
|
||||
_bResizePossible = true;
|
||||
}
|
||||
} else if (event.type == MDIWindowEvent.RESIZE_END) {
|
||||
if (this.width > this.parent.width) {
|
||||
this.width = this.parent.width;
|
||||
this.height = Math.floor((this.width - 6) / _nAspectRatio) + 29;
|
||||
}
|
||||
if (this.height > this.parent.height) {
|
||||
this.height = this.parent.height;
|
||||
this.width = (this.height - 29) * _nAspectRatio + 6;
|
||||
}
|
||||
|
||||
// make sure the size of the window is correct
|
||||
resizeWindow();
|
||||
adjustWindowSize();
|
||||
}
|
||||
}
|
||||
|
||||
private function resizeWindow():void {
|
||||
// recalc size of video based on the width and height of the window
|
||||
// make sure the video has a correct aspect ratio to avoid tall or flat faces
|
||||
private function resizeWindow():void {
|
||||
// prevent the window for blinking
|
||||
if (this.width == _nOldWindowWidth && this.height == _nOldWindowHeight) {
|
||||
adjustWindowSize();
|
||||
return;
|
||||
}
|
||||
|
||||
_nOldWindowWidth = this.width;
|
||||
_nOldWindowHeight = this.height;
|
||||
|
||||
if (this.width == video.width + 6) {
|
||||
// if it's a vertical resizing
|
||||
video.height = this.height - 29;
|
||||
video.width = video.height * _nAspectRatio;
|
||||
} else {
|
||||
// if it's a horizontal resizing
|
||||
video.width = this.width - 6;
|
||||
video.height = Math.floor (video.width / _nAspectRatio);
|
||||
}
|
||||
}
|
||||
|
||||
adjustWindowSize();
|
||||
}
|
||||
|
||||
@ -230,7 +258,7 @@
|
||||
video.height = _nSavedVideoHeight;
|
||||
adjustWindowSize();
|
||||
}
|
||||
|
||||
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user