From 4e90ff63acd72a8467a88fc80d21c7920dc9f064 Mon Sep 17 00:00:00 2001 From: GoshaZotov Date: Wed, 18 Oct 2023 10:27:28 +0300 Subject: [PATCH] [se] Fix bug 63725 --- common/scroll.js | 84 +++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 43 deletions(-) diff --git a/common/scroll.js b/common/scroll.js index 618be83b0a..1bc90f9dc9 100644 --- a/common/scroll.js +++ b/common/scroll.js @@ -623,14 +623,13 @@ CArrowDrawer.prototype.InitSize = function ( sizeW, sizeH ) } }; ScrollObject.prototype.Repos = function ( settings, bIsHorAttack, bIsVerAttack, pos ) { - var dPR = AscBrowser.retinaPixelRatio; - - var isChangeTheme = settings && this.settings.scrollBackgroundColor !== settings.scrollBackgroundColor; + let dPR = AscBrowser.retinaPixelRatio; + let isChangeTheme = settings && this.settings.scrollBackgroundColor !== settings.scrollBackgroundColor; - if (isChangeTheme) - { - for ( var i in settings ) + if (isChangeTheme) { + for (let i in settings) { this.settings[i] = settings[i]; + } } if (this.settings.showArrows) { @@ -639,39 +638,37 @@ CArrowDrawer.prototype.InitSize = function ( sizeW, sizeH ) this.ArrowDrawer.InitSize(this.settings.arrowSizeH, this.settings.arrowSizeW); } - if (bIsVerAttack) - { - var _canvasH = settings.screenH; - if (undefined !== _canvasH && settings.screenAddH) + if (bIsVerAttack) { + let _canvasH = settings.screenH; + if (undefined !== _canvasH && settings.screenAddH) { _canvasH += settings.screenAddH; + } - if (_canvasH == this.canvasH && undefined !== settings.contentH) - { - var _maxScrollY = settings.contentH - settings.screenH > 0 ? settings.contentH - settings.screenH : 0; - if (_maxScrollY == this.maxScrollY && !isChangeTheme) + if (_canvasH == this.canvasH && undefined !== settings.contentH) { + let _maxScrollY = settings.contentH - settings.screenH > 0 ? settings.contentH - settings.screenH : 0; + if (_maxScrollY == this.maxScrollY && !isChangeTheme) { return; + } } } - if (bIsHorAttack) - { - if (settings.screenW == this.canvasW && undefined !== settings.contentW) - { - var _maxScrollX = settings.contentW - settings.screenW > 0 ? settings.contentW - settings.screenW : 0; - if (_maxScrollX == this.maxScrollX && !isChangeTheme) + if (bIsHorAttack) { + if (settings.screenW == this.canvasW && undefined !== settings.contentW) { + let _maxScrollX = settings.contentW - settings.screenW > 0 ? settings.contentW - settings.screenW : 0; + if (_maxScrollX == this.maxScrollX && !isChangeTheme) { return; + } } } - var dPR = AscBrowser.retinaPixelRatio; - var _parentClientW = GetClientWidth( this.canvas.parentNode ); - var _parentClientH = GetClientHeight( this.canvas.parentNode ); + let _parentClientW = GetClientWidth(this.canvas.parentNode); + let _parentClientH = GetClientHeight(this.canvas.parentNode); - var _firstChildW = settings.contentW; - var _firstChildH = settings.contentH; + let _firstChildW = settings.contentW; + let _firstChildH = settings.contentH; this.maxScrollY = this.maxScrollY2 = _firstChildH - settings.screenH > 0 ? _firstChildH - settings.screenH : 0; this.maxScrollX = this.maxScrollX2 = _firstChildW - settings.screenW > 0 ? _firstChildW - settings.screenW : 0; - this._setDimension( _parentClientH, _parentClientW ); + this._setDimension(_parentClientH, _parentClientW); this._setScrollerHW(); this.settings.arrowDim = Math.round(13 * dPR); @@ -681,40 +678,41 @@ CArrowDrawer.prototype.InitSize = function ( sizeW, sizeH ) this.paneHeight = this.canvasH - this.arrowPosition * 2; this.paneWidth = this.canvasW - this.arrowPosition * 2; this.RecalcScroller(); - if ( this.settings.isVerticalScroll && !this.settings.alwaysVisible) { + if (this.settings.isVerticalScroll && !this.settings.alwaysVisible) { - if (this.scrollVCurrentY > this.maxScrollY) + if (this.scrollVCurrentY > this.maxScrollY) { this.scrollVCurrentY = this.maxScrollY; + } - this.scrollToY( this.scrollVCurrentY ); - if(this.maxScrollY == 0){ + this.scrollToY(this.scrollVCurrentY); + if (this.maxScrollY == 0) { this.canvas.style.display = "none"; - } - else{ + } else { this.canvas.style.display = ""; } - } - else if ( this.settings.isHorizontalScroll ) { + } else if (this.settings.isHorizontalScroll) { - if (this.scrollHCurrentX > this.maxScrollX) + if (this.scrollHCurrentX > this.maxScrollX) { this.scrollHCurrentX = this.maxScrollX; + } - this.scrollToX( this.scrollHCurrentX ); - if(this.maxScrollX == 0 && !this.settings.alwaysVisible){ + this.scrollToX(this.scrollHCurrentX); + if (this.maxScrollX == 0 && !this.settings.alwaysVisible) { this.canvas.style.display = "none"; - } - else{ + } else { this.canvas.style.display = ""; } } this.reinit = true; - if ( this.settings.isVerticalScroll && pos) { - pos !== undefined ? this.scrollByY( pos - this.scrollVCurrentY ) : this.scrollToY( this.scrollVCurrentY ); + if (this.settings.isVerticalScroll && pos != null) { + //pos !== undefined ? this.scrollByY( pos - this.scrollVCurrentY ) : this.scrollToY( this.scrollVCurrentY ); + this.scrollByY(pos - this.scrollVCurrentY); } - if ( this.settings.isHorizontalScroll && pos) { - pos !== undefined ? this.scrollByX( pos - this.scrollHCurrentX ) : this.scrollToX( this.scrollHCurrentX ); + if (this.settings.isHorizontalScroll && pos != null) { + //pos !== undefined ? this.scrollByX( pos - this.scrollHCurrentX ) : this.scrollToX( this.scrollHCurrentX ); + this.scrollByX(pos - this.scrollHCurrentX) } this.reinit = false;