Commit feedad60 authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

Исправил баг со скролом графики, если есть строки/столбцы с различными высотами/ширинами

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53272 954022d7-b5bf-4e40-9824-e11837661b57
parent d98c44a7
...@@ -2448,11 +2448,11 @@ prot["asc_getIndex"] = prot.asc_getIndex; ...@@ -2448,11 +2448,11 @@ prot["asc_getIndex"] = prot.asc_getIndex;
// Manager // Manager
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
function GraphicOption(ws, type, delta) { function GraphicOption(ws, type, range) {
var _this = this; var _this = this;
_this.ws = ws; _this.ws = ws;
_this.type = type; _this.type = type;
_this.delta = delta; // Scroll offset: + Down || - Up _this.range = range;
function checkCol(col) { function checkCol(col) {
while ( (col > 0) && !_this.ws.cols[col] ) while ( (col > 0) && !_this.ws.cols[col] )
...@@ -2471,34 +2471,14 @@ function GraphicOption(ws, type, delta) { ...@@ -2471,34 +2471,14 @@ function GraphicOption(ws, type, delta) {
_this.getUpdatedRange = function() { _this.getUpdatedRange = function() {
var vr = _this.ws.visibleRange.clone(); var vr = _this.ws.visibleRange.clone();
if ( _this.isScrollType() && (_this.delta === 0) ) if ( _this.isScrollType() && !range )
return vr; return vr;
switch (_this.type) { switch (_this.type) {
case c_oAscGraphicOption.ScrollVertical: { case c_oAscGraphicOption.ScrollVertical:
// Down
if ( _this.delta > 0 ) {
vr.r1 = vr.r2 - _this.delta;
checkRow(++vr.r2);
}
// Up
else
vr.r2 = vr.r1 - _this.delta;
checkCol(++vr.c2);
}
break;
case c_oAscGraphicOption.ScrollHorizontal: { case c_oAscGraphicOption.ScrollHorizontal: {
// Right vr = range.clone();
if ( _this.delta > 0 ) {
vr.c1 = vr.c2 - _this.delta;
checkCol(++vr.c2); checkCol(++vr.c2);
}
// Left
else
vr.c2 = vr.c1 - _this.delta;
checkRow(++vr.r2); checkRow(++vr.r2);
} }
break; break;
...@@ -3482,7 +3462,10 @@ function DrawingObjects() { ...@@ -3482,7 +3462,10 @@ function DrawingObjects() {
var lastTask = aDrawTasks[aDrawTasks.length - 1]; var lastTask = aDrawTasks[aDrawTasks.length - 1];
if ( lastTask.params.graphicOption && lastTask.params.graphicOption.isScrollType() && graphicOption && (lastTask.params.graphicOption.type === graphicOption.type) ) { if ( lastTask.params.graphicOption && lastTask.params.graphicOption.isScrollType() && graphicOption && (lastTask.params.graphicOption.type === graphicOption.type) ) {
lastTask.params.graphicOption.delta += graphicOption.delta; lastTask.params.graphicOption.range.c1 = Math.min(lastTask.params.graphicOption.range.c1, graphicOption.range.c1);
lastTask.params.graphicOption.range.r1 = Math.min(lastTask.params.graphicOption.range.r1, graphicOption.range.r1);
lastTask.params.graphicOption.range.c2 = Math.max(lastTask.params.graphicOption.range.c2, graphicOption.range.c2);
lastTask.params.graphicOption.range.r2 = Math.max(lastTask.params.graphicOption.range.r2, graphicOption.range.r2);
return; return;
} }
if ( (currTime - lastTask.time < 40) ) if ( (currTime - lastTask.time < 40) )
......
...@@ -1099,7 +1099,7 @@ function NullState(drawingObjectsController, drawingObjects) ...@@ -1099,7 +1099,7 @@ function NullState(drawingObjectsController, drawingObjects)
{ {
History.Create_NewPoint(); History.Create_NewPoint();
text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode))); text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText, 0)); drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText));
text_object.updateSelectionState(drawingObjects.drawingDocument); text_object.updateSelectionState(drawingObjects.drawingDocument);
drawingObjects.controller.changeCurrentState(new TextAddState(drawingObjects.controller, drawingObjects, text_object)); drawingObjects.controller.changeCurrentState(new TextAddState(drawingObjects.controller, drawingObjects, text_object));
} }
...@@ -1503,7 +1503,7 @@ function ChartState(drawingObjectsController, drawingObjects, chart) ...@@ -1503,7 +1503,7 @@ function ChartState(drawingObjectsController, drawingObjects, chart)
History.Create_NewPoint(); History.Create_NewPoint();
drawingObjects.controller.changeCurrentState(new ChartTextAdd(drawingObjects.controller, drawingObjects, chart, text_object)); drawingObjects.controller.changeCurrentState(new ChartTextAdd(drawingObjects.controller, drawingObjects, chart, text_object));
text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode))); text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText, 0)); drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText));
drawingObjects.controller.updateSelectionState(drawingObjects.drawingDocument); drawingObjects.controller.updateSelectionState(drawingObjects.drawingDocument);
drawingObjects.OnUpdateOverlay(); drawingObjects.OnUpdateOverlay();
} }
...@@ -1732,7 +1732,7 @@ function ChartTextAdd(drawingObjectsController, drawingObjects, chart, textObjec ...@@ -1732,7 +1732,7 @@ function ChartTextAdd(drawingObjectsController, drawingObjects, chart, textObjec
{ {
History.Create_NewPoint(); History.Create_NewPoint();
text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode))); text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText, 0)); drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText));
text_object.updateSelectionState(drawingObjects.drawingDocument); text_object.updateSelectionState(drawingObjects.drawingDocument);
} }
}; };
...@@ -1983,7 +1983,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject) ...@@ -1983,7 +1983,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{ {
History.Create_NewPoint(); History.Create_NewPoint();
text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode))); text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText, 0)); drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText));
text_object.updateSelectionState(drawingObjects.drawingDocument); text_object.updateSelectionState(drawingObjects.drawingDocument);
} }
}; };
...@@ -3195,7 +3195,7 @@ function ChartGroupState(drawingObjectsController, drawingObjects, group, chart) ...@@ -3195,7 +3195,7 @@ function ChartGroupState(drawingObjectsController, drawingObjects, group, chart)
History.Create_NewPoint(); History.Create_NewPoint();
drawingObjects.controller.changeCurrentState(new ChartTextAddGroup(drawingObjects.controller, drawingObjects, group, chart, selected_title)); drawingObjects.controller.changeCurrentState(new ChartTextAddGroup(drawingObjects.controller, drawingObjects, group, chart, selected_title));
text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode))); text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText, 0)); drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText));
drawingObjects.controller.updateSelectionState(drawingObjects.drawingDocument); drawingObjects.controller.updateSelectionState(drawingObjects.drawingDocument);
drawingObjects.OnUpdateOverlay(); drawingObjects.OnUpdateOverlay();
} }
...@@ -3266,7 +3266,7 @@ function ChartTextAddGroup(drawingObjectsController, drawingObjects, group, char ...@@ -3266,7 +3266,7 @@ function ChartTextAddGroup(drawingObjectsController, drawingObjects, group, char
{ {
History.Create_NewPoint(); History.Create_NewPoint();
text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode))); text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText, 0)); drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText));
text_object.updateSelectionState(drawingObjects.drawingDocument); text_object.updateSelectionState(drawingObjects.drawingDocument);
} }
}; };
...@@ -3637,7 +3637,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj ...@@ -3637,7 +3637,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{ {
History.Create_NewPoint(); History.Create_NewPoint();
text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode))); text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText, 0)); drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText));
text_object.updateSelectionState(drawingObjects.drawingDocument); text_object.updateSelectionState(drawingObjects.drawingDocument);
} }
}; };
......
...@@ -4985,12 +4985,14 @@ ...@@ -4985,12 +4985,14 @@
.fillRect(this.headersLeft, y + (dy > 0 && oldH > 0 ? oldH - dy : 0), .fillRect(this.headersLeft, y + (dy > 0 && oldH > 0 ? oldH - dy : 0),
ctxW, ctxH - this.cellsTop - (oldH > 0 ? oldH : 0)); ctxW, ctxH - this.cellsTop - (oldH > 0 ? oldH : 0));
var rangeGraphic = null;
if ( !(dy > 0 && vr.r2 === oldEnd && !oldVRE_isPartial && dx === 0) ) { if ( !(dy > 0 && vr.r2 === oldEnd && !oldVRE_isPartial && dx === 0) ) {
var c1 = vr.c1; var c1 = vr.c1;
var r1 = dy > 0 && oldH > 0 ? oldEnd + (oldVRE_isPartial ? 0 : 1) : vr.r1; var r1 = dy > 0 && oldH > 0 ? oldEnd + (oldVRE_isPartial ? 0 : 1) : vr.r1;
var c2 = vr.c2; var c2 = vr.c2;
var r2 = dy > 0 || oldH <= 0 ? vr.r2 : vr.r1 - 1 - delta; /* delta < 0 here */ var r2 = dy > 0 || oldH <= 0 ? vr.r2 : vr.r1 - 1 - delta; /* delta < 0 here */
var range = asc_Range(c1, r1, c2, r2); var range = asc_Range(c1, r1, c2, r2);
rangeGraphic = range.clone();
// Это необходимо для того, чтобы строки, у которых высота по тексту рассчитались (баг http://bugzserver/show_bug.cgi?id=21552) // Это необходимо для того, чтобы строки, у которых высота по тексту рассчитались (баг http://bugzserver/show_bug.cgi?id=21552)
this._prepareCellTextMetricsCache(range); this._prepareCellTextMetricsCache(range);
if (dx === 0) { if (dx === 0) {
...@@ -5034,7 +5036,7 @@ ...@@ -5034,7 +5036,7 @@
this.cellCommentator.updateCommentPosition(); this.cellCommentator.updateCommentPosition();
//ToDo this.drawDepCells(); //ToDo this.drawDepCells();
this._drawGraphic(); this._drawGraphic();
this.objectRender.showDrawingObjects(false, new GraphicOption(this, c_oAscGraphicOption.ScrollVertical, delta)); this.objectRender.showDrawingObjects(false, new GraphicOption(this, c_oAscGraphicOption.ScrollVertical, rangeGraphic));
return this; return this;
}, },
...@@ -5089,12 +5091,14 @@ ...@@ -5089,12 +5091,14 @@
.fillRect(x + (dx > 0 && oldW > 0 ? oldW - dx : 0), y, .fillRect(x + (dx > 0 && oldW > 0 ? oldW - dx : 0), y,
ctxW - this.cellsLeft - (oldW > 0 ? oldW : 0), ctxH); ctxW - this.cellsLeft - (oldW > 0 ? oldW : 0), ctxH);
var rangeGraphic = null;
if ( !(dx > 0 && vr.c2 === oldEnd && !oldVCE_isPartial) ) { if ( !(dx > 0 && vr.c2 === oldEnd && !oldVCE_isPartial) ) {
var c1 = dx > 0 && oldW > 0 ? oldEnd + (oldVCE_isPartial ? 0 : 1) : vr.c1; var c1 = dx > 0 && oldW > 0 ? oldEnd + (oldVCE_isPartial ? 0 : 1) : vr.c1;
var r1 = vr.r1; var r1 = vr.r1;
var c2 = dx > 0 || oldW <= 0 ? vr.c2 : vr.c1 - 1 - delta; /* delta < 0 here */ var c2 = dx > 0 || oldW <= 0 ? vr.c2 : vr.c1 - 1 - delta; /* delta < 0 here */
var r2 = vr.r2; var r2 = vr.r2;
var range = asc_Range(c1, r1, c2, r2); var range = asc_Range(c1, r1, c2, r2);
rangeGraphic = range.clone();
this._drawColumnHeaders(/*drawingCtx*/ undefined, c1, c2); this._drawColumnHeaders(/*drawingCtx*/ undefined, c1, c2);
this._drawGrid(/*drawingCtx*/ undefined, range); this._drawGrid(/*drawingCtx*/ undefined, range);
this._drawCells(/*drawingCtx*/undefined, range); this._drawCells(/*drawingCtx*/undefined, range);
...@@ -5118,7 +5122,7 @@ ...@@ -5118,7 +5122,7 @@
this.cellCommentator.updateCommentPosition(); this.cellCommentator.updateCommentPosition();
//ToDo this.drawDepCells(); //ToDo this.drawDepCells();
this._drawGraphic(); this._drawGraphic();
this.objectRender.showDrawingObjects(false, new GraphicOption(this, c_oAscGraphicOption.ScrollHorizontal, delta)); this.objectRender.showDrawingObjects(false, new GraphicOption(this, c_oAscGraphicOption.ScrollHorizontal, rangeGraphic));
return this; return this;
}, },
......
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