- try and fix synching of annotations for late joiners
This commit is contained in:
parent
ace0e438f9
commit
44b2e55d52
@ -32,13 +32,13 @@ public class Presentation {
|
||||
public Presentation(String name, int numPages){
|
||||
this.name = name;
|
||||
this.pages = new ArrayList<Page>(numPages);
|
||||
for (int i = 0; i < numPages; i++){
|
||||
for (int i = 1; i <= numPages; i++){
|
||||
pages.add(new Page(i));
|
||||
}
|
||||
this.activePage = pages.get(0);
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@ -52,4 +52,12 @@ public class Presentation {
|
||||
activePage = pages.get(index);
|
||||
}
|
||||
|
||||
public Page getPage(int pageNumber) {
|
||||
for (int i = 0; i < pages.size(); i++){
|
||||
Page p = pages.get(i);
|
||||
if (p.getPageIndex() == pageNumber) return p;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -95,9 +95,9 @@ public class WhiteboardApplication extends MultiThreadedApplicationAdapter imple
|
||||
connInvokerService.sendMessage(m);
|
||||
}
|
||||
|
||||
public void sendAnnotationHistory(String userid) {
|
||||
public void sendAnnotationHistory(String userid, String presentationID, Integer pageNumber) {
|
||||
Map<String, Object> message = new HashMap<String, Object>();
|
||||
List<Annotation> annotations = roomManager.getRoom(getMeetingId()).getAnnotations();
|
||||
List<Annotation> annotations = roomManager.getRoom(getMeetingId()).getAnnotations(presentationID, pageNumber);
|
||||
message.put("count", new Integer(annotations.size()));
|
||||
|
||||
/** extract annotation into a Map */
|
||||
@ -106,6 +106,8 @@ public class WhiteboardApplication extends MultiThreadedApplicationAdapter imple
|
||||
a.add(v.getAnnotation());
|
||||
}
|
||||
|
||||
message.put("presentationID", presentationID);
|
||||
message.put("pageNumber", pageNumber);
|
||||
message.put("annotations", a);
|
||||
ClientMessage m = new ClientMessage(ClientMessage.DIRECT, userid, "WhiteboardRequestAnnotationHistoryReply", message);
|
||||
connInvokerService.sendMessage(m);
|
||||
|
@ -59,14 +59,12 @@ public class WhiteboardRoom {
|
||||
presentations.add(activePresentation);
|
||||
}
|
||||
|
||||
public Presentation getPresentation(String name) {
|
||||
if (name.equals(activePresentation.getName())) return activePresentation;
|
||||
|
||||
for (int i= 0; i < presentations.size(); i++){
|
||||
private Presentation getPresentation(String name) {
|
||||
for (int i = 0; i < presentations.size(); i++){
|
||||
Presentation pres = presentations.get(i);
|
||||
if (pres.getName().equals(name)) activePresentation = pres;
|
||||
if (pres.getName().equals(name)) return pres;
|
||||
}
|
||||
return activePresentation;
|
||||
return null;
|
||||
}
|
||||
|
||||
public Presentation getActivePresentation() {
|
||||
@ -74,7 +72,10 @@ public class WhiteboardRoom {
|
||||
}
|
||||
|
||||
public void setActivePresentation(String name) {
|
||||
this.activePresentation = getPresentation(name);
|
||||
Presentation p = getPresentation(name);
|
||||
if (p != null) {
|
||||
this.activePresentation = p;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean presentationExists(String name) {
|
||||
@ -90,9 +91,16 @@ public class WhiteboardRoom {
|
||||
notifyAddShape(activePresentation, annotation);
|
||||
}
|
||||
|
||||
public List<Annotation> getAnnotations() {
|
||||
if (activePresentation == null) return new ArrayList<Annotation>();
|
||||
return activePresentation.getActivePage().getAnnotations();
|
||||
public List<Annotation> getAnnotations(String presentationID, Integer pageNumber) {
|
||||
Presentation p = getPresentation(presentationID);
|
||||
if (p != null) {
|
||||
Page pg = p.getPage(pageNumber.intValue());
|
||||
if (pg != null) {
|
||||
return pg.getAnnotations();
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayList<Annotation>();
|
||||
}
|
||||
|
||||
public void modifyText(Annotation annotation) {
|
||||
|
@ -76,9 +76,10 @@ public class WhiteboardService {
|
||||
application.changePage((Integer) message.get("pageNum"));
|
||||
}
|
||||
|
||||
public void requestAnnotationHistory() {
|
||||
public void requestAnnotationHistory(Map<String, Object> message) {
|
||||
log.info("WhiteboardApplication - requestAnnotationHistory");
|
||||
application.sendAnnotationHistory(Red5.getConnectionLocal().getClient().getId());
|
||||
application.sendAnnotationHistory(Red5.getConnectionLocal().getClient().getId(),
|
||||
(String) message.get("presentationID"), (Integer) message.get("pageNumber"));
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
|
@ -12,11 +12,13 @@ package org.bigbluebutton.modules.whiteboard
|
||||
import flash.text.TextFieldAutoSize;
|
||||
import flash.text.TextFieldType;
|
||||
import flash.text.TextFormat;
|
||||
import flash.ui.Keyboard;
|
||||
import flash.ui.Keyboard;
|
||||
|
||||
import mx.controls.TextInput;
|
||||
import mx.core.Application;
|
||||
import mx.core.UIComponent;
|
||||
import mx.managers.CursorManager;
|
||||
import mx.managers.CursorManager;
|
||||
|
||||
import org.bigbluebutton.common.IBbbCanvas;
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
@ -34,6 +36,7 @@ package org.bigbluebutton.modules.whiteboard
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardSettingResetEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
import org.bigbluebutton.modules.whiteboard.views.AnnotationIDGenerator;
|
||||
import org.bigbluebutton.modules.whiteboard.views.IDrawListener;
|
||||
import org.bigbluebutton.modules.whiteboard.views.PencilDrawListener;
|
||||
@ -45,6 +48,7 @@ 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();
|
||||
@ -63,8 +67,8 @@ package org.bigbluebutton.modules.whiteboard
|
||||
|
||||
public function set wbCanvas(canvas:WhiteboardCanvas):void {
|
||||
_wbCanvas = canvas;
|
||||
drawListeners.push(new PencilDrawListener(idGenerator, _wbCanvas, sendShapeFrequency, shapeFactory));
|
||||
drawListeners.push(new TextDrawListener(idGenerator, _wbCanvas, sendShapeFrequency, shapeFactory));
|
||||
drawListeners.push(new PencilDrawListener(idGenerator, _wbCanvas, sendShapeFrequency, shapeFactory, whiteboardModel));
|
||||
drawListeners.push(new TextDrawListener(idGenerator, _wbCanvas, sendShapeFrequency, shapeFactory, whiteboardModel));
|
||||
}
|
||||
|
||||
public function zoomCanvas(width:Number, height:Number):void {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
{
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
|
||||
public class DrawAnnotation implements IDrawAnnotation
|
||||
{
|
||||
@ -15,6 +16,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
_status = s;
|
||||
}
|
||||
|
||||
public function createAnnotation(ctrlKeyPressed:Boolean=false):Annotation {return null}
|
||||
public function createAnnotation(wbModel:WhiteboardModel,
|
||||
ctrlKeyPressed:Boolean=false):Annotation {return null}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
{
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
|
||||
public class EllipseAnnotation extends DrawAnnotation
|
||||
{
|
||||
@ -35,7 +36,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
return shape;
|
||||
}
|
||||
|
||||
override public function createAnnotation(ctrlKeyPressed:Boolean=false):Annotation {
|
||||
override public function createAnnotation(wbModel:WhiteboardModel, ctrlKeyPressed:Boolean=false):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = _type;
|
||||
ao["points"] = optimize(_shape);
|
||||
@ -50,7 +51,13 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
} else {
|
||||
ao["circle"] = false;
|
||||
}
|
||||
|
||||
|
||||
var pn:Object = wbModel.getCurrentPresentationAndPage();
|
||||
if (pn != null) {
|
||||
ao["presentationID"] = pn.presentationID;
|
||||
ao["pageNumber"] = pn.currentPageNumber;
|
||||
}
|
||||
|
||||
return new Annotation(_id, _type, ao);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
{
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
|
||||
public interface IDrawAnnotation
|
||||
{
|
||||
function createAnnotation(ctrlKeyPressed:Boolean=false):Annotation;
|
||||
function createAnnotation(wbModel:WhiteboardModel, ctrlKeyPressed:Boolean=false):Annotation;
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
{
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
|
||||
public class LineAnnotation extends DrawAnnotation
|
||||
{
|
||||
@ -36,7 +37,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
return shape;
|
||||
}
|
||||
|
||||
override public function createAnnotation(ctrlKeyPressed:Boolean=false):Annotation {
|
||||
override public function createAnnotation(wbModel:WhiteboardModel, ctrlKeyPressed:Boolean=false):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = _type;
|
||||
ao["points"] = optimize(_shape);
|
||||
@ -45,7 +46,13 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
ao["id"] = _id;
|
||||
ao["status"] = _status;
|
||||
ao["transparency"] = _transparent;
|
||||
|
||||
|
||||
var pn:Object = wbModel.getCurrentPresentationAndPage();
|
||||
if (pn != null) {
|
||||
ao["presentationID"] = pn.presentationID;
|
||||
ao["pageNumber"] = pn.currentPageNumber;
|
||||
}
|
||||
|
||||
return new Annotation(_id, _type, ao);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
{
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
|
||||
public class PencilDrawAnnotation extends DrawAnnotation
|
||||
{
|
||||
@ -21,7 +22,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
_transparent = trans;
|
||||
}
|
||||
|
||||
override public function createAnnotation(ctrlKeyPressed:Boolean=false):Annotation {
|
||||
override public function createAnnotation(wbModel:WhiteboardModel, ctrlKeyPressed:Boolean=false):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = _type;
|
||||
ao["points"] = _shape;
|
||||
@ -30,7 +31,13 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
ao["id"] = _id;
|
||||
ao["status"] = _status;
|
||||
ao["transparency"] = _transparent;
|
||||
|
||||
|
||||
var pn:Object = wbModel.getCurrentPresentationAndPage();
|
||||
if (pn != null) {
|
||||
ao["presentationID"] = pn.presentationID;
|
||||
ao["pageNumber"] = pn.currentPageNumber;
|
||||
}
|
||||
|
||||
return new Annotation(_id, _type, ao);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
{
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
|
||||
public class RectangleAnnotation extends DrawAnnotation
|
||||
{
|
||||
@ -35,7 +36,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
return shape;
|
||||
}
|
||||
|
||||
override public function createAnnotation(ctrlKeyPressed:Boolean=false):Annotation {
|
||||
override public function createAnnotation(wbModel:WhiteboardModel, ctrlKeyPressed:Boolean=false):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = _type;
|
||||
ao["points"] = optimize(_shape);
|
||||
@ -51,6 +52,12 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
ao["square"] = false;
|
||||
}
|
||||
|
||||
var pn:Object = wbModel.getCurrentPresentationAndPage();
|
||||
if (pn != null) {
|
||||
ao["presentationID"] = pn.presentationID;
|
||||
ao["pageNumber"] = pn.currentPageNumber;
|
||||
}
|
||||
|
||||
return new Annotation(_id, _type, ao);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
{
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
|
||||
public class TextDrawAnnotation extends DrawAnnotation
|
||||
{
|
||||
@ -27,7 +28,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
_fontSize = fontSize;
|
||||
}
|
||||
|
||||
override public function createAnnotation(ctrlKeyPressed:Boolean=false):Annotation {
|
||||
override public function createAnnotation(wbModel:WhiteboardModel, ctrlKeyPressed:Boolean=false):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = DrawObject.TEXT;
|
||||
ao["id"] = _id;
|
||||
@ -40,6 +41,12 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
ao["textBoxWidth"] = _textBoxWidth;
|
||||
ao["textBoxHeight"] = _textBoxHeight;
|
||||
|
||||
var pn:Object = wbModel.getCurrentPresentationAndPage();
|
||||
if (pn != null) {
|
||||
ao["presentationID"] = pn.presentationID;
|
||||
ao["pageNumber"] = pn.currentPageNumber;
|
||||
}
|
||||
|
||||
return new Annotation(_id, DrawObject.TEXT, ao);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
{
|
||||
import org.bigbluebutton.modules.whiteboard.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
|
||||
public class TriangleAnnotation extends DrawAnnotation
|
||||
{
|
||||
@ -35,7 +36,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
return shape;
|
||||
}
|
||||
|
||||
override public function createAnnotation(ctrlKeyPressed:Boolean=false):Annotation {
|
||||
override public function createAnnotation(wbModel:WhiteboardModel, ctrlKeyPressed:Boolean=false):Annotation {
|
||||
var ao:Object = new Object();
|
||||
ao["type"] = _type;
|
||||
ao["points"] = optimize(_shape);
|
||||
@ -44,6 +45,12 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
ao["id"] = _id;
|
||||
ao["status"] = _status;
|
||||
ao["transparency"] = _transparent;
|
||||
|
||||
var pn:Object = wbModel.getCurrentPresentationAndPage();
|
||||
if (pn != null) {
|
||||
ao["presentationID"] = pn.presentationID;
|
||||
ao["pageNumber"] = pn.currentPageNumber;
|
||||
}
|
||||
|
||||
return new Annotation(_id, _type, ao);
|
||||
}
|
||||
|
@ -66,7 +66,8 @@ package org.bigbluebutton.modules.whiteboard.managers
|
||||
highlighterCanvas.model = model;
|
||||
highlighterCanvas.displayModel = displayModel;
|
||||
displayModel.whiteboardModel = whiteboardModel;
|
||||
|
||||
model.whiteboardModel = whiteboardModel
|
||||
|
||||
model.wbCanvas = highlighterCanvas;
|
||||
displayModel.wbCanvas = highlighterCanvas;
|
||||
|
||||
|
@ -18,40 +18,50 @@
|
||||
*/
|
||||
package org.bigbluebutton.modules.whiteboard.models
|
||||
{
|
||||
public class Annotation {
|
||||
private var _id:String = "undefined";
|
||||
private var _status:String = AnnotationStatus.DRAW_START;
|
||||
private var _type:String = "undefined";
|
||||
private var _annotation:Object;
|
||||
|
||||
public function Annotation(id:String, type:String, annotation:Object) {
|
||||
_id = id;
|
||||
_type = type;
|
||||
_annotation = annotation;
|
||||
}
|
||||
|
||||
public function get type():String{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public function get id():String {
|
||||
return _id;
|
||||
}
|
||||
|
||||
public function get annotation():Object {
|
||||
return _annotation;
|
||||
}
|
||||
|
||||
public function set annotation(a:Object):void {
|
||||
_annotation = a;
|
||||
}
|
||||
|
||||
public function get status():String {
|
||||
return _status;
|
||||
}
|
||||
public class Annotation {
|
||||
private var _id:String = "undefined";
|
||||
private var _status:String = AnnotationStatus.DRAW_START;
|
||||
private var _type:String = "undefined";
|
||||
private var _annotation:Object;
|
||||
private var _presentationID:String;
|
||||
private var _pageNumber:int;
|
||||
|
||||
public function set status(s:String):void {
|
||||
_status = s;
|
||||
}
|
||||
public function Annotation(id:String, type:String, annotation:Object) {
|
||||
_id = id;
|
||||
_type = type;
|
||||
_annotation = annotation;
|
||||
}
|
||||
|
||||
public function get type():String{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public function get id():String {
|
||||
return _id;
|
||||
}
|
||||
|
||||
public function get annotation():Object {
|
||||
return _annotation;
|
||||
}
|
||||
|
||||
public function set annotation(a:Object):void {
|
||||
_annotation = a;
|
||||
}
|
||||
|
||||
public function get status():String {
|
||||
return _status;
|
||||
}
|
||||
|
||||
public function set status(s:String):void {
|
||||
_status = s;
|
||||
}
|
||||
|
||||
public function get presentationID():String {
|
||||
return _annotation.presentationID;
|
||||
}
|
||||
|
||||
public function get pageNumber():Number {
|
||||
return _annotation.pageNumber;
|
||||
}
|
||||
}
|
||||
}
|
@ -54,6 +54,11 @@ package org.bigbluebutton.modules.whiteboard.models
|
||||
|
||||
}
|
||||
|
||||
public function getCurrentPageNumber():int {
|
||||
if (_currentPage == null) return 0;
|
||||
return _currentPage.number;
|
||||
}
|
||||
|
||||
public function addAnnotation(annotation:Annotation):void {
|
||||
_currentPage.addAnnotation(annotation);
|
||||
}
|
||||
|
@ -34,7 +34,13 @@ package org.bigbluebutton.modules.whiteboard.models
|
||||
// LogUtil.debug("*** Dispatched WhiteboardUpdate.BOARD_UPDATED Event ****");
|
||||
}
|
||||
|
||||
public function addAnnotationFromHistory(annotation:Array):void {
|
||||
public function addAnnotationFromHistory(presentationID:String, pageNumber:Number, annotation:Array):void {
|
||||
if (_currentPresentation.id != presentationID || _currentPresentation.getCurrentPageNumber() != pageNumber) {
|
||||
LogUtil.debug("Wrong annotation history [curPresID=" + _currentPresentation.id + ",rxPresID=" + presentationID +
|
||||
"][curPage=" + _currentPresentation.getCurrentPageNumber() + ",rxPageNum=" + pageNumber + "]");
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i:int = 0; i < annotation.length; i++) {
|
||||
// LogUtil.debug("addAnnotationFromHistory: annotation id=" + (annotation[i] as Annotation).id);
|
||||
_currentPresentation.addAnnotation(annotation[i] as Annotation);
|
||||
@ -94,5 +100,18 @@ package org.bigbluebutton.modules.whiteboard.models
|
||||
public function enable(enabled:Boolean):void {
|
||||
|
||||
}
|
||||
|
||||
public function getCurrentPresentationAndPage():Object {
|
||||
if (_currentPresentation == null) return null;
|
||||
var pageNum:int = _currentPresentation.getCurrentPageNumber();
|
||||
if (pageNum == 0) return null;
|
||||
|
||||
var cp:Object = new Object();
|
||||
cp.presentationID = _currentPresentation.id;
|
||||
cp.currentPageNumber = pageNum;
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -94,10 +94,12 @@ package org.bigbluebutton.modules.whiteboard.services
|
||||
}
|
||||
|
||||
private function handleRequestAnnotationHistoryReply(message:Object):void {
|
||||
LogUtil.debug("handleRequestAnnotationHistoryReply: Annotation history for [" + message.presentationID + "," + message.pageNumber + "]");
|
||||
|
||||
if (message.count == 0) {
|
||||
LogUtil.debug("handleRequestAnnotationHistoryReply: No annotations.");
|
||||
} else {
|
||||
// LogUtil.debug("handleRequestAnnotationHistoryReply: Number of annotations in history = " + message.count);
|
||||
LogUtil.debug("handleRequestAnnotationHistoryReply: Number of annotations in history = " + message.count);
|
||||
var annotations:Array = message.annotations as Array;
|
||||
var tempAnnotations:Array = new Array();
|
||||
|
||||
@ -108,7 +110,7 @@ package org.bigbluebutton.modules.whiteboard.services
|
||||
if (an.id == undefined || an.id == null || an.id == "") return;
|
||||
if (an.status == undefined || an.status == null || an.status == "") return;
|
||||
|
||||
// LogUtil.debug("handleRequestAnnotationHistoryReply: annotation id=" + an.id);
|
||||
LogUtil.debug("handleRequestAnnotationHistoryReply: annotation id=" + an.id);
|
||||
|
||||
var annotation:Annotation = new Annotation(an.id, an.type, an);
|
||||
annotation.status = an.status;
|
||||
@ -116,7 +118,7 @@ package org.bigbluebutton.modules.whiteboard.services
|
||||
}
|
||||
|
||||
if (tempAnnotations.length > 0) {
|
||||
whiteboardModel.addAnnotationFromHistory(tempAnnotations);
|
||||
whiteboardModel.addAnnotationFromHistory(message.presentationID, message.pageNumber, tempAnnotations);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,8 +100,12 @@ package org.bigbluebutton.modules.whiteboard.services
|
||||
);
|
||||
}
|
||||
|
||||
public function requestAnnotationHistory():void{
|
||||
public function requestAnnotationHistory(presentationID:String, pageNumber:int):void{
|
||||
// LogUtil.debug("Sending [whiteboard.requestAnnotationHistory] to server.");
|
||||
var msg:Object = new Object();
|
||||
msg["presentationID"] = presentationID;
|
||||
msg["pageNumber"] = pageNumber;
|
||||
|
||||
var _nc:ConnectionManager = BBB.initConnectionManager();
|
||||
_nc.sendMessage("whiteboard.requestAnnotationHistory",
|
||||
function(result:String):void { // On successful result
|
||||
@ -109,7 +113,8 @@ package org.bigbluebutton.modules.whiteboard.services
|
||||
},
|
||||
function(status:String):void { // status - On error occurred
|
||||
LogUtil.error(status);
|
||||
}
|
||||
},
|
||||
msg
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,11 @@ package org.bigbluebutton.modules.whiteboard.services
|
||||
|
||||
public function getAnnotationHistory():void
|
||||
{
|
||||
sender.requestAnnotationHistory();
|
||||
var cp:Object = whiteboardModel.getCurrentPresentationAndPage();
|
||||
if (cp != null) {
|
||||
sender.requestAnnotationHistory(cp.presentationID, cp.currentPageNumber);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function modifyEnabled(e:WhiteboardPresenterEvent):void {
|
||||
|
@ -1,92 +1,101 @@
|
||||
package org.bigbluebutton.modules.whiteboard.views
|
||||
{
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawAnnotation;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.Pencil;
|
||||
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.views.models.WhiteboardTool;
|
||||
|
||||
public class PencilDrawListener implements IDrawListener
|
||||
{
|
||||
private var _drawStatus:String = DrawObject.DRAW_START;
|
||||
private var _isDrawing:Boolean;
|
||||
private var _segment:Array = new Array();
|
||||
private var _wbCanvas:WhiteboardCanvas;
|
||||
private var _sendFrequency:int;
|
||||
private var _shapeFactory:ShapeFactory;
|
||||
private var _ctrlKeyDown:Boolean = false;
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawAnnotation;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.Pencil;
|
||||
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.WhiteboardModel;
|
||||
import org.bigbluebutton.modules.whiteboard.views.models.WhiteboardTool;
|
||||
|
||||
public class PencilDrawListener implements IDrawListener
|
||||
{
|
||||
private var _drawStatus:String = DrawObject.DRAW_START;
|
||||
private var _isDrawing:Boolean;
|
||||
private var _segment:Array = new Array();
|
||||
private var _wbCanvas:WhiteboardCanvas;
|
||||
private var _sendFrequency:int;
|
||||
private var _shapeFactory:ShapeFactory;
|
||||
private var _ctrlKeyDown:Boolean = false;
|
||||
private var _idGenerator:AnnotationIDGenerator;
|
||||
private var _curID:String;
|
||||
|
||||
public function PencilDrawListener(idGenerator:AnnotationIDGenerator, wbCanvas:WhiteboardCanvas, sendShapeFrequency:int, shapeFactory:ShapeFactory)
|
||||
{
|
||||
_idGenerator = idGenerator;
|
||||
_wbCanvas = wbCanvas;
|
||||
_sendFrequency = sendShapeFrequency;
|
||||
_shapeFactory = shapeFactory;
|
||||
private var _wbModel:WhiteboardModel;
|
||||
|
||||
public function PencilDrawListener(idGenerator:AnnotationIDGenerator,
|
||||
wbCanvas:WhiteboardCanvas,
|
||||
sendShapeFrequency:int,
|
||||
shapeFactory:ShapeFactory,
|
||||
wbModel:WhiteboardModel)
|
||||
{
|
||||
_idGenerator = idGenerator;
|
||||
_wbCanvas = wbCanvas;
|
||||
_sendFrequency = sendShapeFrequency;
|
||||
_shapeFactory = shapeFactory;
|
||||
_wbModel = wbModel;
|
||||
}
|
||||
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_SHAPE) {
|
||||
_isDrawing = true;
|
||||
_drawStatus = DrawObject.DRAW_START;
|
||||
_segment = new Array();
|
||||
_segment.push(mouseX);
|
||||
_segment.push(mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
public function ctrlKeyDown(down:Boolean):void {
|
||||
_ctrlKeyDown = down;
|
||||
}
|
||||
|
||||
public function onMouseMove(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_SHAPE) {
|
||||
if (_isDrawing){
|
||||
_segment.push(mouseX);
|
||||
_segment.push(mouseY);
|
||||
if (_segment.length > _sendFrequency) {
|
||||
sendShapeToServer(_drawStatus, tool);
|
||||
}
|
||||
}
|
||||
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_SHAPE) {
|
||||
_isDrawing = true;
|
||||
_drawStatus = DrawObject.DRAW_START;
|
||||
_segment = new Array();
|
||||
_segment.push(mouseX);
|
||||
_segment.push(mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
public function ctrlKeyDown(down:Boolean):void {
|
||||
_ctrlKeyDown = down;
|
||||
}
|
||||
|
||||
|
||||
public function onMouseMove(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_SHAPE) {
|
||||
if (_isDrawing){
|
||||
_segment.push(mouseX);
|
||||
_segment.push(mouseY);
|
||||
if (_segment.length > _sendFrequency) {
|
||||
sendShapeToServer(_drawStatus, tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function onMouseUp(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_SHAPE) {
|
||||
if (_isDrawing) {
|
||||
/**
|
||||
* Check if we are drawing because when resizing the window, it generates
|
||||
* a mouseUp event at the end of resize. We don't want to dispatch another
|
||||
* shape to the viewers.
|
||||
*/
|
||||
_isDrawing = false;
|
||||
|
||||
//check to make sure unnecessary data is not sent ex. a single click when the rectangle tool is selected
|
||||
// is hardly classifiable as a rectangle, and should not be sent to the server
|
||||
if (tool.toolType == DrawObject.RECTANGLE ||
|
||||
tool.toolType == DrawObject.ELLIPSE ||
|
||||
tool.toolType == DrawObject.TRIANGLE) {
|
||||
|
||||
var x:Number = _segment[0];
|
||||
var y:Number = _segment[1];
|
||||
var width:Number = _segment[_segment.length-2]-x;
|
||||
var height:Number = _segment[_segment.length-1]-y;
|
||||
|
||||
if (!(Math.abs(width) <= 2 && Math.abs(height) <=2)) {
|
||||
sendShapeToServer(DrawObject.DRAW_END, tool);
|
||||
}
|
||||
}
|
||||
|
||||
public function onMouseUp(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
if(tool.graphicType == WhiteboardConstants.TYPE_SHAPE) {
|
||||
if (_isDrawing) {
|
||||
/**
|
||||
* Check if we are drawing because when resizing the window, it generates
|
||||
* a mouseUp event at the end of resize. We don't want to dispatch another
|
||||
* shape to the viewers.
|
||||
*/
|
||||
_isDrawing = false;
|
||||
|
||||
//check to make sure unnecessary data is not sent ex. a single click when the rectangle tool is selected
|
||||
// is hardly classifiable as a rectangle, and should not be sent to the server
|
||||
if (tool.toolType == DrawObject.RECTANGLE || tool.toolType == DrawObject.ELLIPSE || tool.toolType == DrawObject.TRIANGLE) {
|
||||
var x:Number = _segment[0];
|
||||
var y:Number = _segment[1];
|
||||
var width:Number = _segment[_segment.length-2]-x;
|
||||
var height:Number = _segment[_segment.length-1]-y;
|
||||
|
||||
if (!(Math.abs(width) <= 2 && Math.abs(height) <=2)) {
|
||||
sendShapeToServer(DrawObject.DRAW_END, tool);
|
||||
}
|
||||
} else {
|
||||
sendShapeToServer(DrawObject.DRAW_END, tool);
|
||||
} /* (tool.toolType */
|
||||
} /* (_isDrawing) */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sendShapeToServer(DrawObject.DRAW_END, tool);
|
||||
} /* (tool.toolType */
|
||||
} /* (_isDrawing) */
|
||||
}
|
||||
}
|
||||
|
||||
private function sendShapeToServer(status:String, tool:WhiteboardTool):void {
|
||||
if (_segment.length == 0) return;
|
||||
@ -120,7 +129,7 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
_segment.push(xy[0], xy[1]);
|
||||
}
|
||||
|
||||
var an:Annotation = dobj.createAnnotation(_ctrlKeyDown);
|
||||
var an:Annotation = dobj.createAnnotation(_wbModel, _ctrlKeyDown);
|
||||
if (an != null) {
|
||||
_wbCanvas.sendGraphicToServer(an, WhiteboardDrawEvent.SEND_SHAPE);
|
||||
}
|
||||
|
@ -1,59 +1,66 @@
|
||||
package org.bigbluebutton.modules.whiteboard.views
|
||||
{
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.ShapeFactory;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextDrawAnnotation;
|
||||
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.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.views.models.WhiteboardTool;
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.ShapeFactory;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextDrawAnnotation;
|
||||
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.models.Annotation;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
import org.bigbluebutton.modules.whiteboard.views.models.WhiteboardTool;
|
||||
|
||||
public class TextDrawListener implements IDrawListener
|
||||
{
|
||||
private var _wbCanvas:WhiteboardCanvas;
|
||||
private var _sendFrequency:int;
|
||||
private var _shapeFactory:ShapeFactory;
|
||||
private var _textStatus:String = TextObject.TEXT_CREATED;
|
||||
private var _mouseXDown:Number = 0;
|
||||
private var _mouseYDown:Number = 0;
|
||||
private var _idGenerator:AnnotationIDGenerator;
|
||||
private var _mousedDown:Boolean = false;
|
||||
private var _curID:String;
|
||||
private var feedback:RectangleFeedbackTextBox = new RectangleFeedbackTextBox();
|
||||
private var _wbModel:WhiteboardModel;
|
||||
|
||||
public class TextDrawListener implements IDrawListener
|
||||
public function TextDrawListener(idGenerator:AnnotationIDGenerator,
|
||||
wbCanvas:WhiteboardCanvas,
|
||||
sendShapeFrequency:int,
|
||||
shapeFactory:ShapeFactory,
|
||||
wbModel:WhiteboardModel)
|
||||
{
|
||||
private var _wbCanvas:WhiteboardCanvas;
|
||||
private var _sendFrequency:int;
|
||||
private var _shapeFactory:ShapeFactory;
|
||||
private var _textStatus:String = TextObject.TEXT_CREATED;
|
||||
private var _mouseXDown:Number = 0;
|
||||
private var _mouseYDown:Number = 0;
|
||||
private var _idGenerator:AnnotationIDGenerator;
|
||||
private var _mousedDown:Boolean = false;
|
||||
private var _curID:String;
|
||||
private var feedback:RectangleFeedbackTextBox = new RectangleFeedbackTextBox();
|
||||
|
||||
public function TextDrawListener(idGenerator:AnnotationIDGenerator, wbCanvas:WhiteboardCanvas, sendShapeFrequency:int, shapeFactory:ShapeFactory)
|
||||
{
|
||||
_idGenerator = idGenerator;
|
||||
_wbCanvas = wbCanvas;
|
||||
_sendFrequency = sendShapeFrequency;
|
||||
_shapeFactory = shapeFactory;
|
||||
_idGenerator = idGenerator;
|
||||
_wbCanvas = wbCanvas;
|
||||
_sendFrequency = sendShapeFrequency;
|
||||
_shapeFactory = shapeFactory;
|
||||
_wbModel = wbModel;
|
||||
}
|
||||
|
||||
public function ctrlKeyDown(down:Boolean):void {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_TEXT) {
|
||||
_mouseXDown = mouseX;
|
||||
_mouseYDown = mouseY;
|
||||
|
||||
// We have to keep track if the user has pressed the mouse. A mouseup event is
|
||||
// dispatched when the mouse goes out of the canvas, theu we end up sending a new text
|
||||
// even if the user has mousedDown yet.
|
||||
_mousedDown = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function onMouseMove(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_TEXT && _mousedDown) {
|
||||
if (_wbCanvas.contains(feedback)) {
|
||||
_wbCanvas.removeRawChild(feedback);
|
||||
}
|
||||
|
||||
public function ctrlKeyDown(down:Boolean):void {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_TEXT) {
|
||||
_mouseXDown = mouseX;
|
||||
_mouseYDown = mouseY;
|
||||
|
||||
// We have to keep track if the user has pressed the mouse. A mouseup event is
|
||||
// dispatched when the mouse goes out of the canvas, theu we end up sending a new text
|
||||
// even if the user has mousedDown yet.
|
||||
_mousedDown = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function onMouseMove(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_TEXT && _mousedDown) {
|
||||
if (_wbCanvas.contains(feedback)) {
|
||||
_wbCanvas.removeRawChild(feedback);
|
||||
}
|
||||
|
||||
|
||||
feedback.draw(_mouseXDown, _mouseYDown, mouseX - _mouseXDown, mouseY - _mouseYDown);
|
||||
_wbCanvas.addRawChild(feedback);
|
||||
}
|
||||
@ -68,8 +75,8 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
_wbCanvas.removeRawChild(feedback);
|
||||
}
|
||||
|
||||
_mousedDown = false;
|
||||
|
||||
_mousedDown = false;
|
||||
|
||||
var tbWidth:Number = mouseX - _mouseXDown;
|
||||
var tbHeight:Number = mouseY - _mouseYDown;
|
||||
|
||||
@ -100,7 +107,7 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
break;
|
||||
}
|
||||
|
||||
_wbCanvas.sendGraphicToServer(tobj.createAnnotation(), WhiteboardDrawEvent.SEND_TEXT);
|
||||
_wbCanvas.sendGraphicToServer(tobj.createAnnotation(_wbModel), WhiteboardDrawEvent.SEND_TEXT);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user