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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 29 15:48:02 UTC 2019


 loleaflet/src/control/Control.ColumnHeader.js |    7 +++++--
 loleaflet/src/control/Control.Header.js       |   21 ++++++++++++---------
 loleaflet/src/control/Control.RowHeader.js    |    4 +++-
 3 files changed, 20 insertions(+), 12 deletions(-)

New commits:
commit 53a7f069ebb41b9ba2d17f56edc371a83b210703
Author:     Marco Cecchetti <mrcekets at gmail.com>
AuthorDate: Wed Jan 23 16:38:47 2019 +0100
Commit:     Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Tue Jan 29 16:46:59 2019 +0100

    calc: header corner: group level ctrls are not scaled on hidpi display
    
    Change-Id: I9b4e016a553a3c8fc2db1a7173f95f344e108256

diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index 96539f3aa..da1a87a7b 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -323,11 +323,13 @@ L.Control.ColumnHeader = L.Control.Header.extend({
 		var ctx = this._cornerCanvasContext;
 		var ctrlHeadSize = this._groupHeadSize;
 		var levelSpacing = this._levelSpacing;
+		var scale = L.getDpiScaleFactor();
 
 		var startOrt = levelSpacing + (ctrlHeadSize + levelSpacing) * level;
-		var startPar = this._cornerCanvas.width - (ctrlHeadSize + (L.Control.Header.rowHeaderWidth - ctrlHeadSize) / 2);
+		var startPar = this._cornerCanvas.width / scale - (ctrlHeadSize + (L.Control.Header.rowHeaderWidth - ctrlHeadSize) / 2);
 
 		ctx.save();
+		ctx.scale(scale, scale);
 		ctx.fillStyle = this._hoverColor;
 		ctx.fillRect(startPar, startOrt, ctrlHeadSize, ctrlHeadSize);
 		ctx.strokeStyle = 'black';
@@ -521,7 +523,8 @@ L.Control.ColumnHeader = L.Control.Header.extend({
 			return;
 		}
 
-		var rowOutlineWidth = this._cornerCanvas.width - L.Control.Header.rowHeaderWidth - this._borderWidth;
+		var scale = L.getDpiScaleFactor();
+		var rowOutlineWidth = this._cornerCanvas.width / scale - L.Control.Header.rowHeaderWidth - this._borderWidth;
 		if (pos.x <= rowOutlineWidth) {
 			// empty rectangle on the left select all
 			this._map.sendUnoCommand('.uno:SelectAll');
diff --git a/loleaflet/src/control/Control.Header.js b/loleaflet/src/control/Control.Header.js
index 268faabca..0390cf4f2 100644
--- a/loleaflet/src/control/Control.Header.js
+++ b/loleaflet/src/control/Control.Header.js
@@ -615,12 +615,12 @@ L.Control.Header = L.Control.extend({
 
 		ctx.fillStyle = this._borderColor;
 		if (this._isColumn) {
-			var startY = this._cornerCanvas.height - (L.Control.Header.colHeaderHeight + this._borderWidth);
+			var startY = this._cornerCanvas.height / scale - (L.Control.Header.colHeaderHeight + this._borderWidth);
 			if (startY > 0)
 				ctx.fillRect(0, startY, this._cornerCanvas.width, this._borderWidth);
 		}
 		else {
-			var startX = this._cornerCanvas.width - (L.Control.Header.rowHeaderWidth + this._borderWidth);
+			var startX = this._cornerCanvas.width / scale - (L.Control.Header.rowHeaderWidth + this._borderWidth);
 			if (startX > 0)
 				ctx.fillRect(startX, 0, this._borderWidth, this._cornerCanvas.height);
 		}
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index 93a99081b..fa61c0516 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -312,11 +312,13 @@ L.Control.RowHeader = L.Control.Header.extend({
 		var ctx = this._cornerCanvasContext;
 		var ctrlHeadSize = this._groupHeadSize;
 		var levelSpacing = this._levelSpacing;
+		var scale = L.getDpiScaleFactor();
 
 		var startOrt = levelSpacing + (ctrlHeadSize + levelSpacing) * level;
-		var startPar = this._cornerCanvas.height - (ctrlHeadSize + (L.Control.Header.colHeaderHeight - ctrlHeadSize) / 2);
+		var startPar = this._cornerCanvas.height / scale - (ctrlHeadSize + (L.Control.Header.colHeaderHeight - ctrlHeadSize) / 2);
 
 		ctx.save();
+		ctx.scale(scale, scale);
 		ctx.fillStyle = this._hoverColor;
 		ctx.fillRect(startOrt, startPar, ctrlHeadSize, ctrlHeadSize);
 		ctx.strokeStyle = 'black';
commit fa5c943355d648bf758b3051a51848d643341f77
Author:     Marco Cecchetti <mrcekets at gmail.com>
AuthorDate: Wed Jan 23 16:28:00 2019 +0100
Commit:     Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Tue Jan 29 16:46:59 2019 +0100

    loleaflet: calc: headers not adjusted when grouping rows or columns
    
    Change-Id: Icfe2ce0bb03de34848faf8f1bee7e1d568156ca7

diff --git a/loleaflet/src/control/Control.Header.js b/loleaflet/src/control/Control.Header.js
index c8beb0c78..268faabca 100644
--- a/loleaflet/src/control/Control.Header.js
+++ b/loleaflet/src/control/Control.Header.js
@@ -472,7 +472,7 @@ L.Control.Header = L.Control.extend({
 		return Math.round(this._getParallelPos(this.converter(point)));
 	},
 
-	_setCanvasSizeImpl: function (container, canvas, property, value) {
+	_setCanvasSizeImpl: function (container, canvas, property, value, isCorner) {
 		if (!value) {
 			value = parseInt(L.DomUtil.getStyle(container, property));
 		}
@@ -483,28 +483,31 @@ L.Control.Header = L.Control.extend({
 		var scale = L.getDpiScaleFactor();
 		if (property === 'width') {
 			canvas.width = value * scale;
-			this._canvasWidth = value;
+			if (!isCorner)
+				this._canvasWidth = value;
+			console.log('Header._setCanvasSizeImpl: _canvasWidth' + this._canvasWidth);
 		}
 		else if (property === 'height') {
 			canvas.height = value * scale;
-			this._canvasHeight = value;
+			if (!isCorner)
+				this._canvasHeight = value;
 		}
 	},
 
 	_setCanvasWidth: function (width) {
-		this._setCanvasSizeImpl(this._headerContainer, this._canvas, 'width', width);
+		this._setCanvasSizeImpl(this._headerContainer, this._canvas, 'width', width, /*isCorner: */ false);
 	},
 
 	_setCanvasHeight: function (height) {
-		this._setCanvasSizeImpl(this._headerContainer, this._canvas, 'height', height);
+		this._setCanvasSizeImpl(this._headerContainer, this._canvas, 'height', height, /*isCorner: */ false);
 	},
 
 	_setCornerCanvasWidth: function (width) {
-		this._setCanvasSizeImpl(this._cornerHeaderContainer, this._cornerCanvas, 'width', width);
+		this._setCanvasSizeImpl(this._cornerHeaderContainer, this._cornerCanvas, 'width', width, /*isCorner: */ true);
 	},
 
 	_setCornerCanvasHeight: function (height) {
-		this._setCanvasSizeImpl(this._cornerHeaderContainer, this._cornerCanvas, 'height', height);
+		this._setCanvasSizeImpl(this._cornerHeaderContainer, this._cornerCanvas, 'height', height, /*isCorner: */ true);
 	},
 
 	_hitOutline: function (e) {


More information about the Libreoffice-commits mailing list