Commit 813a0539 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Поправил expand OnScroll

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68880 954022d7-b5bf-4e40-9824-e11837661b57
parent 61f8f368
...@@ -1305,24 +1305,12 @@ ...@@ -1305,24 +1305,12 @@
WorkbookView.prototype._onAddColumn = function() { WorkbookView.prototype._onAddColumn = function() {
var res = this.getWorksheet().expandColsOnScroll(true); var res = this.getWorksheet().expandColsOnScroll(true);
if (res) { this.controller.reinitializeScroll(/*horizontal*/2, !res);
if(res == 1)
this.controller.reinitializeScroll(/*horizontal*/2);
else
this.controller.reinitializeScroll(/*horizontal*/2,true);
}
}; };
WorkbookView.prototype._onAddRow = function() { WorkbookView.prototype._onAddRow = function() {
var res = this.getWorksheet().expandRowsOnScroll(true); var res = this.getWorksheet().expandRowsOnScroll(true);
if (res) { // Добавлены строки this.controller.reinitializeScroll(/*vertical*/1, !res);
// после добавления controller.settings.wheelScrollLines
// ws.scrollVertical() здесь не нужен, scroll.js сам все разрулит
if(res == 1)
this.controller.reinitializeScroll(/*vertical*/1);
else
this.controller.reinitializeScroll(/*vertical*/1,true);
}
}; };
WorkbookView.prototype._onShowNextPrevWorksheet = function(direction) { WorkbookView.prototype._onShowNextPrevWorksheet = function(direction) {
......
...@@ -3466,11 +3466,11 @@ ...@@ -3466,11 +3466,11 @@
this.visibleRange.c1 = col; this.visibleRange.c1 = col;
this.visibleRange.r1 = row; this.visibleRange.r1 = row;
if ( col >= this.nColsCount ) { if ( col >= this.nColsCount ) {
this.expandColsOnScroll( false, true, 0 ); this.expandColsOnScroll(false, true);
} // Передаем 0, чтобы увеличить размеры }
if ( row >= this.nRowsCount ) { if ( row >= this.nRowsCount ) {
this.expandRowsOnScroll( false, true, 0 ); this.expandRowsOnScroll(false, true);
} // Передаем 0, чтобы увеличить размеры }
this.visibleRange.r2 = 0; this.visibleRange.r2 = 0;
this._calcVisibleRows(); this._calcVisibleRows();
...@@ -9136,8 +9136,8 @@ ...@@ -9136,8 +9136,8 @@
unLockDraw( t.model.workbook ); unLockDraw( t.model.workbook );
return; return;
} }
t.expandColsOnScroll(); this.expandColsOnScroll(false, true);
t.expandRowsOnScroll(); this.expandRowsOnScroll(false, true);
var arrFormula = selectData[1]; var arrFormula = selectData[1];
for ( var i = 0; i < arrFormula.length; ++i ) {//!!! for ( var i = 0; i < arrFormula.length; ++i ) {//!!!
...@@ -10491,101 +10491,65 @@ ...@@ -10491,101 +10491,65 @@
} }
}; };
WorksheetView.prototype.expandColsOnScroll = function ( isNotActive, updateColsCount, newColsCount ) { WorksheetView.prototype.expandColsOnScroll = function(isNotActive, updateColsCount, newColsCount) {
var t = this;
var arn;
var bIsMaxCols = false;
var obr = this.objectRender ? this.objectRender.getDrawingAreaMetrics() : {maxCol: 0, maxRow: 0}; var obr = this.objectRender ? this.objectRender.getDrawingAreaMetrics() : {maxCol: 0, maxRow: 0};
var maxc = Math.max( this.model.getColsCount() + 1, this.cols.length, obr.maxCol ); var maxc = Math.max(this.model.getColsCount() + 1, this.cols.length, obr.maxCol);
if ( newColsCount ) { if (newColsCount) {
maxc = Math.max( maxc, newColsCount ); maxc = Math.max(maxc, newColsCount);
} }
// Сохраняем старое значение // Сохраняем старое значение
var nLastCols = this.nColsCount; var nLastCols = this.nColsCount;
if ( isNotActive ) { if (isNotActive) {
this.nColsCount = maxc + 1; this.nColsCount = maxc + 1;
} } else if (updateColsCount) {
else if ( updateColsCount ) {
this.nColsCount = maxc; this.nColsCount = maxc;
if ( this.cols.length < this.nColsCount ) { if (this.cols.length < this.nColsCount) {
nLastCols = this.cols.length; nLastCols = this.cols.length;
} }
} }
else {
arn = t.activeRange.clone( true );
if ( arn.c2 >= t.cols.length - 1 ) {
this.nColsCount = maxc;
if ( arn.c2 >= this.nColsCount - 1 ) {
this.nColsCount = arn.c2 + 2;
}
}
}
// Проверяем ограничения по столбцам // Проверяем ограничения по столбцам
if ( gc_nMaxCol < this.nColsCount ) { if (gc_nMaxCol < this.nColsCount) {
this.nColsCount = gc_nMaxCol; this.nColsCount = gc_nMaxCol;
bIsMaxCols = true;
} }
t._calcWidthColumns( /*fullRecalc*/2 ); this._calcWidthColumns(/*fullRecalc*/2);
if ( this.objectRender && this.objectRender.drawingArea ) { if (this.objectRender && this.objectRender.drawingArea) {
this.objectRender.drawingArea.reinitRanges(); this.objectRender.drawingArea.reinitRanges();
} }
if ( nLastCols !== this.nColsCount ) return nLastCols !== this.nColsCount;
return 1;
if ( bIsMaxCols )
return 2;
return (nLastCols !== this.nColsCount || bIsMaxCols);
}; };
WorksheetView.prototype.expandRowsOnScroll = function ( isNotActive, updateRowsCount, newRowsCount ) { WorksheetView.prototype.expandRowsOnScroll = function(isNotActive, updateRowsCount, newRowsCount) {
var t = this;
var arn;
var bIsMaxRows = false;
var obr = this.objectRender ? this.objectRender.getDrawingAreaMetrics() : {maxCol: 0, maxRow: 0}; var obr = this.objectRender ? this.objectRender.getDrawingAreaMetrics() : {maxCol: 0, maxRow: 0};
var maxr = Math.max( this.model.getRowsCount() + 1, this.rows.length, obr.maxRow ); var maxr = Math.max(this.model.getRowsCount() + 1, this.rows.length, obr.maxRow);
if ( newRowsCount ) { if (newRowsCount) {
maxr = Math.max( maxr, newRowsCount ); maxr = Math.max(maxr, newRowsCount);
} }
// Сохраняем старое значение // Сохраняем старое значение
var nLastRows = this.nRowsCount; var nLastRows = this.nRowsCount;
if ( isNotActive ) { if (isNotActive) {
this.nRowsCount = maxr + 1; this.nRowsCount = maxr + 1;
} } else if (updateRowsCount) {
else if ( updateRowsCount ) {
this.nRowsCount = maxr; this.nRowsCount = maxr;
if ( this.rows.length < this.nRowsCount ) { if (this.rows.length < this.nRowsCount) {
nLastRows = this.rows.length; nLastRows = this.rows.length;
} }
} }
else {
arn = t.activeRange.clone( true );
if ( arn.r2 >= t.rows.length - 1 ) {
this.nRowsCount = maxr;
if ( arn.r2 >= this.nRowsCount - 1 ) {
this.nRowsCount = arn.r2 + 2;
}
}
}
// Проверяем ограничения по строкам // Проверяем ограничения по строкам
if ( gc_nMaxRow < this.nRowsCount ) { if (gc_nMaxRow < this.nRowsCount) {
this.nRowsCount = gc_nMaxRow; this.nRowsCount = gc_nMaxRow;
bIsMaxRows = true;
} }
t._calcHeightRows( /*fullRecalc*/2 ); this._calcHeightRows(/*fullRecalc*/2);
if ( this.objectRender && this.objectRender.drawingArea ) { if (this.objectRender && this.objectRender.drawingArea) {
this.objectRender.drawingArea.reinitRanges(); this.objectRender.drawingArea.reinitRanges();
} }
if ( nLastRows !== this.nRowsCount ) return nLastRows !== this.nRowsCount;
return 1;
if ( bIsMaxRows )
return 2;
return (nLastRows !== this.nRowsCount || bIsMaxRows);
}; };
WorksheetView.prototype.onChangeWidthCallback = function ( col, r1, r2, onlyIfMore ) { WorksheetView.prototype.onChangeWidthCallback = function ( col, r1, r2, onlyIfMore ) {
......
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