- can't seem to display text properly...need to fix

This commit is contained in:
Richard Alam 2012-08-10 22:17:42 +00:00
parent ba6e43484b
commit 3ed5651a98
7 changed files with 366 additions and 131 deletions

View File

@ -31,6 +31,8 @@ package org.bigbluebutton.modules.whiteboard
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.Pencil;
import org.bigbluebutton.modules.whiteboard.business.shapes.ShapeFactory;
import org.bigbluebutton.modules.whiteboard.business.shapes.TextDrawAnnotation;
import org.bigbluebutton.modules.whiteboard.business.shapes.TextDrawObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.TextFactory;
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
@ -92,48 +94,58 @@ package org.bigbluebutton.modules.whiteboard
}
}
// Draws a DrawObject when/if it is received from the server
private function drawShape(o:DrawObject, recvdShapes:Boolean):void {
switch (o.status) {
case DrawObject.DRAW_START:
addNewShape(o);
break;
case DrawObject.DRAW_UPDATE:
case DrawObject.DRAW_END:
if (graphicList.length == 0 || o.type == DrawObject.PENCIL || o.type == DrawObject.ERASER || recvdShapes) {
addNewShape(o);
} else {
removeLastGraphic();
addNewShape(o);
}
break;
}
}
private function addNewShape(o:DrawObject):void {
// LogUtil.debug("Adding new shape [" + o.getType() + "," + o.getGraphicID() + "," + o.status + "]");
if (o.type == DrawObject.TEXT) return;
var dobj:DrawObject = shapeFactory.makeShape(o);
// LogUtil.debug("Adding new shape 1 [" + dobj.getType() + "," + dobj.getGraphicID() + "," + dobj.status + "]");
wbCanvas.addGraphic(dobj);
// LogUtil.debug("Adding new shape 2 [" + dobj.getGraphicID() + ", [" + dobj.x + "," + dobj.y + "]");
/*
var points:String = "{type=" + dobj.getType() + ",points=";
for (var p:int = 0; p < dobj.getShapeArray().length; p++) {
points += dobj.getShapeArray()[p] + ",";
}
points += "]}";
LogUtil.debug("PencilDrawListener sendShapeToServer - Got here 2 [" + points + "]");
LogUtil.debug("Adding new shape 3 [" + points + "]");
*/ graphicList.push(dobj);
}
// Draws a TextObject when/if it is received from the server
private function drawText(o:Annotation, recvdShapes:Boolean):void {
private function drawText3(o:Annotation, recvdShapes:Boolean):void {
var dobj:TextDrawObject;
switch (o.status) {
case TextObject.TEXT_CREATED:
dobj = drawFactory.makeDrawObject(o, whiteboardModel) as TextDrawObject;
if (dobj != null) {
dobj.draw(o, shapeFactory.parentWidth, shapeFactory.parentHeight);
if (isPresenter) {
dobj.displayForPresenter();
wbCanvas.stage.focus = dobj.textField;
dobj.registerListeners(textObjGainedFocusListener, textObjLostFocusListener, textObjTextListener, textObjSpecialListener);
} else {
dobj.displayNormally();
}
wbCanvas.addGraphic(dobj);
_annotationsList.push(dobj);
}
break;
case TextObject.TEXT_UPDATED:
var gobj1:DrawObject = _annotationsList.pop();
wbCanvas.removeGraphic(gobj1 as DisplayObject);
dobj = drawFactory.makeDrawObject(o, whiteboardModel) as TextDrawObject;
if (dobj != null) {
dobj.draw(o, shapeFactory.parentWidth, shapeFactory.parentHeight);
if (isPresenter) {
// dobj.displayForPresenter();
// wbCanvas.stage.focus = dobj.setFocus();
} else {
dobj.displayNormally();
wbCanvas.addGraphic(dobj);
_annotationsList.push(dobj);
}
}
break;
case TextObject.TEXT_PUBLISHED:
var gobj:DrawObject = _annotationsList.pop();
wbCanvas.removeGraphic(gobj as DisplayObject);
dobj = drawFactory.makeDrawObject(o, whiteboardModel) as TextDrawObject;
if (dobj != null) {
dobj.draw(o, shapeFactory.parentWidth, shapeFactory.parentHeight);
dobj.displayNormally();
wbCanvas.addGraphic(dobj);
_annotationsList.push(dobj);
}
break;
}
}
// Draws a TextObject when/if it is received from the server
private function drawText(o:Annotation, recvdShapes:Boolean):void {
LogUtil.debug("RX: Got text [" + o.type + " " + o.status + " " + o.id + " " + o.annotation.text + "]");
if (recvdShapes) {
LogUtil.debug("RX: Got text [" + o.type + " " + o.status + " " + o.id + "]");
}
@ -165,51 +177,52 @@ package org.bigbluebutton.modules.whiteboard
}
}
private function calibrateNewTextWith(o:Annotation):TextObject {
var tobj:TextObject = shapeFactory.makeTextObject(o);
tobj.setGraphicID(o.id);
tobj.status = o.status;
// LogUtil.debug("Created text object [" + tobj.getGraphicID() + "] in [" + tobj.text + "," + tobj.x + "," + tobj.y + "," + tobj.textSize + "]");
return tobj;
}
/* adds a new TextObject that is suited for a presenter. For example, it will be made editable and the appropriate listeners will be registered so that
the required events will be dispatched */
private function addPresenterText(o:Annotation, background:Boolean=false):void {
if(!isPresenter) return;
var tobj:TextObject = calibrateNewTextWith(o);
tobj.multiline = true;
tobj.wordWrap = true;
tobj.makeEditable(true);
private function calibrateNewTextWith(o:Annotation):TextObject {
var tobj:TextObject = shapeFactory.makeTextObject(o);
tobj.setGraphicID(o.id);
tobj.status = o.status;
// LogUtil.debug("Created text object [" + tobj.getGraphicID() + "] in [" + tobj.text + "," + tobj.x + "," + tobj.y + "," + tobj.textSize + "]");
return tobj;
}
/* adds a new TextObject that is suited for a presenter. For example, it will be made editable and the appropriate listeners will be registered so that
the required events will be dispatched */
private function addPresenterText(o:Annotation, background:Boolean=false):void {
if(!isPresenter) return;
var tobj:TextObject = calibrateNewTextWith(o);
tobj.multiline = true;
tobj.wordWrap = true;
tobj.makeEditable(true);
tobj.border = true;
if (!background) {
tobj.background = false;
tobj.backgroundColor = 0x00FF00;
}
// LogUtil.debug("Putting text object [" + tobj.getGraphicID() + "] in [" + tobj.x + "," + tobj.y + "]");
tobj.registerListeners(textObjGainedFocusListener, textObjLostFocusListener, textObjTextListener, textObjSpecialListener);
wbCanvas.addGraphic(tobj);
wbCanvas.stage.focus = tobj;
graphicList.push(tobj);
}
/* adds a new TextObject that is suited for a viewer. For example, it will not
be made editable and no listeners need to be attached because the viewers
should not be able to edit/modify the TextObject
*/
private function addNormalText(o:Annotation):void {
if (isPresenter) return;
var tobj:TextObject = calibrateNewTextWith(o);
//LogUtil.debug("TEXT ADDED: " + tobj.getGraphicID());
tobj.multiline = true;
tobj.wordWrap = true;
// LogUtil.debug("Putting text object [" + tobj.getGraphicID() + "] in [" + tobj.x + "," + tobj.y + "]");
tobj.registerListeners(textObjGainedFocusListener, textObjLostFocusListener, textObjTextListener, textObjSpecialListener);
wbCanvas.addGraphic(tobj);
wbCanvas.stage.focus = tobj;
graphicList.push(tobj);
}
/* adds a new TextObject that is suited for a viewer. For example, it will not
be made editable and no listeners need to be attached because the viewers
should not be able to edit/modify the TextObject
*/
private function addNormalText(o:Annotation):void {
if (isPresenter) return;
var tobj:TextObject = calibrateNewTextWith(o);
LogUtil.debug("TEXT ADDED: " + tobj.getGraphicID());
tobj.multiline = true;
tobj.wordWrap = true;
tobj.background = false;
tobj.makeEditable(false);
wbCanvas.addGraphic(tobj);
graphicList.push(tobj);
}
tobj.border = true;
tobj.makeEditable(false);
wbCanvas.addGraphic(tobj);
graphicList.push(tobj);
}
private function removeText(id:String):void {
var tobjData:Array = getGobjInfoWithID(id);
var removeIndex:int = tobjData[0];
@ -217,15 +230,17 @@ package org.bigbluebutton.modules.whiteboard
wbCanvas.removeGraphic(tobjToRemove);
graphicList.splice(removeIndex, 1);
}
/* method to modify a TextObject that is already present on the whiteboard, as opposed to adding a new TextObject to the whiteboard */
private function modifyText(o:Annotation):void {
// var tobj:TextObject = calibrateNewTextWith(o);
// var id:String = tobj.getGraphicID();
removeText(o.id);
// LogUtil.debug("Text modified to " + tobj.text);
addNormalText(o);
}
/* method to modify a TextObject that is already present on the whiteboard, as opposed to adding a new TextObject to the whiteboard */
private function modifyText(o:Annotation):void {
LogUtil.debug("Text modified to " + o.annotation.text);
// var tobj:TextObject = calibrateNewTextWith(o);
// var id:String = tobj.getGraphicID();
removeText(o.id);
addNormalText(o);
}
/* the following three methods are used to remove any GraphicObjects (and its subclasses) if the id of the object to remove is specified. The latter
two are convenience methods, the main one is the first of the three.
@ -332,6 +347,7 @@ package org.bigbluebutton.modules.whiteboard
public function changePage():void{
// LogUtil.debug("**** CanvasDisplay changePage. Cearing page *****");
clearBoard();
var annotations:Array = whiteboardModel.getAnnotations();
// LogUtil.debug("**** CanvasDisplay changePage [" + annotations.length + "] *****");
if (annotations.length == 0) {
@ -339,10 +355,14 @@ package org.bigbluebutton.modules.whiteboard
} 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 + "] *****");
if(an.type != "text") {
var dobj:DrawObject = drawFactory.makeDrawObject(an, whiteboardModel);
drawShape(dobj, true);
// LogUtil.debug("**** Drawing graphic from changePage [" + an.type + "] *****");
if(an.type != DrawObject.TEXT) {
var dobj:DrawObject = drawFactory.makeDrawObject(an, whiteboardModel);
if (dobj != null) {
dobj.draw(an, shapeFactory.parentWidth, shapeFactory.parentHeight);
wbCanvas.addGraphic(dobj);
_annotationsList.push(dobj);
}
} else {
drawText(an, true);
}
@ -408,6 +428,7 @@ package org.bigbluebutton.modules.whiteboard
tobj.multiline = true;
tobj.wordWrap = true;
tobj.background = false;
// tobj.backgroundColor = 0xFF0000;
tobj.makeEditable(false);
tobj.background = false;
if (currentlySelectedTextObject != null) {
@ -466,7 +487,6 @@ package org.bigbluebutton.modules.whiteboard
var tf:TextObject = event.target as TextObject;
sendTextToServer(TextObject.TEXT_PUBLISHED, tf);
// LogUtil.debug("Text published to: " + tf.text);
// currentlySelectedTextObject = null;
tf.border = false;
@ -486,8 +506,8 @@ package org.bigbluebutton.modules.whiteboard
public function modifySelectedTextObject(textColor:uint, bgColorVisible:Boolean, backgroundColor:uint, textSize:Number):void {
LogUtil.debug("modifySelectedTextObject = " + textSize);
currentlySelectedTextObject.textColor = textColor;
currentlySelectedTextObject.background = bgColorVisible;
currentlySelectedTextObject.backgroundColor = backgroundColor;
// currentlySelectedTextObject.background = bgColorVisible;
// currentlySelectedTextObject.backgroundColor = backgroundColor;
currentlySelectedTextObject.textSize = textSize;
LogUtil.debug("modifySelectedTextObject = " + currentlySelectedTextObject.textSize);
currentlySelectedTextObject.applyFormatting();
@ -524,7 +544,7 @@ package org.bigbluebutton.modules.whiteboard
annotation["textBoxHeight"] = tobj.textBoxHeight;
var msg:Annotation = new Annotation(tobj.getGraphicID(), "text", annotation);
wbCanvas.sendGraphicToServer(msg, WhiteboardDrawEvent.SEND_TEXT);
wbCanvas.sendGraphicToServer(msg, WhiteboardDrawEvent.SEND_TEXT);
}
public function isPageEmpty():Boolean {

View File

@ -54,9 +54,9 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
} else if (a.type == DrawObject.ELLIPSE) {
LogUtil.debug("Creating ELLIPSE Annotation");
return new Ellipse(a.id, a.type, a.status);
} else if (a.type == DrawObject.TEXT) {
LogUtil.debug("Creating TEXT Annotation");
// return new TextObject(a.id, a.type, a.status, whiteboardModel);
// } else if (a.type == DrawObject.TEXT) {
// LogUtil.debug("Creating TEXT Annotation");
// return new TextObject(a.id, a.type, a.status);
}
return null;

View File

@ -103,8 +103,8 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
return createAnnotation(type, normSegment, color, thickness, fill, fillColor, transparency);
}
public function createTextObject(txt:String, txtColor:uint, bgColor:uint, bgColorVisible:Boolean, x:Number, y:Number, tbWidth:Number, tbHeight:Number, textSize:Number):TextObject {
var tobj:TextObject = new TextObject(txt, txtColor, bgColor, bgColorVisible, normalize(x , _parentWidth), normalize(y, _parentHeight),
public function createTextObject(txt:String, txtColor:uint, x:Number, y:Number, tbWidth:Number, tbHeight:Number, textSize:Number):TextDrawAnnotation {
var tobj:TextDrawAnnotation = new TextDrawAnnotation(txt, txtColor, normalize(x , _parentWidth), normalize(y, _parentHeight),
normalize(tbWidth , _parentWidth), normalize(tbHeight , _parentWidth), textSize);
return tobj;
}
@ -112,20 +112,20 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
/* convenience method for above method, takes a TextObject and returns one with "normalized" coordinates */
public function makeTextObject(t:Annotation):TextObject {
// LogUtil.debug("***Making textObject [" + t.type + ", [" + t.annotation.x + "," + t.annotation.y + "]");
var tobj:TextObject = new TextObject(t.annotation.text, t.annotation.fontColor, t.annotation.backgroundColor, t.annotation.background,
LogUtil.debug("***Making textObject [" + t.type + ", [" + t.annotation.x + "," + t.annotation.y + "]");
var tobj:TextObject = new TextObject(t.annotation.text, t.annotation.fontColor,
t.annotation.x, t.annotation.y, t.annotation.textBoxWidth, t.annotation.textBoxHeight, t.annotation.fontSize);
tobj.makeGraphic(_parentWidth,_parentHeight);
// LogUtil.debug("***Made textObject [" + tobj.text + ", [" + tobj.x + "," + tobj.y + "," + tobj.textSize + "]");
return tobj;
LogUtil.debug("***Made textObject [" + tobj.text + ", [" + tobj.x + "," + tobj.y + "," + tobj.textSize + "]");
return tobj;
}
public function redrawTextObject(a:Annotation, t:TextObject):TextObject {
// LogUtil.debug("***Redraw textObject [" + a.type + ", [" + a.annotation.x + "," + a.annotation.y + "]");
var tobj:TextObject = new TextObject(a.annotation.text, a.annotation.fontColor, a.annotation.backgroundColor, a.annotation.background,
LogUtil.debug("***Redraw textObject [" + a.type + ", [" + a.annotation.x + "," + a.annotation.y + "]");
var tobj:TextObject = new TextObject(a.annotation.text, a.annotation.fontColor,
a.annotation.x, a.annotation.y, a.annotation.textBoxWidth, a.annotation.textBoxHeight, a.annotation.fontSize);
tobj.redrawText(t.oldParentWidth, t.oldParentHeight, _parentWidth,_parentHeight);
// LogUtil.debug("***Redraw textObject [" + tobj.text + ", [" + tobj.x + "," + tobj.y + "," + tobj.textSize + "]");
LogUtil.debug("***Redraw textObject [" + tobj.text + ", [" + tobj.x + "," + tobj.y + "," + tobj.textSize + "]");
return tobj;
}

View File

@ -0,0 +1,46 @@
package org.bigbluebutton.modules.whiteboard.business.shapes
{
import org.bigbluebutton.modules.whiteboard.models.Annotation;
public class TextDrawAnnotation extends DrawAnnotation
{
private var _type:String = DrawObject.TEXT;
private var _text:String;
private var _textBoxWidth:Number = 0;
private var _textBoxHeight:Number = 0;
private var _x:Number;
private var _y:Number;
private var _fontColor:uint;
private var _fontStyle:String = "arial";
private var _fontSize:Number;
public function TextDrawAnnotation(text:String, color:uint, x:Number, y:Number, width:Number, height:Number, fontSize:Number)
{
_text = text;
_fontColor = color;
_x = x;
_y = y;
_textBoxWidth = width;
_textBoxHeight = height;
_fontSize = fontSize;
}
override public function createAnnotation():Annotation {
var ao:Object = new Object();
ao["type"] = DrawObject.TEXT;
ao["id"] = _id;
ao["status"] = _status;
ao["text"] = _text;
ao["fontColor"] = _fontColor;
ao["x"] = _x;
ao["y"] = _y;
ao["fontSize"] = _fontSize;
ao["textBoxWidth"] = _textBoxWidth;
ao["textBoxHeight"] = _textBoxHeight;
return new Annotation(_id, DrawObject.TEXT, ao);
}
}
}

View File

@ -0,0 +1,185 @@
/**
* 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 2.1 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/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
{
import com.asfusion.mate.core.GlobalDispatcher;
import flash.display.DisplayObject;
import flash.display.Shape;
import flash.display.Stage;
import flash.events.Event;
import flash.events.FocusEvent;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.events.TextEvent;
import flash.text.AntiAliasType;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
import flashx.textLayout.edit.SelectionManager;
import flexlib.scheduling.scheduleClasses.utils.Selection;
import mx.controls.Text;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasModel;
import org.bigbluebutton.modules.whiteboard.models.Annotation;
public class TextDrawObject extends DrawObject implements GraphicObject {
public static const TYPE_NOT_EDITABLE:String = "dynamic";
public static const TYPE_EDITABLE:String = "editable";
public static const TEXT_CREATED:String = "textCreated";
public static const TEXT_UPDATED:String = "textEdited";
public static const TEXT_PUBLISHED:String = "textPublished";
public static const TEXT_TOOL:String = "textTool";
private var _editable:Boolean;
private var _type:String = DrawObject.TEXT;
private var _origParentWidth:Number = 0;
private var _origParentHeight:Number = 0;
private var _textField:TextField = new TextField();
public function TextDrawObject(id:String, type:String, status:String) {
super(id, type, status);
addChild(_textField);
}
public function get origParentWidth():Number {
return _origParentWidth;
}
public function get origParentHeight():Number {
return _origParentHeight;
}
public function get textField():TextField {
return _textField;
}
override public function draw(a:Annotation, parentWidth:Number, parentHeight:Number):void {
LogUtil.debug("Drawing TEXT");
this.x = denormalize(a.annotation.x, parentWidth);
this.y = denormalize(a.annotation.y, parentHeight);
var newFontSize:Number = a.annotation.fontSize;
if (_origParentHeight == 0 && _origParentWidth == 0) {
// LogUtil.debug("Old parent dim [" + _origParentWidth + "," + _origParentHeight + "]");
newFontSize = a.annotation.fontSize;
_origParentHeight = parentHeight;
_origParentWidth = parentWidth;
} else {
newFontSize = (parentHeight/_origParentHeight) * a.annotation.fontSize;
// LogUtil.debug("2 Old parent dim [" + _origParentWidth + "," + _origParentHeight + "] newFontSize=" + newFontSize);
}
_textField.text = a.annotation.text;
_textField.antiAliasType = AntiAliasType.ADVANCED;
var format:TextFormat = new TextFormat();
format.size = newFontSize;
format.font = "arial";
_textField.defaultTextFormat = format;
_textField.setTextFormat(format);
this.width = denormalize(a.annotation.textBoxWidth, parentWidth);
this.height = denormalize(a.annotation.textBoxHeight, parentHeight);
LogUtil.debug("2 Old parent dim [" + _origParentWidth + "," + _origParentHeight + "][" + width + "," + height + "] newFontSize=" + newFontSize);
}
public function redrawText(a:Annotation, origParentWidth:Number, origParentHeight:Number, parentWidth:Number, parentHeight:Number):void {
this.x = denormalize(a.annotation.x, parentWidth);
this.y = denormalize(a.annotation.y, parentHeight);
var newFontSize:Number = a.annotation.fontSize;
newFontSize = (parentHeight/origParentHeight) * a.annotation.fontSize;
/** Pass around the original parent width and height when this text was drawn.
* We need this to redraw the the text to the proper size properly.
* **/
_origParentHeight = origParentHeight;
_origParentWidth = origParentWidth;
_textField.text = a.annotation.text;
_textField.antiAliasType = AntiAliasType.ADVANCED;
var format:TextFormat = new TextFormat();
format.size = newFontSize;
format.font = "arial";
_textField.defaultTextFormat = format;
_textField.setTextFormat(format);
this.width = denormalize(a.annotation.textBoxWidth, parentWidth);
this.height = denormalize(a.annotation.textBoxHeight, parentHeight);
LogUtil.debug("Redraw dim [" + _origParentWidth + "," + _origParentHeight + "][" + width + "," + height + "] newFontSize=" + newFontSize);
// LogUtil.debug("Redraw 2 Old parent dim [" + this.width + "," + this.height + "] newFontSize=" + newFontSize);
}
public function displayForPresenter():void {
_textField.multiline = true;
_textField.wordWrap = true;
_textField.type = TextFieldType.INPUT;
_textField.border = true;
_textField.background = true;
_textField.backgroundColor = 0xFFFFFF;
}
public function displayNormally():void {
_textField.multiline = true;
_textField.wordWrap = true;
}
public function makeEditable(editable:Boolean):void {
if(editable) {
_textField.type = TextFieldType.INPUT;
} else {
_textField.type = TextFieldType.DYNAMIC;
}
this._editable = editable;
}
public function registerListeners(textObjGainedFocus:Function, textObjLostFocus:Function, textObjTextListener:Function, textObjDeleteListener:Function):void {
_textField.addEventListener(FocusEvent.FOCUS_IN, textObjGainedFocus);
_textField.addEventListener(FocusEvent.FOCUS_OUT, textObjLostFocus);
_textField.addEventListener(TextEvent.TEXT_INPUT, textObjTextListener);
_textField.addEventListener(KeyboardEvent.KEY_DOWN, textObjDeleteListener);
}
public function deregisterListeners(textObjGainedFocus:Function, textObjLostFocus:Function, textObjTextListener:Function, textObjDeleteListener:Function):void {
_textField.removeEventListener(FocusEvent.FOCUS_IN, textObjGainedFocus);
_textField.removeEventListener(FocusEvent.FOCUS_OUT, textObjLostFocus);
_textField.removeEventListener(TextEvent.TEXT_INPUT, textObjTextListener);
_textField.removeEventListener(KeyboardEvent.KEY_DOWN, textObjDeleteListener);
}
}
}

View File

@ -75,7 +75,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
private var _origParentHeight:Number = 0;
public var fontStyle:String = "arial";
public function TextObject(text:String, textColor:uint, bgColor:uint, bgColorVisible:Boolean, x:Number, y:Number, boxWidth:Number, boxHeight:Number, textSize:Number) {
public function TextObject(text:String, textColor:uint, x:Number, y:Number, boxWidth:Number, boxHeight:Number, textSize:Number) {
this.text = text;
this.textColor = textColor;
// this.backgroundColor = bgColor;

View File

@ -2,6 +2,7 @@ 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;
@ -59,13 +60,13 @@ package org.bigbluebutton.modules.whiteboard.views
if (tbHeight < 15 || tbWidth < 50) return;
var tobj:TextObject = _shapeFactory.createTextObject("", 0x000000, 0x000000, false, _mouseXDown, _mouseYDown, tbWidth, tbHeight, 18);
LogUtil.error("Creating text at [" + mouseX + "," + mouseY + "] norm=[" + tobj.getOrigX() + "," + tobj.getOrigY() + "][" + tobj.textBoxWidth + "," + tobj.textBoxHeight + "]");
var tobj:TextDrawAnnotation = _shapeFactory.createTextObject("", 0x000000, _mouseXDown, _mouseYDown, tbWidth, tbHeight, 18);
sendTextToServer(TextObject.TEXT_CREATED, tobj);
}
}
private function sendTextToServer(status:String, tobj:TextObject):void {
private function sendTextToServer(status:String, tobj:TextDrawAnnotation):void {
switch (status) {
case TextObject.TEXT_CREATED:
tobj.status = TextObject.TEXT_CREATED;
@ -80,24 +81,7 @@ package org.bigbluebutton.modules.whiteboard.views
break;
}
// LogUtil.debug("SENDING TEXT: [" + tobj.text + "]");
var annotation:Object = new Object();
annotation["type"] = "text";
annotation["id"] = tobj.getGraphicID();
annotation["status"] = tobj.status;
annotation["text"] = tobj.text;
annotation["fontColor"] = tobj.textColor;
annotation["backgroundColor"] = tobj.backgroundColor;
annotation["background"] = tobj.background;
annotation["x"] = tobj.getOrigX();
annotation["y"] = tobj.getOrigY();
annotation["fontSize"] = tobj.textSize;
annotation["textBoxWidth"] = tobj.textBoxWidth;
annotation["textBoxHeight"] = tobj.textBoxHeight;
var msg:Annotation = new Annotation(tobj.getGraphicID(), "text", annotation);
_wbCanvas.sendGraphicToServer(msg, WhiteboardDrawEvent.SEND_TEXT);
_wbCanvas.sendGraphicToServer(tobj.createAnnotation(), WhiteboardDrawEvent.SEND_TEXT);
}
}
}