Commit 966e4e09 authored by Alexander.Trofimov's avatar Alexander.Trofimov

Fixed issue #31923, #31946

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68850 954022d7-b5bf-4e40-9824-e11837661b57
parent fe262d69
...@@ -1555,7 +1555,8 @@ function ScrollObject( elemID, settings, dbg ) { ...@@ -1555,7 +1555,8 @@ function ScrollObject( elemID, settings, dbg ) {
this.scroller = {x:0, y:1, h:0, w:0}; this.scroller = {x:0, y:1, h:0, w:0};
this.correct = 0; this.endByX = false;
this.endByY = false;
this.canvas = null; this.canvas = null;
this.context = null; this.context = null;
...@@ -1984,11 +1985,11 @@ ScrollObject.prototype = { ...@@ -1984,11 +1985,11 @@ ScrollObject.prototype = {
isTop = true; isTop = true;
isBottom = false; isBottom = false;
} }
else if ( destY > this.maxScrollY ) { else if ( destY > this.maxScrollY && !this.endByY ) {
// Новое смещение превышает maxScroll, надо вызвать ивент, спрашивающий что делать. // Новое смещение превышает maxScroll, надо вызвать ивент, спрашивающий что делать.
// Чтобы не создавать новый, использую onscrollVEnd, он все равно больше нигде не используется // Чтобы не создавать новый, использую onscrollVEnd, он все равно больше нигде не используется
// 50 = max число wheelScrollLine, если она больше, то будет работать неправильно // 50 = max число wheelScrollLine, если она больше, то будет работать неправильно
for ( var c = 50; destY > this.maxScrollY+this.correct && c > 0; --c ) { for ( var c = 50; destY > this.maxScrollY && c > 0; --c ) {
this.handleEvents( "onscrollVEnd", {} ); this.handleEvents( "onscrollVEnd", {} );
vend = true; vend = true;
} }
...@@ -1996,7 +1997,8 @@ ScrollObject.prototype = { ...@@ -1996,7 +1997,8 @@ ScrollObject.prototype = {
// Обработчик onscrollVEnd решил, что расширение области скрола не нужно, изменяем destY // Обработчик onscrollVEnd решил, что расширение области скрола не нужно, изменяем destY
destY = this.maxScrollY; destY = this.maxScrollY;
} }
isTop = false, isBottom = true; isTop = false;
isBottom = true;
} }
this.scroller.y = destY / Math.max( 1, this.scrollCoeff ) + this.arrowPosition; this.scroller.y = destY / Math.max( 1, this.scrollCoeff ) + this.arrowPosition;
...@@ -2051,15 +2053,16 @@ ScrollObject.prototype = { ...@@ -2051,15 +2053,16 @@ ScrollObject.prototype = {
isTop = true; isTop = true;
isBottom = false; isBottom = false;
} }
else if ( destX > this.maxScrollX ) { else if ( destX > this.maxScrollX && !this.endByX ) {
for ( var c = 50; destX > this.maxScrollX+this.correct && c > 0; --c ) { for ( var c = 50; destX > this.maxScrollX && c > 0; --c ) {
this.handleEvents( "onscrollHEnd", {} ); this.handleEvents( "onscrollHEnd", {} );
hend = true; hend = true;
} }
if ( destX > this.maxScrollX ) { if ( destX > this.maxScrollX ) {
destX = this.maxScrollX; destX = this.maxScrollX;
} }
isTop = false, isBottom = true; isTop = false;
isBottom = true;
} }
this.scroller.x = destX / Math.max( 1, this.scrollCoeff ) + this.arrowPosition; this.scroller.x = destX / Math.max( 1, this.scrollCoeff ) + this.arrowPosition;
......
...@@ -219,8 +219,11 @@ ...@@ -219,8 +219,11 @@
this.isSelectionDialogMode = isSelectionDialogMode; this.isSelectionDialogMode = isSelectionDialogMode;
}; };
/** @param [whichSB] {Number} Scroll bar to reinit (1=vertical, 2=horizontal) */ /**
asc_CEventsController.prototype.reinitializeScroll = function (whichSB,canScroll) { * @param [whichSB] {Number} Scroll bar to reinit (1=vertical, 2=horizontal)
* @param [endScroll] {Boolean} Scroll in the end of document
* */
asc_CEventsController.prototype.reinitializeScroll = function (whichSB, endScroll) {
if (window["NATIVE_EDITOR_ENJINE"]) if (window["NATIVE_EDITOR_ENJINE"])
return; return;
...@@ -236,19 +239,13 @@ ...@@ -236,19 +239,13 @@
vSize = self.vsb.offsetHeight + Math.max( (vSize + 1) * opt.vscrollStep, 1 ); vSize = self.vsb.offsetHeight + Math.max( (vSize + 1) * opt.vscrollStep, 1 );
// this.m_dScrollY_max = vSize; // this.m_dScrollY_max = vSize;
self.vsbHSt.height = vSize + "px"; self.vsbHSt.height = vSize + "px";
self.vsbApi.correct = 0; self.vsbApi.endByY = !!endScroll;
if ( canScroll ) {
self.vsbApi.correct = opt.vscrollStep * 5;
}
self.vsbApi.Reinit(opt, opt.vscrollStep * ws.getFirstVisibleRow(/*allowPane*/true)); self.vsbApi.Reinit(opt, opt.vscrollStep * ws.getFirstVisibleRow(/*allowPane*/true));
} }
if (isHoriz) { if (isHoriz) {
hSize = self.hsb.offsetWidth + Math.max( (hSize + 1) * opt.hscrollStep, 1 ); hSize = self.hsb.offsetWidth + Math.max( (hSize + 1) * opt.hscrollStep, 1 );
// this.m_dScrollX_max = hSize ; // this.m_dScrollX_max = hSize ;
self.hsbHSt.correct = 0; self.hsbApi.endByX = !!endScroll;
if ( canScroll ) {
self.hsbApi.correct = opt.hscrollStep * 5;
}
self.hsbHSt.width = hSize + "px"; self.hsbHSt.width = hSize + "px";
self.hsbApi.Reinit(opt, opt.hscrollStep * ws.getFirstVisibleCol(/*allowPane*/true)); self.hsbApi.Reinit(opt, opt.hscrollStep * ws.getFirstVisibleCol(/*allowPane*/true));
} }
...@@ -354,7 +351,7 @@ ...@@ -354,7 +351,7 @@
self.handlers.trigger("scrollY", evt.scrollPositionY / opt.vscrollStep); self.handlers.trigger("scrollY", evt.scrollPositionY / opt.vscrollStep);
}); });
this.vsbApi.bind("scrollVEnd", function(evt) { this.vsbApi.bind("scrollVEnd", function(evt) {
self.handlers.trigger("addRow",true); self.handlers.trigger("addRow");
}); });
this.vsbApi.onLockMouse = function(evt){ this.vsbApi.onLockMouse = function(evt){
self.vsbApiLockMouse = true; self.vsbApiLockMouse = true;
...@@ -377,7 +374,7 @@ ...@@ -377,7 +374,7 @@
self.handlers.trigger("scrollX", evt.scrollPositionX / opt.hscrollStep); self.handlers.trigger("scrollX", evt.scrollPositionX / opt.hscrollStep);
}); });
this.hsbApi.bind("scrollHEnd",function(evt) { this.hsbApi.bind("scrollHEnd",function(evt) {
self.handlers.trigger("addColumn",true); self.handlers.trigger("addColumn");
}); });
this.hsbApi.onLockMouse = function(){ this.hsbApi.onLockMouse = function(){
self.hsbApiLockMouse = true; self.hsbApiLockMouse = true;
......
...@@ -1303,8 +1303,8 @@ ...@@ -1303,8 +1303,8 @@
this.getWorksheet().emptySelection(c_oAscCleanOptions.Text); this.getWorksheet().emptySelection(c_oAscCleanOptions.Text);
}; };
WorkbookView.prototype._onAddColumn = function(isNotActive) { WorkbookView.prototype._onAddColumn = function() {
var res = this.getWorksheet().expandColsOnScroll(isNotActive); var res = this.getWorksheet().expandColsOnScroll(true);
if (res) { if (res) {
if(res == 1) if(res == 1)
this.controller.reinitializeScroll(/*horizontal*/2); this.controller.reinitializeScroll(/*horizontal*/2);
...@@ -1313,8 +1313,8 @@ ...@@ -1313,8 +1313,8 @@
} }
}; };
WorkbookView.prototype._onAddRow = function(isNotActive) { WorkbookView.prototype._onAddRow = function() {
var res = this.getWorksheet().expandRowsOnScroll(isNotActive); var res = this.getWorksheet().expandRowsOnScroll(true);
if (res) { // Добавлены строки if (res) { // Добавлены строки
// после добавления controller.settings.wheelScrollLines // после добавления controller.settings.wheelScrollLines
// ws.scrollVertical() здесь не нужен, scroll.js сам все разрулит // ws.scrollVertical() здесь не нужен, scroll.js сам все разрулит
......
...@@ -5789,16 +5789,17 @@ ...@@ -5789,16 +5789,17 @@
offsetX: offsetX, offsetY: offsetY offsetX: offsetX, offsetY: offsetY
} ) ); } ) );
} }
// Отрисовывать нужно всегда, вдруг бордеры }
this._drawFrozenPaneLines(); // Отрисовывать нужно всегда, вдруг бордеры
this._fixSelectionOfMergedCells(); this._drawFrozenPaneLines();
this._drawSelection(); this._fixSelectionOfMergedCells();
this._drawSelection();
if ( widthChanged ) { if (widthChanged) {
this.handlers.trigger( "reinitializeScrollX" ); this.handlers.trigger("reinitializeScrollX");
}
} }
if ( reinitScrollY ) { if ( reinitScrollY ) {
this.handlers.trigger( "reinitializeScrollY" ); this.handlers.trigger( "reinitializeScrollY" );
} }
...@@ -5946,14 +5947,15 @@ ...@@ -5946,14 +5947,15 @@
offsetX: offsetX, offsetY: offsetY offsetX: offsetX, offsetY: offsetY
} ) ); } ) );
} }
// Отрисовывать нужно всегда, вдруг бордеры
this._drawFrozenPaneLines();
this._fixSelectionOfMergedCells();
this._drawSelection();
} }
if ( reinitScrollX ) { // Отрисовывать нужно всегда, вдруг бордеры
this.handlers.trigger( "reinitializeScrollX" ); this._drawFrozenPaneLines();
this._fixSelectionOfMergedCells();
this._drawSelection();
if (reinitScrollX) {
this.handlers.trigger("reinitializeScrollX");
} }
this.handlers.trigger( "onDocumentPlaceChanged" ); this.handlers.trigger( "onDocumentPlaceChanged" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment