Commit 3dac31d9 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin

Bug 26168 - [Conversion] Происходит смещение автофигуры после ее поворота при конвертации в DOCX

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59534 954022d7-b5bf-4e40-9824-e11837661b57
parent 78dbfc23
......@@ -197,6 +197,11 @@ XYAdjustmentTrack.prototype.getBounds = function()
bounds_checker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
bounds_checker.Bounds.max_y = Math.max.apply(Math, arr_p_y);
bounds_checker.Bounds.posX = this.originalShape.x;
bounds_checker.Bounds.posY = this.originalShape.y;
bounds_checker.Bounds.extX = this.originalShape.extY;
bounds_checker.Bounds.extY = this.originalShape.extY;
return bounds_checker.Bounds;
};
......
......@@ -142,6 +142,10 @@ MoveShapeImageTrack.prototype.getBounds = function()
boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.apply(Math, arr_p_y);
boundsChecker.Bounds.posX = this.x;
boundsChecker.Bounds.posY = this.y;
boundsChecker.Bounds.extX = this.originalObject.extX;
boundsChecker.Bounds.extY = this.originalObject.extY;
return boundsChecker.Bounds;
};
......@@ -292,6 +296,10 @@ function MoveGroupTrack(originalObject)
{
this.overlayObjects[i].draw(bounds_checker);
}
bounds_checker.Bounds.posX = this.x;
bounds_checker.Bounds.posY = this.y;
bounds_checker.Bounds.extX = this.originalObject.extX;
bounds_checker.Bounds.extY = this.originalObject.extY;
return bounds_checker.Bounds;
};
......
......@@ -477,6 +477,8 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
}
}
}
shape.x = this.x;
shape.y = this.y;
return shape;
};
......@@ -506,6 +508,10 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.apply(Math, arr_p_y);
boundsChecker.Bounds.posX = this.x;
boundsChecker.Bounds.posY = this.y;
boundsChecker.Bounds.extX = this.extX;
boundsChecker.Bounds.extY = this.extY;
return boundsChecker.Bounds;
}
}
\ No newline at end of file
......@@ -63,39 +63,13 @@ function PolyLine (drawingObjects, theme, master, layout, slide, pageIndex)
{
var boundsChecker = new CSlideBoundsChecker();
this.draw(boundsChecker);
boundsChecker.Bounds.posX = boundsChecker.Bounds.min_x;
boundsChecker.Bounds.posY = boundsChecker.Bounds.min_y;
boundsChecker.Bounds.extX = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x;
boundsChecker.Bounds.extY = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y;
return boundsChecker.Bounds;
};
this.getLeftTopPoint = function()
{
if(this.arrPoint.length < 1)
return {x: 0, y: 0};
var xMax = this.arrPoint[0].x, yMax = this.arrPoint[0].y, xMin = xMax, yMin = yMax;
var i;
for( i = 1; i<this.arrPoint.length; ++i)
{
if(this.arrPoint[i].x > xMax)
{
xMax = this.arrPoint[i].x;
}
if(this.arrPoint[i].y > yMax)
{
yMax = this.arrPoint[i].y;
}
if(this.arrPoint[i].x < xMin)
{
xMin = this.arrPoint[i].x;
}
if(this.arrPoint[i].y < yMin)
{
yMin = this.arrPoint[i].y;
}
}
return {x: xMin, y: yMin};
};
this.getShape = function(bWord, drawingDocument, drawingObjects)
{
......@@ -212,6 +186,8 @@ function PolyLine (drawingObjects, theme, master, layout, slide, pageIndex)
shape.spPr.setGeometry(geometry);
shape.setBDeleted(false);
shape.recalculate();
shape.x = xMin;
shape.y = yMin;
return shape;
}
}
......
......@@ -722,6 +722,11 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.apply(Math, arr_p_y);
boundsChecker.Bounds.posX = this.resizedPosX;
boundsChecker.Bounds.posY = this.resizedPosY;
boundsChecker.Bounds.extX = this.resizedExtX;
boundsChecker.Bounds.extY = this.resizedExtY;
return boundsChecker.Bounds;
};
......@@ -1377,6 +1382,14 @@ function ResizeTrackGroup(originalObject, cardDirection, parentTrack)
boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.apply(Math, arr_p_y);
boundsChecker.Bounds.posX = this.resizedPosX;
boundsChecker.Bounds.posY = this.resizedPosY;
boundsChecker.Bounds.extX = this.resizedExtX;
boundsChecker.Bounds.extY = this.resizedExtY;
return boundsChecker.Bounds;
};
......
......@@ -283,6 +283,11 @@ function RotateTrackShapeImage(originalObject)
boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.apply(Math, arr_p_y);
boundsChecker.Bounds.posX = this.originalObject.x;
boundsChecker.Bounds.posY = this.originalObject.y;
boundsChecker.Bounds.extX = this.originalObject.extX;
boundsChecker.Bounds.extY = this.originalObject.extY;
return boundsChecker.Bounds;
}
}
......@@ -348,6 +353,10 @@ function RotateTrackGroup(originalObject)
boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.apply(Math, arr_p_y);
boundsChecker.Bounds.posX = this.originalObject.x;
boundsChecker.Bounds.posY = this.originalObject.y;
boundsChecker.Bounds.extX = this.originalObject.extX;
boundsChecker.Bounds.extY = this.originalObject.extY;
return boundsChecker.Bounds;
};
......
......@@ -119,51 +119,6 @@ function Spline(drawingObjects, theme, master, layout, slide, pageIndex)
g.ds();
};
this.getLeftTopPoint = function()
{
if(this.path.length < 1)
return {x: 0, y: 0};
var min_x = this.path[0].x;
var max_x = min_x;
var min_y = this.path[0].y;
var max_y = min_y;
var last_x = this.path[0].x, last_y = this.path[0].y;
for(var index = 1; index < this.path.length; ++index)
{
var path_command = this.path[index];
if(path_command.id === 1)
{
if(min_x > path_command.x)
min_x = path_command.x;
if(max_x < path_command.x)
max_x = path_command.x;
if(min_y > path_command.y)
min_y = path_command.y;
if(max_y < path_command.y)
max_y = path_command.y;
}
else
{
var bezier_polygon = partition_bezier4(last_x, last_y, path_command.x1, path_command.y1, path_command.x2, path_command.y2, path_command.x3, path_command.y3, APPROXIMATE_EPSILON);
for(var point_index = 1; point_index < bezier_polygon.length; ++point_index)
{
var cur_point = bezier_polygon[point_index];
if(min_x > cur_point.x)
min_x = cur_point.x;
if(max_x < cur_point.x)
max_x = cur_point.x;
if(min_y > cur_point.y)
min_y = cur_point.y;
if(max_y < cur_point.y)
max_y = cur_point.y;
}
}
}
return {x: min_x, y: min_y};
};
this.getShape = function(bWord, drawingDocument, drawingObjects)
{
var xMax = this.path[0].x, yMax = this.path[0].y, xMin = xMax, yMin = yMax;
......@@ -323,6 +278,8 @@ function Spline(drawingObjects, theme, master, layout, slide, pageIndex)
shape.spPr.setGeometry(geometry);
shape.setBDeleted(false);
shape.recalculate();
shape.x = xMin;
shape.y = yMin;
return shape;
};
......@@ -334,6 +291,10 @@ function Spline(drawingObjects, theme, master, layout, slide, pageIndex)
{
var boundsChecker = new CSlideBoundsChecker();
this.draw(boundsChecker);
boundsChecker.Bounds.posX = boundsChecker.Bounds.min_x;
boundsChecker.Bounds.posY = boundsChecker.Bounds.min_y;
boundsChecker.Bounds.extX = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x;
boundsChecker.Bounds.extY = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y;
return boundsChecker.Bounds;
};
}
......
......@@ -87,7 +87,7 @@ StartAddNewShape.prototype =
History.Create_NewPoint();
var bounds = this.drawingObjects.arrTrackObjects[0].getBounds();
var shape = this.drawingObjects.arrTrackObjects[0].getShape(true, this.drawingObjects.drawingDocument);
var drawing = new ParaDrawing(bounds.max_x - bounds.min_x, bounds.max_y - bounds.min_y, shape, this.drawingObjects.drawingDocument, this.drawingObjects.document, null);
var drawing = new ParaDrawing(shape.spPr.xfrm.extX, shape.spPr.xfrm.extY, shape, this.drawingObjects.drawingDocument, this.drawingObjects.document, null);
var nearest_pos = this.drawingObjects.document.Get_NearestPos(this.pageIndex, bounds.min_x, bounds.min_y, true, drawing);
if(false === editor.isViewMode && nearest_pos && false === this.drawingObjects.document.Document_Is_SelectionLocked(changestype_None, {Type : changestype_2_Element_and_Type , Element : nearest_pos.Paragraph, CheckType : changestype_Paragraph_Content} ) && false === editor.isViewMode)
{
......@@ -99,7 +99,7 @@ StartAddNewShape.prototype =
nearest_pos.Paragraph.Check_NearestPos(nearest_pos);
nearest_pos.Page = this.pageIndex;
drawing.Set_XYForAdd(bounds.min_x, bounds.min_y, nearest_pos, this.pageIndex);
drawing.Set_XYForAdd(shape.x, shape.y, nearest_pos, this.pageIndex);
drawing.Add_ToDocument(nearest_pos, false);
this.drawingObjects.resetSelection();
shape.select(this.drawingObjects, this.pageIndex);
......@@ -429,7 +429,7 @@ ChangeAdjState.prototype =
this.drawingObjects.arrTrackObjects[0].trackEnd();
if(!this.majorObject.parent.Is_Inline())
{
this.majorObject.parent.OnEnd_ChangeFlow(bounds.min_x, bounds.min_y, this.majorObject.parent.pageIndex, bounds.max_x - bounds.min_x, bounds.max_y - bounds.min_y, nearest_pos, true, true);
this.majorObject.parent.OnEnd_ChangeFlow(this.majorObject.x, this.majorObject.y, this.majorObject.parent.pageIndex, this.majorObject.extX, this.majorObject.extY, nearest_pos, true, true);
}
else
{
......@@ -569,10 +569,10 @@ RotateState.prototype =
bounds = arr_bounds[i];
this.drawingObjects.arrTrackObjects[i].trackEnd(true);
var original = this.drawingObjects.arrTrackObjects[i].originalObject;
original.parent.Update_Size(bounds.max_x - bounds.min_x, bounds.max_y - bounds.min_y);
original.parent.Update_Size(bounds.extX, bounds.extY);
arr_nearest_pos[i].Paragraph.Check_NearestPos(arr_nearest_pos[i]);
original.parent.Remove_FromDocument(false);
original.parent.Set_XYForAdd(bounds.min_x, bounds.min_y, arr_nearest_pos[i], original.selectStartPage);
original.parent.Set_XYForAdd(bounds.posX, bounds.posY, arr_nearest_pos[i], original.selectStartPage);
}
if(!(this instanceof RotateState || this instanceof ResizeState))
......@@ -593,7 +593,7 @@ RotateState.prototype =
RelativeFrom: c_oAscRelativeFromH.Page,
UseAlign : false,
Align : undefined,
Value : arr_bounds[i].min_x
Value : arr_bounds[i].posX
},
PositionV:
......@@ -601,7 +601,7 @@ RotateState.prototype =
RelativeFrom: c_oAscRelativeFromV.Page,
UseAlign : false,
Align : undefined,
Value : arr_bounds[i].min_y
Value : arr_bounds[i].posY
}
}));
this.drawingObjects.arrTrackObjects[i].originalObject.parent.Add_ToDocument2(arr_parent_paragraphs[i]);
......@@ -620,7 +620,7 @@ RotateState.prototype =
para_drawing.Set_GraphicObject(this.drawingObjects.arrTrackObjects[i].originalObject.copy());
para_drawing.GraphicObj.setParent(para_drawing);
bounds = arr_bounds[i];
para_drawing.Set_XYForAdd(bounds.min_x, bounds.min_y, arr_nearest_pos[i], pageIndex);
para_drawing.Set_XYForAdd(bounds.posX, bounds.posY, arr_nearest_pos[i], pageIndex);
arr_para_drawings.push(para_drawing);
this.drawingObjects.selectObject(para_drawing.GraphicObj, pageIndex);
}
......@@ -1060,6 +1060,8 @@ MoveInGroupState.prototype =
var bounds = this.group.bounds;
var check_paragraphs = [];
check_paragraphs.push(this.group.parent.Get_ParentParagraph());
var posX = this.group.spPr.xfrm.offX;
var posY = this.group.spPr.xfrm.offY;
this.group.spPr.xfrm.setOffX(0);
this.group.spPr.xfrm.setOffY(0);
if(this.group.parent.Is_Inline())
......@@ -1072,7 +1074,7 @@ MoveInGroupState.prototype =
if(nearest_pos.Paragraph !== check_paragraphs[0])
check_paragraphs.push(nearest_pos.Paragraph);
this.group.parent.OnEnd_ChangeFlow(this.group.parent.X + (bounds.x - old_x), this.group.parent.Y + (bounds.y - old_y), this.group.parent.pageIndex, bounds.w, bounds.h, nearest_pos, true, false);
this.group.parent.OnEnd_ChangeFlow(this.group.posX + posX, this.group.posY + posY, this.group.parent.pageIndex, this.group.spPr.xfrm.extX, this.group.spPr.xfrm.extY, nearest_pos, true, false);
}
if(false === editor.isViewMode && false === this.drawingObjects.document.Document_Is_SelectionLocked(changestype_Drawing_Props, {Type : changestype_2_ElementsArray_and_Type , Elements : check_paragraphs, CheckType : changestype_Paragraph_Content}))
{
......@@ -1326,7 +1328,7 @@ ChangeWrapContour.prototype.onMouseUp = function(e, x, y, pageIndex)
var nearest_pos = this.drawingObjects.document.Get_NearestPos(this.majorObject.selectStartPage, this.majorObject.posX + this.majorObject.bounds.x, this.majorObject.posY + this.majorObject.bounds.y, true, this.majorObject.parent);
nearest_pos.Paragraph.Check_NearestPos(nearest_pos);
this.majorObject.parent.Remove_FromDocument(false);
this.majorObject.parent.Set_XYForAdd(this.majorObject.posX + this.majorObject.bounds.x, this.majorObject.posY + this.majorObject.bounds.y, nearest_pos, this.majorObject.selectStartPage);
this.majorObject.parent.Set_XYForAdd(this.majorObject.posX, this.majorObject.posY, nearest_pos, this.majorObject.selectStartPage);
this.majorObject.parent.Add_ToDocument2(this.majorObject.parent.Get_ParentParagraph());
this.drawingObjects.document.Recalculate();
}
......@@ -1415,7 +1417,7 @@ ChangeWrapContourAddPoint.prototype.onMouseUp = function(e, x, y, pageIndex)
var nearest_pos = this.drawingObjects.document.Get_NearestPos(this.majorObject.selectStartPage, this.majorObject.posX + this.majorObject.bounds.x, this.majorObject.posY + this.majorObject.bounds.y, true, this.majorObject.parent);
nearest_pos.Paragraph.Check_NearestPos(nearest_pos);
this.majorObject.parent.Remove_FromDocument(false);
this.majorObject.parent.Set_XYForAdd(this.majorObject.posX + this.majorObject.bounds.x, this.majorObject.posY + this.majorObject.bounds.y, nearest_pos, this.majorObject.selectStartPage);
this.majorObject.parent.Set_XYForAdd(this.majorObject.posX, this.majorObject.posY, nearest_pos, this.majorObject.selectStartPage);
this.majorObject.parent.Add_ToDocument2(this.majorObject.parent.Get_ParentParagraph());
this.drawingObjects.document.Recalculate();
}
......
......@@ -354,10 +354,10 @@ CGroupShape.prototype.getBoundsPos = function()
for(var i = 0; i < sp_tree.length; ++i)
{
var bounds = sp_tree[i].bounds;
var l = bounds.l;
var r = bounds.r;
var t = bounds.t;
var b = bounds.b;
var l = sp_tree[i].x;
var r = sp_tree[i].x + sp_tree[i].extX;
var t = sp_tree[i].y;
var b = sp_tree[i].y + sp_tree[i].extY;
x_arr_max.push(r);
x_arr_min.push(l);
y_arr_max.push(b);
......@@ -367,3 +367,21 @@ CGroupShape.prototype.getBoundsPos = function()
};
CGroupShape.prototype.getAbsolutePos = function()
{
var sp_tree = this.spTree;
var x_arr_max = [], y_arr_max = [], x_arr_min = [], y_arr_min = [];
for(var i = 0; i < sp_tree.length; ++i)
{
var bounds = sp_tree[i].bounds;
var l = sp_tree[i].x;
var r = sp_tree[i].x + sp_tree[i].extX;
var t = sp_tree[i].y;
var b = sp_tree[i].y + sp_tree[i].extY;
x_arr_max.push(r);
x_arr_min.push(l);
y_arr_max.push(b);
y_arr_min.push(t);
}
return {x: Math.min.apply(Math, x_arr_min), y: Math.min.apply(Math, y_arr_min)};
};
......@@ -460,7 +460,7 @@ CGraphicObjects.prototype =
var a_objects = [], nearest_pos;
for(i = 0; i < this.selectedObjects.length; ++i)
{
nearest_pos = this.document.Get_NearestPos(this.selectedObjects[i].parent.PageNum, this.selectedObjects[i].bounds.x + this.selectedObjects[i].posX, this.selectedObjects[i].bounds.y + this.selectedObjects[i].posY, true, this.selectedObjects[i].parent);
nearest_pos = this.document.Get_NearestPos(this.selectedObjects[i].parent.PageNum, this.selectedObjects[i].posX, this.selectedObjects[i].posY, true, this.selectedObjects[i].parent);
a_objects.push(
{
nearestPos: nearest_pos,
......@@ -473,7 +473,7 @@ CGraphicObjects.prototype =
{
a_objects[i].nearestPos.Paragraph.Check_NearestPos(a_objects[i].nearestPos);
this.selectedObjects[i].parent.Remove_FromDocument(false);
this.selectedObjects[i].parent.Set_XYForAdd(this.selectedObjects[i].bounds.x + this.selectedObjects[i].posX, this.selectedObjects[i].bounds.y + this.selectedObjects[i].posY, a_objects[i].nearestPos, a_objects[i].pageNum);
this.selectedObjects[i].parent.Set_XYForAdd(this.selectedObjects[i].posX, this.selectedObjects[i].posY, a_objects[i].nearestPos, a_objects[i].pageNum);
}
for(i = 0; i < a_objects.length; ++i)
{
......@@ -588,7 +588,12 @@ CGraphicObjects.prototype =
chart_space.spPr.xfrm.setOffY(this.selection.groupSelection.selectedObjects[0].spPr.xfrm.offY);
parent_group.addToSpTree(i, chart_space);
parent_group.updateCoordinatesAfterInternalResize();
//TODO: возможно следует нормализовать самую старшую группу
major_group.recalculate();
if(major_group.spPr && major_group.spPr.xfrm)
{
}
if(major_group.parent.Is_Inline())
{
major_group.parent.OnEnd_ResizeInline(major_group.bounds.w, major_group.bounds.h);
......@@ -599,7 +604,7 @@ CGraphicObjects.prototype =
nearest_pos = this.document.Get_NearestPos(major_group.selectStartPage,major_group.posX + major_group.bounds.x, major_group.posY + major_group.bounds.y, true, major_group.parent);
nearest_pos.Paragraph.Check_NearestPos(nearest_pos);
major_group.parent.Remove_FromDocument(false);
major_group.parent.Set_XYForAdd(major_group.posX + major_group.bounds.x,major_group.posY + major_group.bounds.y, nearest_pos, major_group.selectStartPage);
major_group.parent.Set_XYForAdd(major_group.posX,major_group.posY, nearest_pos, major_group.selectStartPage);
major_group.parent.Add_ToDocument2(parent_paragraph);
}
select_start_page = this.selection.groupSelection.selectedObjects[0].selectStartPage;
......@@ -1035,6 +1040,7 @@ CGraphicObjects.prototype =
selectedObjects[i].recalculate();
drawing = new ParaDrawing(0, 0, selectedObjects[i].copy(), this.document.DrawingDocument, this.document, null);
drawing.Set_DrawingType(groupParaDrawing.DrawingType);
drawing.GraphicObj.setParent(drawing);
drawing.Update_Size(selectedObjects[i].bounds.w, selectedObjects[i].bounds.h);
if(groupParaDrawing.DrawingType === drawing_Anchor)
{
......@@ -1056,6 +1062,7 @@ CGraphicObjects.prototype =
run = new ParaRun(para, false);
selectedObjects[i].recalculate();
drawing = new ParaDrawing(0, 0, selectedObjects[i].copy(), this.document.DrawingDocument, this.document, null);
drawing.Set_DrawingType(selectedObjects[i].parent.DrawingType);
drawing.GraphicObj.setParent(drawing);
drawing.Update_Size(selectedObjects[i].bounds.w, selectedObjects[i].bounds.h);
......@@ -1063,6 +1070,10 @@ CGraphicObjects.prototype =
{
drawing.Set_Distance(selectedObjects[i].parent.Distance.L, selectedObjects[i].parent.Distance.T, selectedObjects[i].parent.Distance.R, selectedObjects[i].parent.Distance.B);
drawing.Set_WrappingType(selectedObjects[i].parent.wrappingType);
if(selectedObjects[i].parent.wrappingPolygon && drawing.wrappingPolygon)
{
drawing.wrappingPolygon.fromOther(selectedObjects[i].parent.wrappingPolygon);
}
drawing.Set_BehindDoc(selectedObjects[i].parent.behindDoc);
drawing.Set_PositionH(selectedObjects[i].parent.PositionH.RelativeFrom, selectedObjects[i].parent.PositionH.Align, selectedObjects[i].parent.PositionH.Value + selectedObjects[i].bounds.x);
drawing.Set_PositionV(selectedObjects[i].parent.PositionV.RelativeFrom, selectedObjects[i].parent.PositionV.Align, selectedObjects[i].parent.PositionV.Value + selectedObjects[i].bounds.y);
......@@ -1741,11 +1752,24 @@ CGraphicObjects.prototype =
var x_arr_max = [], y_arr_max = [];
for(var i = 0; i < arrDrawings.length; ++i)
{
var bounds = arrDrawings[i].bounds;
l = bounds.l + arrDrawings[i].posX;
r = bounds.r + arrDrawings[i].posX;
t = bounds.t + arrDrawings[i].posY;
b = bounds.b + arrDrawings[i].posY;
var rot = normalizeRotate(isRealNumber(arrDrawings[i].rot) ? arrDrawings[i].rot : 0);
if ((rot >= 0 && rot < Math.PI * 0.25)
|| (rot > 3 * Math.PI * 0.25 && rot < 5 * Math.PI * 0.25)
|| (rot > 7 * Math.PI * 0.25 && rot < 2 * Math.PI))
{
l = arrDrawings[i].posX;
r = arrDrawings[i].extX + arrDrawings[i].posX;
t = arrDrawings[i].posY;
b = arrDrawings[i].extY + arrDrawings[i].posY;
}
else
{
l = arrDrawings[i].posX + arrDrawings[i].extX/2 - arrDrawings[i].extY/2;
r = arrDrawings[i].posX + arrDrawings[i].extX/2 + arrDrawings[i].extY/2;
t = arrDrawings[i].posY + arrDrawings[i].extY/2 - arrDrawings[i].extX/2;
b = arrDrawings[i].extY + arrDrawings[i].extY/2 + arrDrawings[i].extX/2;
}
x_arr_max.push(r);
x_arr_min.push(l);
y_arr_max.push(b);
......@@ -1854,7 +1878,7 @@ CGraphicObjects.prototype =
sp.setParent(drawing);
drawing.Set_DrawingType(drawing_Anchor);
drawing.Set_WrappingType(cur_group.parent.wrappingType);
drawing.Update_Size(sp.bounds.w, sp.bounds.h);
drawing.Update_Size(sp.extX, sp.extY);
sp.spPr.xfrm.setRot(normalizeRotate(sp.rot + cur_group.rot));
sp.spPr.xfrm.setOffX(0);
sp.spPr.xfrm.setOffY(0);
......@@ -1863,9 +1887,14 @@ CGraphicObjects.prototype =
sp.setGroup(null);
nearest_pos = this.document.Get_NearestPos(page_num, sp.bounds.x + sp.posX, sp.bounds.y + sp.posY, true, drawing);
nearest_pos.Paragraph.Check_NearestPos(nearest_pos);
drawing.Set_XYForAdd(sp.bounds.x + sp.posX, sp.bounds.y + sp.posY, nearest_pos, page_num);
var posX, posY, xc, yc, hc = sp.extX/2, vc = sp.extY/2;
xc = sp.transform.TransformPointX(hc, vc);
yc = sp.transform.TransformPointY(hc, vc);
drawing.Set_XYForAdd(xc - hc, yc - vc, nearest_pos, page_num);
//drawing.Add_ToDocument2(parent_paragraph);
a_objects.push({drawing: drawing, par: parent_paragraph});
a_objects.push({drawing: drawing, par: parent_paragraph, posX: xc - hc, posY: yc - vc});
this.selectObject(sp, page_num);
}
cur_group.parent.Remove_FromDocument(false);
......@@ -1879,7 +1908,7 @@ CGraphicObjects.prototype =
RelativeFrom: c_oAscRelativeFromH.Page,
UseAlign : false,
Align : undefined,
Value : a_objects[i].drawing.GraphicObj.bounds.x + a_objects[i].drawing.GraphicObj.posX
Value : a_objects[i].posX
},
PositionV:
......@@ -1887,7 +1916,7 @@ CGraphicObjects.prototype =
RelativeFrom: c_oAscRelativeFromV.Page,
UseAlign : false,
Align : undefined,
Value : a_objects[i].drawing.GraphicObj.bounds.y + a_objects[i].drawing.GraphicObj.posY
Value : a_objects[i].posY
}
}));
a_objects[i].drawing.Add_ToDocument2(a_objects[i].par);
......@@ -2088,8 +2117,8 @@ CGraphicObjects.prototype =
var new_x, new_y;
var deltaX, deltaY;
deltaX = sp.localTransform.tx - sp.bounds.x;
deltaY = sp.localTransform.ty - sp.bounds.y;
deltaX = 0;//sp.localTransform.tx - sp.bounds.x;
deltaY = 0;//sp.localTransform.ty - sp.bounds.y;
new_x = sp.transform.tx - deltaX;
new_y = sp.transform.ty - deltaY;
sp.recalcBounds();
......@@ -2104,13 +2133,17 @@ CGraphicObjects.prototype =
}
else
{
this.resetInternalSelection();
var new_x, new_y;
var pos = cur_group.getBoundsPos();
new_x = cur_group.x + pos.x;
new_y = cur_group.y + pos.y;
// var pos = cur_group.getBoundsPos();
cur_group.updateCoordinatesAfterInternalResize();
new_x = cur_group.x + cur_group.spPr.xfrm.offX;
new_y = cur_group.y + cur_group.spPr.xfrm.offY;
cur_group.spPr.xfrm.setOffX(0);
cur_group.spPr.xfrm.setOffY(0);
var nearest_pos = this.document.Get_NearestPos(cur_group.selectStartPage, new_x, new_y, true, para_drawing);
nearest_pos.Paragraph.Check_NearestPos(nearest_pos);
para_drawing.Remove_FromDocument(false);
......
......@@ -4436,8 +4436,8 @@ ParaDrawing.prototype =
this.setPageIndex(pageIndex);
if(typeof this.GraphicObj.setStartPage === "function")
this.GraphicObj.setStartPage(pageIndex, this.DocumentContent && this.DocumentContent.Is_HdrFtr());
var _x = !this.PositionH.Align ? x - this.GraphicObj.bounds.x : x;
var _y = !this.PositionV.Align ? y - this.GraphicObj.bounds.y : y;
var _x = this.PositionH.Align ? x - this.GraphicObj.bounds.x : x;
var _y = this.PositionV.Align ? y - this.GraphicObj.bounds.y : y;
this.graphicObjects.addObjectOnPage(pageIndex, this.GraphicObj);
this.selectX = x;
this.selectY = y;
......@@ -5464,11 +5464,12 @@ ParaDrawing.prototype =
}
case historyitem_SetWrapPolygon:
{
Writer.WriteBool(Data.newW !== null && typeof Data.newW === "object");
if(Data.newW !== null && typeof Data.newW === "object")
{
Writer.WriteString2(Data.newW);
}
writeObject(Writer, Data.newW);
// Writer.WriteBool(Data.newW !== null && typeof Data.newW === "object");
// if(Data.newW !== null && typeof Data.newW === "object")
// {
// Writer.WriteString2(Data.newW);
// }
break;
}
}
......@@ -5644,14 +5645,7 @@ ParaDrawing.prototype =
}
case historyitem_SetWrapPolygon:
{
if(Reader.GetBool())
{
this.wrappingPolygon = g_oTableId.Get_ById(Reader.GetString2());
}
else
{
this.wrappingPolygon = null;
}
this.wrappingPolygon = readObject(Reader);
break;
}
}
......@@ -6509,7 +6503,7 @@ ParaDrawing.prototype =
addWrapPolygon: function(wrapPolygon)
{
History.Add(this, {Type: historyitem_SetExtent, oldW: this.wrappingPolygon, newW: wrapPolygon});
History.Add(this, {Type: historyitem_SetWrapPolygon, oldW: this.wrappingPolygon, newW: wrapPolygon});
this.wrappingPolygon = wrapPolygon;
},
......
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