Commit ca2d8615 authored by SergeyLuzyanin's avatar SergeyLuzyanin

fix Bug 32439 - Надпись и текст-арт значительно смещаются вправо при вставке...

fix Bug 32439 - Надпись и текст-арт значительно смещаются вправо при вставке строки перед ними в XLSX книге
parent b909eb0e
......@@ -10264,6 +10264,7 @@
var fullRecalc = false;
var reinitRanges = false;
var updateDrawingObjectsInfo = null;
var updateDrawingObjectsInfo2 = null;//{bInsert: false, operType: c_oAscInsertOptions.InsertColumns, updateRange: arn}
var cw;
var isUpdateCols = false, isUpdateRows = false;
var isCheckChangeAutoFilter;
......@@ -10284,13 +10285,19 @@
}
t._cleanCellsTextMetricsCache();
t._prepareCellTextMetricsCache();
if ( reinitRanges && t.objectRender && t.objectRender.drawingArea ) {
t.objectRender.drawingArea.reinitRanges();
}
if ( null !== updateDrawingObjectsInfo && t.objectRender ) {
t.objectRender.updateSizeDrawingObjects( updateDrawingObjectsInfo );
if(t.objectRender) {
if ( reinitRanges && t.objectRender.drawingArea ) {
t.objectRender.drawingArea.reinitRanges();
}
if ( null !== updateDrawingObjectsInfo) {
t.objectRender.updateSizeDrawingObjects( updateDrawingObjectsInfo );
}
if ( null !== updateDrawingObjectsInfo2 ) {
t.objectRender.updateDrawingObject(updateDrawingObjectsInfo2.bInsert, updateDrawingObjectsInfo2.operType, updateDrawingObjectsInfo2.updateRange);
}
t.objectRender.rebuildChartGraphicObjects( oChangeData );
}
t.objectRender.rebuildChartGraphicObjects( oChangeData );
t.draw( lockDraw );
t.handlers.trigger( "reinitializeScroll" );
......@@ -10388,7 +10395,7 @@
fullRecalc = true;
reinitRanges = true;
t.cellCommentator.updateCommentsDependencies( true, val, arn );
t.objectRender.updateDrawingObject( true, val, arn );
updateDrawingObjectsInfo2 = {bInsert: true, operType: val, updateRange: arn};
}
History.EndTransaction();
};
......@@ -10409,7 +10416,7 @@
fullRecalc = true;
reinitRanges = true;
t.cellCommentator.updateCommentsDependencies( true, val, arn );
t.objectRender.updateDrawingObject( true, val, arn );
updateDrawingObjectsInfo2 = {bInsert: true, operType: val, updateRange: arn};
}
History.EndTransaction();
};
......@@ -10430,7 +10437,7 @@
fullRecalc = true;
reinitRanges = true;
t.model.insertColsBefore( arn.c1, arn.c2 - arn.c1 + 1 );
t.objectRender.updateDrawingObject( true, val, arn );
updateDrawingObjectsInfo2 = {bInsert: true, operType: val, updateRange: arn};
t.cellCommentator.updateCommentsDependencies( true, val, arn );
History.EndTransaction();
};
......@@ -10443,7 +10450,7 @@
fullRecalc = true;
reinitRanges = true;
t.model.insertRowsBefore( arn.r1, arn.r2 - arn.r1 + 1 );
t.objectRender.updateDrawingObject( true, val, arn );
updateDrawingObjectsInfo2 = {bInsert: true, operType: val, updateRange: arn};
t.cellCommentator.updateCommentsDependencies( true, val, arn );
};
......@@ -10471,7 +10478,7 @@
t._cleanCache( oChangeData.changedRange );
t.cellCommentator.updateCommentsDependencies( false, val, checkRange );
} ) ) {
t.objectRender.updateDrawingObject( false, val, checkRange );
updateDrawingObjectsInfo2 = {bInsert: false, operType: val, updateRange: arn};
}
History.EndTransaction();
reinitRanges = true;
......@@ -10496,7 +10503,7 @@
t._cleanCache( oChangeData.changedRange );
t.cellCommentator.updateCommentsDependencies( false, val, checkRange );
} ) ) {
t.objectRender.updateDrawingObject( false, val, checkRange );
updateDrawingObjectsInfo2 = {bInsert: false, operType: val, updateRange: arn};
}
History.EndTransaction();
......@@ -10520,7 +10527,7 @@
t.cellCommentator.updateCommentsDependencies( false, val, checkRange );
t.model.autoFilters.isEmptyAutoFilters( arn, c_oAscDeleteOptions.DeleteColumns );
t.model.removeCols( checkRange.c1, checkRange.c2 );
t.objectRender.updateDrawingObject( false, val, checkRange );
updateDrawingObjectsInfo2 = {bInsert: false, operType: val, updateRange: arn};
History.EndTransaction();
};
......@@ -10541,7 +10548,7 @@
t.cellCommentator.updateCommentsDependencies( false, val, checkRange );
t.model.autoFilters.isEmptyAutoFilters( arn, c_oAscDeleteOptions.DeleteRows );
t.model.removeRows( checkRange.r1, checkRange.r2 );
t.objectRender.updateDrawingObject( false, val, checkRange );
updateDrawingObjectsInfo2 = {bInsert: false, operType: val, updateRange: arn};
History.EndTransaction();
};
......@@ -12839,8 +12846,8 @@
var rangeButton = Asc.Range(autoFilter.Ref.c1 + colId, autoFilter.Ref.r1, autoFilter.Ref.c1 + colId, autoFilter.Ref.r1);
var cellId = ws.autoFilters._rangeToId(rangeButton);
var cellCoord = this.getCellCoord(autoFilter.Ref.c1 + colId, autoFilter.Ref.r1);
var cellCoord = this.getCellCoord(autoFilter.Ref.c1 + colId, autoFilter.Ref.r1);
//get filter object
var filterObj = new Asc.AutoFilterObj();
......
......@@ -2772,6 +2772,80 @@ function DrawingObjects() {
bNeedRedraw && _this.showDrawingObjects(true);
};
_this.updateSizeDrawingObjects = function(target, bNoChangeCoords) {
if(!History.Is_On() || true === bNoChangeCoords){
if (target.target === AscCommonExcel.c_oTargetType.RowResize) {
for (i = 0; i < aObjects.length; i++) {
drawingObject = aObjects[i];
if (drawingObject.from.row >= target.row) {
drawingObject.checkBoundsFromTo();
}
}
} else {
for (i = 0; i < aObjects.length; i++) {
drawingObject = aObjects[i];
if (drawingObject.from.col >= target.col) {
drawingObject.checkBoundsFromTo();
}
}
}
return;
}
var i, bNeedRecalc = false, drawingObject, coords;
if (target.target === AscCommonExcel.c_oTargetType.RowResize) {
for (i = 0; i < aObjects.length; i++) {
drawingObject = aObjects[i];
if (drawingObject.from.row >= target.row) {
coords = _this.coordsManager.calculateCoords(drawingObject.from);
AscFormat.CheckSpPrXfrm(drawingObject.graphicObject);
var rot = AscFormat.isRealNumber(drawingObject.graphicObject.spPr.xfrm.rot) ? drawingObject.graphicObject.spPr.xfrm.rot : 0;
rot = AscFormat.normalizeRotate(rot);
if (AscFormat.checkNormalRotate(rot)) {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x));
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y));
} else {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x) - drawingObject.graphicObject.spPr.xfrm.extX / 2 + drawingObject.graphicObject.spPr.xfrm.extY / 2);
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y) - drawingObject.graphicObject.spPr.xfrm.extY / 2 + drawingObject.graphicObject.spPr.xfrm.extX / 2);
}
drawingObject.graphicObject.checkDrawingBaseCoords();
bNeedRecalc = true;
}
}
} else {
for (i = 0; i < aObjects.length; i++) {
drawingObject = aObjects[i];
if (drawingObject.from.col >= target.col) {
coords = _this.coordsManager.calculateCoords(drawingObject.from);
AscFormat.CheckSpPrXfrm(drawingObject.graphicObject);
var rot = AscFormat.isRealNumber(drawingObject.graphicObject.spPr.xfrm.rot) ? drawingObject.graphicObject.spPr.xfrm.rot : 0;
rot = AscFormat.normalizeRotate(rot);
if (AscFormat.checkNormalRotate(rot)) {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x));
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y));
} else {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x) - drawingObject.graphicObject.spPr.xfrm.extX / 2 + drawingObject.graphicObject.spPr.xfrm.extY / 2);
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y) - drawingObject.graphicObject.spPr.xfrm.extY / 2 + drawingObject.graphicObject.spPr.xfrm.extX / 2);
}
drawingObject.graphicObject.checkDrawingBaseCoords();
bNeedRecalc = true;
}
}
}
if (bNeedRecalc) {
_this.controller.recalculate2();
_this.showDrawingObjects(true);
}
};
_this.moveRangeDrawingObject = function(oBBoxFrom, oBBoxTo) {
if ( oBBoxFrom && oBBoxTo )
......@@ -3508,78 +3582,6 @@ function DrawingObjects() {
}
};
_this.updateSizeDrawingObjects = function(target, bNoChangeCoords) {
if(!History.Is_On() || true === bNoChangeCoords){
if (target.target === AscCommonExcel.c_oTargetType.RowResize) {
for (i = 0; i < aObjects.length; i++) {
drawingObject = aObjects[i];
if (drawingObject.from.row >= target.row) {
drawingObject.checkBoundsFromTo();
}
}
} else {
for (i = 0; i < aObjects.length; i++) {
drawingObject = aObjects[i];
if (drawingObject.from.col >= target.col) {
drawingObject.checkBoundsFromTo();
}
}
}
return;
}
var i, bNeedRecalc = false, drawingObject, coords;
if (target.target === AscCommonExcel.c_oTargetType.RowResize) {
for (i = 0; i < aObjects.length; i++) {
drawingObject = aObjects[i];
if (drawingObject.from.row >= target.row) {
coords = _this.coordsManager.calculateCoords(drawingObject.from);
AscFormat.CheckSpPrXfrm(drawingObject.graphicObject);
var rot = AscFormat.isRealNumber(drawingObject.graphicObject.spPr.xfrm.rot) ? drawingObject.graphicObject.spPr.xfrm.rot : 0;
rot = AscFormat.normalizeRotate(rot);
if (AscFormat.checkNormalRotate(rot)) {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x));
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y));
} else {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x) - drawingObject.graphicObject.spPr.xfrm.extX / 2 + drawingObject.graphicObject.spPr.xfrm.extY / 2);
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y) - drawingObject.graphicObject.spPr.xfrm.extY / 2 + drawingObject.graphicObject.spPr.xfrm.extX / 2);
}
drawingObject.graphicObject.checkDrawingBaseCoords();
bNeedRecalc = true;
}
}
} else {
for (i = 0; i < aObjects.length; i++) {
drawingObject = aObjects[i];
if (drawingObject.from.col >= target.col) {
coords = _this.coordsManager.calculateCoords(drawingObject.from);
AscFormat.CheckSpPrXfrm(drawingObject.graphicObject);
var rot = AscFormat.isRealNumber(drawingObject.graphicObject.spPr.xfrm.rot) ? drawingObject.graphicObject.spPr.xfrm.rot : 0;
rot = AscFormat.normalizeRotate(rot);
if (AscFormat.checkNormalRotate(rot)) {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x));
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y));
} else {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x) - drawingObject.graphicObject.spPr.xfrm.extX / 2 + drawingObject.graphicObject.spPr.xfrm.extY / 2);
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y) - drawingObject.graphicObject.spPr.xfrm.extY / 2 + drawingObject.graphicObject.spPr.xfrm.extX / 2);
}
drawingObject.graphicObject.checkDrawingBaseCoords();
bNeedRecalc = true;
}
}
}
if (bNeedRecalc) {
_this.controller.recalculate2();
_this.showDrawingObjects(true);
}
};
_this.checkCursorDrawingObject = function(x, y) {
var offsets = _this.drawingArea.getOffsets(x, y);
......
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