avoid layout recalculation upon scrollport resize

This commit is contained in:
Guillermo Rauch 2017-02-18 00:27:29 -03:00
parent ade9ad39fd
commit 361db6190e

View file

@ -324,6 +324,25 @@ hterm.Terminal.prototype.onMouseDown_ = function (e) {
}
};
// override `ScrollPort.resize` to avoid an expensive calculation
// just to get the size of the scrollbar, which for Hyper is always
// set to overlay (hence with `0`)
hterm.ScrollPort.prototype.resize = function () {
this.currentScrollbarWidthPx = 0;
this.syncScrollHeight();
this.syncRowNodesDimensions_();
this.publish(
'resize',
{scrollPort: this},
() => {
this.scrollRowToBottom(this.rowProvider_.getRowCount());
this.scheduleRedraw();
}
);
};
// make background transparent to avoid transparency issues
hterm.ScrollPort.prototype.setBackgroundColor = function () {
this.screen_.style.backgroundColor = 'transparent';