[Libreoffice-commits] online.git: 2 commits - loleaflet/src loolwsd/LOOLKit.cpp
Pranav Kant
pranavk at collabora.co.uk
Wed Sep 7 19:48:46 UTC 2016
loleaflet/src/layer/tile/TileLayer.js | 40 ++++++++++++++++++++++++++++++++++
loolwsd/LOOLKit.cpp | 4 +--
2 files changed, 42 insertions(+), 2 deletions(-)
New commits:
commit d2bf039d59d0e4c190535453b2ed8b8faf9b9abd
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Sep 7 21:46:41 2016 +0200
loleaflet: Implement object/image multiple view selections
Change-Id: Ifc2d6f95fa48a947fc043bf48d582ab549fa6172
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 9f70ac2..6fb3c1b 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 = {};
+ // Graphic view selection rectangles
+ this._graphicViewMarkers = {};
+
this._lastValidPart = -1;
// Cursor marker
this._cursorMarker = null;
@@ -143,6 +146,10 @@ L.TileLayer = L.GridLayer.extend({
map.addLayer(this._viewSelectionsGroup);
this._viewSelections = {};
+ this._graphicViewMarkersGroup = new L.LayerGroup();
+ map.addLayer(this._graphicViewMarkersGroup);
+ this._graphicViewMarkers = {};
+
this._searchResultsLayer = new L.LayerGroup();
map.addLayer(this._searchResultsLayer);
@@ -378,6 +385,9 @@ L.TileLayer = L.GridLayer.extend({
else if (textMsg.startsWith('textviewselection:')) {
this._onTextViewSelectionMsg(textMsg);
}
+ else if (textMsg.startsWith('graphicviewselection:')) {
+ this._onGraphicViewSelectionMsg(textMsg);
+ }
},
_onCommandValuesMsg: function (textMsg) {
@@ -479,6 +489,36 @@ L.TileLayer = L.GridLayer.extend({
this._onUpdateGraphicSelection();
},
+ _onGraphicViewSelectionMsg: function (textMsg) {
+ textMsg = textMsg.substring('graphicviewselection:'.length + 1);
+ var obj = JSON.parse(textMsg);
+ var viewId = parseInt(obj.viewId);
+
+ // Ignore yourself
+ if (viewId === this._viewId) {
+ return;
+ }
+
+ var strTwips = obj.selection.match(/\d+/g);
+ if (this._graphicViewMarkers[viewId]) {
+ this._graphicViewMarkersGroup.removeLayer(this._graphicViewMarkers[viewId]);
+ }
+ if (strTwips != null) {
+ var topLeftTwips = new L.Point(parseInt(strTwips[0]), parseInt(strTwips[1]));
+ var offset = new L.Point(parseInt(strTwips[2]), parseInt(strTwips[3]));
+ var bottomRightTwips = topLeftTwips.add(offset);
+ var graphicSelection = new L.LatLngBounds(
+ this._twipsToLatLng(topLeftTwips, this._map.getZoom()),
+ this._twipsToLatLng(bottomRightTwips, this._map.getZoom()));
+ this._graphicViewMarkers[viewId] = L.rectangle(graphicSelection, {
+ pointerEvents: 'none',
+ fill: false,
+ color: L.LOUtil.getViewIdHexColor(viewId)
+ });
+ this._graphicViewMarkersGroup.addLayer(this._graphicViewMarkers[viewId]);
+ }
+ },
+
_onCellCursorMsg: function (textMsg) {
if (!this._cellCursor) {
this._cellCursor = L.LatLngBounds.createDefault();
commit 33a5c4bc7083154aa8fa93fd663d1e38bc8269e5
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Sep 7 16:52:18 2016 +0200
Fix comment
Change-Id: Ib43bcc7378590e71b98856c11218fd99ad90d32d
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index e3519fb..94c0846 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -936,7 +936,7 @@ private:
}
}
- /// Notify all currently active sessions of session with given 'sessionId'
+ /// Notify all currently active sessions about session with given 'sessionId'
void notifyOtherSessions(const std::string& sessionId, const std::string& message) const override
{
std::unique_lock<std::mutex> lock(_mutex);
@@ -954,7 +954,7 @@ private:
}
}
- /// Notify session (with given 'sessionId') of other currently active views
+ /// Notify session (with given 'sessionId'), if active, of other existing views
void notifyCurrentViewOfOtherViews(const std::string& sessionId) const override
{
std::unique_lock<std::mutex> lock(_mutex);
More information about the Libreoffice-commits
mailing list