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

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 24 13:12:23 UTC 2020


 loleaflet/src/layer/tile/CalcTileLayer.js |    4 ++--
 loleaflet/src/layer/tile/TileLayer.js     |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit bedd335049d05f08f5fb6c037e5f9292d89418d3
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Tue Jul 21 21:08:10 2020 +0530
Commit:     Dennis Francis <dennis.francis at collabora.com>
CommitDate: Fri Jul 24 15:12:04 2020 +0200

    calc: deal with late arrival of sheetGeometry message on document-load
    
    On document load, it is possible (even if improbable) for the first
    sheetGeometry message to arrive after other messages (like
    cell-cursor/edit-cursor/selection etc) which need the former to be used
    correctly. So, guard against crashing on the missing sheetGeometry
    object in the docLayer (and let the print-twips coordinates in the
    messages to be used for display which is incorrect). The incorrect
    positions are corrected anyway because we replay those messages, when
    the sheetGeometry message finally arrives.
    
    Change-Id: I21840ca08ca62213cba3a4d5aa6e9462d11a5e0e
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99357
    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 7ecc6d99d..1c681594d 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -857,7 +857,7 @@ L.CalcTileLayer = (L.Browser.mobile ? L.TileLayer : L.CanvasTileLayer).extend({
 
 	_getEditCursorRectangle: function (msgObj) {
 
-		if (!this.options.printTwipsMsgsEnabled ||
+		if (!this.options.printTwipsMsgsEnabled || !this.sheetGeometry ||
 			!msgObj.hasOwnProperty('relrect') || !msgObj.hasOwnProperty('refpoint')) {
 			// 1) non-print-twips messaging mode OR
 			// 2) the edit-cursor belongs to draw/chart objects.
@@ -877,7 +877,7 @@ L.CalcTileLayer = (L.Browser.mobile ? L.TileLayer : L.CanvasTileLayer).extend({
 
 	_getTextSelectionRectangles: function (textMsg) {
 
-		if (!this.options.printTwipsMsgsEnabled) {
+		if (!this.options.printTwipsMsgsEnabled || !this.sheetGeometry) {
 			return L.TileLayer.prototype._getTextSelectionRectangles.call(this, textMsg);
 		}
 
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 7e223a3af..54e640ca9 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -3412,7 +3412,7 @@ L.TileLayer = L.GridLayer.extend({
 
 	// converts rectangle in print-twips to tile-twips rectangle of the smallest cell-range that encloses it.
 	_convertToTileTwipsSheetArea: function (rectangle) {
-		if (!(rectangle instanceof L.Bounds) || !this.options.printTwipsMsgsEnabled) {
+		if (!(rectangle instanceof L.Bounds) || !this.options.printTwipsMsgsEnabled || !this.sheetGeometry) {
 			return rectangle;
 		}
 
@@ -3420,7 +3420,7 @@ L.TileLayer = L.GridLayer.extend({
 	},
 
 	_getGraphicSelectionRectangle: function (rectangle) {
-		if (!(rectangle instanceof L.Bounds) || !this.options.printTwipsMsgsEnabled) {
+		if (!(rectangle instanceof L.Bounds) || !this.options.printTwipsMsgsEnabled || !this.sheetGeometry) {
 			return rectangle;
 		}
 


More information about the Libreoffice-commits mailing list