diff --git a/browser/src/layer/tile/CanvasTileLayer.js b/browser/src/layer/tile/CanvasTileLayer.js index a2c37988a4ca..1572d5e018fb 100644 --- a/browser/src/layer/tile/CanvasTileLayer.js +++ b/browser/src/layer/tile/CanvasTileLayer.js @@ -4162,7 +4162,7 @@ L.CanvasTileLayer = L.Layer.extend({ } if (oldSize.x !== newSize.x || oldSize.y !== newSize.y) { - this._map.invalidateSize(); + this._map.invalidateSize({}, oldSize); } var hasMobileWizardOpened = this._map.uiManager.mobileWizard ? this._map.uiManager.mobileWizard.isOpen() : false; diff --git a/browser/src/map/Map.js b/browser/src/map/Map.js index 4de117e2be1a..32e361db6b74 100644 --- a/browser/src/map/Map.js +++ b/browser/src/map/Map.js @@ -794,7 +794,9 @@ L.Map = L.Evented.extend({ return this.panTo(newCenter, options); }, - invalidateSize: function (options) { + // If map size has already been updated, invalidateSize needs the oldSize to work properly + // (e.g. if getSize() has already been called whith _sizeChanged === true) + invalidateSize: function (options, oldSize) { if (!this._loaded) { return this; } options = L.extend({ @@ -802,7 +804,9 @@ L.Map = L.Evented.extend({ pan: false }, options === true ? {animate: true} : options); - var oldSize = this.getSize(); + if (!oldSize) { + oldSize = this.getSize(); + } this._sizeChanged = true; var newSize = this.getSize(), diff --git a/cypress_test/integration_tests/desktop/calc/cell_cursor_spec.js b/cypress_test/integration_tests/desktop/calc/cell_cursor_spec.js index 4cfc27d119a8..6605853373d2 100644 --- a/cypress_test/integration_tests/desktop/calc/cell_cursor_spec.js +++ b/cypress_test/integration_tests/desktop/calc/cell_cursor_spec.js @@ -14,11 +14,11 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Test jumping on large cell }); it('No jump on long merged cell', function() { - desktopHelper.assertScrollbarPosition('horizontal', 205, 315); + desktopHelper.assertScrollbarPosition('horizontal', 205, 320); calcHelper.clickOnFirstCell(true, false, false); cy.cGet(helper.addressInputSelector).should('have.value', 'A1:Z1'); - desktopHelper.assertScrollbarPosition('horizontal', 205, 315); + desktopHelper.assertScrollbarPosition('horizontal', 205, 320); }); it('Jump on address with not visible cursor', function() { @@ -30,7 +30,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Test jumping on large cell }); it('Jump on search with not visible cursor', function() { - desktopHelper.assertScrollbarPosition('horizontal', 205, 315); + desktopHelper.assertScrollbarPosition('horizontal', 205, 320); cy.cGet('input#search-input').clear().type('FIRST{enter}'); cy.cGet(helper.addressInputSelector).should('have.value', 'A10'); diff --git a/cypress_test/integration_tests/desktop/calc/scrolling_spec.js b/cypress_test/integration_tests/desktop/calc/scrolling_spec.js index 3b13c51a9081..4d9547fad44c 100644 --- a/cypress_test/integration_tests/desktop/calc/scrolling_spec.js +++ b/cypress_test/integration_tests/desktop/calc/scrolling_spec.js @@ -48,7 +48,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Scroll through document', } // Document should scroll - desktopHelper.assertScrollbarPosition('vertical', 50, 60); + desktopHelper.assertScrollbarPosition('vertical', 45, 55); // Document should not scroll horizontally desktopHelper.assertScrollbarPosition('horizontal', 48, 50); }); @@ -71,6 +71,6 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Scroll through document', } // Document should scroll - desktopHelper.assertScrollbarPosition('horizontal', 160, 190); + desktopHelper.assertScrollbarPosition('horizontal', 80, 110); }); }); diff --git a/cypress_test/integration_tests/desktop/calc/sheet_switch_spec.js b/cypress_test/integration_tests/desktop/calc/sheet_switch_spec.js index 617062a2b673..b1b8ce4b327c 100644 --- a/cypress_test/integration_tests/desktop/calc/sheet_switch_spec.js +++ b/cypress_test/integration_tests/desktop/calc/sheet_switch_spec.js @@ -21,21 +21,21 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Sheet switching tests', fu // go to sheet 2 cy.cGet('#spreadsheet-tab1').click(); cy.cGet(helper.addressInputSelector).should('have.prop', 'value', 'F720'); - desktopHelper.assertScrollbarPosition('vertical', 320, 335); + desktopHelper.assertScrollbarPosition('vertical', 320, 340); cy.cGet(helper.addressInputSelector).type('{selectAll}A2{enter}'); desktopHelper.assertScrollbarPosition('vertical', 15, 25); }); - it('Check view position on repeated selection of currently selected sheet', function() { + it.only('Check view position on repeated selection of currently selected sheet', function() { // initially we are on sheet 2 tab cy.cGet(helper.addressInputSelector).should('have.prop', 'value', 'F720'); - desktopHelper.assertScrollbarPosition('vertical', 320, 335); + desktopHelper.assertScrollbarPosition('vertical', 280, 300); // click on sheet 2 tab (yes, current one) cy.cGet('#spreadsheet-tab1').click(); cy.cGet(helper.addressInputSelector).should('have.prop', 'value', 'F720'); - desktopHelper.assertScrollbarPosition('vertical', 320, 335); + desktopHelper.assertScrollbarPosition('vertical', 280, 300); // go to different place in the spreadsheet cy.cGet(helper.addressInputSelector).type('{selectAll}A2{enter}');