loleaflet/src/control/Control.Scroll.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
New commits: commit 458045bb43a31b02443459e053c18ed95d134d7a Author: Marco Cecchetti <[email protected]> Date: Thu Dec 1 21:00:37 2016 +0100 tdf#106597 loleaflet - calc: horizontal scrollbar not updated on doc width change Change-Id: I268ab65d0bf7a6794028e23e51012c11534d6f2f Reviewed-on: https://gerrit.libreoffice.org/35347 Reviewed-by: Thorsten Behrens <[email protected]> Tested-by: Thorsten Behrens <[email protected]> diff --git a/loleaflet/src/control/Control.Scroll.js b/loleaflet/src/control/Control.Scroll.js index 31314408..40089a99 100644 --- a/loleaflet/src/control/Control.Scroll.js +++ b/loleaflet/src/control/Control.Scroll.js @@ -118,14 +118,25 @@ L.Control.Scroll = L.Control.extend({ }, _onUpdateSize: function (e) { + // we need to avoid precision issues in comparison (in the end values are pixels) + var prevDocWidth = Math.ceil(parseFloat(L.DomUtil.getStyle(this._mockDoc, 'width'))); + var prevDocHeight = Math.ceil(parseFloat(L.DomUtil.getStyle(this._mockDoc, 'height'))); + var newDocWidth = Math.ceil(e.x); + var newDocHeight = Math.ceil(e.y); // for writer documents, ignore scroll while document size is being reduced - var prevDocY = parseFloat(L.DomUtil.getStyle(this._mockDoc, 'height')); - if (this._map.getDocType() === 'text' && e.y < prevDocY) { + if (this._map.getDocType() === 'text' && newDocHeight < prevDocHeight) { this._ignoreScroll = true; } L.DomUtil.setStyle(this._mockDoc, 'width', e.x + 'px'); L.DomUtil.setStyle(this._mockDoc, 'height', e.y + 'px'); + + // custom scrollbar plugin checks automatically for content height changes but not for content width changes + // so we need to update scrollbars explicitly; moreover we want to avoid to have 'update' invoked twice + // in case prevDocHeight !== newDocHeight + if (prevDocWidth !== newDocWidth && prevDocHeight === newDocHeight) { + $('.scroll-container').mCustomScrollbar('update'); + } }, _onUpdateScrollOffset: function (e) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
