Commit 2c8ed810 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@47682 954022d7-b5bf-4e40-9824-e11837661b57
parent b4d35f46
......@@ -121,13 +121,14 @@ DrawingObjectsController.prototype =
createGroup: function(drawingBase)
{
var selected_objects = this.selectedObjects;
var drawing_bases = this.drawingObjects.getDrawingObjects();
var grouped_objects = [];
for(var i = 0; i < selected_objects.length; ++i)
for(var i = 0; i < drawing_bases.length; ++i)
{
if(selected_objects[i].canGroup())
var cur_drawing_base = drawing_bases[i];
if(cur_drawing_base.isGraphicObject() && cur_drawing_base.graphicObject.selected && cur_drawing_base.graphicObject.canGroup())
{
grouped_objects.push(selected_objects[i]);
grouped_objects.push(cur_drawing_base.graphicObject);
}
}
if(grouped_objects.length < 2)
......@@ -156,6 +157,7 @@ DrawingObjectsController.prototype =
group.setPosition(min_x, min_y);
group.setExtents(max_x - min_x, max_y - min_y);
group.setChildExtents(max_x - min_x, max_y - min_y);
group.setChildOffsets(0, 0);
for(i = 0; i < grouped_objects.length; ++i)
{
grouped_objects[i].setPosition(grouped_objects[i].x - min_x, grouped_objects[i].y - min_y);
......
......@@ -45,7 +45,6 @@ function CGroupShape(drawingBase, drawingObjects)
this.pen = null;
this.selected = false;
}
CGroupShape.prototype =
......@@ -110,6 +109,11 @@ CGroupShape.prototype =
this.spPr.xfrm.chExtY = chExtY;
},
setChildOffsets: function(chOffX, chOffY)
{
this.spPr.xfrm.chOffX = chOffX;
this.spPr.xfrm.chOffY = chOffY;
},
updateDrawingBaseCoordinates: function()
{
......@@ -401,6 +405,146 @@ CGroupShape.prototype =
}
},
normalize: function()
{
for(var i = 0; i < this.spTree.length; ++i)
{
this.spTree[i].normalize();
}
var new_off_x, new_off_y, new_ext_x, new_ext_y;
var xfrm = this.spPr.xfrm;
if(!isRealObject(this.group))
{
new_off_x = xfrm.offX;
new_off_y = xfrm.offY;
new_ext_x = xfrm.extX;
new_ext_y = xfrm.extY;
}
else
{
var scale_scale_coefficients = this.group.getResultScaleCoefficients();
new_off_x = scale_scale_coefficients.cx*(xfrm.offX - this.group.spPr.xfrm.chOffX);
new_off_y = scale_scale_coefficients.cy*(xfrm.offY - this.group.spPr.xfrm.chOffY);
new_ext_x = scale_scale_coefficients.cx*xfrm.extX;
new_ext_y = scale_scale_coefficients.cy*xfrm.extY;
}
this.setPosition(new_off_x, new_off_y);
this.setExtents(new_ext_x, new_ext_y);
this.setChildExtents(new_ext_x, new_ext_y);
this.setChildOffsets(0, 0);
},
updateCoordinatesAfterInternalResize: function()
{
for(var i = 0; i < this.spTree.length; ++i)
{
if(this.spTree[i].isGroup())
this.spTree[i].updateCoordinatesAfterInternalResize();
}
var sp_tree = this.spTree;
var min_x, max_x, min_y, max_y;
var sp = sp_tree[0];
var xfrm = sp.spPr.xfrm;
var rot = xfrm.rot == null ? 0 : xfrm.rot;
var xc, yc;
if(rot < Math.PI*0.25 || rot>Math.PI*1.75 || (rot>Math.PI*0.75 && rot<Math.PI*1.25))
{
min_x = xfrm.offX;
min_y = xfrm.offY;
max_x = xfrm.offX + xfrm.extX;
max_y = xfrm.offY + xfrm.extY;
}
else
{
xc = xfrm.offX + xfrm.extX*0.5;
yc = xfrm.offY + xfrm.extY*0.5;
min_x = xc - xfrm.extY*0.5;
min_y = yc - xfrm.extX*0.5;
max_x = xc + xfrm.extY*0.5;
max_y = yc + xfrm.extX*0.5;
}
var cur_max_x, cur_min_x, cur_max_y, cur_min_y;
for(i = 1; i < sp_tree.length; ++i)
{
sp = sp_tree[i];
xfrm = sp.spPr.xfrm;
rot = xfrm.rot == null ? 0 : xfrm.rot;
if(rot < Math.PI*0.25 || rot>Math.PI*1.75 || (rot>Math.PI*0.75 && rot<Math.PI*1.25))
{
cur_min_x = xfrm.offX;
cur_min_y = xfrm.offY;
cur_max_x = xfrm.offX + xfrm.extX;
cur_max_y = xfrm.offY + xfrm.extY;
}
else
{
xc = xfrm.offX + xfrm.extX*0.5;
yc = xfrm.offY + xfrm.extY*0.5;
cur_min_x = xc - xfrm.extY*0.5;
cur_min_y = yc - xfrm.extX*0.5;
cur_max_x = xc + xfrm.extY*0.5;
cur_max_y = yc + xfrm.extX*0.5;
}
if(cur_max_x > max_x)
max_x = cur_max_x;
if(cur_min_x < min_x)
min_x = cur_min_x;
if(cur_max_y > max_y)
max_y = cur_max_y;
if(cur_min_y < min_y)
min_y = cur_min_y;
}
var temp;
var x_min_clear = min_x;
var y_min_clear = min_y;
if(this.spPr.xfrm.flipH === true)
{
temp = max_x;
max_x = this.spPr.xfrm.extX - min_x;
min_x = this.spPr.xfrm.extX - temp;
}
if(this.spPr.xfrm.flipV === true)
{
temp = max_y;
max_y = this.spPr.xfrm.extY - min_y;
min_y = this.spPr.xfrm.extY - temp;
}
var old_x0, old_y0;
var xfrm = this.spPr.xfrm;
var rot = xfrm.rot == null ? 0 : xfrm.rot;
var hc = xfrm.extX*0.5;
var vc = xfrm.extY*0.5;
old_x0 = this.spPr.xfrm.offX + hc - (hc*Math.cos(rot) - vc*Math.sin(rot));
old_y0 = this.spPr.xfrm.offY + vc - (hc*Math.sin(rot) + vc*Math.cos(rot));
var t_dx = min_x*Math.cos(rot) - min_y*Math.sin(rot);
var t_dy = min_x*Math.sin(rot) + min_y*Math.cos(rot);
var new_x0, new_y0;
new_x0 = old_x0 + t_dx;
new_y0 = old_y0 + t_dy;
var new_hc = Math.abs(max_x - min_x)*0.5;
var new_vc = Math.abs(max_y - min_y)*0.5;
var new_xc = new_x0 + (new_hc*Math.cos(rot) - new_vc*Math.sin(rot));
var new_yc = new_y0 + (new_hc*Math.sin(rot) + new_vc*Math.cos(rot));
var pos_x, pos_y;
pos_x = new_xc - new_hc;
pos_y = new_yc - new_vc;
this.setPosition(pos_x, pos_y);
this.setExtents(Math.abs(max_x - min_x), Math.abs(max_y - min_y));
this.setChildExtents(Math.abs(max_x - min_x), Math.abs(max_y - min_y));
for(i = 0; i < sp_tree.length; ++i)
{
sp_tree[i].setPosition(sp_tree[i].spPr.xfrm.offX - x_min_clear, sp_tree[i].spPr.xfrm.offY - y_min_clear);
}
},
canRotate: function()
{
......@@ -517,8 +661,8 @@ CGroupShape.prototype =
getInvertTransform: function()
{
if(this.recalcInfo.recalculateTransform)
this.recalculateTransform();
//if(this.recalcInfo.recalculateTransform)
//this.recalculateTransform();
return this.invertTransform;
} ,
......@@ -621,6 +765,12 @@ CGroupShape.prototype =
}
},
resetSelection: function(drawingObjectsController)
{
while(this.selectedObjects.length > 0)
this.selectedObjects[0].deselect(drawingObjectsController);
},
createRotateTrack: function()
{
return new RotateTrackGroup(this);
......
......@@ -200,6 +200,29 @@ CImage.prototype =
}
},
normalize: function()
{
var new_off_x, new_off_y, new_ext_x, new_ext_y;
var xfrm = this.spPr.xfrm;
if(!isRealObject(this.group))
{
new_off_x = xfrm.offX;
new_off_y = xfrm.offY;
new_ext_x = xfrm.extX;
new_ext_y = xfrm.extY;
}
else
{
var scale_scale_coefficients = this.group.getResultScaleCoefficients();
new_off_x = scale_scale_coefficients.cx*(xfrm.offX - this.group.spPr.xfrm.chOffX);
new_off_y = scale_scale_coefficients.cy*(xfrm.offY - this.group.spPr.xfrm.chOffY);
new_ext_x = scale_scale_coefficients.cx*xfrm.extX;
new_ext_y = scale_scale_coefficients.cy*xfrm.extY;
}
this.setPosition(new_off_x, new_off_y);
this.setExtents(new_ext_x, new_ext_y);
},
getTransform: function()
{
if(this.recalcInfo.recalculateTransform)
......@@ -501,10 +524,9 @@ CImage.prototype =
createMoveInGroupTrack: function()
{
return new MoveShapeImageInGroupTrack(this);
return new MoveShapeImageTrackInGroup(this);
},
getRotateAngle: function(x, y)
{
var transform = this.getTransform();
......
......@@ -101,7 +101,7 @@ CShape.prototype =
if(this.recalcInfo.recalculateBrush)
this.recalculateBrush();
if(this.recalcInfo.recalculatePen)
this.recalculatePen()
this.recalculatePen();
},
setPosition: function(x, y)
......@@ -266,6 +266,29 @@ CShape.prototype =
this.invertTransform = global_MatrixTransformer.Invert(this.transform);
},
normalize: function()
{
var new_off_x, new_off_y, new_ext_x, new_ext_y;
var xfrm = this.spPr.xfrm;
if(!isRealObject(this.group))
{
new_off_x = xfrm.offX;
new_off_y = xfrm.offY;
new_ext_x = xfrm.extX;
new_ext_y = xfrm.extY;
}
else
{
var scale_scale_coefficients = this.group.getResultScaleCoefficients();
new_off_x = scale_scale_coefficients.cx*(xfrm.offX - this.group.spPr.xfrm.chOffX);
new_off_y = scale_scale_coefficients.cy*(xfrm.offY - this.group.spPr.xfrm.chOffY);
new_ext_x = scale_scale_coefficients.cx*xfrm.extX;
new_ext_y = scale_scale_coefficients.cy*xfrm.extY;
}
this.setPosition(new_off_x, new_off_y);
this.setExtents(new_ext_x, new_ext_y);
},
recalculateBrush: function()
{
var brush;
......@@ -763,6 +786,7 @@ CShape.prototype =
return new MoveShapeImageTrack(this);
},
createRotateInGroupTrack: function()
{
return new RotateTrackShapeImageInGroup(this);
......@@ -775,7 +799,7 @@ CShape.prototype =
createMoveInGroupTrack: function()
{
return new MoveShapeImageInGroupTrack(this);
return new MoveShapeImageTrackInGroup(this);
}
};
\ No newline at end of file
......@@ -179,8 +179,7 @@ function NullState(drawingObjectsController, drawingObjects)
{};
this.onMouseUp = function(e, x, y)
{
};
{};
this.drawSelection = function(drawingDocument)
{
......@@ -217,7 +216,6 @@ function PreRotateState(drawingObjectsController, drawingObjects, majorObject)
};
}
function RotateState(drawingObjectsController, drawingObjects, majorObject)
{
this.id = STATES_ID_ROTATE;
......@@ -635,30 +633,90 @@ function GroupState(drawingObjectsController, drawingObjects, group)
{
this.drawingObjectsController.addPreTrackObject(group_selected_objects[j].createResizeInGroupTrack(CARD_DIRECTION_E))
}
this.drawingObjectsController.changeCurrentState(new PreRotateInGroupState(this.drawingObjectsController, this.drawingObjects, this.group, group_selected_objects[i]));
this.drawingObjectsController.changeCurrentState(new PreResizeInGroupState(this.drawingObjectsController, this.drawingObjects, this.group, group_selected_objects[i]));
}
return;
}
}
var hit_to_handles = this.group.hitToHandles(x, y);
if(hit_to_handles > -1)
{
if(hit_to_handles === 8)
{
if(!this.group.canRotate())
return;
this.group.resetSelection(this.drawingObjectsController);
this.drawingObjectsController.addPreTrackObject(this.group.createRotateTrack());
this.drawingObjectsController.changeCurrentState(new PreRotateState(this.drawingObjectsController, this.drawingObjects, this.group));
return;
}
else
{
if(!this.group.canResize())
return;
this.group.resetSelection(this.drawingObjectsController);
var card_direction = this.group.getCardDirectionByNum(hit_to_handles);
this.drawingObjectsController.addPreTrackObject(this.group.createResizeTrack(card_direction));
this.drawingObjectsController.changeCurrentState(new PreResizeState(this.drawingObjectsController, this.drawingObjects, this.group, card_direction));
return;
}
}
for(i = group_selected_objects.length - 1; i > -1; --i)
{
if(group_selected_objects[i].hitInBoundingRect(x, y))
{
if(!group_selected_objects[i].canMove())
return;
this.drawingObjectsController.clearPreTrackObjects();
for(var j = 0; j < group_selected_objects.length; ++j)
{
this.drawingObjectsController.addPreTrackObject(group_selected_objects[j].createMoveInGroupTrack());
}
this.drawingObjectsController.changeCurrentState(new PreMoveInGroupState(this.drawingObjectsController, this.group, this.drawingObjects, x, y, e.shiftKey, e.ctrl, group_selected_objects[i], true));
return;
}
this.drawingObjectsController.changeCurrentState(new PreMoveInGroupState(this.drawingObjectsController, this.drawingObjects, this.group,
x, y, e.shiftKey, e.ctrlKey, group_selected_objects[i], true));
}
}
for(i = group_selected_objects.length - 1; i > -1; --i)
if(this.group.hitInBoundingRect(x, y))
{
this.group.resetSelection();
this.drawingObjectsController.addPreTrackObject(this.group.createMoveTrack());
this.drawingObjectsController.changeCurrentState(new PreMoveState(this.drawingObjectsController, this.drawingObjects, x, y, e.shiftKey, e.ctrlKey, this.group, true, false));
return;
}
var arr_graphic_objects = this.group.getArrGraphicObjects();
for(i = arr_graphic_objects.length - 1; i > -1; --i)
{
var cur_drawing = arr_graphic_objects[i];
var hit_in_inner_area = cur_drawing.hitInInnerArea(x, y);
var hit_in_path = cur_drawing.hitInPath(x, y);
var hit_in_text_rect = cur_drawing.hitInTextRect(x, y);
if(hit_in_inner_area && !hit_in_text_rect || hit_in_path)
{
var is_selected = cur_drawing.selected;
if(!(e.ctrlKey || e.shiftKey) && !is_selected)
this.group.resetSelection();
cur_drawing.select(this.drawingObjectsController);
this.drawingObjects.selectGraphicObject();
for(var j = 0; j < group_selected_objects.length; ++j)
{
this.drawingObjectsController.addPreTrackObject(group_selected_objects[j].createMoveInGroupTrack());
}
this.drawingObjectsController.changeCurrentState(new PreMoveInGroupState(this.drawingObjectsController, this.drawingObjects,this.group, x, y, e.shiftKey, e.ctrl, cur_drawing, is_selected));
return;
}
else if(hit_in_text_rect)
{
//TODO
}
}
this.group.resetSelection(this.drawingObjectsController);
this.drawingObjectsController.resetSelection();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
this.drawingObjects.selectGraphicObject();
};
this.onMouseMove = function(e, x, y)
......@@ -680,6 +738,13 @@ function PreMoveInGroupState(drawingObjectsController, drawingObjects, group, st
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.group = group;
this.startX = startX;
this.startY = startY;
this.shiftKey = shiftKey;
this.ctrlKey = ctrlKey;
this.majorObject = majorObject;
this.majorObjectIsSelected = majorObjectIsSelected;
this.onMouseDown = function(e, x, y)
{
......@@ -688,12 +753,38 @@ function PreMoveInGroupState(drawingObjectsController, drawingObjects, group, st
this.onMouseMove = function(e, x, y)
{
this.drawingObjectsController.swapTrackObjects();
this.drawingObjectsController.trackAdjObject(x, y);
this.drawingObjectsController.changeCurrentState(new ChangeAdjInGroupState(this.drawingObjectsController, this.drawingObjects, this.group))
var track_objects = this.drawingObjectsController.getTrackObjects();
var max_x, min_x, max_y, min_y;
var cur_rect_bounds = track_objects[0].getOriginalBoundsRect();
max_x = cur_rect_bounds.maxX;
min_x = cur_rect_bounds.minX;
max_y = cur_rect_bounds.maxY;
min_y = cur_rect_bounds.minY;
for(var i = 0; i < track_objects.length; ++i)
{
cur_rect_bounds = track_objects[i].getOriginalBoundsRect();
if(max_x < cur_rect_bounds.maxX)
max_x = cur_rect_bounds.maxX;
if(min_x > cur_rect_bounds.minX)
min_x = cur_rect_bounds.minX;
if(max_y < cur_rect_bounds.maxY)
max_y = cur_rect_bounds.maxY;
if(min_y > cur_rect_bounds.minY)
min_y = cur_rect_bounds.minY;
}
this.drawingObjectsController.changeCurrentState(new MoveInGroupState(this.drawingObjectsController, this.drawingObjects, this.group, this.startX, this.startY, min_x, min_y, max_x - min_x, max_y - min_y))
};
this.onMouseUp = function(e, x, y)
{};
{
this.drawingObjectsController.clearPreTrackObjects();
if(this.shift || this.ctrl)
{
if(this.majorObjectIsSelected)
this.majorObject.deselect(this.drawingObjectsController);
}
this.drawingObjectsController.changeCurrentState(new GroupState(this.drawingObjectsController, this.drawingObjects, this.group));
};
this.drawSelection = function(drawingDocument)
{
......@@ -701,12 +792,18 @@ function PreMoveInGroupState(drawingObjectsController, drawingObjects, group, st
};
}
function MoveInGroupState(drawingObjectsController, drawingObjects, group)
function MoveInGroupState(drawingObjectsController, drawingObjects, group, startX, startY, rectX, rectY, rectW, rectH)
{
this.id = STATES_ID_MOVE_IN_GROUP;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.group = group;
this.startX = startX;
this.startY = startY;
this.rectX = rectX;
this.rectY = rectY;
this.rectW = rectW;
this.rectH = rectH;
this.onMouseDown = function(e, x, y)
{
......@@ -714,12 +811,22 @@ function MoveInGroupState(drawingObjectsController, drawingObjects, group)
this.onMouseMove = function(e, x, y)
{
var dx = x - this.startX;
var dy = y - this.startY;
var check_position = this.drawingObjects.checkGraphicObjectPosition(this.rectX + dx, this.rectY + dy, this.rectW, this.rectH);
this.drawingObjectsController.trackMoveObjects(dx + check_position.x, dy + check_position.y);
this.drawingObjects.selectGraphicObject();
this.drawingObjects.showOverlayGraphicObjects();
};
this.onMouseUp = function(e, x, y)
{
// this.drawingObjectsController.trackEnd();
this.drawingObjectsController.trackEnd();
this.group.normalize();
this.group.updateCoordinatesAfterInternalResize();
this.group.recalculateTransform();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjects.showDrawingObjects(true);
this.drawingObjectsController.changeCurrentState(new GroupState(this.drawingObjectsController, this.drawingObjects, this.group));
};
......@@ -825,11 +932,18 @@ function RotateInGroupState(drawingObjectsController, drawingObjects, group, maj
this.onMouseMove = function(e, x, y)
{
var angle = this.majorObject.getRotateAngle(x, y);
this.drawingObjectsController.rotateTrackObjects(angle, e);
this.drawingObjects.selectGraphicObject();
this.drawingObjects.showOverlayGraphicObjects();
};
this.onMouseUp = function(e, x, y)
{
// this.drawingObjectsController.trackEnd();
this.drawingObjectsController.trackEnd();
this.group.normalize();
this.group.updateCoordinatesAfterInternalResize();
this.group.recalculateTransform();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjectsController.changeCurrentState(new GroupState(this.drawingObjectsController, this.drawingObjects, this.group));
};
......@@ -856,7 +970,7 @@ function PreResizeInGroupState(drawingObjectsController, drawingObjects, group,
this.onMouseMove = function(e, x, y)
{
this.drawingObjectsController.swapTrackObjects();
this.drawingObjectsController.changeCurrentState(new RotateInGroupState(this.drawingObjectsController, this.drawingObjects, this.group, this.majorObject))
this.drawingObjectsController.changeCurrentState(new ResizeInGroupState(this.drawingObjectsController, this.drawingObjects, this.group, this.majorObject))
};
this.onMouseUp = function(e, x, y)
......
......@@ -51,49 +51,60 @@ function MoveShapeImageTrack(originalObject)
};
}
function MoveShapeImageInGroupTrack(originalObject)
function MoveShapeImageTrackInGroup(originalObject)
{
this.originalObject = originalObject;
this.transform = new CMatrix();
this.x = null;
this.y = null;
this.transform = new CMatrix();
this.overlayObject = new OverlayObject(this.originalObject.spPr.geometry, this.originalObject.extX, this.originalObject.extY, this.originalObject.brush, this.originalObject.pen, this.transform);
this.getOriginalBoundsRect = function()
this.inv = global_MatrixTransformer.Invert(originalObject.group.transform);
this.inv.tx = 0;
this.inv.ty = 0;
this.draw = function(overlay)
{
return this.originalObject.getRectBounds();
this.overlayObject.draw(overlay);
};
this.track = function(dx, dy)
{
var original = this.originalObject;
this.x = original.x + dx;
this.y = original.y + dy;
this.transform.Reset();
var hc = original.extX*0.5;
var vc = original.extY*0.5;
var dx_t = this.inv.TransformPointX(dx, dy);
var dy_t = this.inv.TransformPointY(dx, dy);
this.x = this.originalObject.x + dx_t;
this.y = this.originalObject.y + dy_t;
this.calculateTransform();
};
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
if(original.flipH)
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
if(original.flipV)
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
global_MatrixTransformer.RotateRadAppend(this.transform, -original.rot);
global_MatrixTransformer.TranslateAppend(this.transform, this.x + hc, this.y + vc);
this.getOriginalBoundsRect = function()
{
return this.originalObject.getRectBounds();
};
this.draw = function(overlay)
this.calculateTransform = function()
{
this.overlayObject.draw(overlay);
var t = this.transform;
t.Reset();
global_MatrixTransformer.TranslateAppend(t, -this.originalObject.extX*0.5, -this.originalObject.extY*0.5);
if(this.originalObject.flipH)
{
global_MatrixTransformer.ScaleAppend(t, -1, 1);
}
if(this.originalObject.flipV)
{
global_MatrixTransformer.ScaleAppend(t, 1, -1);
}
global_MatrixTransformer.RotateRadAppend(t, -this.originalObject.rot);
global_MatrixTransformer.TranslateAppend(t, this.x + this.originalObject.extX*0.5, this.y + this.originalObject.extY*0.5);
global_MatrixTransformer.MultiplyAppend(t, this.originalObject.group.getTransform());
};
this.trackEnd = function()
{
this.originalObject.setPosition(this.x, this.y);
var scale_scale_coefficients = this.originalObject.group.getResultScaleCoefficients();
var xfrm = this.originalObject.group.spPr.xfrm;
this.originalObject.setPosition(this.x/scale_scale_coefficients.cx + xfrm.chOffX, this.y/scale_scale_coefficients.cy + xfrm.chOffY);
this.originalObject.recalculateTransform();
this.originalObject.updateDrawingBaseCoordinates();
};
}
}
function MoveGroupTrack(originalObject)
......
......@@ -1880,7 +1880,7 @@ function ShapeForResizeInGroup(originalObject, parentTrack)
{
global_MatrixTransformer.ScaleAppend(t, 1, -1);
}
global_MatrixTransformer.RotateRadAppend(t, this.rot);
global_MatrixTransformer.RotateRadAppend(t, -this.rot);
global_MatrixTransformer.TranslateAppend(t, this.x + this.extX*0.5, this.y+this.extY*0.5);
if(this.parentTrack)
global_MatrixTransformer.MultiplyAppend(t, this.parentTrack.transform);
......
......@@ -133,7 +133,9 @@ function RotateTrackShapeImageInGroup(originalObject)
this.overlayObject = new OverlayObject(originalObject.spPr.geometry, originalObject.extX, originalObject.extY, originalObject.brush, originalObject.pen, this.transform);
this.angle = originalObject.rot;
var full_flip_h = this.originalObject.getFullFlipH();
var full_flip_v = this.originalObject.getFullFlipV();
this.signum = !full_flip_h && !full_flip_v || full_flip_h && full_flip_v ? 1 : -1;
this.draw = function(overlay)
{
this.overlayObject.draw(overlay);
......@@ -141,7 +143,7 @@ function RotateTrackShapeImageInGroup(originalObject)
this.track = function(angle, e)
{
var new_rot = angle + this.originalObject.rot;
var new_rot = this.signum*angle + this.originalObject.rot;
while(new_rot < 0)
new_rot += 2*Math.PI;
while(new_rot >= 2*Math.PI)
......
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