loleaflet/dist/toolbar/toolbar.js     |    2 +-
 loleaflet/src/control/Ruler.js        |   27 +++++++++++++++++++--------
 loleaflet/src/layer/tile/GridLayer.js |    4 ++--
 3 files changed, 22 insertions(+), 11 deletions(-)

New commits:
commit 9c6e1cc4239626e99703452836289186c3580116
Author: Pranav Kant <pran...@collabora.co.uk>
Date:   Thu Dec 28 17:42:26 2017 +0530

    lint: string must be single quote
    
    Change-Id: I7a6042448f384ea478eb546fbfcc5f307f420f4d

diff --git a/loleaflet/dist/toolbar/toolbar.js 
b/loleaflet/dist/toolbar/toolbar.js
index 9f56aa98..8a0f2978 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -726,7 +726,7 @@ var userPopupTimeout = null;
 function localizeStateTableCell (text) {
        var stateArray = text.split(';');
        var stateArrayLength = stateArray.length;
-       var localizedText = "";
+       var localizedText = '';
        for (var i = 0; i < stateArrayLength; i++) {
                var labelValuePair = stateArray[i].split(':');
                localizedText += _(labelValuePair[0].trim()) + ':' + 
labelValuePair[1];
commit 1a191d9cd3370fc4922cd81d37eb4ea92e989349
Author: Aditya Dewan <aditya.de...@collabora.co.uk>
Date:   Mon Dec 11 01:15:07 2017 +0530

    fix ruler misalignment due to comments
    
    Change-Id: I0d69d6cb1fa57801ee969556a25c89bb9afe9869

diff --git a/loleaflet/src/control/Ruler.js b/loleaflet/src/control/Ruler.js
index c301580f..df702e05 100644
--- a/loleaflet/src/control/Ruler.js
+++ b/loleaflet/src/control/Ruler.js
@@ -30,7 +30,9 @@ L.Control.Ruler = L.Control.extend({
                return this._initLayout();
        },
 
-       _updatePaintTimer: function() {
+       _updatePaintTimer: function(e) {
+               if (e.extraSize)
+                       this.options.extraSize = e.extraSize.x;
                clearTimeout(this.options.timer);
                this.options.timer = setTimeout(L.bind(this._updateBreakPoints, 
this), 300);
        },
@@ -79,11 +81,8 @@ L.Control.Ruler = L.Control.extend({
                if (this.options.margin1 == null || this.options.margin2 == 
null)
                        return;
 
-               if (this._map._docLayer._annotations._items.length === 0)
+               if (this._map._docLayer._annotations._items.length === 0 || 
!this.options.marginSet)
                        this.options.extraSize = 0;
-               else
-                       this.options.extraSize = 290;
-               /// as used for the size of actual comments
 
                var classMajorSep = 'loleaflet-ruler-maj',
                classMargin = 'loleaflet-ruler-margin',
@@ -153,12 +152,24 @@ L.Control.Ruler = L.Control.extend({
        _fixOffset: function() {
                var scale = this._map.getZoomScale(this._map.getZoom(), 10);
                var mapPane = this._map._mapPane;
-               var fTile = mapPane.getElementsByClassName('leaflet-tile')[0];
+
+               /// The rulerOffset depends on the leftmost tile's position
+               /// sometimes the leftmost tile is not available and we need to 
calculate
+               /// from the tiles that we have already.
+               var tiles = this._map._docLayer._tiles;
+               var firstTileKey = Object.keys(tiles)[0];
+               var columnNumber = parseInt(firstTileKey.match(/(\d*):/)[1]);
+               var firstTile = tiles[firstTileKey].el;
+               var firstTileXTranslate = parseInt(firstTile.style.left) - 
this._map._docLayer._tileWidthPx * columnNumber;
+
                var tileContainer = 
mapPane.getElementsByClassName('leaflet-tile-container');
                tileContainer = tileContainer[tileContainer.length - 1];
-               var mapPaneOffset = 
parseInt(mapPane.style.transform.match(/\(([-0-9]*)/)[1]) + 
parseInt(fTile.style.left) + 
parseInt(tileContainer.style.transform.match(/\(([-0-9]*)/)[1]) + 18 * scale;
+               var tileContainerXTranslate = 
parseInt(tileContainer.style.transform.match(/\(([-0-9]*)/)[1]);
+               var mapPaneXTranslate = 
parseInt(mapPane.style.transform.match(/\(([-0-9]*)/)[1]);
+
+               var rulerOffset = mapPaneXTranslate + firstTileXTranslate + 
tileContainerXTranslate + (this.options.tileMargin * scale);
 
-               this._rFace.style.marginLeft = mapPaneOffset + 'px';
+               this._rFace.style.marginLeft = rulerOffset + 'px';
        },
 
        _initiateDrag: function(e) {
diff --git a/loleaflet/src/layer/tile/GridLayer.js 
b/loleaflet/src/layer/tile/GridLayer.js
index 3994b847..6a5b2c96 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -391,10 +391,10 @@ L.GridLayer = L.Layer.extend({
 
                var scrollPixelLimits = new L.Point(this._docWidthTwips / 
this._tileWidthTwips,
                        this._docHeightTwips / this._tileHeightTwips);
-               scrollPixelLimits = extraSize ? 
scrollPixelLimits.multiplyBy(this._tileSize).add(extraSize) :
+               scrollPixelLimits = extraSize ? 
scrollPixelLimits.multiplyBy(this._tileSize).add(extraSize.multiplyBy(scale)) :
                        scrollPixelLimits.multiplyBy(this._tileSize);
                this._docPixelSize = {x: scrollPixelLimits.x, y: 
scrollPixelLimits.y};
-               this._map.fire('docsize', {x: scrollPixelLimits.x, y: 
scrollPixelLimits.y});
+               this._map.fire('docsize', {x: scrollPixelLimits.x, y: 
scrollPixelLimits.y, extraSize: extraSize});
        },
 
        _checkSpreadSheetBounds: function (newZoom) {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to