Create text field in the whiteboard with a single click.
This commit is contained in:
parent
2eb332b618
commit
cf8285c36f
@ -16,8 +16,7 @@
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.modules.whiteboard.views
|
||||
{
|
||||
package org.bigbluebutton.modules.whiteboard.views {
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.ShapeFactory;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextDrawAnnotation;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
|
||||
@ -26,28 +25,38 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
import org.bigbluebutton.modules.whiteboard.views.models.WhiteboardTool;
|
||||
|
||||
public class TextDrawListener implements IDrawListener
|
||||
{
|
||||
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 _mouseXMove:Number = 0;
|
||||
|
||||
private var _mouseYMove:Number = 0;
|
||||
|
||||
private var _singleClickWidth:Number = 200;
|
||||
|
||||
private var _singleClickHeight:Number = 80;
|
||||
|
||||
private var _idGenerator:AnnotationIDGenerator;
|
||||
|
||||
private var _mousedDown:Boolean = false;
|
||||
|
||||
private var _curID:String;
|
||||
|
||||
private var feedback:RectangleFeedbackTextBox = new RectangleFeedbackTextBox();
|
||||
|
||||
private var _wbModel:WhiteboardModel;
|
||||
|
||||
public function TextDrawListener(idGenerator:AnnotationIDGenerator,
|
||||
wbCanvas:WhiteboardCanvas,
|
||||
sendShapeFrequency:int,
|
||||
shapeFactory:ShapeFactory,
|
||||
wbModel:WhiteboardModel)
|
||||
{
|
||||
public function TextDrawListener(idGenerator:AnnotationIDGenerator, wbCanvas:WhiteboardCanvas, sendShapeFrequency:int, shapeFactory:ShapeFactory, wbModel:WhiteboardModel) {
|
||||
_idGenerator = idGenerator;
|
||||
_wbCanvas = wbCanvas;
|
||||
_sendFrequency = sendShapeFrequency;
|
||||
@ -59,8 +68,7 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
// Ignore
|
||||
}
|
||||
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
public function onMouseDown(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void {
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_TEXT) {
|
||||
_mouseXDown = _mouseXMove = mouseX;
|
||||
_mouseYDown = _mouseYMove = mouseY;
|
||||
@ -72,8 +80,7 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
}
|
||||
}
|
||||
|
||||
public function onMouseMove(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
public function onMouseMove(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void {
|
||||
if (tool.graphicType == WhiteboardConstants.TYPE_TEXT && _mousedDown) {
|
||||
_mouseXMove = mouseX;
|
||||
_mouseYMove = mouseY;
|
||||
@ -85,11 +92,9 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
feedback.draw(_mouseXDown, _mouseYDown, mouseX - _mouseXDown, mouseY - _mouseYDown);
|
||||
_wbCanvas.addRawChild(feedback);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function onMouseUp(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void
|
||||
{
|
||||
public function onMouseUp(mouseX:Number, mouseY:Number, tool:WhiteboardTool):void {
|
||||
// We have to use the saved X and Y from the last mouse move rather than the X and
|
||||
// Y from MouseUp because the latter might be outside the bounds of the area.
|
||||
|
||||
@ -104,7 +109,12 @@ package org.bigbluebutton.modules.whiteboard.views
|
||||
var tbWidth:Number = Math.abs(_mouseXMove - _mouseXDown);
|
||||
var tbHeight:Number = Math.abs(_mouseYMove - _mouseYDown);
|
||||
|
||||
if (tbHeight < 15 || tbWidth < 50) return;
|
||||
if (tbHeight == 0 && tbWidth == 0) {
|
||||
tbWidth = _singleClickWidth;
|
||||
tbHeight = _singleClickHeight;
|
||||
} else if (tbHeight < 15 || tbWidth < 50) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tobj:TextDrawAnnotation = _shapeFactory.createTextObject("", 0x000000, Math.min(_mouseXDown, _mouseXMove), Math.min(_mouseYDown, _mouseYMove), tbWidth, tbHeight, 18);
|
||||
|
||||
|
@ -250,7 +250,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
|
||||
<mx:ColorPicker width="20" height="20" change="setTextColor(event)" id="ctextpik" selectedColor="0x000000"
|
||||
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.texttoolbar.textColorPicker')}"/>
|
||||
|
||||
|
@ -25,7 +25,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
accessibilityName="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.toolbar.text.accessibilityName')}">
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import org.bigbluebutton.common.Images;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
|
Loading…
Reference in New Issue
Block a user