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

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 5 17:43:19 UTC 2019


 loleaflet/src/control/Control.Header.js |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 8e7f64dc25b23b33f08ebbd4413928b8eab7bf72
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Nov 5 17:41:14 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue Nov 5 17:42:59 2019 +0000

    gaptick map - dealing in pixels internally solves rounding issues with zoom.
    
    Change-Id: I8ee233a66bc7381200b966c22d8a2abd73403713

diff --git a/loleaflet/src/control/Control.Header.js b/loleaflet/src/control/Control.Header.js
index daf142e3b..1b7787ef3 100644
--- a/loleaflet/src/control/Control.Header.js
+++ b/loleaflet/src/control/Control.Header.js
@@ -758,7 +758,13 @@ L.Control.Header.colHeaderHeight = undefined;
  * - When a new tick position is defined, it resets the size of the last known gap
  *
  * All the outputs are mapped through a scale function. Inputs are meant
- * to be given in twips, outputs are meant to be returned in CSS pixels.
+ * to be given in twips, outputs are meant to be returned in CSS pixels,
+ * which is also the internal storage format.
+ *
+ * **NB.** to ensure that all row heights are the same size even though
+ * their twip height doesn't map to an integer number of pixels we need to
+ * convert to pixels early - and work in pixels internally, as the calc
+ * core does.
  */
 L.Control.Header.GapTickMap = L.Class.extend({
 
@@ -774,7 +780,8 @@ L.Control.Header.GapTickMap = L.Class.extend({
 			// The field in the input data struct is called "text" but it's the
 			// column/row index, as a string.
 			// Idem for "size": it's the tick position in twips, as a string
-			knownTicks[ parseInt(ticks[i].text) ] = parseInt(ticks[i].size);
+			knownTicks[ parseInt(ticks[i].text) ] =
+				this.scaleCallback(parseInt(ticks[i].size));
 		}
 
 		// This *assumes* the input is ordered - i.e. tick indexes only grow
@@ -800,7 +807,7 @@ L.Control.Header.GapTickMap = L.Class.extend({
 
 	// Gets the position of the i-th tick (or `undefined` if the index falls outside).
 	getTick: function getTick(i) {
-		return this.scaleCallback(this._ticks[i]);
+		return this._ticks[i];
 	},
 
 	getMinTickIdx: function() {


More information about the Libreoffice-commits mailing list