loleaflet/src/control/Control.ColumnHeader.js | 4 ++-- loleaflet/src/control/Control.Header.js | 21 ++++++++++++++++++++- loleaflet/src/control/Control.RowHeader.js | 4 ++-- 3 files changed, 24 insertions(+), 5 deletions(-)
New commits: commit 3ce8389e8211562ab8f2548ba014cc2c3bb662ef Author: Dennis Francis <[email protected]> AuthorDate: Tue Jan 28 14:36:18 2020 +0530 Commit: Dennis Francis <[email protected]> CommitDate: Tue Jan 28 11:11:54 2020 +0100 Adjust the row/col header fontSize with zoom-level Change-Id: I5eda8b1af1c10bc83714a63595aba8062070115a Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87591 Reviewed-by: Jan Holesovsky <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js index 19282b97e..d0d7290b7 100644 --- a/loleaflet/src/control/Control.ColumnHeader.js +++ b/loleaflet/src/control/Control.ColumnHeader.js @@ -256,7 +256,7 @@ L.Control.ColumnHeader = L.Control.Header.extend({ } // draw text content ctx.fillStyle = isHighlighted ? this._selectionTextColor : this._textColor; - ctx.font = this._font; + ctx.font = this._font.getFont(); ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; // The '+ 1' below is a hack - it's currently not possible to measure @@ -348,7 +348,7 @@ L.Control.ColumnHeader = L.Control.Header.extend({ ctx.strokeRect(startPar, startOrt, ctrlHeadSize, ctrlHeadSize); // draw level number ctx.fillStyle = this._textColor; - ctx.font = this._font; + ctx.font = this._font.getFont(); ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillText(level + 1, startPar + (ctrlHeadSize / 2), startOrt + (ctrlHeadSize / 2)); diff --git a/loleaflet/src/control/Control.Header.js b/loleaflet/src/control/Control.Header.js index 76eea58ee..37d03062c 100644 --- a/loleaflet/src/control/Control.Header.js +++ b/loleaflet/src/control/Control.Header.js @@ -71,7 +71,26 @@ L.Control.Header = L.Control.extend({ var fontSize = parseInt(L.DomUtil.getStyle(elem, 'font-size')); var fontHeight = parseInt(L.DomUtil.getStyle(elem, 'line-height')); var rate = fontHeight / fontSize; - this._font = fontSize + 'px/' + rate + ' ' + fontFamily; + this._font = { + _map: this._map, + _baseFontSize: fontSize, + _fontSizeRate: rate, + _fontFamily: fontFamily, + getFont: function() { + var zoomScale = this._map.getZoomScale(this._map.getZoom(), + this._map.options.defaultZoom); + // Limit zoomScale to 115%. At 120% the row ids at the bottom eat all + // horizontal margins and it looks ugly. Beyond 120% the row ids get + // clipped out visibly. + zoomScale = Math.min(zoomScale, 1.15); + + return Math.floor(this._baseFontSize * zoomScale) + + 'px/' + + this._fontSizeRate + + ' ' + + this._fontFamily; + } + }; this._borderColor = L.DomUtil.getStyle(elem, 'border-top-color'); var borderWidth = L.DomUtil.getStyle(elem, 'border-top-width'); this._borderWidth = Math.round(parseFloat(borderWidth)); diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js index 8709a72c5..15c783220 100644 --- a/loleaflet/src/control/Control.RowHeader.js +++ b/loleaflet/src/control/Control.RowHeader.js @@ -249,7 +249,7 @@ L.Control.RowHeader = L.Control.Header.extend({ } // draw text content ctx.fillStyle = isHighlighted ? this._selectionTextColor : this._textColor; - ctx.font = this._font; + ctx.font = this._font.getFont(); ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillText(content, startOrt + (width / 2), endPar - (height / 2)); @@ -337,7 +337,7 @@ L.Control.RowHeader = L.Control.Header.extend({ ctx.strokeRect(startOrt, startPar, ctrlHeadSize, ctrlHeadSize); // draw level number ctx.fillStyle = this._textColor; - ctx.font = this._font; + ctx.font = this._font.getFont(); ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillText(level + 1, startOrt + (ctrlHeadSize / 2), startPar + (ctrlHeadSize / 2)); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
