refactor of WhiteboardCanvas to be more isolated and easier to duplicate
This commit is contained in:
parent
372b154e35
commit
381b8dae29
@ -1,39 +0,0 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.common
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
|
||||
|
||||
/**
|
||||
* An interface currently used to interface the Whiteboard module with the Presentation module in a decoupled sort of way.
|
||||
*
|
||||
*/
|
||||
public interface IBbbCanvas
|
||||
{
|
||||
function addRawChild(child:DisplayObject):void;
|
||||
function removeRawChild(child:DisplayObject):void;
|
||||
function doesContain(child:DisplayObject):Boolean;
|
||||
function acceptOverlayCanvas(overlay:IBbbCanvas):void;
|
||||
function moveCanvas(x:Number, y:Number):void;
|
||||
function zoomCanvas(width:Number, height:Number):void;
|
||||
function showCanvas(show:Boolean):void;
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.modules.present.api
|
||||
{
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
import mx.containers.Canvas;
|
||||
import mx.controls.Button;
|
||||
|
||||
import org.bigbluebutton.common.IBbbCanvas;
|
||||
import org.bigbluebutton.modules.present.events.AddOverlayCanvasEvent;
|
||||
|
||||
public class PresentationAPI
|
||||
{
|
||||
private static var instance:PresentationAPI;
|
||||
|
||||
private var dispatcher:Dispatcher;
|
||||
|
||||
public function PresentationAPI(enforcer:SingletonEnforcer)
|
||||
{
|
||||
if (enforcer == null){
|
||||
throw new Error("There can only be 1 UserManager instance");
|
||||
}
|
||||
initialize();
|
||||
}
|
||||
|
||||
private function initialize():void{
|
||||
dispatcher = new Dispatcher();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the single instance of the PresentationAPI class, which is a singleton
|
||||
*/
|
||||
public static function getInstance():PresentationAPI{
|
||||
if (instance == null){
|
||||
instance = new PresentationAPI(new SingletonEnforcer());
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public function addOverlayCanvas(canvas:IBbbCanvas):void{
|
||||
var overlayEvent:AddOverlayCanvasEvent = new AddOverlayCanvasEvent(AddOverlayCanvasEvent.ADD_OVERLAY_CANVAS);
|
||||
overlayEvent.canvas = canvas;
|
||||
dispatcher.dispatchEvent(overlayEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
class SingletonEnforcer{}
|
@ -1,37 +0,0 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.modules.present.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
import org.bigbluebutton.common.IBbbCanvas;
|
||||
|
||||
public class AddOverlayCanvasEvent extends Event
|
||||
{
|
||||
public static const ADD_OVERLAY_CANVAS:String = "ADD_OVERLAY_CANVAS";
|
||||
|
||||
public var canvas:IBbbCanvas;
|
||||
|
||||
public function AddOverlayCanvasEvent(type:String)
|
||||
{
|
||||
super(type, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -25,8 +25,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import mx.events.FlexEvent;
|
||||
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
import org.bigbluebutton.main.model.users.events.RoleChangeEvent;
|
||||
import org.bigbluebutton.modules.present.api.PresentationAPI;
|
||||
import org.bigbluebutton.modules.present.business.PresentProxy;
|
||||
import org.bigbluebutton.modules.present.commands.ChangePageCommand;
|
||||
import org.bigbluebutton.modules.present.commands.ChangePresentationCommand;
|
||||
@ -34,34 +32,20 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.modules.present.commands.GoToPageCommand;
|
||||
import org.bigbluebutton.modules.present.commands.GoToPrevPageCommand;
|
||||
import org.bigbluebutton.modules.present.commands.UploadFileCommand;
|
||||
import org.bigbluebutton.modules.present.events.AddOverlayCanvasEvent;
|
||||
import org.bigbluebutton.modules.present.events.DownloadEvent;
|
||||
import org.bigbluebutton.modules.present.events.GetListOfPresentationsRequest;
|
||||
import org.bigbluebutton.modules.present.events.PresentModuleEvent;
|
||||
import org.bigbluebutton.modules.present.events.PresentationChangedEvent;
|
||||
import org.bigbluebutton.modules.present.events.PresentationEvent;
|
||||
import org.bigbluebutton.modules.present.events.PresenterCommands;
|
||||
import org.bigbluebutton.modules.present.events.RemovePresentationEvent;
|
||||
import org.bigbluebutton.modules.present.events.DownloadEvent;
|
||||
import org.bigbluebutton.modules.present.events.UploadEvent;
|
||||
import org.bigbluebutton.modules.present.managers.PresentManager;
|
||||
import org.bigbluebutton.modules.present.services.PageLoaderService;
|
||||
import org.bigbluebutton.modules.present.services.PresentationService;
|
||||
import org.bigbluebutton.modules.present.ui.views.PresentationWindow;
|
||||
import org.bigbluebutton.modules.whiteboard.events.GetCurrentPresentationInfo;
|
||||
|
||||
private var apiInstance:PresentationAPI;
|
||||
|
||||
private function createAPI():void{
|
||||
apiInstance = PresentationAPI.getInstance();
|
||||
}
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
<EventHandlers type="{FlexEvent.PREINITIALIZE}">
|
||||
<ObjectBuilder generator="{PresentManager}" cache="global" />
|
||||
<ObjectBuilder generator="{PresentProxy}" cache="global" />
|
||||
|
||||
<InlineInvoker method="createAPI" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{PresentModuleEvent.START_MODULE}" >
|
||||
@ -121,10 +105,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<MethodInvoker generator="{PresentProxy}" method="zoomSlide" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{GetCurrentPresentationInfo.GET_CURRENT_PRESENTATION_INFO}" >
|
||||
<MethodInvoker generator="{PresentProxy}" method="getCurrentPresentationInfo" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{GetListOfPresentationsRequest.GET_LIST_OF_PRESENTATIONS}" >
|
||||
<MethodInvoker generator="{PresentProxy}" method="handleGetListOfPresentationsRequest" />
|
||||
</EventHandlers>
|
||||
|
@ -27,20 +27,20 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
xmlns:code="http://code.google.com/p/flexlib/"
|
||||
xmlns:containers="flexlib.containers.*"
|
||||
xmlns:mate="http://mate.asfusion.com/"
|
||||
xmlns:views="org.bigbluebutton.modules.present.ui.views.*"
|
||||
xmlns:poll="org.bigbluebutton.modules.polling.views.*"
|
||||
showCloseButton="false" layout="absolute"
|
||||
verticalScrollPolicy="off"
|
||||
horizontalScrollPolicy="off"
|
||||
showControls="true" resize="resizeHandler()"
|
||||
styleNameFocus="presentationWindowStyleFocus"
|
||||
styleNameNoFocus="presentationWindowStyleNoFocus"
|
||||
implements="org.bigbluebutton.common.IBbbModuleWindow"
|
||||
implements="org.bigbluebutton.common.IBbbModuleWindow,org.bigbluebutton.modules.whiteboard.views.IWhiteboardReceiver"
|
||||
initialize="init()"
|
||||
creationComplete="onCreationComplete()"
|
||||
width="{DEFAULT_WINDOW_WIDTH}" height="{DEFAULT_WINDOW_HEIGHT}"
|
||||
x="{DEFAULT_X_POSITION}" y="{DEFAULT_Y_POSITION}"
|
||||
title="{ResourceUtil.getInstance().getString('bbb.presentation.title')}"
|
||||
xmlns:views="org.bigbluebutton.modules.present.ui.views.*"
|
||||
xmlns:poll="org.bigbluebutton.modules.polling.views.*"
|
||||
>
|
||||
|
||||
<mate:Dispatcher id="globalDispatcher" />
|
||||
@ -50,7 +50,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<mate:Listener type="{PresentationChangedEvent.PRESENTATION_CHANGED_EVENT}" method="handlePresentationChangedEvent" />
|
||||
<mate:Listener type="{UploadEvent.CLEAR_PRESENTATION}" method="clearPresentation" />
|
||||
<mate:Listener type="{DisplaySlideEvent.DISPLAY_SLIDE_EVENT}" method="handleDisplaySlideEvent" />
|
||||
<mate:Listener type="{AddOverlayCanvasEvent.ADD_OVERLAY_CANVAS}" method="addOverlayCanvas" />
|
||||
<mate:Listener type="{LocaleChangeEvent.LOCALE_CHANGED}" method="localeChanged" />
|
||||
<mate:Listener type="{ShortcutEvent.UPLOAD_PRESENTATION}" method="remoteUpload" />
|
||||
<mate:Listener type="{ShortcutEvent.PREVIOUS_SLIDE}" method="remotePrevious" />
|
||||
@ -75,31 +74,26 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<![CDATA[
|
||||
import flash.geom.Point;
|
||||
|
||||
import flexlib.mdi.events.MDIWindowEvent;
|
||||
|
||||
import mx.collections.ArrayCollection;
|
||||
import mx.controls.Menu;
|
||||
import mx.events.MenuEvent;
|
||||
import mx.managers.PopUpManager;
|
||||
|
||||
import flexlib.mdi.events.MDIWindowEvent;
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.common.IBbbCanvas;
|
||||
import org.bigbluebutton.common.IBbbModuleWindow;
|
||||
import org.bigbluebutton.common.events.AddUIComponentToMainCanvas;
|
||||
import org.bigbluebutton.common.events.LocaleChangeEvent;
|
||||
import org.bigbluebutton.core.BBB;
|
||||
import org.bigbluebutton.core.KeyboardUtil;
|
||||
import org.bigbluebutton.core.PopUpUtil;
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.main.events.MadePresenterEvent;
|
||||
import org.bigbluebutton.main.events.ShortcutEvent;
|
||||
import org.bigbluebutton.main.events.PresenterStatusEvent;
|
||||
import org.bigbluebutton.main.events.ShortcutEvent;
|
||||
import org.bigbluebutton.main.views.MainCanvas;
|
||||
import org.bigbluebutton.modules.screenshare.events.ShareEvent;
|
||||
import org.bigbluebutton.modules.screenshare.events.RequestToPauseSharing;
|
||||
import org.bigbluebutton.modules.screenshare.events.RequestToRestartSharing;
|
||||
import org.bigbluebutton.modules.screenshare.events.RequestToStartSharing;
|
||||
import org.bigbluebutton.modules.screenshare.view.components.ScreenshareViewWindow;
|
||||
import org.bigbluebutton.modules.polling.events.PollShowResultEvent;
|
||||
import org.bigbluebutton.modules.polling.events.PollStartedEvent;
|
||||
import org.bigbluebutton.modules.polling.events.PollStoppedEvent;
|
||||
@ -109,18 +103,26 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.modules.polling.views.PollResultsModal;
|
||||
import org.bigbluebutton.modules.present.commands.GoToNextPageCommand;
|
||||
import org.bigbluebutton.modules.present.commands.GoToPrevPageCommand;
|
||||
import org.bigbluebutton.modules.present.events.AddOverlayCanvasEvent;
|
||||
import org.bigbluebutton.modules.present.events.DisplaySlideEvent;
|
||||
import org.bigbluebutton.modules.present.events.DownloadEvent;
|
||||
import org.bigbluebutton.modules.present.events.PageLoadedEvent;
|
||||
import org.bigbluebutton.modules.present.events.PresentationChangedEvent;
|
||||
import org.bigbluebutton.modules.present.events.PresenterCommands;
|
||||
import org.bigbluebutton.modules.present.events.RemovePresentationEvent;
|
||||
import org.bigbluebutton.modules.present.events.UploadEvent;
|
||||
import org.bigbluebutton.modules.present.model.Page;
|
||||
import org.bigbluebutton.modules.present.model.PresentationModel;
|
||||
import org.bigbluebutton.modules.screenshare.events.RequestToPauseSharing;
|
||||
import org.bigbluebutton.modules.screenshare.events.RequestToRestartSharing;
|
||||
import org.bigbluebutton.modules.screenshare.events.RequestToStartSharing;
|
||||
import org.bigbluebutton.modules.screenshare.events.ShareEvent;
|
||||
import org.bigbluebutton.modules.screenshare.view.components.ScreenshareViewWindow;
|
||||
import org.bigbluebutton.modules.whiteboard.events.RequestNewCanvasEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
|
||||
import org.bigbluebutton.modules.present.events.PageLoadedEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdateReceived;
|
||||
import org.bigbluebutton.modules.whiteboard.views.WhiteboardCanvas;
|
||||
import org.bigbluebutton.modules.whiteboard.views.WhiteboardTextToolbar;
|
||||
import org.bigbluebutton.modules.whiteboard.views.WhiteboardToolbar;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
|
||||
private static const LOGGER:ILogger = getClassLogger(PresentationWindow);
|
||||
@ -174,9 +176,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private var noticeSoundClass:Class;
|
||||
private var noticeSound:Sound = new noticeSoundClass() as Sound;
|
||||
|
||||
private var whiteboardOverlay:IBbbCanvas = null;
|
||||
private var whiteboardOverlay:WhiteboardCanvas = null;
|
||||
private var screenshareView:ScreenshareViewWindow = null;
|
||||
private var whiteboardAdded:Boolean = false;
|
||||
|
||||
private function init():void{
|
||||
presentOptions = new PresentOptions();
|
||||
@ -199,8 +200,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
hotkeyCapture();
|
||||
|
||||
//Necessary now because of module loading race conditions
|
||||
var t:Timer = new Timer(2000, 1);
|
||||
t.addEventListener(TimerEvent.TIMER, addWhiteboardToolbar);
|
||||
var t:Timer = new Timer(5000, 1);
|
||||
t.addEventListener(TimerEvent.TIMER, requestWhiteboardCanvas);
|
||||
t.start();
|
||||
|
||||
presenterTabs.addEventListener(Event.CHANGE, onSelectTabEvent, true);
|
||||
@ -214,15 +215,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
setPollMenuData();
|
||||
}
|
||||
|
||||
private function addWhiteboardToolbar(event:TimerEvent):void {
|
||||
LOGGER.debug("Sending event to add whiteboard canvas.");
|
||||
callLater(fitSlideToWindowMaintainingAspectRatio);
|
||||
// Tell the WhiteboardManager to add the toolbar
|
||||
var e:WhiteboardButtonEvent = new WhiteboardButtonEvent(WhiteboardButtonEvent.WHITEBOARD_ADDED_TO_PRESENTATION);
|
||||
e.window = this;
|
||||
dispatchEvent(e);
|
||||
}
|
||||
|
||||
private function requestWhiteboardCanvas(event:TimerEvent):void {
|
||||
LOGGER.debug("Sending event to add whiteboard canvas.");
|
||||
callLater(fitSlideToWindowMaintainingAspectRatio);
|
||||
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatcher.dispatchEvent(new RequestNewCanvasEvent(this));
|
||||
}
|
||||
|
||||
private function hotkeyCapture():void{
|
||||
LOGGER.debug("Entering hotkeyCapture");
|
||||
this.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);
|
||||
@ -508,19 +508,15 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private function showThumbnails():void{
|
||||
slideView.thumbnailView.visible = !slideView.thumbnailView.visible;
|
||||
}
|
||||
|
||||
private function addOverlayCanvas(e:AddOverlayCanvasEvent):void{
|
||||
LOGGER.debug("OVERLAYING WHITEBOARD CANVAS");
|
||||
whiteboardOverlay = e.canvas;
|
||||
}
|
||||
|
||||
private function addWhiteboardCanvasToSlideView(e:PageLoadedEvent):void{
|
||||
if(!whiteboardAdded && whiteboardOverlay != null) {
|
||||
private function addWhiteboardCanvasToSlideView(e:PageLoadedEvent = null):void{
|
||||
if(whiteboardOverlay != null) {
|
||||
LOGGER.debug("addWhiteboardCanvasToSlideView: Adding whiteboard canvas to SlideView");
|
||||
changeWhiteboardPageOnly(PresentationModel.getInstance().getCurrentPage().id);
|
||||
whiteboardOverlay.acceptOverlayCanvas(slideView);
|
||||
slideView.acceptOverlayCanvas(whiteboardOverlay);
|
||||
whiteboardAdded = true;
|
||||
if (screenshareView) {
|
||||
screenshareView.removeOverlayCanvas();
|
||||
}
|
||||
} else LOGGER.debug("addWhiteboardCanvasToSlideView: NOT adding whiteboard canvas to Slide View.");
|
||||
}
|
||||
|
||||
@ -922,9 +918,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
if (whiteboardOverlay != null) {
|
||||
changeWhiteboardPageOnly(PresentationModel.getInstance().getCurrentPage().id);
|
||||
slideView.acceptOverlayCanvas(whiteboardOverlay);
|
||||
whiteboardOverlay.acceptOverlayCanvas(slideView);
|
||||
this.addWhiteboardCanvasToSlideView();
|
||||
}
|
||||
|
||||
if(!presenterTabs.getTabAt(PRESENTATION_TAB_INDEX).visible) {
|
||||
@ -970,12 +964,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
LOGGER.debug("Adding whiteboard layer to Deskshare View Canvas");
|
||||
changeWhiteboardPageOnly("deskshare");
|
||||
screenshareView.acceptOverlayCanvas(whiteboardOverlay);
|
||||
whiteboardOverlay.acceptOverlayCanvas(screenshareView);
|
||||
slideView.removeOverlayCanvas();
|
||||
if(UsersUtil.amIPresenter()) {
|
||||
annotationsPermissionChanged(true);
|
||||
}
|
||||
if(!whiteboardAdded)
|
||||
whiteboardAdded = true;
|
||||
} else {
|
||||
LOGGER.debug("openScreenshareViewTab: whiteboard overlay or desktop view canvas is null!");
|
||||
}
|
||||
@ -991,10 +983,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function changeWhiteboardPageOnly(whiteboardId:String):void {
|
||||
LOGGER.debug("Dispatching whiteboard page changed event. Id: " + whiteboardId);
|
||||
var e:WhiteboardUpdate = new WhiteboardUpdate(WhiteboardUpdate.CHANGE_PAGE);
|
||||
e.pageID = whiteboardId;
|
||||
dispatchEvent(e);
|
||||
if (whiteboardOverlay) {
|
||||
LOGGER.debug("Telling the WhiteboardCanvas to switch ids. Id: " + whiteboardId);
|
||||
whiteboardOverlay.displayWhiteboardById(whiteboardId);
|
||||
} else {
|
||||
LOGGER.debug("No WhiteboardCanvas overlayed cannot switch ids. Id: " + whiteboardId);
|
||||
}
|
||||
}
|
||||
|
||||
private function stopSharing():void {
|
||||
@ -1103,6 +1097,22 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
screenshareTab.label = ResourceUtil.getInstance().getString('bbb.screensharePublish.restart.label');
|
||||
dispatchEvent(new RequestToPauseSharing());
|
||||
}
|
||||
|
||||
public function receiveToolbars(wt:WhiteboardToolbar, wtt:WhiteboardTextToolbar):void {
|
||||
var addUIEvent:AddUIComponentToMainCanvas = new AddUIComponentToMainCanvas(AddUIComponentToMainCanvas.ADD_COMPONENT);
|
||||
addUIEvent.component = wt;
|
||||
globalDispatcher.dispatchEvent(addUIEvent);
|
||||
wt.positionToolbar(this);
|
||||
|
||||
var addTextToolbarEvent:AddUIComponentToMainCanvas = new AddUIComponentToMainCanvas(AddUIComponentToMainCanvas.ADD_COMPONENT);
|
||||
addTextToolbarEvent.component = wtt;
|
||||
globalDispatcher.dispatchEvent(addTextToolbarEvent);
|
||||
wtt.positionToolbar(this);
|
||||
}
|
||||
|
||||
public function receiveCanvas(wc:WhiteboardCanvas):void {
|
||||
whiteboardOverlay = wc;
|
||||
}
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
|
@ -30,8 +30,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
verticalScrollPolicy="off"
|
||||
horizontalScrollPolicy="off"
|
||||
rollOut="hideCursor()" styleName="presentationSlideViewStyle"
|
||||
xmlns:views="org.bigbluebutton.modules.present.views.*"
|
||||
implements="org.bigbluebutton.common.IBbbCanvas">
|
||||
xmlns:views="org.bigbluebutton.modules.present.views.*">
|
||||
|
||||
<mate:Listener type="{PageChangedEvent.PRESENTATION_PAGE_CHANGED_EVENT}" method="handlePageChangedEvent" />
|
||||
<mate:Listener type="{PageLoadedEvent.PAGE_LOADED_EVENT}" method="handlePageLoadedEvent" />
|
||||
@ -51,7 +50,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.common.IBbbCanvas;
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
import org.bigbluebutton.main.events.MadePresenterEvent;
|
||||
@ -67,6 +65,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.modules.present.model.PresentationModel;
|
||||
import org.bigbluebutton.modules.present.ui.views.models.SlideCalcUtil;
|
||||
import org.bigbluebutton.modules.present.ui.views.models.SlideViewModel;
|
||||
import org.bigbluebutton.modules.whiteboard.views.WhiteboardCanvas;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
|
||||
private static const LOGGER:ILogger = getClassLogger(SlideView);
|
||||
@ -76,8 +75,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
public static const THUMBNAILS_CLOSED:String = "ThumbnailsClosed";
|
||||
|
||||
private var cursor:Shape;
|
||||
private var whiteboardCanvasHolder:Canvas = new Canvas();
|
||||
private var whiteboardCanvas:IBbbCanvas;
|
||||
private var whiteboardCanvas:WhiteboardCanvas;
|
||||
|
||||
private var dispatcher:Dispatcher = new Dispatcher();
|
||||
|
||||
@ -101,12 +99,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
this.rawChildren.addChild(cursor);
|
||||
cursor.visible = false;
|
||||
|
||||
whiteboardCanvasHolder = new Canvas();
|
||||
this.addChild(whiteboardCanvasHolder);
|
||||
whiteboardCanvasHolder.x = 0;
|
||||
whiteboardCanvasHolder.y = 0;
|
||||
whiteboardCanvasHolder.clipContent = true;
|
||||
|
||||
this.setChildIndex(thumbnailView, this.numChildren - 1);
|
||||
|
||||
/*
|
||||
@ -464,52 +456,33 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
private function hideCursor():void{
|
||||
cursor.visible = false;
|
||||
}
|
||||
|
||||
/** Inherited from IBbbCanvas*/
|
||||
public function addRawChild(child:DisplayObject):void{
|
||||
this.whiteboardCanvasHolder.rawChildren.addChild(child);
|
||||
}
|
||||
|
||||
public function removeRawChild(child:DisplayObject):void{
|
||||
this.whiteboardCanvasHolder.rawChildren.removeChild(child);
|
||||
}
|
||||
|
||||
public function doesContain(child:DisplayObject):Boolean{
|
||||
return this.whiteboardCanvasHolder.rawChildren.contains(child);
|
||||
}
|
||||
|
||||
public function acceptOverlayCanvas(overlay:IBbbCanvas):void{
|
||||
cleanCanvasHolder();
|
||||
public function acceptOverlayCanvas(overlay:WhiteboardCanvas):void{
|
||||
whiteboardCanvas = overlay;
|
||||
var c:Canvas = overlay as Canvas;
|
||||
// add the canvas below the thumbnails
|
||||
this.addChildAt(c, this.getChildIndex(thumbnailView));
|
||||
c.x = slideLoader.x * SlideCalcUtil.MYSTERY_NUM;
|
||||
c.y = slideLoader.y * SlideCalcUtil.MYSTERY_NUM;
|
||||
c.width = slideLoader.width;
|
||||
c.height = slideLoader.height;
|
||||
this.addChildAt(whiteboardCanvas, this.getChildIndex(thumbnailView));
|
||||
zoomCanvas(slideLoader.width, slideLoader.height);
|
||||
fitSlideToLoader();
|
||||
c.addEventListener(MouseEvent.MOUSE_DOWN, handleWhiteboardCanvasClick);
|
||||
whiteboardCanvas.addEventListener(MouseEvent.MOUSE_DOWN, handleWhiteboardCanvasClick);
|
||||
slideLoader.addEventListener(MouseEvent.MOUSE_DOWN, handleWhiteboardCanvasClick);
|
||||
}
|
||||
|
||||
public function removeOverlayCanvas():void {
|
||||
whiteboardCanvas = null;
|
||||
}
|
||||
|
||||
private function handleWhiteboardCanvasClick(e:MouseEvent):void {
|
||||
if (thumbnailView.visible) thumbnailView.visible = false;
|
||||
}
|
||||
|
||||
public function moveCanvas(x:Number, y:Number):void{
|
||||
whiteboardCanvasHolder.x = slideLoader.x * SlideCalcUtil.MYSTERY_NUM;
|
||||
whiteboardCanvasHolder.y = slideLoader.y * SlideCalcUtil.MYSTERY_NUM;
|
||||
|
||||
if (whiteboardCanvas != null) {
|
||||
whiteboardCanvas.moveCanvas(whiteboardCanvasHolder.x, whiteboardCanvasHolder.y);
|
||||
whiteboardCanvas.moveCanvas(x * SlideCalcUtil.MYSTERY_NUM, y * SlideCalcUtil.MYSTERY_NUM);
|
||||
}
|
||||
}
|
||||
|
||||
public function zoomCanvas(width:Number, height:Number):void{
|
||||
whiteboardCanvasHolder.width = width;
|
||||
whiteboardCanvasHolder.height = height;
|
||||
moveCanvas(slideLoader.x, slideLoader.y);
|
||||
if (whiteboardCanvas != null) {
|
||||
//LogUtil.debug("Zooming Canvas " + width + " " + height);
|
||||
@ -517,20 +490,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
}
|
||||
|
||||
public function showCanvas(show:Boolean):void{
|
||||
|
||||
}
|
||||
|
||||
private function focusSlide(e:ShortcutEvent):void{
|
||||
focusManager.setFocus(slideLoader);
|
||||
slideLoader.drawFocus(true);
|
||||
}
|
||||
|
||||
private function cleanCanvasHolder():void{
|
||||
while (this.whiteboardCanvasHolder.rawChildren.numChildren > 0) {
|
||||
this.whiteboardCanvasHolder.rawChildren.removeChildAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
@ -25,7 +25,6 @@
|
||||
width="100%"
|
||||
height="100%"
|
||||
creationComplete="onCreationComplete()"
|
||||
implements="org.bigbluebutton.common.IBbbCanvas"
|
||||
xmlns:mate="http://mate.asfusion.com/"
|
||||
backgroundColor="#C0C0C0">
|
||||
|
||||
@ -35,27 +34,28 @@
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import mx.core.UIComponent;
|
||||
import mx.events.ResizeEvent;
|
||||
|
||||
import flexlib.mdi.events.MDIWindowEvent;
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.common.Images;
|
||||
import org.bigbluebutton.common.events.LocaleChangeEvent;
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.core.managers.ReconnectionManager;
|
||||
import org.bigbluebutton.main.api.JSLog;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
import org.bigbluebutton.main.views.MainCanvas;
|
||||
import org.bigbluebutton.modules.screenshare.events.ViewStreamEvent;
|
||||
import org.bigbluebutton.modules.screenshare.events.ViewWindowEvent;
|
||||
import org.bigbluebutton.modules.screenshare.managers.SmartWindowResizer;
|
||||
import org.bigbluebutton.modules.screenshare.model.ScreenshareModel;
|
||||
import org.bigbluebutton.modules.screenshare.model.ScreenshareOptions;
|
||||
import org.bigbluebutton.modules.screenshare.services.red5.Connection;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
import flexlib.mdi.events.MDIWindowEvent;
|
||||
|
||||
import mx.core.UIComponent;
|
||||
import mx.events.ResizeEvent;
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.common.Images;
|
||||
import org.bigbluebutton.common.events.LocaleChangeEvent;
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.core.managers.ReconnectionManager;
|
||||
import org.bigbluebutton.main.api.JSLog;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
import org.bigbluebutton.main.views.MainCanvas;
|
||||
import org.bigbluebutton.modules.screenshare.events.ViewStreamEvent;
|
||||
import org.bigbluebutton.modules.screenshare.events.ViewWindowEvent;
|
||||
import org.bigbluebutton.modules.screenshare.managers.SmartWindowResizer;
|
||||
import org.bigbluebutton.modules.screenshare.model.ScreenshareModel;
|
||||
import org.bigbluebutton.modules.screenshare.model.ScreenshareOptions;
|
||||
import org.bigbluebutton.modules.screenshare.services.red5.Connection;
|
||||
import org.bigbluebutton.modules.whiteboard.views.WhiteboardCanvas;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
|
||||
private static const LOG:String = "SC::ScreenshareViewWIndow - ";
|
||||
private static const LOGGER:ILogger = getClassLogger(ScreenshareViewWindow);
|
||||
@ -84,8 +84,7 @@
|
||||
|
||||
private var resizer:SmartWindowResizer = new SmartWindowResizer();
|
||||
|
||||
private var whiteboardCanvas:IBbbCanvas = null;
|
||||
private var whiteboardCanvasHolder:Canvas = new Canvas();
|
||||
private var whiteboardCanvas:WhiteboardCanvas = null;
|
||||
|
||||
// The following code block is to deal with a bug in FLexLib
|
||||
// with MDI windows not responding well to being maximized
|
||||
@ -213,7 +212,6 @@
|
||||
videoWithWarnings.height = video.height = internalHeight;
|
||||
|
||||
// update the whiteboard canvas holder and overlay with new video dimensions
|
||||
updateWhiteboardCanvasHolder();
|
||||
updateWhiteboardCanvasOverlay();
|
||||
}
|
||||
}
|
||||
@ -221,34 +219,10 @@
|
||||
private function setVideo():void {
|
||||
LOGGER.debug("Callback called. Adding video, its whiteboard canvas and resizing components...");
|
||||
videoHolder.addChild(video);
|
||||
addWhiteboardCanvasHolder();
|
||||
addWhiteboardCanvasOverlay();
|
||||
onResizeEvent();
|
||||
}
|
||||
|
||||
private function addWhiteboardCanvasHolder():void{
|
||||
if(video != null) {
|
||||
this.addChildAt(whiteboardCanvasHolder, 1);
|
||||
LOGGER.debug("Whiteboard canvas holder added");
|
||||
}
|
||||
}
|
||||
|
||||
private function cleanCanvasHolder():void{
|
||||
while (this.whiteboardCanvasHolder.rawChildren.numChildren > 0) {
|
||||
this.whiteboardCanvasHolder.rawChildren.removeChildAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
private function updateWhiteboardCanvasHolder():void{
|
||||
if (video != null && videoHolder != null) {
|
||||
whiteboardCanvasHolder.x = videoWithWarnings.x;
|
||||
whiteboardCanvasHolder.y = videoWithWarnings.y;
|
||||
whiteboardCanvasHolder.width = videoWithWarnings.width;
|
||||
whiteboardCanvasHolder.height = videoWithWarnings.height;
|
||||
LOGGER.debug("Whiteboard canvas holder dimensions updated");
|
||||
}
|
||||
}
|
||||
|
||||
public function addWhiteboardCanvasOverlay():void {
|
||||
updateWhiteboardCanvasOverlay();
|
||||
if (video != null && whiteboardCanvas != null && videoHolder != null) {
|
||||
@ -343,39 +317,13 @@
|
||||
resourcesChanged();
|
||||
}
|
||||
|
||||
/** Inherited from IBbbCanvas*/
|
||||
public function addRawChild(child:DisplayObject):void {
|
||||
whiteboardCanvasHolder.rawChildren.addChild(child);
|
||||
}
|
||||
|
||||
public function removeRawChild(child:DisplayObject):void {
|
||||
this.whiteboardCanvasHolder.rawChildren.removeChild(child);
|
||||
}
|
||||
|
||||
public function doesContain(child:DisplayObject):Boolean {
|
||||
return this.whiteboardCanvasHolder.rawChildren.contains(child);
|
||||
}
|
||||
|
||||
public function acceptOverlayCanvas(overlay:IBbbCanvas):void {
|
||||
public function acceptOverlayCanvas(overlay:WhiteboardCanvas):void {
|
||||
LOGGER.debug("ScreenshareViewWindow: acceptOverlayCanvas");
|
||||
cleanCanvasHolder();
|
||||
whiteboardCanvas = overlay;
|
||||
}
|
||||
|
||||
private function handleWhiteboardCanvasClick(e:MouseEvent):void {
|
||||
LOGGER.debug("ScreenshareViewWindow: handleWhiteboardCanvasClick");
|
||||
}
|
||||
|
||||
public function moveCanvas(x:Number, y:Number):void {
|
||||
LOGGER.debug("ScreenshareViewWindow: moveCanvas");
|
||||
}
|
||||
|
||||
public function zoomCanvas(width:Number, height:Number):void {
|
||||
LOGGER.debug("ScreenshareViewWindow: zoomCanvas");
|
||||
}
|
||||
|
||||
public function showCanvas(show:Boolean):void {
|
||||
LOGGER.debug("ScreenshareViewWindow: showCanvas");
|
||||
|
||||
public function removeOverlayCanvas():void {
|
||||
whiteboardCanvas = null;
|
||||
}
|
||||
|
||||
public function handleDisconnectedEvent(event:BBBEvent):void {
|
||||
|
@ -26,7 +26,6 @@ package org.bigbluebutton.modules.whiteboard
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.common.IBbbCanvas;
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
import org.bigbluebutton.main.events.MadePresenterEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
|
||||
@ -36,7 +35,7 @@ package org.bigbluebutton.modules.whiteboard
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdateReceived;
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.AnnotationStatus;
|
||||
import org.bigbluebutton.modules.whiteboard.models.AnnotationType;
|
||||
@ -56,7 +55,6 @@ package org.bigbluebutton.modules.whiteboard
|
||||
private var shapeFactory:ShapeFactory = new ShapeFactory();
|
||||
private var textUpdateListener:TextUpdateListener = new TextUpdateListener();
|
||||
|
||||
private var bbbCanvas:IBbbCanvas;
|
||||
private var width:Number;
|
||||
private var height:Number;
|
||||
|
||||
@ -64,7 +62,7 @@ package org.bigbluebutton.modules.whiteboard
|
||||
wbCanvas = whiteboardCanvas;
|
||||
this.whiteboardModel = whiteboardModel;
|
||||
|
||||
textUpdateListener.setDependencies(wbCanvas, whiteboardModel, shapeFactory);
|
||||
textUpdateListener.setDependencies(wbCanvas, shapeFactory);
|
||||
}
|
||||
|
||||
public function isEditingText():Boolean {
|
||||
@ -75,8 +73,7 @@ package org.bigbluebutton.modules.whiteboard
|
||||
if (textUpdateListener) textUpdateListener.canvasMouseDown();
|
||||
}
|
||||
|
||||
public function drawGraphic(event:WhiteboardUpdate):void {
|
||||
var o:Annotation = event.annotation;
|
||||
public function drawGraphic(o:Annotation):void {
|
||||
// LogUtil.debug("**** Drawing graphic [" + o.type + "] *****");
|
||||
var gobj:GraphicObject;
|
||||
switch (o.status) {
|
||||
@ -152,11 +149,11 @@ package org.bigbluebutton.modules.whiteboard
|
||||
wbCanvas.removeGraphic(gobj as DisplayObject);
|
||||
}
|
||||
|
||||
public function clearBoard(event:WhiteboardUpdate = null):void {
|
||||
if (event && event.userId) {
|
||||
public function clearBoard(userId:String=null):void {
|
||||
if (userId) {
|
||||
for (var i:Number = _annotationsList.length-1; i >= 0; i--){
|
||||
var gobj:GraphicObject = _annotationsList[i] as GraphicObject;
|
||||
if (gobj.userId == event.userId) {
|
||||
if (gobj.userId == userId) {
|
||||
removeGraphic(_annotationsList[i].id);
|
||||
}
|
||||
}
|
||||
@ -192,29 +189,8 @@ package org.bigbluebutton.modules.whiteboard
|
||||
}
|
||||
}
|
||||
}
|
||||
/*********************************************************
|
||||
* HACK! HACK! HACK! HACK! HACK! HACK! HACK! HACK! HACK!
|
||||
* To tell us that the Whiteboard Canvas has been overlayed into the Presentation Canvas.
|
||||
* The problem was that latecomers query for annotations history before the Whiteboard Canvas has
|
||||
* been overlayed on top of the presentation canvas. When we receive the history and try to
|
||||
* display the TEXT annotation, the text will be very small because when we calculate the font size,
|
||||
* the value for the canvas width and height is still zero.
|
||||
*
|
||||
* We need to setup the sequence of whiteboard startup properly to handle latecomers but this will
|
||||
* do for now.
|
||||
*/
|
||||
private var wbCanvasInitialized:Boolean = false;
|
||||
public function parentCanvasInitialized():void {
|
||||
wbCanvasInitialized = true;
|
||||
}
|
||||
|
||||
public function get canvasInited():Boolean {
|
||||
return wbCanvasInitialized;
|
||||
}
|
||||
|
||||
/**********************************************************/
|
||||
|
||||
public function changePage(wbId:String):void{
|
||||
public function changeWhiteboard(wbId:String):void{
|
||||
textUpdateListener.canvasMouseDown();
|
||||
|
||||
// LogUtil.debug("**** CanvasDisplay changePage. Clearing page *****");
|
||||
@ -222,29 +198,15 @@ package org.bigbluebutton.modules.whiteboard
|
||||
|
||||
var annotations:Array = whiteboardModel.getAnnotations(wbId);
|
||||
// LogUtil.debug("**** CanvasDisplay changePage [" + annotations.length + "] *****");
|
||||
if (annotations.length == 0) {
|
||||
/***
|
||||
* Check if the whiteboard canvas has already been overlayed into the presentation canvas.
|
||||
* If not, don't query for history. The overlay canvas event will trigger the querying of
|
||||
* the history.
|
||||
*/
|
||||
if (wbCanvasInitialized) wbCanvas.queryForAnnotationHistory(wbId);
|
||||
} else {
|
||||
for (var i:int = 0; i < annotations.length; i++) {
|
||||
var an:Annotation = annotations[i] as Annotation;
|
||||
// LogUtil.debug("**** Drawing graphic from changePage [" + an.type + "] *****");
|
||||
var gobj:GraphicObject = shapeFactory.makeGraphicObject(an, whiteboardModel);
|
||||
if (gobj != null) {
|
||||
gobj.draw(an, shapeFactory.parentWidth, shapeFactory.parentHeight);
|
||||
wbCanvas.addGraphic(gobj as DisplayObject);
|
||||
_annotationsList.push(gobj);
|
||||
}
|
||||
}
|
||||
/*
|
||||
for (var ij:int = 0; ij < this._annotationsList.length; ij++){
|
||||
redrawGraphic(this._annotationsList[ij] as GraphicObject, ij);
|
||||
for (var i:int = 0; i < annotations.length; i++) {
|
||||
var an:Annotation = annotations[i] as Annotation;
|
||||
// LogUtil.debug("**** Drawing graphic from changePage [" + an.type + "] *****");
|
||||
var gobj:GraphicObject = shapeFactory.makeGraphicObject(an, whiteboardModel);
|
||||
if (gobj != null) {
|
||||
gobj.draw(an, shapeFactory.parentWidth, shapeFactory.parentHeight);
|
||||
wbCanvas.addGraphic(gobj as DisplayObject);
|
||||
_annotationsList.push(gobj);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,9 +223,5 @@ package org.bigbluebutton.modules.whiteboard
|
||||
private function redrawGraphic(gobj:GraphicObject, objIndex:int):void {
|
||||
gobj.redraw(shapeFactory.parentWidth, shapeFactory.parentHeight);
|
||||
}
|
||||
|
||||
public function isPageEmpty():Boolean {
|
||||
return _annotationsList.length == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ package org.bigbluebutton.modules.whiteboard
|
||||
{
|
||||
import flash.events.KeyboardEvent;
|
||||
|
||||
import mx.containers.Canvas;
|
||||
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.ShapeFactory;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
@ -35,7 +37,6 @@ package org.bigbluebutton.modules.whiteboard
|
||||
* Class responsible for handling actions from presenter and sending annotations to the server.
|
||||
*/
|
||||
public class WhiteboardCanvasModel {
|
||||
public var whiteboardModel:WhiteboardModel;
|
||||
private var _wbCanvas:WhiteboardCanvas;
|
||||
private var drawListeners:Array = new Array();
|
||||
private var wbTool:WhiteboardTool = new WhiteboardTool();
|
||||
@ -52,11 +53,12 @@ package org.bigbluebutton.modules.whiteboard
|
||||
private var width:Number;
|
||||
private var height:Number;
|
||||
|
||||
public function set wbCanvas(canvas:WhiteboardCanvas):void {
|
||||
public function setDependencies(canvas:WhiteboardCanvas, displayModel:WhiteboardCanvasDisplayModel):void {
|
||||
_wbCanvas = canvas;
|
||||
drawListeners.push(new PencilDrawListener(idGenerator, _wbCanvas, sendShapeFrequency, shapeFactory, whiteboardModel));
|
||||
drawListeners.push(new ShapeDrawListener(idGenerator, _wbCanvas, sendShapeFrequency, shapeFactory, whiteboardModel));
|
||||
drawListeners.push(new TextDrawListener(idGenerator, _wbCanvas, sendShapeFrequency, shapeFactory, whiteboardModel));
|
||||
|
||||
drawListeners.push(new PencilDrawListener(idGenerator, _wbCanvas, shapeFactory));
|
||||
drawListeners.push(new ShapeDrawListener(idGenerator, _wbCanvas, shapeFactory));
|
||||
drawListeners.push(new TextDrawListener(idGenerator, _wbCanvas, shapeFactory));
|
||||
}
|
||||
|
||||
public function zoomCanvas(width:Number, height:Number):void {
|
||||
@ -80,10 +82,10 @@ package org.bigbluebutton.modules.whiteboard
|
||||
}
|
||||
}
|
||||
|
||||
public function doMouseDown(mouseX:Number, mouseY:Number):void {
|
||||
public function doMouseDown(mouseX:Number, mouseY:Number, wbId:String):void {
|
||||
// LogUtil.debug("*** CanvasModel doMouseDown");
|
||||
for (var ob:int = 0; ob < drawListeners.length; ob++) {
|
||||
(drawListeners[ob] as IDrawListener).onMouseDown(mouseX, mouseY, wbTool);
|
||||
(drawListeners[ob] as IDrawListener).onMouseDown(mouseX, mouseY, wbTool, wbId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,6 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
_status = s;
|
||||
}
|
||||
|
||||
public function createAnnotation(wbModel:WhiteboardModel):Annotation {return null}
|
||||
public function createAnnotation(wbId:String):Annotation {return null}
|
||||
}
|
||||
}
|
@ -55,7 +55,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
return shape;
|
||||
}
|
||||
|
||||
override public function createAnnotation(wbModel:WhiteboardModel):Annotation {
|
||||
override public function createAnnotation(wbId:String):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = _type;
|
||||
ao["points"] = optimize(_shape);
|
||||
@ -65,7 +65,6 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
ao["status"] = _status;
|
||||
ao["transparency"] = _transparent;
|
||||
|
||||
var wbId:String = wbModel.getCurrentWhiteboardId();
|
||||
if (wbId != null) {
|
||||
ao["whiteboardId"] = wbId;
|
||||
}
|
||||
|
@ -23,6 +23,6 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
|
||||
public interface IDrawAnnotation
|
||||
{
|
||||
function createAnnotation(wbModel:WhiteboardModel):Annotation;
|
||||
function createAnnotation(wbId:String):Annotation;
|
||||
}
|
||||
}
|
@ -56,7 +56,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
return shape;
|
||||
}
|
||||
|
||||
override public function createAnnotation(wbModel:WhiteboardModel):Annotation {
|
||||
override public function createAnnotation(wbId:String):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = _type;
|
||||
ao["points"] = optimize(_shape);
|
||||
@ -66,7 +66,6 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
ao["status"] = _status;
|
||||
ao["transparency"] = _transparent;
|
||||
|
||||
var wbId:String = wbModel.getCurrentWhiteboardId();
|
||||
if (wbId != null) {
|
||||
ao["whiteboardId"] = wbId;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
_transparent = trans;
|
||||
}
|
||||
|
||||
override public function createAnnotation(wbModel:WhiteboardModel):Annotation {
|
||||
override public function createAnnotation(wbId:String):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = _type;
|
||||
ao["points"] = _shape;
|
||||
@ -51,7 +51,6 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
ao["status"] = _status;
|
||||
ao["transparency"] = _transparent;
|
||||
|
||||
var wbId:String = wbModel.getCurrentWhiteboardId();
|
||||
if (wbId != null) {
|
||||
ao["whiteboardId"] = wbId;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
return shape;
|
||||
}
|
||||
|
||||
override public function createAnnotation(wbModel:WhiteboardModel):Annotation {
|
||||
override public function createAnnotation(wbId:String):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = _type;
|
||||
ao["points"] = optimize(_shape);
|
||||
@ -65,7 +65,6 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
ao["status"] = _status;
|
||||
ao["transparency"] = _transparent;
|
||||
|
||||
var wbId:String = wbModel.getCurrentWhiteboardId();
|
||||
if (wbId != null) {
|
||||
ao["whiteboardId"] = wbId;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
_calcedFontSize = calcedFontSize;
|
||||
}
|
||||
|
||||
override public function createAnnotation(wbModel:WhiteboardModel):Annotation {
|
||||
override public function createAnnotation(wbId:String):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = AnnotationType.TEXT;
|
||||
ao["id"] = _id;
|
||||
@ -63,7 +63,6 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
ao["textBoxWidth"] = _textBoxWidth;
|
||||
ao["textBoxHeight"] = _textBoxHeight;
|
||||
|
||||
var wbId:String = wbModel.getCurrentWhiteboardId();
|
||||
if (wbId != null) {
|
||||
ao["whiteboardId"] = wbId;
|
||||
}
|
||||
|
@ -78,6 +78,10 @@ package org.bigbluebutton.modules.whiteboard.business.shapes {
|
||||
return _fontSize;
|
||||
}
|
||||
|
||||
public function get whiteboardId():String {
|
||||
return _ao.whiteboardId;
|
||||
}
|
||||
|
||||
public function denormalize(val:Number, side:Number):Number {
|
||||
return (val*side)/100.0;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
return shape;
|
||||
}
|
||||
|
||||
override public function createAnnotation(wbModel:WhiteboardModel):Annotation {
|
||||
override public function createAnnotation(wbId:String):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = _type;
|
||||
ao["points"] = optimize(_shape);
|
||||
@ -65,7 +65,6 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
ao["status"] = _status;
|
||||
ao["transparency"] = _transparent;
|
||||
|
||||
var wbId:String = wbModel.getCurrentWhiteboardId();
|
||||
if (wbId != null) {
|
||||
ao["whiteboardId"] = wbId;
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
package org.bigbluebutton.modules.whiteboard.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class GetCurrentPresentationInfo extends Event
|
||||
{
|
||||
public static const GET_CURRENT_PRESENTATION_INFO:String = "Get Current Presentation Info Event";
|
||||
|
||||
public function GetCurrentPresentationInfo()
|
||||
{
|
||||
super(GET_CURRENT_PRESENTATION_INFO, true, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.modules.whiteboard.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
import mx.collections.ArrayCollection;
|
||||
|
||||
public class PageEvent extends Event
|
||||
{
|
||||
public static const CHANGE_PAGE:String = "ChangePage";
|
||||
public static const LOAD_PAGE:String = "LoadPage";
|
||||
|
||||
public var pageNum:Number;
|
||||
public var graphicObjs:ArrayCollection;
|
||||
public var isGrid:Boolean;
|
||||
|
||||
public function PageEvent(type:String)
|
||||
{
|
||||
super(type, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package org.bigbluebutton.modules.whiteboard.events {
|
||||
import flash.events.Event;
|
||||
|
||||
import org.bigbluebutton.modules.whiteboard.views.IWhiteboardReceiver;
|
||||
|
||||
public class RequestNewCanvasEvent extends Event {
|
||||
public static const REQUEST_NEW_CANVAS:String = "request_new_whiteboard_canvas";
|
||||
|
||||
public var receivingObject:IWhiteboardReceiver;
|
||||
|
||||
public function RequestNewCanvasEvent(ro:IWhiteboardReceiver) {
|
||||
super(REQUEST_NEW_CANVAS, false, false);
|
||||
receivingObject = ro;
|
||||
}
|
||||
}
|
||||
}
|
@ -20,14 +20,15 @@ package org.bigbluebutton.modules.whiteboard.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class WhiteboardPresenterEvent extends Event
|
||||
public class WhiteboardAccessEvent extends Event
|
||||
{
|
||||
public static const MODIFY_WHITEBOARD_ACCESS:String = "MODIFY_WHITEBOARD_ACCESS_EVENT";
|
||||
public static const MODIFIED_WHITEBOARD_ACCESS:String = "MODIFIED_WHITEBOARD_ACCESS_EVENT";
|
||||
|
||||
public var multiUser:Boolean;
|
||||
public var whiteboardId:String;
|
||||
|
||||
public function WhiteboardPresenterEvent(type:String)
|
||||
public function WhiteboardAccessEvent(type:String)
|
||||
{
|
||||
super(type, false, false);
|
||||
}
|
@ -26,16 +26,12 @@ package org.bigbluebutton.modules.whiteboard.events
|
||||
{
|
||||
public static const ENABLE_WHITEBOARD:String = "enable_whiteboard";
|
||||
public static const DISABLE_WHITEBOARD:String = "disable_whiteboard";
|
||||
public static const WHITEBOARD_ADDED_TO_PRESENTATION:String = "whiteboard_added";
|
||||
public static const CHANGE_TO_PENCIL:String = "change-to-pencil";
|
||||
|
||||
public static const WHITEBOARD_BUTTON_PRESSED:String = "WhiteboardButtonPressedEvent";
|
||||
|
||||
public var toolType:String;
|
||||
public var graphicType:String;
|
||||
|
||||
public var window:PresentationWindow;
|
||||
|
||||
public function WhiteboardButtonEvent(type:String)
|
||||
{
|
||||
super(type, true, false);
|
||||
|
@ -29,10 +29,9 @@ package org.bigbluebutton.modules.whiteboard.events
|
||||
public static const SEND_SHAPE:String = "sendShape";
|
||||
public static const CLEAR:String = "WhiteboardClearCommand";
|
||||
public static const UNDO:String = "WhiteboardUndoCommand";
|
||||
|
||||
public static const GET_ANNOTATION_HISTORY:String = "WhiteboardGetAnnotationHistory";
|
||||
|
||||
public var annotation:Annotation;
|
||||
public var wbId:String;
|
||||
|
||||
public function WhiteboardDrawEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false)
|
||||
{
|
||||
|
@ -1,18 +0,0 @@
|
||||
package org.bigbluebutton.modules.whiteboard.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class WhiteboardShapesEvent extends Event
|
||||
{
|
||||
|
||||
public static const SHAPES_EVENT:String = "whiteboard shapes history event";
|
||||
|
||||
public var whiteboardId:String;
|
||||
|
||||
public function WhiteboardShapesEvent(wbId:String)
|
||||
{
|
||||
super(SHAPES_EVENT, true, false);
|
||||
whiteboardId = wbId;
|
||||
}
|
||||
}
|
||||
}
|
@ -22,27 +22,19 @@ package org.bigbluebutton.modules.whiteboard.events
|
||||
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
|
||||
public class WhiteboardUpdate extends Event
|
||||
public class WhiteboardUpdateReceived extends Event
|
||||
{
|
||||
public static const BOARD_UPDATED:String = "boardUpdated";
|
||||
public static const BOARD_CLEARED:String = "boardClear";
|
||||
public static const BOARD_ENABLED:String = "boardEnabled";
|
||||
public static const GRAPHIC_UNDONE:String = "graphicUndone";
|
||||
|
||||
|
||||
// Event to notify display of presenter's request.
|
||||
public static const UNDO_ANNOTATION:String = "WhiteboardUndoAnnotationEvent";
|
||||
public static const CLEAR_ANNOTATIONS:String = "WhiteboardClearAnnotationEvent";
|
||||
public static const NEW_ANNOTATION:String = "boardUpdated";
|
||||
public static const UNDO_ANNOTATION:String = "WhiteboardUndoAnnotationEvent";
|
||||
public static const CLEAR_ANNOTATIONS:String = "WhiteboardClearAnnotationEvent";
|
||||
public static const RECEIVED_ANNOTATION_HISTORY:String = "WhiteboardReceivedAnnotationHistoryEvent";
|
||||
public static const CHANGE_PAGE:String = "WhiteboardChangePageEvent";
|
||||
|
||||
public var annotation:Annotation;
|
||||
public var boardEnabled:Boolean;
|
||||
public var annotationID:String;
|
||||
public var pageID:String;
|
||||
public var wbId:String;
|
||||
public var userId:String;
|
||||
|
||||
public function WhiteboardUpdate(type:String)
|
||||
public function WhiteboardUpdateReceived(type:String)
|
||||
{
|
||||
super(type, true, false);
|
||||
}
|
@ -26,13 +26,12 @@ package org.bigbluebutton.modules.whiteboard.managers
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.common.events.AddUIComponentToMainCanvas;
|
||||
import org.bigbluebutton.modules.present.api.PresentationAPI;
|
||||
import org.bigbluebutton.modules.present.events.PageLoadedEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasDisplayModel;
|
||||
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasModel;
|
||||
import org.bigbluebutton.modules.whiteboard.events.RequestNewCanvasEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardShapesEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdateReceived;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
import org.bigbluebutton.modules.whiteboard.views.WhiteboardCanvas;
|
||||
import org.bigbluebutton.modules.whiteboard.views.WhiteboardTextToolbar;
|
||||
@ -44,108 +43,24 @@ package org.bigbluebutton.modules.whiteboard.managers
|
||||
|
||||
/* Injected by Mate */
|
||||
public var whiteboardModel:WhiteboardModel;
|
||||
|
||||
private var globalDispatcher:Dispatcher;
|
||||
private var highlighterCanvas:WhiteboardCanvas;
|
||||
private var highlighterToolbar:WhiteboardToolbar;
|
||||
private var textToolbar:WhiteboardTextToolbar;
|
||||
|
||||
private var model:WhiteboardCanvasModel = new WhiteboardCanvasModel();
|
||||
private var displayModel:WhiteboardCanvasDisplayModel = new WhiteboardCanvasDisplayModel();
|
||||
|
||||
private var previousWhiteboardPageId:String;
|
||||
|
||||
|
||||
public function WhiteboardManager() {
|
||||
globalDispatcher = new Dispatcher();
|
||||
|
||||
}
|
||||
|
||||
public function handleStartModuleEvent():void {
|
||||
if (highlighterCanvas != null) return;
|
||||
|
||||
highlighterCanvas = new WhiteboardCanvas();
|
||||
highlighterCanvas.model = model;
|
||||
highlighterCanvas.displayModel = displayModel;
|
||||
model.whiteboardModel = whiteboardModel
|
||||
|
||||
model.wbCanvas = highlighterCanvas;
|
||||
displayModel.setDependencies(highlighterCanvas, whiteboardModel);
|
||||
|
||||
if (highlighterToolbar != null) return;
|
||||
|
||||
highlighterToolbar = new WhiteboardToolbar();
|
||||
highlighterToolbar.canvas = highlighterCanvas;
|
||||
|
||||
if (textToolbar != null) return;
|
||||
|
||||
textToolbar = new WhiteboardTextToolbar();
|
||||
textToolbar.canvas = highlighterCanvas;
|
||||
textToolbar.init();
|
||||
highlighterCanvas.textToolbar = textToolbar;
|
||||
public function handleStartModuleEvent():void {
|
||||
|
||||
//Necessary now because of module loading race conditions
|
||||
var t:Timer = new Timer(1000, 1);
|
||||
t.addEventListener(TimerEvent.TIMER, addHighlighterCanvas);
|
||||
t.start();
|
||||
//var t:Timer = new Timer(1000, 1);
|
||||
//t.addEventListener(TimerEvent.TIMER, addHighlighterCanvas);
|
||||
//t.start();
|
||||
}
|
||||
|
||||
private function addHighlighterCanvas(e:TimerEvent):void {
|
||||
LOGGER.debug("Adding Whiteboard Overlay Canvas");
|
||||
PresentationAPI.getInstance().addOverlayCanvas(highlighterCanvas);
|
||||
}
|
||||
|
||||
public function positionToolbar(e:WhiteboardButtonEvent):void {
|
||||
// add text toolbar for allowing customization of text
|
||||
var addUIEvent:AddUIComponentToMainCanvas = new AddUIComponentToMainCanvas(AddUIComponentToMainCanvas.ADD_COMPONENT);
|
||||
addUIEvent.component = highlighterToolbar;
|
||||
globalDispatcher.dispatchEvent(addUIEvent);
|
||||
highlighterToolbar.positionToolbar(e.window);
|
||||
highlighterToolbar.stage.focus = highlighterToolbar;
|
||||
|
||||
var addTextToolbarEvent:AddUIComponentToMainCanvas = new AddUIComponentToMainCanvas(AddUIComponentToMainCanvas.ADD_COMPONENT);
|
||||
addTextToolbarEvent.component = textToolbar;
|
||||
globalDispatcher.dispatchEvent(addTextToolbarEvent);
|
||||
textToolbar.positionToolbar(e.window);
|
||||
public function handleRequestNewCanvas(e:RequestNewCanvasEvent):void {
|
||||
var whiteboardCanvas:WhiteboardCanvas = new WhiteboardCanvas(whiteboardModel);
|
||||
whiteboardCanvas.attachToReceivingObject(e.receivingObject);
|
||||
}
|
||||
|
||||
public function drawGraphic(event:WhiteboardUpdate):void {
|
||||
if (event.annotation.whiteboardId == whiteboardModel.getCurrentWhiteboardId()) {
|
||||
displayModel.drawGraphic(event);
|
||||
}
|
||||
}
|
||||
|
||||
public function clearAnnotations(event:WhiteboardUpdate):void {
|
||||
displayModel.clearBoard(event);
|
||||
}
|
||||
|
||||
public function receivedAnnotationsHistory(event:WhiteboardShapesEvent):void {
|
||||
displayModel.receivedAnnotationsHistory(event.whiteboardId);
|
||||
}
|
||||
|
||||
public function undoAnnotation(event:WhiteboardUpdate):void {
|
||||
displayModel.undoAnnotation(event.annotation);
|
||||
}
|
||||
|
||||
public function enableWhiteboard(e:WhiteboardButtonEvent):void {
|
||||
highlighterCanvas.enableWhiteboard(e);
|
||||
}
|
||||
|
||||
public function disableWhiteboard(e:WhiteboardButtonEvent):void {
|
||||
highlighterCanvas.disableWhiteboard(e);
|
||||
}
|
||||
|
||||
public function handlePageChangedEvent(e:PageLoadedEvent):void {
|
||||
if(!whiteboardModel.isOverlayingDeskshare()) {
|
||||
whiteboardModel.setCurrentWhiteboardId(e.pageId);
|
||||
displayModel.changePage(e.pageId);
|
||||
}
|
||||
else LOGGER.debug("Got new slide page loaded, but current whiteboard page is deskshare: doing nothing.");
|
||||
}
|
||||
|
||||
public function handleChangeWhiteboardPageEvent(e:WhiteboardUpdate):void {
|
||||
whiteboardModel.setCurrentWhiteboardId(e.pageID);
|
||||
displayModel.changePage(e.pageID);
|
||||
}
|
||||
|
||||
public function removeAnnotationsHistory():void {
|
||||
// it will dispatch the cleanAnnotations in the displayModel later
|
||||
whiteboardModel.clearAll();
|
||||
|
@ -24,33 +24,27 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
import org.bigbluebutton.main.events.ModuleStartedEvent;
|
||||
import org.bigbluebutton.modules.present.events.AddOverlayCanvasEvent;
|
||||
import org.bigbluebutton.modules.present.events.PageLoadedEvent;
|
||||
import org.bigbluebutton.modules.present.events.PresentationEvent;
|
||||
import org.bigbluebutton.modules.present.events.UploadEvent;
|
||||
import org.bigbluebutton.modules.present.events.WindowResizedEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.commands.GetWhiteboardAccessCommand;
|
||||
import org.bigbluebutton.modules.whiteboard.commands.GetWhiteboardShapesCommand;
|
||||
import org.bigbluebutton.modules.whiteboard.events.PageEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.RequestNewCanvasEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.StartWhiteboardModuleEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardAccessEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardShapesEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdateReceived;
|
||||
import org.bigbluebutton.modules.whiteboard.managers.WhiteboardManager;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
import org.bigbluebutton.modules.whiteboard.services.MessageReceiver;
|
||||
import org.bigbluebutton.modules.whiteboard.services.MessageSender;
|
||||
import org.bigbluebutton.modules.whiteboard.services.WhiteboardService;
|
||||
import org.bigbluebutton.modules.whiteboard.views.WhiteboardCanvas;
|
||||
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
|
||||
<EventHandlers type="{WhiteboardPresenterEvent.MODIFY_WHITEBOARD_ACCESS}" >
|
||||
<EventHandlers type="{WhiteboardAccessEvent.MODIFY_WHITEBOARD_ACCESS}" >
|
||||
<MethodInvoker generator="{WhiteboardService}" method="modifyAccess" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
@ -65,13 +59,17 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<EventHandlers type="{StartWhiteboardModuleEvent.START_HIGHLIGHTER_MODULE_EVENT}">
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="handleStartModuleEvent" />
|
||||
</EventHandlers>
|
||||
|
||||
|
||||
<EventHandlers type="{RequestNewCanvasEvent.REQUEST_NEW_CANVAS}">
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="handleRequestNewCanvas" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{GetWhiteboardShapesCommand.GET_SHAPES}">
|
||||
<MethodInvoker generator="{WhiteboardService}" method="getAnnotationHistory" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{WhiteboardDrawEvent.CLEAR}" >
|
||||
<MethodInvoker generator="{WhiteboardService}" method="clearBoard" />
|
||||
<MethodInvoker generator="{WhiteboardService}" method="clearBoard" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{WhiteboardDrawEvent.SEND_SHAPE}">
|
||||
@ -79,45 +77,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{WhiteboardDrawEvent.UNDO}" >
|
||||
<MethodInvoker generator="{WhiteboardService}" method="undoGraphic" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{WhiteboardButtonEvent.WHITEBOARD_ADDED_TO_PRESENTATION}" >
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="positionToolbar" arguments="{event}" />
|
||||
<MethodInvoker generator="{WhiteboardService}" method="undoGraphic" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{WhiteboardShapesEvent.SHAPES_EVENT}" >
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="receivedAnnotationsHistory" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{WhiteboardUpdate.CLEAR_ANNOTATIONS}" >
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="clearAnnotations" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{WhiteboardUpdate.BOARD_UPDATED}" >
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="drawGraphic" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{WhiteboardUpdate.UNDO_ANNOTATION}" >
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="undoAnnotation" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{WhiteboardButtonEvent.ENABLE_WHITEBOARD}" >
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="enableWhiteboard" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{WhiteboardButtonEvent.DISABLE_WHITEBOARD}" >
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="disableWhiteboard" arguments="{event}" />
|
||||
<EventHandlers type="{GetWhiteboardShapesCommand.GET_SHAPES}" >
|
||||
<MethodInvoker generator="{WhiteboardService}" method="getAnnotationHistory" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{PageLoadedEvent.PAGE_LOADED_EVENT}" >
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="handlePageChangedEvent" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{WhiteboardUpdate.CHANGE_PAGE}" >
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="handleChangeWhiteboardPageEvent" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{BBBEvent.RECONNECT_BIGBLUEBUTTON_SUCCEEDED_EVENT}" >
|
||||
<MethodInvoker generator="{WhiteboardManager}" method="removeAnnotationsHistory" />
|
||||
</EventHandlers>
|
||||
|
@ -7,6 +7,7 @@ package org.bigbluebutton.modules.whiteboard.models
|
||||
public class Whiteboard
|
||||
{
|
||||
private var _id:String;
|
||||
private var _historyLoaded:Boolean = false;
|
||||
private var _annotations:ArrayCollection = new ArrayCollection();
|
||||
|
||||
public function Whiteboard(id:String) {
|
||||
@ -17,10 +18,22 @@ package org.bigbluebutton.modules.whiteboard.models
|
||||
return _id;
|
||||
}
|
||||
|
||||
public function get historyLoaded():Boolean {
|
||||
return _historyLoaded;
|
||||
}
|
||||
|
||||
public function set historyLoaded(v:Boolean):void {
|
||||
_historyLoaded = v;
|
||||
}
|
||||
|
||||
public function addAnnotation(annotation:Annotation):void {
|
||||
_annotations.addItem(annotation);
|
||||
}
|
||||
|
||||
public function addAnnotationAt(annotation:Annotation, index:int):void {
|
||||
_annotations.addItemAt(annotation, index);
|
||||
}
|
||||
|
||||
public function updateAnnotation(annotation:Annotation):void {
|
||||
var a:Annotation = getAnnotation(annotation.id);
|
||||
if (a != null) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.bigbluebutton.modules.whiteboard.models
|
||||
{
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.events.IEventDispatcher;
|
||||
|
||||
import mx.collections.ArrayCollection;
|
||||
@ -28,11 +29,12 @@ package org.bigbluebutton.modules.whiteboard.models
|
||||
import org.bigbluebutton.modules.present.model.Page;
|
||||
import org.bigbluebutton.modules.present.model.PresentationModel;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardShapesEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
|
||||
import org.bigbluebutton.modules.whiteboard.commands.GetWhiteboardShapesCommand;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardAccessEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdateReceived;
|
||||
|
||||
public class WhiteboardModel
|
||||
public class WhiteboardModel extends EventDispatcher
|
||||
{
|
||||
private static const LOGGER:ILogger = getClassLogger(WhiteboardModel);
|
||||
private var _whiteboards:ArrayCollection = new ArrayCollection();
|
||||
@ -40,69 +42,63 @@ package org.bigbluebutton.modules.whiteboard.models
|
||||
private var _multiUser:Boolean = false;
|
||||
|
||||
private var _dispatcher:IEventDispatcher;
|
||||
|
||||
private var currentWhiteboardId:String;
|
||||
|
||||
public function WhiteboardModel(dispatcher:IEventDispatcher) {
|
||||
_dispatcher = dispatcher;
|
||||
}
|
||||
|
||||
private function getWhiteboard(id:String):Whiteboard {
|
||||
for (var i:int = 0; i < _whiteboards.length; i++) {
|
||||
var wb:Whiteboard = _whiteboards.getItemAt(i) as Whiteboard;
|
||||
if (wb.id == id) return wb;
|
||||
}
|
||||
return null;
|
||||
private function getWhiteboard(id:String, requestHistory:Boolean=true):Whiteboard {
|
||||
var wb:Whiteboard;
|
||||
|
||||
for (var i:int = 0; i < _whiteboards.length; i++) {
|
||||
wb = _whiteboards.getItemAt(i) as Whiteboard;
|
||||
if (wb.id == id) return wb;
|
||||
}
|
||||
|
||||
wb = new Whiteboard(id);
|
||||
_whiteboards.addItem(wb);
|
||||
|
||||
if (requestHistory) {
|
||||
_dispatcher.dispatchEvent(new GetWhiteboardShapesCommand(id));
|
||||
}
|
||||
|
||||
return wb;
|
||||
}
|
||||
|
||||
public function addAnnotation(annotation:Annotation):void {
|
||||
// LOGGER.debug("*** Adding annotation [{0},{1},{2}] ****", [annotation.id, annotation.type, annotation.status]);
|
||||
var wb:Whiteboard;
|
||||
public function addAnnotation(annotation:Annotation):void {
|
||||
// LOGGER.debug("*** Adding annotation [{0},{1},{2}] ****", [annotation.id, annotation.type, annotation.status]);
|
||||
var wb:Whiteboard = getWhiteboard(annotation.whiteboardId);;
|
||||
if (annotation.status == AnnotationStatus.DRAW_START || annotation.type == AnnotationType.POLL) {
|
||||
wb = getWhiteboard(annotation.whiteboardId);
|
||||
if (wb != null) {
|
||||
wb.addAnnotation(annotation);
|
||||
} else {
|
||||
wb = new Whiteboard(annotation.whiteboardId);
|
||||
wb.addAnnotation(annotation);
|
||||
_whiteboards.addItem(wb);
|
||||
}
|
||||
} else {
|
||||
wb = getWhiteboard(annotation.whiteboardId);
|
||||
if (wb != null) {
|
||||
wb.updateAnnotation(annotation);
|
||||
}
|
||||
}
|
||||
|
||||
wb.addAnnotation(annotation);
|
||||
} else {
|
||||
wb.updateAnnotation(annotation);
|
||||
}
|
||||
// LOGGER.debug("*** Dispatching WhiteboardUpdate.BOARD_UPDATED Event ****");
|
||||
var event:WhiteboardUpdate = new WhiteboardUpdate(WhiteboardUpdate.BOARD_UPDATED);
|
||||
event.annotation = annotation;
|
||||
_dispatcher.dispatchEvent(event);
|
||||
// trace(LOG + "*** Dispatched WhiteboardUpdate.BOARD_UPDATED Event ****");
|
||||
}
|
||||
var event:WhiteboardUpdateReceived = new WhiteboardUpdateReceived(WhiteboardUpdateReceived.NEW_ANNOTATION);
|
||||
event.annotation = annotation;
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
private function addShapes(wb:Whiteboard, shapes:Array):void {
|
||||
for (var i:int = 0; i < shapes.length; i++) {
|
||||
var an:Annotation = shapes[i] as Annotation;
|
||||
wb.addAnnotation(an);
|
||||
wb.addAnnotationAt(an, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function addAnnotationFromHistory(whiteboardId:String, annotation:Array):void {
|
||||
//LOGGER.debug("addAnnotationFromHistory: wb id=[{0}]", [whiteboardId]);
|
||||
var wb:Whiteboard = getWhiteboard(whiteboardId);
|
||||
if (wb != null) {
|
||||
// LOGGER.debug("Whiteboard is already present. Adding shapes.");
|
||||
var wb:Whiteboard = getWhiteboard(whiteboardId, false);
|
||||
if (wb != null && !wb.historyLoaded) {
|
||||
// LOGGER.debug("Whiteboard is already present. Adding shapes.");
|
||||
addShapes(wb, annotation);
|
||||
} else {
|
||||
// LOGGER.debug("Whiteboard is NOT present. Creating WB and adding shapes.");
|
||||
wb = new Whiteboard(whiteboardId);
|
||||
addShapes(wb, annotation);
|
||||
_whiteboards.addItem(wb);
|
||||
}
|
||||
|
||||
_dispatcher.dispatchEvent(new WhiteboardShapesEvent(wb.id));
|
||||
wb.historyLoaded = true;
|
||||
|
||||
var e:WhiteboardUpdateReceived = new WhiteboardUpdateReceived(WhiteboardUpdateReceived.RECEIVED_ANNOTATION_HISTORY);
|
||||
e.wbId = wb.id;
|
||||
dispatchEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeAnnotation(wbId:String, shapeId:String):void {
|
||||
@ -111,23 +107,12 @@ package org.bigbluebutton.modules.whiteboard.models
|
||||
if (wb != null) {
|
||||
var removedAnnotation:Annotation = wb.undo(shapeId);
|
||||
if (removedAnnotation != null) {
|
||||
var e:WhiteboardUpdate = new WhiteboardUpdate(WhiteboardUpdate.UNDO_ANNOTATION);
|
||||
var e:WhiteboardUpdateReceived = new WhiteboardUpdateReceived(WhiteboardUpdateReceived.UNDO_ANNOTATION);
|
||||
e.annotation = removedAnnotation;
|
||||
_dispatcher.dispatchEvent(e);
|
||||
dispatchEvent(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getAnnotation(id:String):Annotation {
|
||||
var wbId:String = getCurrentWhiteboardId();
|
||||
if (wbId != null) {
|
||||
var wb:Whiteboard = getWhiteboard(wbId);
|
||||
if (wb != null) {
|
||||
return wb.getAnnotation(id);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getAnnotations(wbId:String):Array {
|
||||
var wb:Whiteboard = getWhiteboard(wbId);
|
||||
@ -142,48 +127,33 @@ package org.bigbluebutton.modules.whiteboard.models
|
||||
LOGGER.debug("Clearing whiteboard");
|
||||
var wb:Whiteboard = getWhiteboard(wbId);
|
||||
if (wb != null) {
|
||||
var event:WhiteboardUpdateReceived = new WhiteboardUpdateReceived(WhiteboardUpdateReceived.CLEAR_ANNOTATIONS);
|
||||
event.wbId = wbId;
|
||||
if (fullClear) {
|
||||
wb.clearAll();
|
||||
_dispatcher.dispatchEvent(new WhiteboardUpdate(WhiteboardUpdate.CLEAR_ANNOTATIONS));
|
||||
} else {
|
||||
wb.clear(userId);
|
||||
var event:WhiteboardUpdate = new WhiteboardUpdate(WhiteboardUpdate.CLEAR_ANNOTATIONS);
|
||||
event.userId = userId;
|
||||
_dispatcher.dispatchEvent(event);
|
||||
}
|
||||
dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
public function clearAll():void {
|
||||
_whiteboards.removeAll();
|
||||
_dispatcher.dispatchEvent(new WhiteboardUpdate(WhiteboardUpdate.CLEAR_ANNOTATIONS));
|
||||
|
||||
var event:WhiteboardUpdateReceived = new WhiteboardUpdateReceived(WhiteboardUpdateReceived.CLEAR_ANNOTATIONS);
|
||||
event.wbId = "all";
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
public function accessModified(multiUser:Boolean):void {
|
||||
_multiUser = multiUser;
|
||||
|
||||
var event:WhiteboardPresenterEvent = new WhiteboardPresenterEvent(WhiteboardPresenterEvent.MODIFIED_WHITEBOARD_ACCESS);
|
||||
var event:WhiteboardAccessEvent = new WhiteboardAccessEvent(WhiteboardAccessEvent.MODIFIED_WHITEBOARD_ACCESS);
|
||||
event.multiUser = multiUser;
|
||||
_dispatcher.dispatchEvent(event);
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
|
||||
public function getCurrentWhiteboardId():String {
|
||||
if(currentWhiteboardId)
|
||||
return currentWhiteboardId;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function setCurrentWhiteboardId(whiteboardId:String):void {
|
||||
currentWhiteboardId = whiteboardId;
|
||||
LOGGER.debug("currentWhiteboardId set to: " + currentWhiteboardId);
|
||||
LOGGER.debug("(current page id: " + PresentationModel.getInstance().getCurrentPage().id + ")");
|
||||
}
|
||||
|
||||
public function isOverlayingDeskshare():Boolean {
|
||||
return (currentWhiteboardId && currentWhiteboardId == "deskshare");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -23,13 +23,13 @@ package org.bigbluebutton.modules.whiteboard.services
|
||||
import org.bigbluebutton.core.BBB;
|
||||
import org.bigbluebutton.core.managers.ConnectionManager;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardAccessEvent;
|
||||
|
||||
public class MessageSender
|
||||
{
|
||||
private static const LOGGER:ILogger = getClassLogger(MessageSender);
|
||||
|
||||
public function modifyAccess(e:WhiteboardPresenterEvent):void {
|
||||
public function modifyAccess(e:WhiteboardAccessEvent):void {
|
||||
// LogUtil.debug("Sending [whiteboard.enableWhiteboard] to server.");
|
||||
var message:Object = new Object();
|
||||
message["multiUser"] = e.multiUser;
|
||||
|
@ -22,7 +22,7 @@ package org.bigbluebutton.modules.whiteboard.services
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.modules.whiteboard.commands.GetWhiteboardShapesCommand;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardAccessEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
|
||||
public class WhiteboardService
|
||||
@ -38,7 +38,7 @@ package org.bigbluebutton.modules.whiteboard.services
|
||||
sender.requestAnnotationHistory(cmd.whiteboardId);
|
||||
}
|
||||
|
||||
public function modifyAccess(e:WhiteboardPresenterEvent):void {
|
||||
public function modifyAccess(e:WhiteboardAccessEvent):void {
|
||||
sender.modifyAccess(e);
|
||||
}
|
||||
|
||||
@ -50,19 +50,15 @@ package org.bigbluebutton.modules.whiteboard.services
|
||||
sender.toggleGrid();
|
||||
}
|
||||
|
||||
public function undoGraphic():void {
|
||||
var wbId:String = whiteboardModel.getCurrentWhiteboardId();
|
||||
if (wbId != null) {
|
||||
|
||||
sender.undoGraphic(wbId)
|
||||
public function undoGraphic(e:WhiteboardDrawEvent):void {
|
||||
if (e.wbId != null) {
|
||||
sender.undoGraphic(e.wbId)
|
||||
}
|
||||
}
|
||||
|
||||
public function clearBoard():void {
|
||||
var wbId:String = whiteboardModel.getCurrentWhiteboardId();
|
||||
if (wbId != null) {
|
||||
LOGGER.debug("Clear shape for wb [{0}]", [wbId]);
|
||||
sender.clearBoard(wbId);
|
||||
public function clearBoard(e:WhiteboardDrawEvent):void {
|
||||
if (e.wbId != null) {
|
||||
sender.clearBoard(e.wbId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
|
||||
public interface IDrawListener
|
||||
{
|
||||
function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void;
|
||||
function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool, wbId:String):void;
|
||||
function onMouseMove(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void;
|
||||
function onMouseUp(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void;
|
||||
}
|
||||
|
@ -16,12 +16,10 @@
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.modules.whiteboard.views.models
|
||||
{
|
||||
public class WhiteboardCanvasModel
|
||||
{
|
||||
public function WhiteboardCanvasModel()
|
||||
{
|
||||
}
|
||||
|
||||
package org.bigbluebutton.modules.whiteboard.views {
|
||||
public interface IWhiteboardReceiver {
|
||||
function receiveToolbars(wt:WhiteboardToolbar, wtt:WhiteboardTextToolbar):void;
|
||||
function receiveCanvas(wc:WhiteboardCanvas):void;
|
||||
}
|
||||
}
|
@ -37,28 +37,22 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
private var _isDrawing:Boolean = false;;
|
||||
private var _segment:Array = new Array();
|
||||
private var _wbCanvas:WhiteboardCanvas;
|
||||
private var _sendFrequency:int;
|
||||
private var _shapeFactory:ShapeFactory;
|
||||
private var _idGenerator:AnnotationIDGenerator;
|
||||
private var _curID:String;
|
||||
private var _wbModel:WhiteboardModel;
|
||||
private var _wbId:String = null;
|
||||
|
||||
|
||||
public function PencilDrawListener(idGenerator:AnnotationIDGenerator,
|
||||
wbCanvas:WhiteboardCanvas,
|
||||
sendShapeFrequency:int,
|
||||
shapeFactory:ShapeFactory,
|
||||
wbModel:WhiteboardModel)
|
||||
shapeFactory:ShapeFactory)
|
||||
{
|
||||
_idGenerator = idGenerator;
|
||||
_wbCanvas = wbCanvas;
|
||||
_sendFrequency = sendShapeFrequency;
|
||||
_shapeFactory = shapeFactory;
|
||||
_wbModel = wbModel;
|
||||
}
|
||||
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void {
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool, wbId:String):void {
|
||||
//if (tool.graphicType == WhiteboardConstants.TYPE_SHAPE) {
|
||||
if (tool.toolType == AnnotationType.PENCIL) {
|
||||
if (_isDrawing) {
|
||||
@ -69,7 +63,7 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
_isDrawing = true;
|
||||
_drawStatus = AnnotationStatus.DRAW_START;
|
||||
|
||||
_wbId = _wbModel.getCurrentWhiteboardId();
|
||||
_wbId = wbId;
|
||||
|
||||
// Generate a shape id so we can match the mouse down and up events. Then we can
|
||||
// remove the specific shape when a mouse up occurs.
|
||||
@ -131,11 +125,7 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
dobj.status = status;
|
||||
dobj.id = _curID;
|
||||
|
||||
var an:Annotation = dobj.createAnnotation(_wbModel);
|
||||
|
||||
if (_wbId != null) {
|
||||
an.annotation["whiteboardId"] = _wbId;
|
||||
}
|
||||
var an:Annotation = dobj.createAnnotation(_wbId);
|
||||
|
||||
if (an != null) {
|
||||
_wbCanvas.sendGraphicToServer(an);
|
||||
|
@ -21,14 +21,11 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
import flash.geom.Point;
|
||||
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawAnnotation;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.ShapeFactory;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.AnnotationStatus;
|
||||
import org.bigbluebutton.modules.whiteboard.models.AnnotationType;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
import org.bigbluebutton.modules.whiteboard.views.models.WhiteboardTool;
|
||||
|
||||
public class ShapeDrawListener implements IDrawListener
|
||||
@ -37,26 +34,20 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
private var _isDrawing:Boolean = false;
|
||||
private var _segment:Array = new Array();
|
||||
private var _wbCanvas:WhiteboardCanvas;
|
||||
private var _sendFrequency:int;
|
||||
private var _shapeFactory:ShapeFactory;
|
||||
private var _idGenerator:AnnotationIDGenerator;
|
||||
private var _curID:String;
|
||||
private var _wbModel:WhiteboardModel;
|
||||
private var _wbId:String = null;
|
||||
|
||||
public function ShapeDrawListener(idGenerator:AnnotationIDGenerator,
|
||||
wbCanvas:WhiteboardCanvas,
|
||||
sendShapeFrequency:int,
|
||||
shapeFactory:ShapeFactory,
|
||||
wbModel:WhiteboardModel) {
|
||||
shapeFactory:ShapeFactory) {
|
||||
_idGenerator = idGenerator;
|
||||
_wbCanvas = wbCanvas;
|
||||
_sendFrequency = sendShapeFrequency;
|
||||
_shapeFactory = shapeFactory;
|
||||
_wbModel = wbModel;
|
||||
}
|
||||
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void {
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool, wbId:String):void {
|
||||
if (tool.toolType == AnnotationType.RECTANGLE ||
|
||||
tool.toolType == AnnotationType.TRIANGLE ||
|
||||
tool.toolType == AnnotationType.ELLIPSE ||
|
||||
@ -69,7 +60,7 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
_isDrawing = true;
|
||||
_drawStatus = AnnotationStatus.DRAW_START;
|
||||
|
||||
_wbId = _wbModel.getCurrentWhiteboardId();
|
||||
_wbId = wbId;
|
||||
|
||||
// Generate a shape id so we can match the mouse down and up events. Then we can
|
||||
// remove the specific shape when a mouse up occurs.
|
||||
@ -128,11 +119,7 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
dobj.status = status;
|
||||
dobj.id = _curID;
|
||||
|
||||
var an:Annotation = dobj.createAnnotation(_wbModel);
|
||||
|
||||
if (_wbId != null) {
|
||||
an.annotation["whiteboardId"] = _wbId;
|
||||
}
|
||||
var an:Annotation = dobj.createAnnotation(_wbId);
|
||||
|
||||
if (an != null) {
|
||||
_wbCanvas.sendGraphicToServer(an);
|
||||
|
@ -29,8 +29,6 @@ package org.bigbluebutton.modules.whiteboard.views {
|
||||
public class TextDrawListener implements IDrawListener {
|
||||
private var _wbCanvas:WhiteboardCanvas;
|
||||
|
||||
private var _sendFrequency:int;
|
||||
|
||||
private var _shapeFactory:ShapeFactory;
|
||||
|
||||
private var _mouseXDown:Number = 0;
|
||||
@ -53,19 +51,17 @@ package org.bigbluebutton.modules.whiteboard.views {
|
||||
|
||||
private var _curID:String;
|
||||
|
||||
private var _wbId:String;
|
||||
|
||||
private var feedback:RectangleFeedbackTextBox = new RectangleFeedbackTextBox();
|
||||
|
||||
private var _wbModel:WhiteboardModel;
|
||||
|
||||
public function TextDrawListener(idGenerator:AnnotationIDGenerator, wbCanvas:WhiteboardCanvas, sendShapeFrequency:int, shapeFactory:ShapeFactory, wbModel:WhiteboardModel) {
|
||||
public function TextDrawListener(idGenerator:AnnotationIDGenerator, wbCanvas:WhiteboardCanvas, shapeFactory:ShapeFactory) {
|
||||
_idGenerator = idGenerator;
|
||||
_wbCanvas = wbCanvas;
|
||||
_sendFrequency = sendShapeFrequency;
|
||||
_shapeFactory = shapeFactory;
|
||||
_wbModel = wbModel;
|
||||
}
|
||||
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void {
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool, wbId:String):void {
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_TEXT) {
|
||||
_mouseXDown = _mouseXMove = mouseX;
|
||||
_mouseYDown = _mouseYMove = mouseY;
|
||||
@ -75,10 +71,12 @@ package org.bigbluebutton.modules.whiteboard.views {
|
||||
// even if the user has mousedDown yet.
|
||||
_mousedDown = true;
|
||||
|
||||
_wbId = wbId;
|
||||
|
||||
// Need to check whether we were editing on mouse down because the edit will be finished by the time mouse up happens
|
||||
_wasEditing = _wbCanvas.isEditingText();
|
||||
|
||||
_wbCanvas.addRawChild(feedback);
|
||||
_wbCanvas.addGraphic(feedback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +96,7 @@ package org.bigbluebutton.modules.whiteboard.views {
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_TEXT && _mousedDown) {
|
||||
feedback.clear();
|
||||
if (_wbCanvas.contains(feedback)) {
|
||||
_wbCanvas.removeRawChild(feedback);
|
||||
_wbCanvas.removeGraphic(feedback);
|
||||
}
|
||||
|
||||
_mousedDown = false;
|
||||
@ -130,7 +128,7 @@ package org.bigbluebutton.modules.whiteboard.views {
|
||||
tobj.status = status;
|
||||
tobj.id = _curID;
|
||||
|
||||
_wbCanvas.sendGraphicToServer(tobj.createAnnotation(_wbModel));
|
||||
_wbCanvas.sendGraphicToServer(tobj.createAnnotation(_wbId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,18 +16,15 @@ package org.bigbluebutton.modules.whiteboard.views {
|
||||
|
||||
public class TextUpdateListener {
|
||||
private var _whiteboardCanvas:WhiteboardCanvas;
|
||||
private var _whiteboardModel:WhiteboardModel;
|
||||
private var _shapeFactory:ShapeFactory;
|
||||
|
||||
private var _currentTextObject:TextObject;
|
||||
private var _whiteboardId:String;
|
||||
|
||||
public function TextUpdateListener() {
|
||||
}
|
||||
|
||||
public function setDependencies(whiteboardCanvas:WhiteboardCanvas, whiteboardModel:WhiteboardModel, shapeFactory:ShapeFactory):void {
|
||||
public function setDependencies(whiteboardCanvas:WhiteboardCanvas, shapeFactory:ShapeFactory):void {
|
||||
_whiteboardCanvas = whiteboardCanvas;
|
||||
_whiteboardModel = whiteboardModel;
|
||||
_shapeFactory = shapeFactory;
|
||||
}
|
||||
|
||||
@ -54,8 +51,7 @@ package org.bigbluebutton.modules.whiteboard.views {
|
||||
canvasMouseDown();
|
||||
}
|
||||
_currentTextObject = tobj;
|
||||
_whiteboardId = _whiteboardModel.getCurrentWhiteboardId();
|
||||
_whiteboardCanvas.textToolbar.syncPropsWith(_currentTextObject);
|
||||
_whiteboardCanvas.textToolbarSyncProxy(_currentTextObject);
|
||||
_whiteboardCanvas.stage.focus = tobj;
|
||||
tobj.registerListeners(textObjLostFocusListener, textObjTextChangeListener, textObjKeyDownListener);
|
||||
}
|
||||
@ -63,7 +59,7 @@ package org.bigbluebutton.modules.whiteboard.views {
|
||||
public function removedTextObject(tobj:TextObject):void {
|
||||
if (tobj == _currentTextObject) {
|
||||
_currentTextObject = null;
|
||||
_whiteboardCanvas.textToolbar.syncPropsWith(null);
|
||||
_whiteboardCanvas.textToolbarSyncProxy(null);
|
||||
tobj.deregisterListeners(textObjLostFocusListener, textObjTextChangeListener, textObjKeyDownListener);
|
||||
}
|
||||
}
|
||||
@ -106,7 +102,7 @@ package org.bigbluebutton.modules.whiteboard.views {
|
||||
if (status == AnnotationStatus.DRAW_END) {
|
||||
tobj.deregisterListeners(textObjLostFocusListener, textObjTextChangeListener, textObjKeyDownListener);
|
||||
_currentTextObject = null;
|
||||
_whiteboardCanvas.textToolbar.syncPropsWith(null);
|
||||
_whiteboardCanvas.textToolbarSyncProxy(null);
|
||||
}
|
||||
|
||||
// LogUtil.debug("SENDING TEXT: [" + tobj.textSize + "]");
|
||||
@ -115,11 +111,7 @@ package org.bigbluebutton.modules.whiteboard.views {
|
||||
tda.status = status;
|
||||
tda.id = tobj.id;
|
||||
|
||||
var an:Annotation = tda.createAnnotation(_whiteboardModel);
|
||||
|
||||
if (_whiteboardId != null) {
|
||||
an.annotation["whiteboardId"] = _whiteboardId;
|
||||
}
|
||||
var an:Annotation = tda.createAnnotation(tobj.whiteboardId);
|
||||
|
||||
_whiteboardCanvas.sendGraphicToServer(an);
|
||||
}
|
||||
|
@ -0,0 +1,300 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.bigbluebutton.modules.whiteboard.views {
|
||||
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import com.asfusion.mate.events.Listener;
|
||||
|
||||
import flash.display.DisplayObject;
|
||||
import flash.events.Event;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
import mx.containers.Canvas;
|
||||
import mx.managers.CursorManager;
|
||||
|
||||
import org.bigbluebutton.common.Images;
|
||||
import org.bigbluebutton.main.events.MadePresenterEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasDisplayModel;
|
||||
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasModel;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
|
||||
import org.bigbluebutton.modules.whiteboard.commands.GetWhiteboardAccessCommand;
|
||||
import org.bigbluebutton.modules.whiteboard.commands.GetWhiteboardShapesCommand;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardAccessEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdateReceived;
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.AnnotationType;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
|
||||
public class WhiteboardCanvas extends Canvas {
|
||||
private var canvasModel:WhiteboardCanvasModel;
|
||||
private var canvasDisplayModel:WhiteboardCanvasDisplayModel;
|
||||
private var whiteboardToolbar:WhiteboardToolbar;
|
||||
private var textToolbar:WhiteboardTextToolbar;
|
||||
|
||||
private var graphicObjectHolder:Canvas = new Canvas();
|
||||
private var images:Images = new Images();
|
||||
|
||||
[Bindable] private var pencil_icon:Class = images.pencil_icon;
|
||||
[Bindable] private var rectangle_icon:Class = images.square_icon;
|
||||
[Bindable] private var triangle_icon:Class = images.triangle_icon;
|
||||
[Bindable] private var ellipse_icon:Class = images.circle_icon;
|
||||
[Bindable] private var line_icon:Class = images.line_icon;
|
||||
[Bindable] private var text_icon:Class = images.text_icon;
|
||||
private var toolType:String = AnnotationType.PENCIL;
|
||||
private var whiteboardEnabled:Boolean = false;
|
||||
private var currentWhiteboardId:String;
|
||||
|
||||
public function WhiteboardCanvas(wbModel:WhiteboardModel):void {
|
||||
canvasModel = new WhiteboardCanvasModel();
|
||||
canvasDisplayModel = new WhiteboardCanvasDisplayModel();
|
||||
|
||||
//set up model cross dependencies
|
||||
canvasModel.setDependencies(this, canvasDisplayModel);
|
||||
canvasDisplayModel.setDependencies(this, wbModel);
|
||||
|
||||
whiteboardToolbar = new WhiteboardToolbar();
|
||||
whiteboardToolbar.canvas = this;
|
||||
|
||||
textToolbar = new WhiteboardTextToolbar();
|
||||
textToolbar.canvas = this;
|
||||
|
||||
//create the annotation display container
|
||||
this.addChild(graphicObjectHolder);
|
||||
graphicObjectHolder.x = 0;
|
||||
graphicObjectHolder.y = 0;
|
||||
graphicObjectHolder.clipContent = true;
|
||||
graphicObjectHolder.tabFocusEnabled = false;
|
||||
|
||||
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
|
||||
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
|
||||
|
||||
wbModel.addEventListener(WhiteboardUpdateReceived.NEW_ANNOTATION, onNewAnnotationEvent);
|
||||
wbModel.addEventListener(WhiteboardUpdateReceived.RECEIVED_ANNOTATION_HISTORY, onReceivedAnnotationsHistory);
|
||||
wbModel.addEventListener(WhiteboardUpdateReceived.CLEAR_ANNOTATIONS, onClearAnnotations);
|
||||
wbModel.addEventListener(WhiteboardUpdateReceived.UNDO_ANNOTATION, onUndoAnnotation);
|
||||
wbModel.addEventListener(WhiteboardAccessEvent.MODIFIED_WHITEBOARD_ACCESS, onModifiedAccess);
|
||||
|
||||
whiteboardToolbar.addEventListener(WhiteboardButtonEvent.ENABLE_WHITEBOARD, onEnableWhiteboardEvent);
|
||||
whiteboardToolbar.addEventListener(WhiteboardButtonEvent.DISABLE_WHITEBOARD, onDisableWhiteboardEvent);
|
||||
}
|
||||
|
||||
public function attachToReceivingObject(ro:IWhiteboardReceiver):void {
|
||||
ro.receiveCanvas(this);
|
||||
ro.receiveToolbars(whiteboardToolbar, textToolbar);
|
||||
}
|
||||
|
||||
private function registerForMouseEvents():void {
|
||||
addEventListener(MouseEvent.MOUSE_DOWN, doMouseDown);
|
||||
}
|
||||
|
||||
private function unregisterForMouseEvents():void {
|
||||
removeEventListener(MouseEvent.MOUSE_DOWN, doMouseDown);
|
||||
}
|
||||
|
||||
private function doMouseUp(event:MouseEvent):void {
|
||||
canvasModel.doMouseUp(Math.min(Math.max(parent.mouseX, 0), parent.width) - this.x, Math.min(Math.max(parent.mouseY, 0), parent.height) - this.y);
|
||||
|
||||
stage.removeEventListener(MouseEvent.MOUSE_UP, doMouseUp);
|
||||
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doMouseMove);
|
||||
}
|
||||
|
||||
private function doMouseDown(event:MouseEvent):void {
|
||||
canvasModel.doMouseDown(this.mouseX, this.mouseY, currentWhiteboardId);
|
||||
canvasDisplayModel.doMouseDown(this.mouseX, this.mouseY);
|
||||
event.stopPropagation(); // we want to stop the bubbling so slide doesn't move
|
||||
|
||||
stage.addEventListener(MouseEvent.MOUSE_UP, doMouseUp);
|
||||
stage.addEventListener(MouseEvent.MOUSE_MOVE, doMouseMove);
|
||||
}
|
||||
|
||||
private function doMouseMove(event:MouseEvent):void {
|
||||
canvasModel.doMouseMove(Math.min(Math.max(parent.mouseX, 0), parent.width-1) - this.x, Math.min(Math.max(parent.mouseY, 0), parent.height-1) - this.y);
|
||||
}
|
||||
|
||||
public function changeColor(e:Event):void {
|
||||
canvasModel.changeColor(e.target.selectedColor);
|
||||
}
|
||||
|
||||
public function isEditingText():Boolean {
|
||||
return canvasDisplayModel.isEditingText();
|
||||
}
|
||||
|
||||
public function sendGraphicToServer(gobj:Annotation):void {
|
||||
// LogUtil.debug("DISPATCHING SEND sendGraphicToServer [" + type + "]");
|
||||
var event:WhiteboardDrawEvent = new WhiteboardDrawEvent(WhiteboardDrawEvent.SEND_SHAPE);
|
||||
event.annotation = gobj;
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatcher.dispatchEvent(event);
|
||||
}
|
||||
|
||||
public function sendUndoToServer():void {
|
||||
var event:WhiteboardDrawEvent = new WhiteboardDrawEvent(WhiteboardDrawEvent.UNDO);
|
||||
event.wbId = currentWhiteboardId;
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatcher.dispatchEvent(event);
|
||||
}
|
||||
|
||||
public function sendClearToServer():void {
|
||||
var event:WhiteboardDrawEvent = new WhiteboardDrawEvent(WhiteboardDrawEvent.CLEAR);
|
||||
event.wbId = currentWhiteboardId;
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatcher.dispatchEvent(event);
|
||||
}
|
||||
|
||||
public function setGraphicType(type:String):void {
|
||||
if (canvasModel == null) return;
|
||||
canvasModel.setGraphicType(type);
|
||||
}
|
||||
|
||||
public function setTool(s:String):void {
|
||||
if (canvasModel == null) return;
|
||||
canvasModel.setTool(s);
|
||||
toolType = s;
|
||||
}
|
||||
|
||||
public function changeThickness(e:Event):void {
|
||||
canvasModel.changeThickness(e.target.value);
|
||||
}
|
||||
|
||||
private function setWhiteboardInteractable():void {
|
||||
if (this.whiteboardEnabled) {
|
||||
registerForMouseEvents();
|
||||
} else {
|
||||
unregisterForMouseEvents();
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseOver(e:MouseEvent):void {
|
||||
setCursor(toolType);
|
||||
}
|
||||
|
||||
private function onMouseOut(e:MouseEvent):void {
|
||||
removeCursor();
|
||||
}
|
||||
|
||||
private function setCursor(toolType:String):void {
|
||||
if(toolType == AnnotationType.ELLIPSE) {
|
||||
CursorManager.setCursor(ellipse_icon);
|
||||
} else if(toolType == AnnotationType.RECTANGLE) {
|
||||
CursorManager.setCursor(rectangle_icon);
|
||||
} else if(toolType == AnnotationType.TRIANGLE) {
|
||||
CursorManager.setCursor(triangle_icon);
|
||||
} else if(toolType == AnnotationType.PENCIL) {
|
||||
CursorManager.setCursor(pencil_icon, 2, -2, -22);
|
||||
} else if(toolType == AnnotationType.LINE) {
|
||||
CursorManager.setCursor(line_icon);
|
||||
} else if(toolType == AnnotationType.TEXT) {
|
||||
CursorManager.setCursor(text_icon);
|
||||
}
|
||||
}
|
||||
|
||||
private function removeCursor():void {
|
||||
CursorManager.removeCursor(CursorManager.currentCursorID);
|
||||
}
|
||||
|
||||
public function doesContain(child:DisplayObject):Boolean {
|
||||
return this.graphicObjectHolder.rawChildren.contains(child);
|
||||
}
|
||||
|
||||
public function getMouseXY():Array {
|
||||
return [Math.min(Math.max(parent.mouseX, 0), parent.width-2) - this.x, Math.min(Math.max(parent.mouseY, 0), parent.height-2) - this.y];
|
||||
}
|
||||
|
||||
public function removeGraphic(child:DisplayObject):void {
|
||||
if (doesContain(child)) this.graphicObjectHolder.rawChildren.removeChild(child);
|
||||
else trace("Does not contain");
|
||||
}
|
||||
|
||||
public function addGraphic(child:DisplayObject):void {
|
||||
this.graphicObjectHolder.rawChildren.addChild(child);
|
||||
}
|
||||
|
||||
public function textToolbarSyncProxy(tobj:TextObject):void {
|
||||
textToolbar.syncPropsWith(tobj);
|
||||
}
|
||||
|
||||
public function moveCanvas(x:Number, y:Number):void {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public function zoomCanvas(width:Number, height:Number):void {
|
||||
graphicObjectHolder.width = width;
|
||||
graphicObjectHolder.height = height;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
canvasDisplayModel.zoomCanvas(width, height);
|
||||
canvasModel.zoomCanvas(width, height);
|
||||
textToolbar.adjustForZoom(width, height);
|
||||
}
|
||||
|
||||
public function displayWhiteboardById(wbId:String):void {
|
||||
currentWhiteboardId = wbId;
|
||||
canvasDisplayModel.changeWhiteboard(wbId);
|
||||
}
|
||||
|
||||
private function onNewAnnotationEvent(e:WhiteboardUpdateReceived):void {
|
||||
if (e.annotation.whiteboardId == currentWhiteboardId) {
|
||||
canvasDisplayModel.drawGraphic(e.annotation);
|
||||
}
|
||||
}
|
||||
|
||||
private function onClearAnnotations(e:WhiteboardUpdateReceived):void {
|
||||
if (e.wbId == currentWhiteboardId || e.wbId == "all") {
|
||||
canvasDisplayModel.clearBoard(e.userId);
|
||||
}
|
||||
}
|
||||
|
||||
private function onReceivedAnnotationsHistory(e:WhiteboardUpdateReceived):void {
|
||||
if (e.wbId == currentWhiteboardId) {
|
||||
canvasDisplayModel.receivedAnnotationsHistory(e.wbId);
|
||||
}
|
||||
}
|
||||
|
||||
private function onUndoAnnotation(e:WhiteboardUpdateReceived):void {
|
||||
if (e.annotation.whiteboardId == currentWhiteboardId) {
|
||||
canvasDisplayModel.undoAnnotation(e.annotation);
|
||||
}
|
||||
}
|
||||
|
||||
private function onModifiedAccess(e:WhiteboardAccessEvent):void {
|
||||
//if (e.whiteboardId == currentWhiteboardId) {
|
||||
whiteboardToolbar.whiteboardAccessModified(e.multiUser);
|
||||
//}
|
||||
}
|
||||
|
||||
private function onEnableWhiteboardEvent(e:WhiteboardButtonEvent):void {
|
||||
e.stopPropagation();
|
||||
|
||||
this.whiteboardEnabled = true;
|
||||
setWhiteboardInteractable();
|
||||
}
|
||||
|
||||
private function onDisableWhiteboardEvent(e:WhiteboardButtonEvent):void {
|
||||
e.stopPropagation();
|
||||
|
||||
this.whiteboardEnabled = false;
|
||||
setWhiteboardInteractable();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,279 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
|
||||
Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the
|
||||
terms of the GNU Lesser General Public License as published by the Free Software
|
||||
Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" xmlns:mate="http://mate.asfusion.com/"
|
||||
creationComplete="init()" visible="false" mouseOver="setCursor(toolType)" mouseOut="removeCursor()" implements="org.bigbluebutton.common.IBbbCanvas">
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
import mx.managers.CursorManager;
|
||||
|
||||
import org.bigbluebutton.common.IBbbCanvas;
|
||||
import org.bigbluebutton.common.Images;
|
||||
import org.bigbluebutton.main.events.MadePresenterEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasDisplayModel;
|
||||
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasModel;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
|
||||
import org.bigbluebutton.modules.whiteboard.commands.GetWhiteboardAccessCommand;
|
||||
import org.bigbluebutton.modules.whiteboard.commands.GetWhiteboardShapesCommand;
|
||||
import org.bigbluebutton.modules.whiteboard.events.PageEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.AnnotationType;
|
||||
|
||||
public var model:WhiteboardCanvasModel;
|
||||
public var displayModel:WhiteboardCanvasDisplayModel;
|
||||
|
||||
public var textToolbar:WhiteboardTextToolbar;
|
||||
private var bbbCanvas:IBbbCanvas;
|
||||
private var _xPosition:int;
|
||||
private var _yPosition:int;
|
||||
private var images:Images = new Images();
|
||||
|
||||
[Bindable] private var pencil_icon:Class = images.pencil_icon;
|
||||
[Bindable] private var rectangle_icon:Class = images.square_icon;
|
||||
[Bindable] private var triangle_icon:Class = images.triangle_icon;
|
||||
[Bindable] private var ellipse_icon:Class = images.circle_icon;
|
||||
[Bindable] private var line_icon:Class = images.line_icon;
|
||||
[Bindable] private var text_icon:Class = images.text_icon;
|
||||
private var toolType:String = AnnotationType.PENCIL;
|
||||
private var whiteboardEnabled:Boolean = false;
|
||||
private var showWhiteboard:Boolean = true;
|
||||
|
||||
private function init():void {
|
||||
this.label = "Highlighter";
|
||||
registerForMouseEvents();
|
||||
}
|
||||
|
||||
public function queryForAnnotationHistory(webId:String):void {
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatcher.dispatchEvent(new GetWhiteboardShapesCommand(webId));
|
||||
}
|
||||
|
||||
public function queryForWhiteboardAccess():void {
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatcher.dispatchEvent(new GetWhiteboardAccessCommand());
|
||||
}
|
||||
|
||||
public function registerForMouseEvents():void {
|
||||
addEventListener(MouseEvent.MOUSE_DOWN, doMouseDown);
|
||||
}
|
||||
|
||||
public function unregisterForMouseEvents():void {
|
||||
removeEventListener(MouseEvent.MOUSE_DOWN, doMouseDown);
|
||||
}
|
||||
|
||||
private function doMouseUp(event:MouseEvent):void {
|
||||
model.doMouseUp(Math.min(Math.max(parent.mouseX, 0), parent.width) - this.x, Math.min(Math.max(parent.mouseY, 0), parent.height) - this.y);
|
||||
|
||||
stage.removeEventListener(MouseEvent.MOUSE_UP, doMouseUp);
|
||||
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doMouseMove);
|
||||
}
|
||||
|
||||
private function doMouseDown(event:MouseEvent):void {
|
||||
model.doMouseDown(this.mouseX, this.mouseY);
|
||||
displayModel.doMouseDown(this.mouseX, this.mouseY);
|
||||
event.stopPropagation(); // we want to stop the bubbling so slide doesn't move
|
||||
|
||||
stage.addEventListener(MouseEvent.MOUSE_UP, doMouseUp);
|
||||
stage.addEventListener(MouseEvent.MOUSE_MOVE, doMouseMove);
|
||||
}
|
||||
|
||||
private function doMouseMove(event:MouseEvent):void {
|
||||
model.doMouseMove(Math.min(Math.max(parent.mouseX, 0), parent.width-1) - this.x, Math.min(Math.max(parent.mouseY, 0), parent.height-1) - this.y);
|
||||
}
|
||||
|
||||
public function changeColor(e:Event):void {
|
||||
model.changeColor(e.target.selectedColor);
|
||||
}
|
||||
|
||||
public function isEditingText():Boolean {
|
||||
return displayModel.isEditingText();
|
||||
}
|
||||
|
||||
public function sendGraphicToServer(gobj:Annotation):void {
|
||||
// LogUtil.debug("DISPATCHING SEND sendGraphicToServer [" + type + "]");
|
||||
var event:WhiteboardDrawEvent = new WhiteboardDrawEvent(WhiteboardDrawEvent.SEND_SHAPE);
|
||||
event.annotation = gobj;
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatcher.dispatchEvent(event);
|
||||
}
|
||||
|
||||
public function setGraphicType(type:String):void {
|
||||
if (model == null) return;
|
||||
model.setGraphicType(type);
|
||||
}
|
||||
|
||||
public function setTool(s:String):void {
|
||||
if (model == null) return;
|
||||
model.setTool(s);
|
||||
toolType = s;
|
||||
}
|
||||
|
||||
public function changeThickness(e:Event):void {
|
||||
model.changeThickness(e.target.value);
|
||||
}
|
||||
|
||||
public function get xPosition():int {
|
||||
return _xPosition;
|
||||
}
|
||||
|
||||
public function get yPosition():int {
|
||||
return _yPosition;
|
||||
}
|
||||
|
||||
public function set xPosition(x:int):void {
|
||||
_xPosition = x;
|
||||
}
|
||||
|
||||
public function set yPosition(y:int):void {
|
||||
_yPosition = y;
|
||||
}
|
||||
|
||||
private function setWhiteboardVisibility():void {
|
||||
if (this.whiteboardEnabled && this.showWhiteboard) {
|
||||
this.visible = true;
|
||||
registerForMouseEvents();
|
||||
} else {
|
||||
this.visible = false;
|
||||
unregisterForMouseEvents();
|
||||
}
|
||||
}
|
||||
|
||||
/* added this functionality in WhiteboardToolbar.mxml instead to allow a variety of cursors */
|
||||
public function setCursorPencil():void {
|
||||
CursorManager.setCursor(pencil_icon);
|
||||
}
|
||||
|
||||
public function setCursor(toolType:String):void {
|
||||
if(toolType == AnnotationType.ELLIPSE) {
|
||||
CursorManager.setCursor(ellipse_icon);
|
||||
} else if(toolType == AnnotationType.RECTANGLE) {
|
||||
CursorManager.setCursor(rectangle_icon);
|
||||
} else if(toolType == AnnotationType.TRIANGLE) {
|
||||
CursorManager.setCursor(triangle_icon);
|
||||
} else if(toolType == AnnotationType.PENCIL) {
|
||||
CursorManager.setCursor(pencil_icon, 2, -2, -22);
|
||||
} else if(toolType == AnnotationType.LINE) {
|
||||
CursorManager.setCursor(line_icon);
|
||||
} else if(toolType == AnnotationType.TEXT) {
|
||||
CursorManager.setCursor(text_icon);
|
||||
// } else if(toolType == SelectObject.SELECT_TOOL) {
|
||||
// CursorManager.setCursor(select_icon);
|
||||
}
|
||||
}
|
||||
|
||||
private function removeCursor():void {
|
||||
CursorManager.removeCursor(CursorManager.currentCursorID);
|
||||
}
|
||||
|
||||
/** Inherited from org.bigbluebutton.common.IBbbCanvas*/
|
||||
public function addRawChild(child:DisplayObject):void {
|
||||
this.bbbCanvas.addRawChild(child);
|
||||
}
|
||||
|
||||
public function removeRawChild(child:DisplayObject):void {
|
||||
this.bbbCanvas.removeRawChild(child);
|
||||
}
|
||||
|
||||
public function doesContain(child:DisplayObject):Boolean {
|
||||
return bbbCanvas.doesContain(child);
|
||||
}
|
||||
|
||||
public function acceptOverlayCanvas(overlay:IBbbCanvas):void {
|
||||
// LogUtil.debug("WhiteboardCanvas::acceptOverlayCanvas()");
|
||||
// LogUtil.debug("OVERLAYING PRESENTATION CANVAS");
|
||||
|
||||
this.bbbCanvas = overlay;
|
||||
//Load existing shapes onto the canvas.
|
||||
dispatchEvent(new PageEvent(PageEvent.LOAD_PAGE));
|
||||
|
||||
/**
|
||||
* Check if this is the first time we overlayed the whiteboard canvas into the
|
||||
* presentation canvas. If so, query for annotations history.
|
||||
*/
|
||||
if (! displayModel.canvasInited) {
|
||||
displayModel.parentCanvasInitialized();
|
||||
var webId:String = model.whiteboardModel.getCurrentWhiteboardId();
|
||||
if (webId != null) {
|
||||
queryForAnnotationHistory(webId);
|
||||
queryForWhiteboardAccess();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function moveCanvas(x:Number, y:Number):void {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public function getMouseXY():Array {
|
||||
return [Math.min(Math.max(parent.mouseX, 0), parent.width-2) - this.x, Math.min(Math.max(parent.mouseY, 0), parent.height-2) - this.y];
|
||||
}
|
||||
|
||||
public function removeGraphic(child:DisplayObject):void {
|
||||
if (bbbCanvas == null) return;
|
||||
if (doesContain(child)) removeRawChild(child);
|
||||
}
|
||||
|
||||
public function addGraphic(child:DisplayObject):void {
|
||||
if (bbbCanvas == null) return;
|
||||
addRawChild(child);
|
||||
}
|
||||
|
||||
public function zoomCanvas(width:Number, height:Number):void {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
displayModel.zoomCanvas(width, height);
|
||||
model.zoomCanvas(width, height);
|
||||
textToolbar.adjustForZoom(width, height);
|
||||
}
|
||||
|
||||
public function showCanvas(show:Boolean):void{
|
||||
this.showWhiteboard = show;
|
||||
|
||||
setWhiteboardVisibility();
|
||||
}
|
||||
|
||||
/** End IBBBCanvas*/
|
||||
public function isPageEmpty():Boolean {
|
||||
return displayModel.isPageEmpty();
|
||||
}
|
||||
|
||||
public function enableWhiteboard(e:WhiteboardButtonEvent):void{
|
||||
this.whiteboardEnabled = true;
|
||||
setWhiteboardVisibility();
|
||||
useHandCursor = false;
|
||||
}
|
||||
|
||||
public function disableWhiteboard(e:WhiteboardButtonEvent):void{
|
||||
this.whiteboardEnabled = false;
|
||||
setWhiteboardVisibility();
|
||||
useHandCursor = true;
|
||||
}
|
||||
|
||||
]]>
|
||||
</mx:Script>
|
||||
</mx:Canvas>
|
@ -24,20 +24,22 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
xmlns:mate="http://mate.asfusion.com/" visible="false" backgroundColor="0xCCCCCC"
|
||||
cornerRadius="5" borderStyle="solid"
|
||||
paddingBottom="3" paddingTop="3" paddingLeft="3" paddingRight="3" alpha="0"
|
||||
xmlns:views="org.bigbluebutton.modules.whiteboard.views.*" xmlns:local="*">
|
||||
xmlns:views="org.bigbluebutton.modules.whiteboard.views.*" xmlns:local="*"
|
||||
creationComplete="onCreationComplete()">
|
||||
|
||||
<mate:Listener type="{MadePresenterEvent.SWITCH_TO_VIEWER_MODE}" method="viewerMode" />
|
||||
<mate:Listener type="{WhiteboardButtonEvent.DISABLE_WHITEBOARD}" method="disableTextToolbar" />
|
||||
<mate:Listener type="{StopWhiteboardModuleEvent.STOP_HIGHLIGHTER_MODULE_EVENT}" method="closeToolbar" />
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import flexlib.mdi.containers.MDIWindow;
|
||||
|
||||
import mx.events.MoveEvent;
|
||||
import mx.events.ResizeEvent;
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.main.events.MadePresenterEvent;
|
||||
import org.bigbluebutton.modules.present.ui.views.PresentationWindow;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
|
||||
import org.bigbluebutton.modules.whiteboard.events.StopWhiteboardModuleEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
|
||||
@ -51,13 +53,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
public var backgroundVisible:Boolean;
|
||||
|
||||
private var currentlySelectedTextObject:TextObject = null;
|
||||
private var presentationWindow:PresentationWindow;
|
||||
private var containerToOverlay:MDIWindow;
|
||||
private var normalAlpha:Number = 0.55;
|
||||
private var focusedAlpha:Number = 1.0;
|
||||
private var hasFocus:Boolean;
|
||||
[Bindable] private var fontSizes:Array = ["12", "14", "16", "18", "22", "24", "32", "36"];
|
||||
|
||||
public function init():void {
|
||||
private function onCreationComplete():void {
|
||||
this.alpha = normalAlpha;
|
||||
this.addEventListener(MouseEvent.ROLL_OVER, makeFocused);
|
||||
this.addEventListener(MouseEvent.ROLL_OUT, makeDim);
|
||||
@ -74,11 +76,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
/* Following two methods are used for aesthetics when mouse hovers over TextToolbar and when it hovers out of it */
|
||||
public function makeDim(event:MouseEvent):void {
|
||||
private function makeDim(event:MouseEvent):void {
|
||||
this.alpha = normalAlpha;
|
||||
}
|
||||
|
||||
public function makeFocused(event:MouseEvent):void {
|
||||
private function makeFocused(event:MouseEvent):void {
|
||||
this.alpha = focusedAlpha;
|
||||
}
|
||||
|
||||
@ -141,11 +143,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
// invoked by WhiteboardManager when the TextToolbar is first loaded
|
||||
public function positionToolbar(window:PresentationWindow):void{
|
||||
this.presentationWindow = window;
|
||||
presentationWindow.addEventListener(ResizeEvent.RESIZE, repositionToolbarByWindow);
|
||||
presentationWindow.addEventListener(MouseEvent.CLICK, repositionToolbarByWindow);
|
||||
presentationWindow.addEventListener(MoveEvent.MOVE, repositionToolbarByWindow);
|
||||
public function positionToolbar(container:MDIWindow):void{
|
||||
containerToOverlay = container;
|
||||
containerToOverlay.addEventListener(ResizeEvent.RESIZE, repositionToolbarByWindow);
|
||||
containerToOverlay.addEventListener(MouseEvent.CLICK, repositionToolbarByWindow);
|
||||
containerToOverlay.addEventListener(MoveEvent.MOVE, repositionToolbarByWindow);
|
||||
}
|
||||
|
||||
/* required for repositioning the TextToolbar when an event occurs on the presentation window */
|
||||
|
@ -21,7 +21,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<mx:VBox xmlns="flexlib.containers.*"
|
||||
initialize="init()"
|
||||
xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
xmlns:view="org.bigbluebutton.modules.whiteboard.views.*"
|
||||
xmlns:wbBtns="org.bigbluebutton.modules.whiteboard.views.buttons.*"
|
||||
@ -35,13 +34,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
<mate:Listener type="{MadePresenterEvent.SWITCH_TO_PRESENTER_MODE}" method="presenterMode" />
|
||||
<mate:Listener type="{MadePresenterEvent.SWITCH_TO_VIEWER_MODE}" method="viewerMode" />
|
||||
<mate:Listener type="{WhiteboardPresenterEvent.MODIFIED_WHITEBOARD_ACCESS}" method="whiteboardAccessModified" />
|
||||
<mate:Listener type="{StopWhiteboardModuleEvent.STOP_HIGHLIGHTER_MODULE_EVENT}" method="closeToolbar" />
|
||||
<mate:Listener type="{ShortcutEvent.UNDO_WHITEBOARD}" method="undoShortcut" />
|
||||
<mate:Listener type="{WhiteboardButtonEvent.WHITEBOARD_BUTTON_PRESSED}" method="handleWhiteboardButtonPressed"/>
|
||||
<mate:Listener type="{ChangeMyRole.CHANGE_MY_ROLE_EVENT}" method="refreshRole" />
|
||||
<mate:Listener type="{DisplaySlideEvent.DISPLAY_SLIDE_EVENT}" method="handleSlideLoaded" />
|
||||
<mate:Listener type="{UploadEvent.PRESENTATION_READY}" method="handlePresentationSwitch" />
|
||||
<mate:Listener type="{PresenterStatusEvent.ANNOTATIONS_PERMISSION_CHANGE}" method="handleEnableAnnotations" />
|
||||
|
||||
<mx:Style>
|
||||
@ -68,6 +64,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import com.asfusion.mate.core.GlobalDispatcher;
|
||||
import com.asfusion.mate.events.Listener;
|
||||
|
||||
import flexlib.mdi.containers.MDIWindow;
|
||||
|
||||
import mx.events.MoveEvent;
|
||||
import mx.events.ResizeEvent;
|
||||
|
||||
@ -80,15 +78,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.main.events.ShortcutEvent;
|
||||
import org.bigbluebutton.main.model.users.events.ChangeMyRole;
|
||||
import org.bigbluebutton.modules.present.events.DisplaySlideEvent;
|
||||
import org.bigbluebutton.modules.present.events.UploadEvent;
|
||||
import org.bigbluebutton.modules.present.model.Presenter;
|
||||
import org.bigbluebutton.modules.present.ui.views.PresentationWindow;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
|
||||
import org.bigbluebutton.modules.whiteboard.events.StopWhiteboardModuleEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardAccessEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.views.models.WhiteboardOptions;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
|
||||
@ -107,7 +100,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private var enableAnnotations:Boolean = true;
|
||||
|
||||
public var canvas:WhiteboardCanvas;
|
||||
private var presentationWindow:PresentationWindow;
|
||||
private var containerToOverlay:MDIWindow;
|
||||
|
||||
[Bindable]
|
||||
private var multiUser:Boolean = false;
|
||||
@ -116,14 +109,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
'0xCCFF00', '0x00FF00', '0x00FF88', '0x00FFFF', '0x0088FF', '0x0000FF', '0x8800FF', '0xFF00FF', '0xC0C0C0'];
|
||||
|
||||
private var _hideToolbarTimer:Timer = new Timer(500, 1);
|
||||
|
||||
private function init():void{
|
||||
|
||||
}
|
||||
|
||||
private function onCreationComplete():void {
|
||||
setToolType(WhiteboardConstants.TYPE_ZOOM, null);
|
||||
_hideToolbarTimer.addEventListener(TimerEvent.TIMER, onHideToolbarTimerComplete);
|
||||
addEventListener(WhiteboardButtonEvent.WHITEBOARD_BUTTON_PRESSED, handleWhiteboardButtonPressed);
|
||||
}
|
||||
|
||||
private function handleWhiteboardButtonPressed(e:WhiteboardButtonEvent):void {
|
||||
@ -132,7 +122,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
private function setToolType(graphicType:String, toolType:String):void {
|
||||
if (graphicType == WhiteboardConstants.TYPE_CLEAR) {
|
||||
dispatchEvent(new WhiteboardDrawEvent(WhiteboardDrawEvent.CLEAR));
|
||||
canvas.sendClearToServer();
|
||||
} else if (graphicType == WhiteboardConstants.TYPE_UNDO) {
|
||||
sendUndoCommand();
|
||||
} else {
|
||||
@ -182,7 +172,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
var dispatcher:GlobalDispatcher = new GlobalDispatcher();
|
||||
|
||||
var event:WhiteboardPresenterEvent = new WhiteboardPresenterEvent(WhiteboardPresenterEvent.MODIFY_WHITEBOARD_ACCESS);
|
||||
var event:WhiteboardAccessEvent = new WhiteboardAccessEvent(WhiteboardAccessEvent.MODIFY_WHITEBOARD_ACCESS);
|
||||
event.multiUser = !multiUser;
|
||||
dispatcher.dispatchEvent(event);
|
||||
}
|
||||
@ -196,8 +186,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
checkVisibility();
|
||||
}
|
||||
|
||||
private function whiteboardAccessModified(e:WhiteboardPresenterEvent):void {
|
||||
multiUser = e.multiUser;
|
||||
public function whiteboardAccessModified(mu:Boolean):void {
|
||||
multiUser = mu;
|
||||
checkToolReset();
|
||||
checkVisibility();
|
||||
}
|
||||
@ -208,28 +198,26 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function sendUndoCommand():void {
|
||||
// if (!canvas.isPageEmpty()) {
|
||||
dispatchEvent(new WhiteboardDrawEvent(WhiteboardDrawEvent.UNDO));
|
||||
// }
|
||||
canvas.sendUndoToServer();
|
||||
}
|
||||
|
||||
public function positionToolbar(window:PresentationWindow):void {
|
||||
public function positionToolbar(container:MDIWindow):void {
|
||||
LOGGER.debug("Positioning whiteboard toolbar");
|
||||
presentationWindow = window;
|
||||
presentationWindow.addEventListener(MoveEvent.MOVE, setPositionAndDepth);
|
||||
presentationWindow.addEventListener(ResizeEvent.RESIZE, setPositionAndDepth);
|
||||
presentationWindow.addEventListener(MouseEvent.CLICK, setPositionAndDepth);
|
||||
containerToOverlay = container;
|
||||
containerToOverlay.addEventListener(MoveEvent.MOVE, setPositionAndDepth);
|
||||
containerToOverlay.addEventListener(ResizeEvent.RESIZE, setPositionAndDepth);
|
||||
containerToOverlay.addEventListener(MouseEvent.CLICK, setPositionAndDepth);
|
||||
|
||||
if (!wbOptions.keepToolbarVisible) {
|
||||
window.presCtrlBar.addEventListener(MouseEvent.ROLL_OVER, handleMouseOut);
|
||||
window.presCtrlBar.addEventListener(MouseEvent.ROLL_OUT, handleMouseIn);
|
||||
|
||||
window.addEventListener(MouseEvent.ROLL_OVER, handleMouseIn);
|
||||
window.addEventListener(MouseEvent.ROLL_OUT, handleMouseOut);
|
||||
|
||||
this.addEventListener(MouseEvent.ROLL_OVER, handleMouseIn);
|
||||
this.addEventListener(MouseEvent.ROLL_OUT, handleMouseOut);
|
||||
}
|
||||
if (!wbOptions.keepToolbarVisible) {
|
||||
//containerToOverlay.presCtrlBar.addEventListener(MouseEvent.ROLL_OVER, handleMouseOut);
|
||||
//containerToOverlay.presCtrlBar.addEventListener(MouseEvent.ROLL_OUT, handleMouseIn);
|
||||
|
||||
containerToOverlay.addEventListener(MouseEvent.ROLL_OVER, handleMouseIn);
|
||||
containerToOverlay.addEventListener(MouseEvent.ROLL_OUT, handleMouseOut);
|
||||
|
||||
this.addEventListener(MouseEvent.ROLL_OVER, handleMouseIn);
|
||||
this.addEventListener(MouseEvent.ROLL_OUT, handleMouseOut);
|
||||
}
|
||||
}
|
||||
|
||||
private function refreshRole(e:ChangeMyRole):void {
|
||||
@ -237,7 +225,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function checkVisibility(e:MadePresenterEvent = null):void {
|
||||
if (toolbarAllowed() && slideLoaded && enableAnnotations && (wbOptions.keepToolbarVisible || mousedOver) && !presentationWindow.minimized) {
|
||||
if (toolbarAllowed() && slideLoaded && enableAnnotations && (wbOptions.keepToolbarVisible || mousedOver) && !containerToOverlay.minimized) {
|
||||
setPositionAndDepth();
|
||||
showToolbar();
|
||||
} else {
|
||||
@ -267,8 +255,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
private function setPositionAndDepth(e:Event = null):void {
|
||||
if (parent == null) return;
|
||||
this.x = presentationWindow.x + presentationWindow.width - 43;
|
||||
this.y = presentationWindow.y + 30;
|
||||
this.x = containerToOverlay.x + containerToOverlay.width - 43;
|
||||
this.y = containerToOverlay.y + 30;
|
||||
parent.setChildIndex(this, parent.numChildren - 1);
|
||||
}
|
||||
|
||||
@ -296,14 +284,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
slideLoaded = true;
|
||||
checkVisibility();
|
||||
}
|
||||
|
||||
private function handlePresentationSwitch(e:UploadEvent):void {
|
||||
slideLoaded = false;
|
||||
if (panzoomBtn) {
|
||||
panzoomBtn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
|
||||
}
|
||||
checkVisibility();
|
||||
}
|
||||
|
||||
private function toolbarAllowed():Boolean {
|
||||
return (multiUser? true : isPresenter);
|
||||
|
Loading…
Reference in New Issue
Block a user