All resize operations work as expected
The toggle button is still missplaced.
This commit is contained in:
parent
114fad22e6
commit
9e9bbfc72e
@ -1,105 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<mx:HBox xmlns="flexlib.containers.*"
|
||||
initialize="init()"
|
||||
xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
xmlns:mate="http://mate.asfusion.com/"
|
||||
creationComplete="onCreationComplete()"
|
||||
visible="{toolbarVisible}"
|
||||
styleName="whiteboardToolbarStyle"
|
||||
horizontalAlign="center"
|
||||
hideEffect="{fadeOut}" showEffect="{fadeIn}" >
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import mx.core.UIComponent;
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.modules.chat.events.ChatToolbarButtonEvent;
|
||||
import org.bigbluebutton.modules.chat.model.ChatOptions;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
|
||||
[Bindable] public var chatOptions:ChatOptions;
|
||||
[Bindable] private var baseIndex:int;
|
||||
[Bindable] private var toolbarVisible:Boolean = false;
|
||||
|
||||
private var mousedOver:Boolean = false;
|
||||
private var globalDispatcher:Dispatcher;
|
||||
private var _toolbarHideTimer:Timer;
|
||||
|
||||
public function init():void{
|
||||
chatOptions = new ChatOptions();
|
||||
baseIndex = chatOptions.baseTabIndex;
|
||||
|
||||
_toolbarHideTimer = new Timer(500, 1);
|
||||
_toolbarHideTimer.addEventListener(TimerEvent.TIMER, closeToolbar);
|
||||
}
|
||||
|
||||
private function onCreationComplete():void {
|
||||
globalDispatcher = new Dispatcher();
|
||||
this.addEventListener(MouseEvent.ROLL_OVER, handleMouseIn);
|
||||
this.addEventListener(MouseEvent.ROLL_OUT, handleMouseOut);
|
||||
}
|
||||
|
||||
private function checkVisibility():void {
|
||||
toolbarVisible = (toolbarAllowed() && mousedOver);
|
||||
}
|
||||
|
||||
public function closeToolbar(e:TimerEvent = null):void {
|
||||
mousedOver = false;
|
||||
checkVisibility();
|
||||
//parent.removeChild(this);
|
||||
}
|
||||
|
||||
private function handleMouseIn(e:MouseEvent = null):void {
|
||||
_toolbarHideTimer.reset();
|
||||
mousedOver = true;
|
||||
checkVisibility();
|
||||
}
|
||||
|
||||
private function handleMouseOut(e:MouseEvent = null):void {
|
||||
_toolbarHideTimer.reset();
|
||||
_toolbarHideTimer.start();
|
||||
}
|
||||
|
||||
private function toolbarAllowed():Boolean {
|
||||
// Created to make possible to create rules to allow or not the toolbar
|
||||
return true;
|
||||
}
|
||||
|
||||
public function sendSaveEvent():void{
|
||||
var saveEvent:ChatToolbarButtonEvent = new ChatToolbarButtonEvent(ChatToolbarButtonEvent.SAVE_CHAT_TOOLBAR_EVENT);
|
||||
globalDispatcher.dispatchEvent(saveEvent);
|
||||
}
|
||||
|
||||
public function sendCopyEvent():void{
|
||||
var copyEvent:ChatToolbarButtonEvent = new ChatToolbarButtonEvent(ChatToolbarButtonEvent.COPY_CHAT_TOOLBAR_EVENT);
|
||||
globalDispatcher.dispatchEvent(copyEvent);
|
||||
}
|
||||
|
||||
public function registerListeners(component:UIComponent):void {
|
||||
component.addEventListener(MouseEvent.ROLL_OVER, handleMouseIn);
|
||||
component.addEventListener(MouseEvent.ROLL_OUT, handleMouseOut);
|
||||
}
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
<mx:Fade id="fadeOut" duration="200" alphaFrom="1.0" alphaTo="0.0" />
|
||||
<mx:Fade id="fadeIn" duration="200" alphaFrom="0.0" alphaTo="1.0" />
|
||||
|
||||
<mx:Button id="saveBtn" label="{ResourceUtil.getInstance().getString('bbb.chat.saveBtn.label')}"
|
||||
styleName="chatToolbarSaveButtonStyle"
|
||||
toolTip="{ResourceUtil.getInstance().getString('bbb.chat.saveBtn.toolTip')}"
|
||||
click="sendSaveEvent()"
|
||||
tabIndex="{baseIndex+1}"
|
||||
accessibilityName="{ResourceUtil.getInstance().getString('bbb.chat.copyBtn.accessibilityName')}"/>
|
||||
|
||||
<mx:Button id="copyBtn" label="{ResourceUtil.getInstance().getString('bbb.chat.copyBtn.label')}"
|
||||
styleName="chatToolbarCopyButtonStyle"
|
||||
toolTip="{ResourceUtil.getInstance().getString('bbb.chat.copyBtn.toolTip')}"
|
||||
click="sendCopyEvent()"
|
||||
tabIndex="{baseIndex+2}"
|
||||
accessibilityName="{ResourceUtil.getInstance().getString('bbb.chat.copyBtn.accessibilityName')}"/>
|
||||
|
||||
</mx:HBox>
|
@ -74,5 +74,16 @@ package org.bigbluebutton.modules.deskshare.managers {
|
||||
|
||||
callback(externalWidth, externalHeight, internalWidthCandidate, internalHeightCandidate, internalOffsetX, internalOffsetY);
|
||||
}
|
||||
|
||||
public function onRepositionOnly(externalWidth:int, externalHeight:int, internalWidth:int, internalHeight:int, callback:Function):void {
|
||||
var internalOffsetX:int;
|
||||
var internalOffsetY:int;
|
||||
|
||||
// center the video in the window
|
||||
internalOffsetX = Math.floor ((externalWidth - internalWidth) / 2);
|
||||
internalOffsetY = Math.floor ((externalHeight - internalHeight) / 2);
|
||||
|
||||
callback(externalWidth, externalHeight, internalOffsetX, internalOffsetY);
|
||||
}
|
||||
}
|
||||
}
|
@ -72,6 +72,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private var videoHeight:Number;
|
||||
private var videoWidth:Number;
|
||||
|
||||
[Bindable]
|
||||
private var actualSize:Boolean = true;
|
||||
|
||||
// The following code block is to deal with a bug in FLexLib
|
||||
// with MDI windows not responding well to being maximized
|
||||
private var savedWindowWidth:Number;
|
||||
@ -90,7 +93,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function onCreationComplete():void{
|
||||
this.addChild(videoHolder);
|
||||
this.addChildAt(videoHolder, 0);
|
||||
videoHolder.percentWidth = 100;
|
||||
videoHolder.percentHeight = 100;
|
||||
addEventListener(MDIWindowEvent.RESIZE_START, onResizeStartEvent);
|
||||
@ -129,14 +132,19 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
return;
|
||||
}
|
||||
|
||||
resizer.onResize(this.width - horizontalBorder, this.height - verticalBorder, this.maximized, video.width, video.height, videoWidth / videoHeight, false, onResizeCallback);
|
||||
if(actualSize) {
|
||||
resizer.onRepositionOnly(this.width - horizontalBorder, this.height - verticalBorder, video.width, video.height, onRepositionOnlyCallback);
|
||||
}
|
||||
else {
|
||||
resizer.onResize(this.width - horizontalBorder, this.height - verticalBorder, this.maximized, video.width, video.height, videoWidth / videoHeight, false, onResizeCallback);
|
||||
}
|
||||
updateButtonPosition();
|
||||
}
|
||||
|
||||
private function updateButtonPosition():void {
|
||||
if(btnActualSize) {
|
||||
btnActualSize.x = this.width - btnActualSize.width - 10;
|
||||
btnActualSize.y = this.height - btnActualSize.height - 10;
|
||||
btnActualSize.x = 0;// this.width - btnActualSize.width*2;
|
||||
btnActualSize.y = 0;// this.height - btnActualSize.height*2;
|
||||
trace("x: " + btnActualSize.x + " y: " + btnActualSize.y);
|
||||
}
|
||||
}
|
||||
@ -145,18 +153,23 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
this.width = externalWidth + horizontalBorder;
|
||||
this.height = externalHeight + verticalBorder;
|
||||
|
||||
/* Displaying actual size, do not resize video */
|
||||
// TODO: These check null comparations are horrible.
|
||||
if (btnActualSize && btnActualSize.selected) {
|
||||
return;
|
||||
}
|
||||
/* Reposition video within window */
|
||||
videoHolder.x = internalOffsetX;
|
||||
videoHolder.y = internalOffsetY;
|
||||
|
||||
videoHolder.width = video.width = internalWidth;
|
||||
videoHolder.height = video.height = internalHeight;
|
||||
}
|
||||
|
||||
private function onRepositionOnlyCallback(externalWidth:int, externalHeight:int, internalOffsetX:int, internalOffsetY:int):void {
|
||||
this.width = externalWidth + horizontalBorder;
|
||||
this.height = externalHeight + verticalBorder;
|
||||
|
||||
/* Reposition video within window */
|
||||
videoHolder.x = internalOffsetX;
|
||||
videoHolder.y = internalOffsetY;
|
||||
}
|
||||
|
||||
|
||||
protected function get verticalBorder():Number {
|
||||
return this.borderMetrics.top + this.borderMetrics.bottom;
|
||||
}
|
||||
@ -240,10 +253,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function fitWindowToVideo():void {
|
||||
video.width = videoWidth;
|
||||
videoHolder.width = videoWidth;
|
||||
video.height = videoHeight;
|
||||
videoHolder.height = videoHeight;
|
||||
this.restore();
|
||||
video.width = videoHolder.width = videoWidth;
|
||||
video.height = videoHolder.height = videoHeight;
|
||||
this.height = videoHeight + verticalBorder;
|
||||
this.width = videoWidth + horizontalBorder;
|
||||
}
|
||||
@ -267,14 +279,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function determineHowToDisplayVideo():void {
|
||||
if (btnActualSize.selected) {
|
||||
if (!actualSize) {
|
||||
actualSize = true;
|
||||
fitToActualSize();
|
||||
btnActualSize.toolTip = ResourceUtil.getInstance().getString('bbb.desktopView.fitToWindow');
|
||||
btnActualSize.label = ResourceUtil.getInstance().getString('bbb.desktopView.fitToWindow');
|
||||
} else {
|
||||
actualSize = false;
|
||||
onResizeEvent();
|
||||
btnActualSize.toolTip = ResourceUtil.getInstance().getString('bbb.desktopView.actualSize');
|
||||
btnActualSize.label = ResourceUtil.getInstance().getString('bbb.desktopView.actualSize');
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,11 +318,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<mx:Image id="cursorImg" visible="false" source="@Embed('../../assets/images/cursor4.png')"/>
|
||||
|
||||
<views:DesktopViewButton id="btnActualSize"
|
||||
click="determineHowToDisplayVideo()"
|
||||
toggle="true"
|
||||
selected="false"
|
||||
label="{btnActualSize.selected ? ResourceUtil.getInstance().getString('bbb.desktopView.fitToWindow') : ResourceUtil.getInstance().getString('bbb.desktopView.actualSize')}"
|
||||
toolTip="{btnActualSize.selected ? ResourceUtil.getInstance().getString('bbb.desktopView.fitToWindow') : ResourceUtil.getInstance().getString('bbb.desktopView.actualSize')}"
|
||||
depth="3" />
|
||||
click="determineHowToDisplayVideo()"
|
||||
label="{actualSize ? ResourceUtil.getInstance().getString('bbb.desktopView.fitToWindow') : ResourceUtil.getInstance().getString('bbb.desktopView.actualSize')}"
|
||||
toolTip="{actualSize ? ResourceUtil.getInstance().getString('bbb.desktopView.fitToWindow') : ResourceUtil.getInstance().getString('bbb.desktopView.actualSize')}" />
|
||||
|
||||
</MDIWindow>
|
||||
|
Loading…
Reference in New Issue
Block a user