From 6ac17bd220455c8efb9426a5103ba93d810d3d93 Mon Sep 17 00:00:00 2001 From: Chad Pilkey Date: Fri, 20 Jul 2018 14:28:06 -0700 Subject: [PATCH] more assertive annotation and cursor clearing --- .../WhiteboardCanvasDisplayModel.as | 12 ++++++- .../whiteboard/views/WhiteboardCanvas.as | 32 +++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/WhiteboardCanvasDisplayModel.as b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/WhiteboardCanvasDisplayModel.as index 585ad25ad7..290df5aabc 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/WhiteboardCanvasDisplayModel.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/WhiteboardCanvasDisplayModel.as @@ -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; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardCanvas.as b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardCanvas.as index 153d0ee738..bd8760e5b8 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardCanvas.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardCanvas.as @@ -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();