[Libreoffice-commits] online.git: 2 commits - loleaflet/src

Pranav Kant pranavk at collabora.co.uk
Tue Aug 30 07:44:54 UTC 2016


 loleaflet/src/layer/tile/TileLayer.js |    8 +++++++-
 loleaflet/src/map/Map.js              |   17 +++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 7536deab8e32c4df4c5c2c007ee7d70e7a664873
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Aug 29 16:39:46 2016 +0530

    loleaflet: addView and removeView map methods
    
    Change-Id: I6ad2013f3378969822ba20e578d5b2b1cc26ec60
    Reviewed-on: https://gerrit.libreoffice.org/28478
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index d449c74..ee32550 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -655,13 +655,17 @@ L.TileLayer = L.GridLayer.extend({
 
 	_onAddViewMsg: function(textMsg) {
 		textMsg = textMsg.substring('addview:'.length + 1);
-		var viewId = parseInt(textMsg);
+		var obj = JSON.parse(textMsg);
+		var viewId = parseInt(obj.viewId);
+		var username = obj.username;
 
 		// Ignore if viewid is same as ours
 		if (viewId === this._viewId) {
 			return;
 		}
 
+		this._map.addView(viewId, username);
+
 		//TODO: We can initialize color and other properties here.
 		if (typeof this._viewCursors[viewId] !== 'undefined') {
 			this._viewCursors[viewId] = {};
@@ -690,6 +694,8 @@ L.TileLayer = L.GridLayer.extend({
 			this._onUpdateViewCursor(viewId);
 			delete this._viewCursors[viewId];
 		}
+
+		this._map.removeView(viewId);
 	},
 
 	_onRemAllViewMsg: function(textMsg) {
commit 3d8b73da8be0e5727c0613db131e06509ea1a051
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Aug 29 16:34:42 2016 +0530

    loleaflet: Infrastructure for user list
    
    Change-Id: If06d014174479d3d05397422c000ca47c51c819e
    Reviewed-on: https://gerrit.libreoffice.org/28477
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index ba2fe3c..3f7acc3 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -116,11 +116,28 @@ L.Map = L.Evented.extend({
 
 		this.showBusy(_('Initializing...'), false);
 		this.on('statusindicator', this._onUpdateProgress, this);
+
+		// View info (user names and view ids)
+		this._viewInfo = {};
 	},
 
 
 	// public methods that modify map state
 
+	addView: function(viewid, username) {
+		this._viewInfo[viewid] = username;
+		this.fire('addview', {viewId: viewid, username: username});
+	},
+
+	removeView: function(viewid) {
+		delete this._viewInfo[viewid];
+		this.fire('removeview', {viewId: viewid});
+	},
+
+	getViewName: function(viewid) {
+		return this._viewInfo[viewid];
+	},
+
 	// replaced by animation-powered implementation in Map.PanAnimation.js
 	setView: function (center, zoom) {
 		zoom = zoom === undefined ? this.getZoom() : zoom;


More information about the Libreoffice-commits mailing list