Merge pull request #5895 from capilkey/assertive-wb-clear

More assertive annotation and cursor clearing
This commit is contained in:
Chad Pilkey 2018-07-20 17:34:23 -04:00 committed by GitHub
commit 3fe94acfa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 3 deletions

View File

@ -145,7 +145,12 @@ package org.bigbluebutton.modules.whiteboard
textUpdateListener.canvasMouseDown();
//LogUtil.debug("**** CanvasDisplay changePage. Clearing page *****");
clearBoard();
// forcefully clear all annotations and cursors on whiteboard change
_annotationsMap = new Object();
wbCanvas.removeAllGraphics();
clearCursors();
var annotations:Array = whiteboardModel.getAnnotations(wbId);
//LogUtil.debug("**** CanvasDisplay changePage [" + annotations.length + "] *****");
@ -154,6 +159,11 @@ package org.bigbluebutton.modules.whiteboard
}
}
public function clearCursors():void {
_cursors = new Object();
wbCanvas.removeAllCursorChildren();
}
public function drawCursor(userId:String, xPercent:Number, yPercent:Number):void {
var showName: Boolean = LiveMeeting.inst().whiteboardModel.multiUser;

View File

@ -26,10 +26,15 @@ package org.bigbluebutton.modules.whiteboard.views {
import flash.events.MouseEvent;
import flash.geom.Point;
import melomel.core.UI;
import mx.containers.Canvas;
import mx.core.IChildList;
import mx.managers.CursorManager;
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.core.model.users.User2x;
import org.bigbluebutton.main.events.SwitchedPresenterEvent;
import org.bigbluebutton.main.events.UserLeftEvent;
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasDisplayModel;
@ -268,6 +273,13 @@ package org.bigbluebutton.modules.whiteboard.views {
else trace("Does not contain");
}
public function removeAllGraphics():void {
var children:IChildList = this.graphicObjectHolder.rawChildren;
while (children.numChildren != 0) {
children.removeChildAt(children.numChildren - 1);
}
}
public function addGraphic(child:DisplayObject):void {
this.graphicObjectHolder.rawChildren.addChild(child);
}
@ -284,6 +296,13 @@ package org.bigbluebutton.modules.whiteboard.views {
if (doesContainCursor(cursor)) this.cursorObjectHolder.rawChildren.removeChild(cursor);
}
public function removeAllCursorChildren():void {
var children:IChildList = this.cursorObjectHolder.rawChildren;
while (children.numChildren != 0) {
children.removeChildAt(children.numChildren - 1);
}
}
public function textToolbarSyncProxy(tobj:TextObject):void {
textToolbar.syncPropsWith(tobj);
}
@ -341,11 +360,20 @@ package org.bigbluebutton.modules.whiteboard.views {
//if (e.whiteboardId == currentWhiteboardId) {
whiteboardToolbar.whiteboardAccessModified(e.multiUser);
canvasModel.multiUserChange(e.multiUser);
if (!e.multiUser) {
canvasDisplayModel.clearCursors();
}
//}
}
private function onReceivedCursorPosition(e:WhiteboardCursorEvent):void {
canvasDisplayModel.drawCursor(e.userId, e.xPercent, e.yPercent);
var user:User2x = UsersUtil.getUser(e.userId);
// only draw the cursor if the user exists and it's in multiuser mode or they are the presenter
if (user && (LiveMeeting.inst().whiteboardModel.multiUser || user.presenter)) {
canvasDisplayModel.drawCursor(e.userId, e.xPercent, e.yPercent);
}
}
private function onEnableWhiteboardEvent(e:WhiteboardButtonEvent):void {
@ -360,7 +388,7 @@ package org.bigbluebutton.modules.whiteboard.views {
stopDrawing();
removeCursor()
removeCursor();
this.whiteboardEnabled = false;
setWhiteboardInteractable();