Commit 47530013 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@47720 954022d7-b5bf-4e40-9824-e11837661b57
parent cb7db39c
...@@ -172,7 +172,27 @@ DrawingObjectsController.prototype = ...@@ -172,7 +172,27 @@ DrawingObjectsController.prototype =
}, },
unGroup: function() unGroup: function()
{}, {
var selected_objects = this.selectedObjects;
var ungrouped_objects = [];
for(var i = 0; i < selected_objects.length; ++i)
{
if(selected_objects[i].isGroup() && selected_objects[i].canUnGroup())
{
ungrouped_objects.push(selected_objects[i]);
}
}
for(i = 0; i < ungrouped_objects.length; ++i)
{
var ungrouped_sp_tree = ungrouped_objects[i].getUnGroupedSpTree();
for(var j = 0; j < ungrouped_sp_tree.length; ++j)
{
ungrouped_sp_tree[j].recalculateTransform();
}
this.drawingObjects.insertUngroupedObjects(ungrouped_objects[i].drawingBase.id, ungrouped_sp_tree);
}
},
canGroup: function() canGroup: function()
{ {
...@@ -181,7 +201,7 @@ DrawingObjectsController.prototype = ...@@ -181,7 +201,7 @@ DrawingObjectsController.prototype =
canUnGroup: function() canUnGroup: function()
{ {
return false; return true;
}, },
startTrackNewShape: function(presetGeom) startTrackNewShape: function(presetGeom)
......
...@@ -566,6 +566,11 @@ CGroupShape.prototype = ...@@ -566,6 +566,11 @@ CGroupShape.prototype =
return true;//TODO return true;//TODO
}, },
canUnGroup: function()
{
return true;
},
hitInBoundingRect: function(x, y) hitInBoundingRect: function(x, y)
{ {
var invert_transform = this.getInvertTransform(); var invert_transform = this.getInvertTransform();
...@@ -666,6 +671,31 @@ CGroupShape.prototype = ...@@ -666,6 +671,31 @@ CGroupShape.prototype =
return this.invertTransform; return this.invertTransform;
} , } ,
getUnGroupedSpTree: function()
{
this.normalize();
this.recalculateTransform();
var sp_tree = this.spTree;
var ret = [];
for(var i = 0; i < sp_tree.length; ++i)
{
var sp = sp_tree[i];
var full_flip_h = sp.getFullFlipH();
var full_flip_v = sp.getFullFlipV();
var full_rotate = sp.getFullRotate();
var hc = sp.spPr.xfrm.extX*0.5;
var vc = sp.spPr.xfrm.extY*0.5;
var xc = sp.transform.TransformPointX(hc, vc);
var yc = sp.transform.TransformPointY(hc, vc);
sp.setGroup(null);
sp.setPosition(xc - hc, yc - vc);
sp.setFlips(full_flip_h, full_flip_v);
sp.setRotate(normalizeRotate(sp.getFullRotate()));
ret.push(sp);
}
return ret;
},
select: function(drawingObjectsController) select: function(drawingObjectsController)
{ {
this.selected = true; this.selected = true;
...@@ -784,4 +814,18 @@ CGroupShape.prototype = ...@@ -784,4 +814,18 @@ CGroupShape.prototype =
{ {
return new ResizeTrackGroup(this, cardDirection); return new ResizeTrackGroup(this, cardDirection);
} }
}; };
\ No newline at end of file
function normalizeRotate(rot)
{
var new_rot = rot;
if(isRealNumber(new_rot))
{
while(new_rot >= 2*Math.PI)
new_rot -= Math.PI;
while(new_rot < 0)
new_rot += Math.PI;
return new_rot;
}
return new_rot;
}
\ No newline at end of file
...@@ -116,6 +116,7 @@ CImage.prototype = ...@@ -116,6 +116,7 @@ CImage.prototype =
setPresetGeometry: function(preset) setPresetGeometry: function(preset)
{ {
this.spPr.geometry = CreateGeometry(preset); this.spPr.geometry = CreateGeometry(preset);
this.spPr.geometry.Init(5, 5);
}, },
setPosition: function(x, y) setPosition: function(x, y)
...@@ -141,6 +142,15 @@ CImage.prototype = ...@@ -141,6 +142,15 @@ CImage.prototype =
this.spPr.xfrm.rot = rot; this.spPr.xfrm.rot = rot;
}, },
setRecalculateAll: function()
{
this.recalcInfo =
{
recalculateTransform: true,
recalculateGeometry: true,
recalculateBrush: true
};
},
updateDrawingBaseCoordinates: function() updateDrawingBaseCoordinates: function()
{ {
if(isRealObject(this.drawingBase)) if(isRealObject(this.drawingBase))
......
...@@ -139,6 +139,16 @@ CShape.prototype = ...@@ -139,6 +139,16 @@ CShape.prototype =
this.spPr.geometry.Init(5, 5); this.spPr.geometry.Init(5, 5);
}, },
setRecalculateAll: function()
{
this.recalcInfo =
{
recalculateTransform: true,
recalculateBrush: true,
recalculatePen: true
};
},
setStyle: function(style) setStyle: function(style)
{ {
this.style = style; this.style = style;
......
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