Skip to content

Commit

Permalink
[se] Fix redraw scrolls
Browse files Browse the repository at this point in the history
  • Loading branch information
GoshaZotov authored and K0R0L committed Jan 29, 2025
1 parent ffa6624 commit c4ea44e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
34 changes: 26 additions & 8 deletions cell/view/EventsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2806,35 +2806,53 @@
};

asc_CEventsController.prototype.showHorizontalScroll = function (val) {
this.hsb.style.visibility = val ? "visible" : "hidden";
let toVisibility = val ? "visible" : "hidden";
let res;
if (this.hsb.style.visibility === toVisibility) {
res = false;
} else {
this.hsb.style.visibility = toVisibility;
res = true;
}

let isVisibleVerScroll = this.view.getShowVerticalScroll();
let scrollWidth = this.view && this.view.defaults && this.view.defaults.scroll ? this.view.defaults.scroll.widthPx : 14;
if (val) {
this.hsb.style.right = isVisibleVerScroll ? scrollWidth + "px" : "0px";
}

this.hsb.style.right = isVisibleVerScroll ? scrollWidth + "px" : "0px";

if (!this.view.Api.isMobileVersion) {
let cornerStyle = val && isVisibleVerScroll ? "visible" : "hidden";
let corner = document.getElementById("ws-scrollbar-corner");
if (corner) {
corner.style.visibility = cornerStyle;
}
}
return res;
};

asc_CEventsController.prototype.showVerticalScroll = function (val) {
this.vsb.style.visibility = val ? "visible" : "hidden";
let toVisibility = val ? "visible" : "hidden";
let res;
if (this.vsb.style.visibility === toVisibility) {
res = false;
} else {
this.vsb.style.visibility = toVisibility;
res = true;
}
this.vsb.style.visibility = toVisibility;
let isVisibleHorScroll = this.view.getShowHorizontalScroll();
let scrollWidth = this.view && this.view.defaults && this.view.defaults.scroll ? this.view.defaults.scroll.heightPx : 14;
if (val) {
this.vsb.style.bottom = isVisibleHorScroll ? scrollWidth + "px" : "0px";
}

this.vsb.style.bottom = isVisibleHorScroll ? scrollWidth + "px" : "0px";

if (!this.view.Api.isMobileVersion) {
let cornerStyle = val && isVisibleHorScroll ? "visible" : "hidden";
let corner = document.getElementById("ws-scrollbar-corner");
if (corner) {
corner.style.visibility = cornerStyle;
}
}
return res;
};


Expand Down
13 changes: 8 additions & 5 deletions cell/view/WorkbookView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1108,12 +1108,15 @@
self.changeUpdateLinks(val);
});
this.model.handlers.add("updateScrollVisibility", function() {
self.controller.showVerticalScroll(self.getShowVerticalScroll());
self.controller.showHorizontalScroll(self.getShowHorizontalScroll());
self._canResize();
let isChangedVertScroll = self.controller.showVerticalScroll(self.getShowVerticalScroll());
let isChangedHorScroll = self.controller.showHorizontalScroll(self.getShowHorizontalScroll());
if (isChangedVertScroll || isChangedHorScroll) {
self._canResize();

let ws = self.getWorksheet();
ws.draw();
let ws = self.getWorksheet();
ws._updateRange(new Asc.Range(0, 0, ws.model.getColsCount(), ws.model.getRowsCount()), true);
ws.draw();
}
});
this.cellCommentator = new AscCommonExcel.CCellCommentator({
model: new WorkbookCommentsModel(this.handlers, this.model.aComments),
Expand Down

0 comments on commit c4ea44e

Please sign in to comment.