- draw rectangle while presenter drags mouse for text tool

This commit is contained in:
Richard Alam 2012-08-14 15:38:40 +00:00
parent b88aacd19d
commit b81880c7a3
3 changed files with 43 additions and 5 deletions

View File

@ -140,6 +140,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
applyTextFormat(newFontSize);
this.width = denormalize(_textBoxWidth, parentWidth);
this.height = denormalize(_textBoxHeight, parentHeight);
}
public function get textBoxWidth():Number {

View File

@ -0,0 +1,24 @@
package org.bigbluebutton.modules.whiteboard.views
{
import flash.display.Sprite;
public class RectangleFeedbackTextBox extends Sprite
{
public function RectangleFeedbackTextBox()
{
super();
}
public function draw(startX:Number, startY:Number, width:Number, height:Number):void {
graphics.clear();
graphics.lineStyle(1, 0x0)
graphics.drawRect(0, 0, width, height);
x = startX;
y = startY;
}
public function clear():void {
graphics.clear();
}
}
}

View File

@ -20,7 +20,8 @@ package org.bigbluebutton.modules.whiteboard.views
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;
@ -35,7 +36,7 @@ package org.bigbluebutton.modules.whiteboard.views
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
{
if(tool.graphicType == WhiteboardConstants.TYPE_TEXT) {
if (tool.graphicType == WhiteboardConstants.TYPE_TEXT) {
_mouseXDown = mouseX;
_mouseYDown = mouseY;
@ -48,13 +49,25 @@ package org.bigbluebutton.modules.whiteboard.views
public function onMouseMove(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
{
// do nothing
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);
}
}
public function onMouseUp(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
{
if(tool.graphicType == WhiteboardConstants.TYPE_TEXT && _mousedDown) {
if (tool.graphicType == WhiteboardConstants.TYPE_TEXT && _mousedDown) {
feedback.clear();
if (_wbCanvas.contains(feedback)) {
_wbCanvas.removeRawChild(feedback);
}
_mousedDown = false;
var tbWidth:Number = mouseX - _mouseXDown;