Skip to content

Commit

Permalink
calc: fix reduce/extend scroll bar
Browse files Browse the repository at this point in the history
Sometimes when changing zoom levels and scrolling past the content of a
sheet and back into it, the scroll bar would get stuck on a size and not
let you scroll past a certain point.

Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I7870813be8ea0af364f769e59e43f46c16c3e206
  • Loading branch information
Jaume Pujantell committed Oct 18, 2024
1 parent b054945 commit a620e26
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions browser/src/layer/tile/CalcTileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,20 +271,20 @@ L.CalcTileLayer = L.CanvasTileLayer.extend({

// limit to data area only (and map size for margin)
if (limitWidth)
newDocWidth = Math.min(lastCellTwips.x + limitMargin.x, newDocWidth);
newDocWidth = lastCellTwips.x + limitMargin.x;

if (limitHeight)
newDocHeight = Math.min(lastCellTwips.y + limitMargin.y, newDocHeight);
newDocHeight = lastCellTwips.y + limitMargin.y;

var extendedLimit = false;

if (!limitWidth && maxDocSize.x > this._docWidthTwips) {
newDocWidth = this._docWidthTwips + mapSizeTwips.x;
newDocWidth = Math.min(this._docWidthTwips + mapSizeTwips.x, maxDocSize.x);
extendedLimit = true;
}

if (!limitHeight && maxDocSize.y > this._docHeightTwips) {
newDocHeight = this._docHeightTwips + mapSizeTwips.y;
newDocHeight = Math.min(this._docHeightTwips + mapSizeTwips.y, maxDocSize.y);
extendedLimit = true;
}

Expand Down Expand Up @@ -345,7 +345,9 @@ L.CalcTileLayer = L.CanvasTileLayer.extend({

/// take into account only data area to reduce scrollbar range
updateScrollLimit: function () {
if (this.sheetGeometry && this._lastColumn && this._lastRow) {
if (this.sheetGeometry
&& this._lastColumn !== undefined && this._lastColumn !== null
&& this._lastRow !== undefined && this._lastRow !== null) {
this._restrictDocumentSize();
}
},
Expand Down

0 comments on commit a620e26

Please sign in to comment.