[Libreoffice-commits] online.git: loleaflet/src
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Thu Apr 21 05:17:42 UTC 2016
loleaflet/src/map/Map.js | 55 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
New commits:
commit b0701733fa144be081f8cdbde84b94d266356af0
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Thu Apr 21 01:11:54 2016 -0400
loleaflet: leaflet is dimmed after losing focus by 10s and Online notified
Change-Id: I0ed38e89c6dbd4f7325a81cc49b3b37de65c0ea0
Reviewed-on: https://gerrit.libreoffice.org/24271
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index fb4509d..a734bc5 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -2,6 +2,57 @@
* L.Map is the central class of the API - it is used to create a map.
*/
+function activate(socket)
+{
+ socket.sendMessage('useractive');
+ clearTimeout(vex.timer);
+ return vex.close(vex.globalID - 1);
+}
+
+function deactivate(socket)
+{
+ socket.sendMessage('userinactive');
+ clearTimeout(vex.timer);
+
+ options = $.extend({}, vex.defaultOptions, {contentCSS: {"background":"rgba(0, 0, 0, 0)"}});
+ options.id = vex.globalID;
+ vex.globalID += 1;
+ options.$vex = $('<div>').addClass(vex.baseClassNames.vex).addClass(options.className).css(options.css).data({
+ vex: options
+ });
+ options.$vexOverlay = $('<div>').addClass(vex.baseClassNames.overlay).addClass(options.overlayClassName).css(options.overlayCSS).data({
+ vex: options
+ });
+
+ options.$vexOverlay.bind('click.vex', function(e) {
+ if (e.target !== this) {
+ return;
+ }
+ return activate(socket);
+ });
+ options.$vex.append(options.$vexOverlay);
+
+ options.$vexContent = $('<div>').addClass(vex.baseClassNames.content).addClass(options.contentClassName).css(options.contentCSS).data({
+ vex: options
+ });
+ options.$vex.append(options.$vexContent);
+
+ $(options.appendLocation).append(options.$vex);
+ vex.setupBodyClassName(options.$vex);
+}
+
+function dim(bool, socket)
+{
+ if (bool)
+ {
+ vex.timer = setTimeout(function() { deactivate(socket); }, 10 * 1000);
+ }
+ else
+ {
+ activate(socket);
+ }
+}
+
L.Map = L.Evented.extend({
options: {
@@ -695,6 +746,8 @@ L.Map = L.Evented.extend({
doclayer._isCursorOverlayVisible = false;
doclayer._onUpdateCursor();
}
+
+ dim(true, this._socket);
},
_onGotFocus: function () {
@@ -710,6 +763,8 @@ L.Map = L.Evented.extend({
doclayer._onUpdateCursor();
}, 300);
}
+
+ dim(false, this._socket);
},
_onUpdateProgress: function (e) {
More information about the Libreoffice-commits
mailing list