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

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47610 954022d7-b5bf-4e40-9824-e11837661b57
parent cad3e30e
......@@ -153,11 +153,14 @@ DrawingObjectsController.prototype =
min_y = bounds.minY;
}
var group = new CGroupShape(drawingBase, this.drawingObjects);
group.setPosition(min_x, min_y);
group.setExtents(max_x - min_x, max_y - min_y);
for(i = 0; i < grouped_objects.length; ++i)
{
grouped_objects[i].setPosition(grouped_objects[i].x - min_x, grouped_objects.y - min_y);
group.addToSpTree(grouped_objects[i]);
}
group.recalculate();
},
canGroup: function()
......
......@@ -76,6 +76,29 @@ CGroupShape.prototypr =
return false;
},
setPosition: function(x, y)
{
this.spPr.xfrm.offX = x;
this.spPr.xfrm.offY = y;
},
setExtents: function(extX, extY)
{
this.spPr.xfrm.extX = extX;
this.spPr.xfrm.extY = extY;
},
setFlips: function(flipH, flipV)
{
this.spPr.xfrm.flipH = flipH;
this.spPr.xfrm.flipV = flipV;
},
setRotate: function(rot)
{
this.spPr.xfrm.rot = rot;
},
updateDrawingBaseCoordinates: function()
{
......@@ -180,6 +203,18 @@ CGroupShape.prototypr =
return {kd1: 1, kd2: 1};
},
recalculate: function()
{
if(this.recalcInfo.recalculateTransform)
this.re
this.recalcInfo =
{
recalculateTransform: true,
recalculateArrGraphicObjects: true
};
},
recalculateArrGraphicObjects: function()
{
this.arrGraphicObjects.length = 0;
......@@ -196,6 +231,51 @@ CGroupShape.prototypr =
}
},
recalculateTransform: function()
{
var xfrm = this.spPr.xfrm;
if(!isRealObject(this.group))
{
this.x = xfrm.offX;
this.y = xfrm.offY;
this.extX = xfrm.extX;
this.extY = xfrm.extY;
this.rot = isRealNumber(xfrm.rot) ? xfrm.rot : 0;
this.flipH = xfrm.flipH === true;
this.flipV = xfrm.flipV === true;
}
else
{
var scale_scale_coefficients = this.group.getResultScaleCoefficients();
this.x = scale_scale_coefficients.cx*(xfrm.offX - this.group.xfrm.chOffX);
this.y = scale_scale_coefficients.cy*(xfrm.offY - this.group.xfrm.chOffY);
this.extX = scale_scale_coefficients.cx*xfrm.extX;
this.extY = scale_scale_coefficients.cy*xfrm.extY;
this.rot = isRealNumber(xfrm.rot) ? xfrm.rot : 0;
this.flipH = xfrm.flipH === true;
this.flipV = xfrm.flipV === true;
}
if(isRealObject(this.spPr.geometry))
this.spPr.geometry.Recalculate(this.extX, this.extY);
this.transform.Reset();
var hc, vc;
hc = this.extX*0.5;
vc = this.extY*0.5;
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
if(this.flipH)
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
if(this.flipV)
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
global_MatrixTransformer.RotateRadAppend(this.transform, -this.rot);
global_MatrixTransformer.TranslateAppend(this.transform, this.x + hc, this.y + vc);
if(isRealObject(this.group))
{
global_MatrixTransformer.MultiplyAppend(this.transform, this.group.getTransform());
}
this.invertTransform = global_MatrixTransformer.Invert(this.transform);
},
canRotate: function()
{
......
......@@ -392,11 +392,15 @@ function MoveState(drawingObjectsController, drawingObjects, startX, startY, rec
{
var dx = x - this.startX;
var dy = y - this.startY;
if(this.drawingObjects.checkGraphicObjectPosition(this.rectX + dx, this.rectY + dy, this.rectW, this.rectH))
var dx2 = 0, dy2 = 0;
var check_position = this.drawingObjects.checkGraphicObjectPosition(this.rectX + dx, this.rectY + dy, this.rectW, this.rectH);
if(check_position.result === false)
{
this.drawingObjectsController.trackMoveObjects(dx, dy);
this.drawingObjects.showOverlayGraphicObjects();
dx2 = check_position.x;
dy2 = check_position.y;
}
this.drawingObjectsController.trackMoveObjects(dx + dx2, dy + dy2);
this.drawingObjects.showOverlayGraphicObjects();
};
this.onMouseUp = function(e, 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