fix horizontal scroll desynchronization on windows

This commit is contained in:
nightwing 2012-01-14 21:04:32 +04:00
commit 9f2e504d67

View file

@ -421,6 +421,10 @@ var VirtualRenderer = function(container, theme) {
)
this.$computeLayerConfig();
// horizontal scrolling
if (changes & this.CHANGE_H_SCROLL)
this.scroller.scrollLeft = this.scrollLeft
// full
if (changes & this.CHANGE_FULL) {
this.$textLayer.update(this.layerConfig);
@ -477,11 +481,6 @@ var VirtualRenderer = function(container, theme) {
if (changes & this.CHANGE_SIZE)
this.$updateScrollBar();
if (changes & this.CHANGE_H_SCROLL) {
//this.content.style.left = -this.scrollLeft + "px";
this.scroller.scrollLeft = this.scrollLeft
}
};
this.$computeLayerConfig = function() {
@ -495,9 +494,13 @@ var VirtualRenderer = function(container, theme) {
var horizScroll = this.$horizScrollAlwaysVisible || this.$size.scrollerWidth - longestLine < 0;
var horizScrollChanged = this.$horizScroll !== horizScroll;
this.$horizScroll = horizScroll;
if (horizScrollChanged)
if (horizScrollChanged) {
this.scroller.style.overflowX = horizScroll ? "scroll" : "hidden";
// when we hide scrollbar scroll event isn't emited
// leaving session with wrong scrollLeft value
if (!horizScroll)
this.session.setScrollLeft(0);
}
var maxHeight = this.session.getScreenLength() * this.lineHeight;
this.session.setScrollTop(Math.max(0, Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight)));