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

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 c3d9abb4
...@@ -197,6 +197,11 @@ XYAdjustmentTrack.prototype.getBounds = function() ...@@ -197,6 +197,11 @@ XYAdjustmentTrack.prototype.getBounds = function()
bounds_checker.Bounds.min_y = Math.min.apply(Math, arr_p_y); 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.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; return bounds_checker.Bounds;
}; };
......
...@@ -142,6 +142,10 @@ MoveShapeImageTrack.prototype.getBounds = function() ...@@ -142,6 +142,10 @@ MoveShapeImageTrack.prototype.getBounds = function()
boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x); boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y); boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.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; return boundsChecker.Bounds;
}; };
...@@ -292,6 +296,10 @@ function MoveGroupTrack(originalObject) ...@@ -292,6 +296,10 @@ function MoveGroupTrack(originalObject)
{ {
this.overlayObjects[i].draw(bounds_checker); 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; return bounds_checker.Bounds;
}; };
......
...@@ -477,6 +477,8 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide, ...@@ -477,6 +477,8 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
} }
} }
} }
shape.x = this.x;
shape.y = this.y;
return shape; return shape;
}; };
...@@ -506,6 +508,10 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide, ...@@ -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.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y); boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.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; return boundsChecker.Bounds;
} }
} }
\ No newline at end of file
...@@ -63,39 +63,13 @@ function PolyLine (drawingObjects, theme, master, layout, slide, pageIndex) ...@@ -63,39 +63,13 @@ function PolyLine (drawingObjects, theme, master, layout, slide, pageIndex)
{ {
var boundsChecker = new CSlideBoundsChecker(); var boundsChecker = new CSlideBoundsChecker();
this.draw(boundsChecker); 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; 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) this.getShape = function(bWord, drawingDocument, drawingObjects)
{ {
...@@ -212,6 +186,8 @@ function PolyLine (drawingObjects, theme, master, layout, slide, pageIndex) ...@@ -212,6 +186,8 @@ function PolyLine (drawingObjects, theme, master, layout, slide, pageIndex)
shape.spPr.setGeometry(geometry); shape.spPr.setGeometry(geometry);
shape.setBDeleted(false); shape.setBDeleted(false);
shape.recalculate(); shape.recalculate();
shape.x = xMin;
shape.y = yMin;
return shape; return shape;
} }
} }
......
...@@ -722,6 +722,11 @@ function ResizeTrackShapeImage(originalObject, cardDirection) ...@@ -722,6 +722,11 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x); boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y); boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.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; return boundsChecker.Bounds;
}; };
...@@ -1377,6 +1382,14 @@ function ResizeTrackGroup(originalObject, cardDirection, parentTrack) ...@@ -1377,6 +1382,14 @@ function ResizeTrackGroup(originalObject, cardDirection, parentTrack)
boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x); boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y); boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.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; return boundsChecker.Bounds;
}; };
......
...@@ -283,6 +283,11 @@ function RotateTrackShapeImage(originalObject) ...@@ -283,6 +283,11 @@ function RotateTrackShapeImage(originalObject)
boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x); boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y); boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.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; return boundsChecker.Bounds;
} }
} }
...@@ -348,6 +353,10 @@ function RotateTrackGroup(originalObject) ...@@ -348,6 +353,10 @@ function RotateTrackGroup(originalObject)
boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x); boundsChecker.Bounds.max_x = Math.max.apply(Math, arr_p_x);
boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y); boundsChecker.Bounds.min_y = Math.min.apply(Math, arr_p_y);
boundsChecker.Bounds.max_y = Math.max.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; return boundsChecker.Bounds;
}; };
......
...@@ -119,51 +119,6 @@ function Spline(drawingObjects, theme, master, layout, slide, pageIndex) ...@@ -119,51 +119,6 @@ function Spline(drawingObjects, theme, master, layout, slide, pageIndex)
g.ds(); 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) this.getShape = function(bWord, drawingDocument, drawingObjects)
{ {
var xMax = this.path[0].x, yMax = this.path[0].y, xMin = xMax, yMin = yMax; 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) ...@@ -323,6 +278,8 @@ function Spline(drawingObjects, theme, master, layout, slide, pageIndex)
shape.spPr.setGeometry(geometry); shape.spPr.setGeometry(geometry);
shape.setBDeleted(false); shape.setBDeleted(false);
shape.recalculate(); shape.recalculate();
shape.x = xMin;
shape.y = yMin;
return shape; return shape;
}; };
...@@ -334,6 +291,10 @@ function Spline(drawingObjects, theme, master, layout, slide, pageIndex) ...@@ -334,6 +291,10 @@ function Spline(drawingObjects, theme, master, layout, slide, pageIndex)
{ {
var boundsChecker = new CSlideBoundsChecker(); var boundsChecker = new CSlideBoundsChecker();
this.draw(boundsChecker); 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; return boundsChecker.Bounds;
}; };
} }
......
...@@ -87,7 +87,7 @@ StartAddNewShape.prototype = ...@@ -87,7 +87,7 @@ StartAddNewShape.prototype =
History.Create_NewPoint(); History.Create_NewPoint();
var bounds = this.drawingObjects.arrTrackObjects[0].getBounds(); var bounds = this.drawingObjects.arrTrackObjects[0].getBounds();
var shape = this.drawingObjects.arrTrackObjects[0].getShape(true, this.drawingObjects.drawingDocument); 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); 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) 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 = ...@@ -99,7 +99,7 @@ StartAddNewShape.prototype =
nearest_pos.Paragraph.Check_NearestPos(nearest_pos); nearest_pos.Paragraph.Check_NearestPos(nearest_pos);
nearest_pos.Page = this.pageIndex; 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); drawing.Add_ToDocument(nearest_pos, false);
this.drawingObjects.resetSelection(); this.drawingObjects.resetSelection();
shape.select(this.drawingObjects, this.pageIndex); shape.select(this.drawingObjects, this.pageIndex);
...@@ -429,7 +429,7 @@ ChangeAdjState.prototype = ...@@ -429,7 +429,7 @@ ChangeAdjState.prototype =
this.drawingObjects.arrTrackObjects[0].trackEnd(); this.drawingObjects.arrTrackObjects[0].trackEnd();
if(!this.majorObject.parent.Is_Inline()) 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 else
{ {
...@@ -569,10 +569,10 @@ RotateState.prototype = ...@@ -569,10 +569,10 @@ RotateState.prototype =
bounds = arr_bounds[i]; bounds = arr_bounds[i];
this.drawingObjects.arrTrackObjects[i].trackEnd(true); this.drawingObjects.arrTrackObjects[i].trackEnd(true);
var original = this.drawingObjects.arrTrackObjects[i].originalObject; 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]); arr_nearest_pos[i].Paragraph.Check_NearestPos(arr_nearest_pos[i]);
original.parent.Remove_FromDocument(false); 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)) if(!(this instanceof RotateState || this instanceof ResizeState))
...@@ -593,7 +593,7 @@ RotateState.prototype = ...@@ -593,7 +593,7 @@ RotateState.prototype =
RelativeFrom: c_oAscRelativeFromH.Page, RelativeFrom: c_oAscRelativeFromH.Page,
UseAlign : false, UseAlign : false,
Align : undefined, Align : undefined,
Value : arr_bounds[i].min_x Value : arr_bounds[i].posX
}, },
PositionV: PositionV:
...@@ -601,7 +601,7 @@ RotateState.prototype = ...@@ -601,7 +601,7 @@ RotateState.prototype =
RelativeFrom: c_oAscRelativeFromV.Page, RelativeFrom: c_oAscRelativeFromV.Page,
UseAlign : false, UseAlign : false,
Align : undefined, 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]); this.drawingObjects.arrTrackObjects[i].originalObject.parent.Add_ToDocument2(arr_parent_paragraphs[i]);
...@@ -620,7 +620,7 @@ RotateState.prototype = ...@@ -620,7 +620,7 @@ RotateState.prototype =
para_drawing.Set_GraphicObject(this.drawingObjects.arrTrackObjects[i].originalObject.copy()); para_drawing.Set_GraphicObject(this.drawingObjects.arrTrackObjects[i].originalObject.copy());
para_drawing.GraphicObj.setParent(para_drawing); para_drawing.GraphicObj.setParent(para_drawing);
bounds = arr_bounds[i]; 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); arr_para_drawings.push(para_drawing);
this.drawingObjects.selectObject(para_drawing.GraphicObj, pageIndex); this.drawingObjects.selectObject(para_drawing.GraphicObj, pageIndex);
} }
...@@ -1060,6 +1060,8 @@ MoveInGroupState.prototype = ...@@ -1060,6 +1060,8 @@ MoveInGroupState.prototype =
var bounds = this.group.bounds; var bounds = this.group.bounds;
var check_paragraphs = []; var check_paragraphs = [];
check_paragraphs.push(this.group.parent.Get_ParentParagraph()); 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.setOffX(0);
this.group.spPr.xfrm.setOffY(0); this.group.spPr.xfrm.setOffY(0);
if(this.group.parent.Is_Inline()) if(this.group.parent.Is_Inline())
...@@ -1072,7 +1074,7 @@ MoveInGroupState.prototype = ...@@ -1072,7 +1074,7 @@ MoveInGroupState.prototype =
if(nearest_pos.Paragraph !== check_paragraphs[0]) if(nearest_pos.Paragraph !== check_paragraphs[0])
check_paragraphs.push(nearest_pos.Paragraph); 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})) 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) ...@@ -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); 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); nearest_pos.Paragraph.Check_NearestPos(nearest_pos);
this.majorObject.parent.Remove_FromDocument(false); 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.majorObject.parent.Add_ToDocument2(this.majorObject.parent.Get_ParentParagraph());
this.drawingObjects.document.Recalculate(); this.drawingObjects.document.Recalculate();
} }
...@@ -1415,7 +1417,7 @@ ChangeWrapContourAddPoint.prototype.onMouseUp = function(e, x, y, pageIndex) ...@@ -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); 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); nearest_pos.Paragraph.Check_NearestPos(nearest_pos);
this.majorObject.parent.Remove_FromDocument(false); 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.majorObject.parent.Add_ToDocument2(this.majorObject.parent.Get_ParentParagraph());
this.drawingObjects.document.Recalculate(); this.drawingObjects.document.Recalculate();
} }
......
...@@ -354,10 +354,10 @@ CGroupShape.prototype.getBoundsPos = function() ...@@ -354,10 +354,10 @@ CGroupShape.prototype.getBoundsPos = function()
for(var i = 0; i < sp_tree.length; ++i) for(var i = 0; i < sp_tree.length; ++i)
{ {
var bounds = sp_tree[i].bounds; var bounds = sp_tree[i].bounds;
var l = bounds.l; var l = sp_tree[i].x;
var r = bounds.r; var r = sp_tree[i].x + sp_tree[i].extX;
var t = bounds.t; var t = sp_tree[i].y;
var b = bounds.b; var b = sp_tree[i].y + sp_tree[i].extY;
x_arr_max.push(r); x_arr_max.push(r);
x_arr_min.push(l); x_arr_min.push(l);
y_arr_max.push(b); y_arr_max.push(b);
...@@ -367,3 +367,21 @@ CGroupShape.prototype.getBoundsPos = function() ...@@ -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)};
};
...@@ -4436,8 +4436,8 @@ ParaDrawing.prototype = ...@@ -4436,8 +4436,8 @@ ParaDrawing.prototype =
this.setPageIndex(pageIndex); this.setPageIndex(pageIndex);
if(typeof this.GraphicObj.setStartPage === "function") if(typeof this.GraphicObj.setStartPage === "function")
this.GraphicObj.setStartPage(pageIndex, this.DocumentContent && this.DocumentContent.Is_HdrFtr()); this.GraphicObj.setStartPage(pageIndex, this.DocumentContent && this.DocumentContent.Is_HdrFtr());
var _x = !this.PositionH.Align ? x - this.GraphicObj.bounds.x : x; var _x = this.PositionH.Align ? x - this.GraphicObj.bounds.x : x;
var _y = !this.PositionV.Align ? y - this.GraphicObj.bounds.y : y; var _y = this.PositionV.Align ? y - this.GraphicObj.bounds.y : y;
this.graphicObjects.addObjectOnPage(pageIndex, this.GraphicObj); this.graphicObjects.addObjectOnPage(pageIndex, this.GraphicObj);
this.selectX = x; this.selectX = x;
this.selectY = y; this.selectY = y;
...@@ -5464,11 +5464,12 @@ ParaDrawing.prototype = ...@@ -5464,11 +5464,12 @@ ParaDrawing.prototype =
} }
case historyitem_SetWrapPolygon: case historyitem_SetWrapPolygon:
{ {
Writer.WriteBool(Data.newW !== null && typeof Data.newW === "object"); writeObject(Writer, Data.newW);
if(Data.newW !== null && typeof Data.newW === "object") // Writer.WriteBool(Data.newW !== null && typeof Data.newW === "object");
{ // if(Data.newW !== null && typeof Data.newW === "object")
Writer.WriteString2(Data.newW); // {
} // Writer.WriteString2(Data.newW);
// }
break; break;
} }
} }
...@@ -5644,14 +5645,7 @@ ParaDrawing.prototype = ...@@ -5644,14 +5645,7 @@ ParaDrawing.prototype =
} }
case historyitem_SetWrapPolygon: case historyitem_SetWrapPolygon:
{ {
if(Reader.GetBool()) this.wrappingPolygon = readObject(Reader);
{
this.wrappingPolygon = g_oTableId.Get_ById(Reader.GetString2());
}
else
{
this.wrappingPolygon = null;
}
break; break;
} }
} }
...@@ -6509,7 +6503,7 @@ ParaDrawing.prototype = ...@@ -6509,7 +6503,7 @@ ParaDrawing.prototype =
addWrapPolygon: function(wrapPolygon) 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; 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