[Libreoffice-commits] online.git: loleaflet/src
Dennis Francis (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 6 17:00:44 UTC 2020
loleaflet/src/layer/tile/CalcTileLayer.js | 12 ++++++++----
loleaflet/src/layer/tile/TileLayer.js | 18 +++++++++---------
2 files changed, 17 insertions(+), 13 deletions(-)
New commits:
commit b882da11ee218ee9f031ea4dc16da777256fa020
Author: Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Sat Jun 6 11:00:18 2020 +0530
Commit: Dennis Francis <dennis.francis at collabora.com>
CommitDate: Mon Jul 6 19:00:25 2020 +0200
Handle print-twips 'invalidateviewcursor' msg correctly
Change-Id: I0860c157ee9c82c22add4b1342a8be149d919f2e
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98151
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Dennis Francis <dennis.francis at collabora.com>
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 93a633eb2..4a2dcc8c8 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -778,14 +778,18 @@ L.CalcTileLayer = L.TileLayer.extend({
this._onUpdateCurrentHeader();
},
- _getCursorRectangle: function (msgObj) {
+ _getEditCursorRectangle: function (msgObj) {
if (!this.options.printTwipsMsgsEnabled) {
- return L.TileLayer.prototype._getCursorRectangle.call(this, msgObj);
+ return L.TileLayer.prototype._getEditCursorRectangle.call(this, msgObj);
}
- if (typeof msgObj !== 'object' || !msgObj.hasOwnProperty('relrect') ||
- !msgObj.hasOwnProperty('refpoint')) {
+ if (typeof msgObj !== 'object') {
+ console.error('invalid edit cursor message');
+ return undefined;
+ }
+
+ if (!msgObj.hasOwnProperty('relrect') || !msgObj.hasOwnProperty('refpoint')) {
// This can happen because the kit sends such messages (sometimes)
// after doing its own parsing (probably needed for writer/impress?).
// These aren't needed for Calc.
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 85ab40d74..0cba2697c 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1247,7 +1247,7 @@ L.TileLayer = L.GridLayer.extend({
_onInvalidateCursorMsg: function (textMsg) {
textMsg = textMsg.substring('invalidatecursor:'.length + 1);
var obj = JSON.parse(textMsg);
- var rectangle = this._getCursorRectangle(obj);
+ var rectangle = this._getEditCursorRectangle(obj);
if (rectangle === undefined) {
return;
}
@@ -1315,15 +1315,15 @@ L.TileLayer = L.GridLayer.extend({
return;
}
- var strTwips = obj.rectangle.match(/\d+/g);
- 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 rectangle = this._getEditCursorRectangle(obj);
+ if (rectangle === undefined) {
+ return;
+ }
this._viewCursors[viewId] = this._viewCursors[viewId] || {};
this._viewCursors[viewId].bounds = new L.LatLngBounds(
- this._twipsToLatLng(topLeftTwips, this._map.getZoom()),
- this._twipsToLatLng(bottomRightTwips, this._map.getZoom())),
+ this._twipsToLatLng(rectangle.getTopLeft(), this._map.getZoom()),
+ this._twipsToLatLng(rectangle.getBottomRight(), this._map.getZoom())),
this._viewCursors[viewId].part = parseInt(obj.part);
// FIXME. Server not sending view visible cursor
@@ -3402,10 +3402,10 @@ L.TileLayer = L.GridLayer.extend({
return this.sheetGeometry.getTileTwipsSheetAreaFromPrint(rectangle);
},
- _getCursorRectangle: function (msgObj) {
+ _getEditCursorRectangle: function (msgObj) {
if (typeof msgObj !== 'object' || !msgObj.hasOwnProperty('rectangle')) {
- console.error('invalid cursor message');
+ console.error('invalid edit cursor message');
return undefined;
}
More information about the Libreoffice-commits
mailing list