- figure out why we dispatch a text created event when mouse moves out of canvas

This commit is contained in:
Richard Alam 2012-08-03 19:04:15 +00:00
parent 9b4a1b4815
commit e95e4c72f0
2 changed files with 13 additions and 3 deletions

View File

@ -158,7 +158,7 @@ package org.bigbluebutton.modules.whiteboard
var tobj:TextObject = calibrateNewTextWith(o);
tobj.multiline = true;
tobj.wordWrap = true;
tobj.autoSize = TextFieldAutoSize.LEFT;
// tobj.autoSize = TextFieldAutoSize.LEFT;
tobj.makeEditable(true);
tobj.border = true;
// LogUtil.debug("Putting text object [" + tobj.getGraphicID() + "] in [" + tobj.x + "," + tobj.y + "]");
@ -178,7 +178,7 @@ package org.bigbluebutton.modules.whiteboard
//LogUtil.debug("TEXT ADDED: " + tobj.getGraphicID());
tobj.multiline = true;
tobj.wordWrap = true;
tobj.autoSize = TextFieldAutoSize.LEFT;
// tobj.autoSize = TextFieldAutoSize.LEFT;
tobj.makeEditable(false);
tobj.border = true;
wbCanvas.addGraphic(tobj);

View File

@ -17,6 +17,8 @@ package org.bigbluebutton.modules.whiteboard.views
private var _mouseXDown:Number = 0;
private var _mouseYDown:Number = 0;
private var _mousedDown:Boolean = false;
public function TextDrawListener(wbCanvas:WhiteboardCanvas, sendShapeFrequency:int, shapeFactory:ShapeFactory)
{
_wbCanvas = wbCanvas;
@ -29,6 +31,11 @@ package org.bigbluebutton.modules.whiteboard.views
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;
}
}
@ -39,7 +46,10 @@ package org.bigbluebutton.modules.whiteboard.views
public function onMouseUp(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
{
if(tool.graphicType == WhiteboardConstants.TYPE_TEXT) {
if(tool.graphicType == WhiteboardConstants.TYPE_TEXT && _mousedDown) {
_mousedDown = false;
var tbWidth:Number = mouseX - _mouseXDown;
var tbHeight:Number = mouseY - _mouseYDown;