From c6ffab94184addfb8c6a2e60a1c86ed2b7119ab0 Mon Sep 17 00:00:00 2001 From: Pedro Beschorner Marin Date: Mon, 16 Mar 2015 14:23:31 -0300 Subject: [PATCH 1/3] Avoid chat window to be dragged when user is selecting text from chat box with shift key --- .../modules/chat/views/ChatBox.mxml | 22 ++++++++++++++++++- .../modules/chat/views/ChatView.mxml | 17 +++++++++----- .../modules/chat/views/ChatWindow.mxml | 8 +++++-- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml index d0dafe61c0..4550e08976 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml @@ -150,6 +150,8 @@ with BigBlueButton; if not, see . private var chatListHeight:Number = 100; [Bindable] public var chatOptions:ChatOptions = new ChatOptions(); + + private var shiftPressed:Boolean = false; private function onCreationComplete():void { bindToHeightToDetermineHeightOfMessageList(); @@ -170,6 +172,10 @@ with BigBlueButton; if not, see . // Listen for the ENTER key to send the message. txtMsgArea.addEventListener(TextEvent.TEXT_INPUT, handleTextInput); + + // Listen for the SHIFT key to avoid moving the chat box while text selection + chatMessagesList.addEventListener(KeyboardEvent.KEY_DOWN, handleShiftDown); + chatMessagesList.addEventListener(KeyboardEvent.KEY_UP, handleShiftUp); queryForChatHistory(); @@ -184,7 +190,21 @@ with BigBlueButton; if not, see . trace(LOG + " onCreationComplete. Apply lock settings"); applyLockSettings(); } - + + private function handleShiftDown(e:KeyboardEvent):void { + if (e.shiftKey && !shiftPressed) { + shiftPressed = true; + parentDocument.handleDraggableStatus(false); + } + } + + private function handleShiftUp(e:KeyboardEvent):void { + if (!e.shiftKey && shiftPressed) { + shiftPressed = false; + parentDocument.handleDraggableStatus(true); + } + } + private function focusChatBox(e:ShortcutEvent):void{ focusManager.setFocus(chatMessagesList); } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatView.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatView.mxml index 0ed5ea1053..ff14481a38 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatView.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatView.mxml @@ -27,7 +27,7 @@ with BigBlueButton; if not, see . xmlns:flexlib="http://code.google.com/p/flexlib/" width="100%" height="100%" xmlns:containers="flexlib.containers.*" verticalScrollPolicy="off"> - + @@ -86,7 +86,7 @@ with BigBlueButton; if not, see . private static const PUBLIC_TAB_NEW:String = ResourceUtil.getInstance().getString("bbb.accessibility.chat.chatView.publicTabNew"); private var publicWaiting:Boolean = false; - private var publicFocus:Boolean = false; + private var publicFocus:Boolean = false; private var noticeLabel:String; [Embed(source="../sounds/notice.mp3")] @@ -94,7 +94,7 @@ with BigBlueButton; if not, see . private var noticeSound:Sound = new noticeSoundClass() as Sound; // All author and license information for the use of this sound can be found in: // src/org/bigbluebutton/modules/chat/sounds/license.txt - + // Initialization private function init():void { chatOptions = new ChatOptions(); @@ -103,7 +103,7 @@ with BigBlueButton; if not, see . baseIndex = chatOptions.getBaseIndex() + 4; } - + private function onCreationComplete():void{ openChatBoxFor(PUBLIC_CHAT_USERID, true); makePublicChatUncloseable(); @@ -310,7 +310,7 @@ with BigBlueButton; if not, see . // Activates an audio alert for screen-reader users on public message reception - private function publicNotification():void { + private function publicNotification():void { publicWaiting = true; if (Accessibility.active){ noticeSound.play(); @@ -328,7 +328,7 @@ with BigBlueButton; if not, see . } } - public function publicChatFocus(event:FocusEvent):void{ + public function publicChatFocus(event:FocusEvent):void{ publicFocus = true; publicWaiting = false; } @@ -362,6 +362,11 @@ with BigBlueButton; if not, see . private function onUserClosedTab(e:SuperTabEvent):void{ var name:String = chatTabs.getChildAt(e.tabIndex).name; } + + // This message comes from the chat box and must get to the chat window + public function handleDraggableStatus(value:Boolean):void { + parentDocument.handleDraggableStatus(value); + } ]]> diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatWindow.mxml index 8f1b8615be..2b514d0c73 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatWindow.mxml @@ -187,9 +187,13 @@ with BigBlueButton; if not, see . override protected function showAllChildren():void { chatView.includeInLayout=true; } + + public function handleDraggableStatus(value:Boolean):void { + this.draggable = value; + } ]]> - - + + From 3858555685cac4fb55d45a82a9e579658cd7e495 Mon Sep 17 00:00:00 2001 From: Pedro Beschorner Marin Date: Mon, 16 Mar 2015 14:59:36 -0300 Subject: [PATCH 2/3] Applied to the text message too --- .../src/org/bigbluebutton/modules/chat/views/ChatBox.mxml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml index 4550e08976..948e6e4490 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml @@ -174,6 +174,8 @@ with BigBlueButton; if not, see . txtMsgArea.addEventListener(TextEvent.TEXT_INPUT, handleTextInput); // Listen for the SHIFT key to avoid moving the chat box while text selection + txtMsgArea.addEventListener(KeyboardEvent.KEY_DOWN, handleShiftDown); + txtMsgArea.addEventListener(KeyboardEvent.KEY_UP, handleShiftUp); chatMessagesList.addEventListener(KeyboardEvent.KEY_DOWN, handleShiftDown); chatMessagesList.addEventListener(KeyboardEvent.KEY_UP, handleShiftUp); From f0ce09a45eecd27967a97cae09388146ae0e0b35 Mon Sep 17 00:00:00 2001 From: Pedro Beschorner Marin Date: Mon, 16 Mar 2015 15:15:11 -0300 Subject: [PATCH 3/3] Unlocking shift key if focus is changed --- .../org/bigbluebutton/modules/chat/views/ChatBox.mxml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml index 948e6e4490..3ed7d87594 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml @@ -178,6 +178,8 @@ with BigBlueButton; if not, see . txtMsgArea.addEventListener(KeyboardEvent.KEY_UP, handleShiftUp); chatMessagesList.addEventListener(KeyboardEvent.KEY_DOWN, handleShiftDown); chatMessagesList.addEventListener(KeyboardEvent.KEY_UP, handleShiftUp); + + this.addEventListener(FocusEvent.FOCUS_OUT, releaseShift); queryForChatHistory(); @@ -207,6 +209,13 @@ with BigBlueButton; if not, see . } } + private function releaseShift(focus:FocusEvent):void { + if (shiftPressed) { + shiftPressed = false; + parentDocument.handleDraggableStatus(true); + } + } + private function focusChatBox(e:ShortcutEvent):void{ focusManager.setFocus(chatMessagesList); }