Commit f8dc55ee authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Bug 26552 - Некорректная отрисовка автофигуры "textbox" при ее повороте

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58978 954022d7-b5bf-4e40-9824-e11837661b57
parent 8c83d2a8
......@@ -398,7 +398,8 @@ function FrozenPlace(ws, type) {
_this.isObjectInside = function(object) {
// TODO Нужно учитывать collOff, rowOff
var objectRange = new asc_Range(object.from.col, object.from.row, object.to.col, object.to.row);
var boundsFromTo = object.boundsFromTo;
var objectRange = new asc_Range(boundsFromTo.from.col, boundsFromTo.from.row, boundsFromTo.to.col, boundsFromTo.to.row);
return _this.range.isIntersect(objectRange);
};
......
......@@ -1365,6 +1365,12 @@ function DrawingObjects() {
this.graphicObject = null; // CImage, CShape, GroupShape or CChartAsGroup
this.boundsFromTo =
{
from: new CCellObjectInfo(),
to : new CCellObjectInfo()
};
this.flags = {
anchorUpdated: false,
lockState: c_oAscLockTypes.kLockTypeNone
......@@ -1534,6 +1540,89 @@ function DrawingObjects() {
}
};
DrawingBase.prototype.checkBoundsFromTo = function() {
var _t = this;
if ( _t.isGraphicObject() && _t.graphicObject.bounds) {
var bounds = _t.graphicObject.bounds;
if ( (bounds.x < 0) || (bounds.y < 0) || (bounds.w < 0) || (bounds.h < 0) )
return;
var fromX = mmToPt(bounds.x), fromY = mmToPt(bounds.y),
toX = mmToPt(bounds.x + bounds.w), toY = mmToPt(bounds.y + bounds.h);
var bReinitHorScroll = false, bReinitVertScroll = false;
var fromColCell = worksheet.findCellByXY(fromX, fromY, true, false, true);
while(fromColCell.col === null && worksheet.cols.length < gc_nMaxCol)
{
worksheet.expandColsOnScroll(true);
fromColCell = worksheet.findCellByXY(fromX, fromY, true, false, true);
bReinitHorScroll = true;
}
if(fromColCell.col === null)
{
fromColCell.col = gc_nMaxCol;
}
var fromRowCell = worksheet.findCellByXY(fromX, fromY, true, true, false);
while(fromRowCell.row === null && worksheet.rows.length < gc_nMaxRow)
{
worksheet.expandRowsOnScroll(true);
fromRowCell = worksheet.findCellByXY(fromX, fromY, true, true, false);
bReinitVertScroll = true;
}
if(fromRowCell.row === null)
{
fromRowCell.row = gc_nMaxRow;
}
var toColCell = worksheet.findCellByXY(toX, toY, true, false, true);
while(toColCell.col === null && worksheet.cols.length < gc_nMaxCol)
{
worksheet.expandColsOnScroll(true);
toColCell = worksheet.findCellByXY(toX, toY, true, false, true);
bReinitHorScroll = true;
}
if(toColCell.col === null)
{
toColCell.col = gc_nMaxCol;
}
var toRowCell = worksheet.findCellByXY(toX, toY, true, true, false);
while(toRowCell.row === null && worksheet.rows.length < gc_nMaxRow)
{
worksheet.expandRowsOnScroll(true);
toRowCell = worksheet.findCellByXY(toX, toY, true, true, false);
bReinitVertScroll = true;
}
if(toRowCell.row === null)
{
toRowCell.row = gc_nMaxRow;
}
_t.boundsFromTo.from.col = fromColCell.col;
_t.boundsFromTo.from.colOff = ptToMm(fromColCell.colOff);
_t.boundsFromTo.from.row = fromRowCell.row;
_t.boundsFromTo.from.rowOff = ptToMm(fromRowCell.rowOff);
_t.boundsFromTo.to.col = toColCell.col;
_t.boundsFromTo.to.colOff = ptToMm(toColCell.colOff);
_t.boundsFromTo.to.row = toRowCell.row;
_t.boundsFromTo.to.rowOff = ptToMm(toRowCell.rowOff);
if(bReinitHorScroll)
{
worksheet.handlers.trigger("reinitializeScrollX");
}
if(bReinitVertScroll)
{
worksheet.handlers.trigger("reinitializeScrollY");
}
}
};
// Проверяет выход за границы
DrawingBase.prototype.inVisibleArea = function(scrollType) {
var _t = this;
......
......@@ -224,6 +224,10 @@ CChartSpace.prototype.recalculateBounds = function()
this.bounds.h = this.bounds.b - this.bounds.t;
this.bounds.x = this.bounds.l;
this.bounds.y = this.bounds.t;
if(this.drawingBase && !this.group)
{
this.drawingBase.checkBoundsFromTo();
}
};
......
......@@ -120,8 +120,6 @@ CGroupShape.prototype.recalculateBounds = function()
y_arr_max.push(b);
y_arr_min.push(t);
}
if(!this.group)
{
var tr = this.localTransform;
......@@ -141,7 +139,6 @@ CGroupShape.prototype.recalculateBounds = function()
y_arr_max = y_arr_max.concat(arr_p_y);
y_arr_min = y_arr_min.concat(arr_p_y);
}
this.bounds.x = Math.min.apply(Math, x_arr_min);
this.bounds.y = Math.min.apply(Math, y_arr_min);
this.bounds.l = this.bounds.x;
......@@ -150,6 +147,10 @@ CGroupShape.prototype.recalculateBounds = function()
this.bounds.b = Math.max.apply(Math, y_arr_max);
this.bounds.w = this.bounds.r - this.bounds.l;
this.bounds.h = this.bounds.b - this.bounds.t;
if(this.drawingBase && !this.group)
{
this.drawingBase.checkBoundsFromTo();
}
};
CGroupShape.prototype.deselect = CShape.prototype.deselect;
......@@ -167,12 +168,14 @@ CGroupShape.prototype.handleUpdatePosition = function()
this.spTree[i].handleUpdatePosition();
}
}
this.recalcBounds();
this.addToRecalculate();
delete this.fromSerialize;
};
CGroupShape.prototype.handleUpdateExtents = function()
{
this.recalcTransform();
this.recalcBounds();
this.addToRecalculate();
delete this.fromSerialize;
};
......
......@@ -365,6 +365,10 @@ CShape.prototype.recalculateBounds = function()
this.bounds.b = boundsChecker.Bounds.max_y;
this.bounds.w = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x;
this.bounds.h = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y;
if(this.drawingBase && !this.group)
{
this.drawingBase.checkBoundsFromTo();
}
};
CShape.prototype.recalculateContent = function()
......
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