[Libreoffice-commits] online.git: 4 commits - loleaflet/main.js loleaflet/src loolwsd/.gitignore
Pranav Kant
pranavk at collabora.co.uk
Thu Sep 22 15:31:50 UTC 2016
loleaflet/main.js | 5 ++
loleaflet/src/layer/tile/TileLayer.js | 57 ++++++++++++++----------------
loleaflet/src/map/handler/Map.Keyboard.js | 2 -
loolwsd/.gitignore | 2 +
4 files changed, 35 insertions(+), 31 deletions(-)
New commits:
commit 7c5a540e8dba2fda15f02d2ca4225eaf0943fe57
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Thu Sep 22 20:45:02 2016 +0530
Add log files to .gitignore
Change-Id: I3f1cd2c3e770d8828de1ec09aaaf1329a4ce0123
diff --git a/loolwsd/.gitignore b/loolwsd/.gitignore
index 52945b4..4cdd66b 100644
--- a/loolwsd/.gitignore
+++ b/loolwsd/.gitignore
@@ -42,6 +42,8 @@ test/data/hello-world.odt
*.exe
cscope*
*.orig
+loolwsd.log
+*.log.*.gz
connect
lokitclient
commit 2d7333398449f8831ffaeaa1346240a583f8a11f
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Thu Sep 22 19:35:21 2016 +0530
loleaflet: 'tiledebuggingmode' is not a protocol message
Lets use this function, onMessage, for protocol messages only.
Change-Id: I418eab988ea54b814da3b05bf78b14f65709e586
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 007cc83..f4158d1 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -385,16 +385,17 @@ L.TileLayer = L.GridLayer.extend({
else if (textMsg.startsWith('graphicviewselection:')) {
this._onGraphicViewSelectionMsg(textMsg);
}
- else if (textMsg.startsWith('tiledebuggingmode:')) {
- this._invalidateClientVisibleArea();
- this._debug = !this._debug;
- if (this._debug) {
- if (!this._debugInfo) {
- this._debugInfo = new L.LayerGroup();
- map.addLayer(this._debugInfo);
- }
- this._onMessage('invalidatetiles: EMPTY', null);
+ },
+
+ toggleTileDebugMode: function() {
+ this._invalidateClientVisibleArea();
+ this._debug = !this._debug;
+ if (this._debug) {
+ if (!this._debugInfo) {
+ this._debugInfo = new L.LayerGroup();
+ this._map.addLayer(this._debugInfo);
}
+ this._onMessage('invalidatetiles: EMPTY', null);
}
},
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js
index 9835846..817130c 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -389,7 +389,7 @@ L.Map.Keyboard = L.Handler.extend({
} else if (e.originalEvent.altKey) {
switch (e.originalEvent.keyCode) {
case 68: // Ctrl + Shift + Alt + d for tile debugging mode
- this._map._docLayer._onMessage('tiledebuggingmode:', null);
+ this._map._docLayer.toggleTileDebugMode();
}
}
commit 4e6c1cf56906fc90e30aadcb3d028ef083ba0b30
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Sep 21 22:37:26 2016 +0530
loleaflet: Group all other view's layers
Change-Id: Ide0d91850520e97550016b17c4505f2c75ead132
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 232dfc0..007cc83 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -102,6 +102,9 @@ L.TileLayer = L.GridLayer.extend({
// View cell cursors with viewId to 'cursor info' mapping.
this._cellViewCursors = {};
+ // View selection of other views
+ this._viewSelections = {};
+
// Graphic view selection rectangles
this._graphicViewMarkers = {};
@@ -142,9 +145,10 @@ L.TileLayer = L.GridLayer.extend({
this._getToolbarCommandsValues();
this._selections = new L.LayerGroup();
map.addLayer(this._selections);
- this._viewSelectionsGroup = new L.LayerGroup();
- map.addLayer(this._viewSelectionsGroup);
- this._viewSelections = {};
+
+ // This layergroup contains all the layers corresponding to other's view
+ this._viewLayerGroup = new L.LayerGroup();
+ map.addLayer(this._viewLayerGroup);
this._debug = map.options.debug;
if (this._debug) {
@@ -672,10 +676,10 @@ L.TileLayer = L.GridLayer.extend({
this._cellViewCursors[viewId].marker = cellViewCursorsMarker;
}
cellViewCursorsMarker.setBounds(this._cellViewCursors[viewId].bounds);
- this._map.addLayer(cellViewCursorsMarker);
+ this._viewLayerGroup.addLayer(cellViewCursorsMarker);
}
else if (cellViewCursorsMarker) {
- this._map.removeLayer(cellViewCursorsMarker);
+ this._viewLayerGroup.removeLayer(cellViewCursorsMarker);
}
},
@@ -720,7 +724,7 @@ L.TileLayer = L.GridLayer.extend({
// Remove selection, if any.
if (this._viewSelections[viewId] && this._viewSelections[viewId].selection) {
- this._viewSelectionsGroup.removeLayer(this._viewSelections[viewId].selection);
+ this._viewLayerGroup.removeLayer(this._viewSelections[viewId].selection);
}
// Remove the view and update (to refresh as needed).
@@ -1209,10 +1213,10 @@ L.TileLayer = L.GridLayer.extend({
else {
viewCursorMarker.setLatLng(viewCursorPos, pixBounds.getSize().multiplyBy(this._map.getZoomScale(this._map.getZoom())));
}
- this._map.addLayer(viewCursorMarker);
+ this._viewLayerGroup.addLayer(viewCursorMarker);
}
else if (viewCursorMarker) {
- this._map.removeLayer(viewCursorMarker);
+ this._viewLayerGroup.removeLayer(viewCursorMarker);
}
},
@@ -1227,7 +1231,7 @@ L.TileLayer = L.GridLayer.extend({
// Reset previous selections
if (viewSelection) {
- this._viewSelectionsGroup.removeLayer(viewSelection);
+ this._viewLayerGroup.removeLayer(viewSelection);
}
viewSelection = new L.Polygon(viewPolygons, {
@@ -1238,10 +1242,10 @@ L.TileLayer = L.GridLayer.extend({
opacity: 0.25
});
this._viewSelections[viewId].selection = viewSelection;
- this._viewSelectionsGroup.addLayer(viewSelection);
+ this._viewLayerGroup.addLayer(viewSelection);
}
else if (viewSelection) {
- this._viewSelectionsGroup.removeLayer(viewSelection);
+ this._viewLayerGroup.removeLayer(viewSelection);
}
},
@@ -1266,10 +1270,10 @@ L.TileLayer = L.GridLayer.extend({
else {
viewMarker.setBounds(viewBounds);
}
- this._map.addLayer(viewMarker);
+ this._viewLayerGroup.addLayer(viewMarker);
}
else if (viewMarker) {
- this._map.removeLayer(viewMarker);
+ this._viewLayerGroup.removeLayer(viewMarker);
}
},
commit 7ea0688760a1c134b2d10384b0f3008775c232a7
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Sep 21 22:22:11 2016 +0530
loleaflet: Code reuse in debug mode implementation
Lets use the already existing getParameterByName function
Change-Id: Ib75ff5430e440cee609f48450a28916f9d2aff43
diff --git a/loleaflet/main.js b/loleaflet/main.js
index 7ae3246..cb53fb7 100644
--- a/loleaflet/main.js
+++ b/loleaflet/main.js
@@ -61,6 +61,8 @@ var timestamp = getParameterByName('timestamp');
var closebutton = getParameterByName('closebutton');
// Shows revision history file menu option
var revHistoryEnabled = getParameterByName('revisionhistory');
+// Loleaflet Debug mode
+var debugMode = getParameterByName('debug');
if (wopiSrc === '' && filePath === '') {
vex.dialog.alert(errorMessages.wrongwopisrc);
}
@@ -89,7 +91,8 @@ var map = L.map('map', {
docParams: docParams,
permission: permission,
timestamp: timestamp,
- documentContainer: 'document-container'
+ documentContainer: 'document-container',
+ debug: debugMode
});
// toolbar.js (loaded in <script> tag accesses map as global variable,
// so expose it
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index e22bc69..232dfc0 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -12,12 +12,6 @@ if (typeof String.prototype.startsWith !== 'function') {
};
}
-function getParameterByName(name) {
- name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
- var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(location.search);
- return results === null ? '' : results[1].replace(/\+/g, ' ');
-}
-
L.Compatibility = {
clipboardGet: function (event) {
var text = null;
@@ -152,7 +146,7 @@ L.TileLayer = L.GridLayer.extend({
map.addLayer(this._viewSelectionsGroup);
this._viewSelections = {};
- this._debug = (getParameterByName('debug') == '1');
+ this._debug = map.options.debug;
if (this._debug) {
this._debugInfo = new L.LayerGroup();
map.addLayer(this._debugInfo);
More information about the Libreoffice-commits
mailing list