- change text color and size

This commit is contained in:
Richard Alam 2012-08-07 18:26:06 +00:00
parent f0e5762b12
commit 3343ab1f0e
4 changed files with 46 additions and 14 deletions

View File

@ -194,7 +194,6 @@ package org.bigbluebutton.modules.whiteboard
tobj.multiline = true;
tobj.wordWrap = true;
tobj.background = false;
// tobj.backgroundColor = 0x0000FF;
tobj.makeEditable(false);
wbCanvas.addGraphic(tobj);
graphicList.push(tobj);
@ -434,7 +433,7 @@ package org.bigbluebutton.modules.whiteboard
}
public function textObjGainedFocusListener(event:FocusEvent):void {
// LogUtil.debug("### GAINED FOCUS ");
LogUtil.debug("### GAINED FOCUS ");
var tf:TextObject = event.currentTarget as TextObject;
wbCanvas.stage.focus = tf;
tf.stage.focus = tf;
@ -445,11 +444,11 @@ package org.bigbluebutton.modules.whiteboard
}
public function textObjLostFocusListener(event:FocusEvent):void {
// LogUtil.debug("### LOST FOCUS ");
LogUtil.debug("### LOST FOCUS ");
var tf:TextObject = event.target as TextObject;
sendTextToServer(TextObject.TEXT_PUBLISHED, tf);
// LogUtil.debug("Text published to: " + tf.text);
currentlySelectedTextObject = null;
// currentlySelectedTextObject = null;
tf.border = false;
@ -459,6 +458,24 @@ package org.bigbluebutton.modules.whiteboard
/* hide text toolbar because we don't want to show it if there is no text selected */
}
/* invoked by the WhiteboardManager that is invoked by the TextToolbar, that
specifies the currently selected TextObject to change its attributes. For example,
when a 'text color' ColorPicker is changed in the TextToolbar, the invocation
eventually reaches this method that causes the currently selected TextObject
to be re-sent to the red5 server with the modified attributes.
*/
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.textSize = textSize;
LogUtil.debug("modifySelectedTextObject = " + currentlySelectedTextObject.textSize);
currentlySelectedTextObject.applyFormatting();
sendTextToServer(TextObject.TEXT_PUBLISHED, currentlySelectedTextObject);
}
private function sendTextToServer(status:String, tobj:TextObject):void {
switch (status) {
case TextObject.TEXT_CREATED:
@ -472,7 +489,7 @@ package org.bigbluebutton.modules.whiteboard
break;
}
// LogUtil.debug("SENDING TEXT: [" + tobj.text + "]");
LogUtil.debug("SENDING TEXT: [" + tobj.textSize + "]");
var annotation:Object = new Object();
annotation["type"] = "text";

View File

@ -170,8 +170,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
public function redrawText(origParentWidth:Number, origParentHeight:Number, parentWidth:Number, parentHeight:Number):void {
this.x = denormalize(origX, parentWidth);
this.y = denormalize(origY, parentHeight);
var newFontSize:Number = textSize;
newFontSize = (parentHeight/origParentHeight) * textSize;
@ -215,6 +214,18 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
this._editable = editable;
}
public function applyFormatting():void {
var tf:TextFormat = new TextFormat();
tf.size = this.textSize;
tf.font = "arial";
this.defaultTextFormat = tf;
this.setTextFormat(tf);
this.multiline = true;
this.wordWrap = true;
// this.autoSize = TextFieldAutoSize.LEFT;
this.antiAliasType = AntiAliasType.ADVANCED;
}
public function registerListeners(textObjGainedFocus:Function, textObjLostFocus:Function, textObjTextListener:Function, textObjDeleteListener:Function):void {
this.addEventListener(FocusEvent.FOCUS_IN, textObjGainedFocus);
this.addEventListener(FocusEvent.FOCUS_OUT, textObjLostFocus);

View File

@ -24,8 +24,10 @@
creationComplete="init()" visible="false" mouseOver="setCursor(toolType)" mouseOut="removeCursor()" implements="org.bigbluebutton.common.IBbbCanvas">
<mx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import com.asfusion.mate.events.Dispatcher;
import mx.managers.CursorManager;
import org.bigbluebutton.common.IBbbCanvas;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.LogUtil;
@ -160,7 +162,8 @@
}
public function modifySelectedTextObject(fgColor:uint, bgColorVisible:Boolean, backgroundColor:uint, textSize:Number):void {
// displayModel.modifySelectedTextObject(fgColor, bgColorVisible, backgroundColor, textSize);
LogUtil.debug("modifying text size = " + textSize);
displayModel.modifySelectedTextObject(fgColor, bgColorVisible, backgroundColor, textSize);
}
public function makeTextObjectsEditable(e:MadePresenterEvent):void {

View File

@ -181,8 +181,8 @@ Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
if(tobj == null) return;
currentlySelectedTextObject = tobj;
this.textColor = ctextpik.selectedColor = tobj.textColor;
this.bgColor = cbackpik.selectedColor = tobj.backgroundColor;
this.backgroundVisible = btnToggleBackground.selected = tobj.background;
// this.bgColor = cbackpik.selectedColor = tobj.backgroundColor;
// this.backgroundVisible = btnToggleBackground.selected = tobj.background;
this.textSizeMenu.label = String(tobj.textSize);
this.textSize = tobj.textSize;
}
@ -266,15 +266,16 @@ Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
<mx:ColorPicker width="20" height="20" change="setTextColor(event)" id="ctextpik" selectedColor="0x000000"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.texttoolbar.textColorPicker')}"/>
<!--
<mx:Spacer width="3" />
<mx:Button width="20" height="20" id="btnToggleBackground" click="setBackgroundVisible(event)" icon="{toggle_text_background_icon}"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.texttoolbar.backColorVisible')}" toggle="true"/>
<mx:ColorPicker width="20" height="20" change="changeTextBackgroundColor(event)" id="cbackpik" selectedColor="0x000000"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.texttoolbar.backColorPicker')}"/>
-->
<views:PopUpCombo id="textSizeMenu" creationComplete="initTextSizeMenu()"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.texttoolbar.textSizeMenu')}"
openAlways="true" specificOpenDirection="{PopUpCombo.OPEN_UP}" />