Skip to content

Commit

Permalink
[se] Fix bug 63725
Browse files Browse the repository at this point in the history
  • Loading branch information
GoshaZotov committed Oct 18, 2023
1 parent e0bfd7e commit 4e90ff6
Showing 1 changed file with 41 additions and 43 deletions.
84 changes: 41 additions & 43 deletions common/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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;

Expand Down

0 comments on commit 4e90ff6

Please sign in to comment.