You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/08/20 08:11:42 UTC

openmeetings git commit: [OPENMEETINGS-1644] arrange video windows is implemented

Repository: openmeetings
Updated Branches:
  refs/heads/master a86a6551b -> b87120624


[OPENMEETINGS-1644] arrange video windows is implemented


Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/b8712062
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/b8712062
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/b8712062

Branch: refs/heads/master
Commit: b871206243bcedca2986d2783382bd892cb89a39
Parents: a86a655
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Sun Aug 20 15:11:33 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Sun Aug 20 15:11:33 2017 +0700

----------------------------------------------------------------------
 openmeetings-server/src/site/xdoc/HotKeys.xml   |  9 +++----
 .../org/apache/openmeetings/web/room/room.js    | 28 +++++++++++++++-----
 2 files changed, 25 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/b8712062/openmeetings-server/src/site/xdoc/HotKeys.xml
----------------------------------------------------------------------
diff --git a/openmeetings-server/src/site/xdoc/HotKeys.xml b/openmeetings-server/src/site/xdoc/HotKeys.xml
index e4d5d30..71705b1 100644
--- a/openmeetings-server/src/site/xdoc/HotKeys.xml
+++ b/openmeetings-server/src/site/xdoc/HotKeys.xml
@@ -13,8 +13,8 @@
    limitations under the License.
  -->
 <document xmlns="http://maven.apache.org/XDOC/2.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+		xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
 	<properties>
 		<title>Hot Keys</title>
 		<author email="dev@openmeetings.apache.org">Apache OpenMeetings Team</author>
@@ -35,9 +35,8 @@
 					<td>exclusive.audio.keycode</td>
 				</tr>
 				<tr>
-					<td>F8 (code 119)</td>
-					<td>If 1 or 2 video windows are present in the room they will be
-						"rearranged" to take all the place available</td>
+					<td>Shift+F8 (code 119)</td>
+					<td>Room video windows will be "rearranged" using masonry layout</td>
 					<td>No</td>
 					<td>
 					</td>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/b8712062/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
index a1c5d0f..aad4161 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
@@ -16,7 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-const WBA_SELECTOR = '.room.wb.area .ui-tabs-panel.ui-corner-bottom.ui-widget-content:visible';
+const WBA_SEL = '.room.wb.area .ui-tabs-panel.ui-corner-bottom.ui-widget-content:visible';
+const VID_SEL = '.video.user-video';
 var VideoUtil = (function() {
 	var self = {};
 	function _getVid(uid) {
@@ -57,7 +58,7 @@ var VideoUtil = (function() {
 			return [0, 0];
 		}
 		*/
-		var wba = $(WBA_SELECTOR);
+		var wba = $(WBA_SEL);
 		var woffset = wba.offset();
 		const offsetX = 40, offsetY = 10
 			, area = {left: woffset.left, top: woffset.top, right: woffset.left + wba.width(), bottom: woffset.top + wba.height()};
@@ -111,6 +112,16 @@ var VideoUtil = (function() {
 		} while (!posFound);
 		return {left: rectNew.left, top: rectNew.top};
 	}
+	function _arrange(e) {
+		if (e.which === 119 && e.shiftKey) { // Shift+F8
+			let list = [], elems = $(VID_SEL);
+			for (let i = 0; i < elems.length; ++i) {
+				let v = $(elems[i]);
+				v.css(_getPos(list, v.width(), v.height()));
+				list.push(_getRect(v));
+			}
+		}
+	}
 
 	self.getVid = _getVid;
 	self.isSharing = _isSharing;
@@ -118,6 +129,7 @@ var VideoUtil = (function() {
 	self.hasVideo = _hasVideo;
 	self.getRects = _getRects;
 	self.getPos = _getPos;
+	self.arrange = _arrange;
 	return self;
 })();
 var Video = (function() {
@@ -130,13 +142,13 @@ var Video = (function() {
 		if (on) {
 			//TODO buttons
 			v.dialog({
-				position: {my: "center", at: "center", of: WBA_SELECTOR}
+				position: {my: "center", at: "center", of: WBA_SEL}
 			});
 		} else {
 			let h = size.height + t.height() + 2;
 			v.dialog("option", "width", size.width)
 				.dialog("option", "height", h);
-			v.dialog("widget").css(VideoUtil.getPos(VideoUtil.getRects('.video.user-video', VideoUtil.getVid(c.uid)), c.width, h));
+			v.dialog("widget").css(VideoUtil.getPos(VideoUtil.getRects(VID_SEL, VideoUtil.getVid(c.uid)), c.width, h));
 			_setSize(size.width, size.height);
 		}
 	}
@@ -263,7 +275,7 @@ var VideoManager = (function() {
 			, av = VideoUtil.hasAudio(c) || VideoUtil.hasVideo(c)
 			, v = $('#' + _id);
 		if (av && v.length != 1 && !!c.self) {
-			Video().init(box, options.uid, c, VideoUtil.getPos(VideoUtil.getRects('.video.user-video'), c.width, c.height + 25));
+			Video().init(box, options.uid, c, VideoUtil.getPos(VideoUtil.getRects(VID_SEL), c.width, c.height + 25));
 		} else if (av && v.length == 1) {
 			v.data().update(c);
 		} else if (!av && v.length == 1) {
@@ -285,13 +297,13 @@ var VideoManager = (function() {
 			share.tooltip().off('click').click(function() {
 				var v = $('#' + VideoUtil.getVid(c.uid))
 				if (v.length != 1) {
-					Video().init(box, options.uid, c, $(WBA_SELECTOR).offset());
+					Video().init(box, options.uid, c, $(WBA_SEL).offset());
 				} else {
 					v.dialog('open');
 				}
 			});
 		} else if ('sharing' !== c.type) {
-			Video().init(box, options.uid, c, VideoUtil.getPos(VideoUtil.getRects('.video.user-video'), c.width, c.height + 25));
+			Video().init(box, options.uid, c, VideoUtil.getPos(VideoUtil.getRects(VID_SEL), c.width, c.height + 25));
 		}
 	}
 	function _close(uid) {
@@ -378,6 +390,7 @@ function roomLoad() {
 	});
 	Wicket.Event.subscribe("/websocket/closed", roomClosed);
 	Wicket.Event.subscribe("/websocket/error", roomClosed);
+	$(window).keyup(VideoUtil.arrange);
 }
 function roomUnload() {
 	$(window).off('resize.openmeetings');
@@ -388,6 +401,7 @@ function roomUnload() {
 	}
 	VideoSettings.close();
 	$('.ui-dialog.user-video').remove();
+	$(window).off('keyup', VideoUtil.arrange);
 }
 function startPrivateChat(el) {
 	Chat.addTab('chatTab-u' + el.parent().parent().data("userid"), el.parent().parent().find('.user.name').text());