Commit dd6a5794 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@47630 954022d7-b5bf-4e40-9824-e11837661b57
parent 5f2bf659
......@@ -331,5 +331,19 @@ CGroupShape.prototypr =
drawAdjustments: function(drawingDocument)
{
},
getTransform: function()
{
if(this.recalcInfo.recalculateTransform)
this.recalculateTransform();
return this.transform;
},
getInvertTransform: function()
{
if(this.recalcInfo.recalculateTransform)
this.recalculateTransform();
return this.invertTransform;
}
};
\ No newline at end of file
......@@ -448,6 +448,11 @@ CImage.prototype =
return new MoveShapeImageTrack(this);
},
createRotateInGroupTrack: function()
{
return new RotateTrackShapeImageInGroup(this);
},
getRotateAngle: function(x, y)
{
var transform = this.getTransform();
......
......@@ -722,6 +722,12 @@ CShape.prototype =
return true;//TODO
},
canChangeAdjustments: function()
{
return true;//TODO
},
createRotateTrack: function()
{
return new RotateTrackShapeImage(this);
......@@ -735,6 +741,16 @@ CShape.prototype =
createMoveTrack: function()
{
return new MoveShapeImageTrack(this);
},
createRotateInGroupTrack: function()
{
return new RotateTrackShapeImageInGroup(this);
},
createResizeInGroupTrack: function(cardDirection)
{
return new ResizeTrackShapeImageInGroup(this, cardDirection);
}
};
\ No newline at end of file
......@@ -21,7 +21,10 @@ var STATES_ID_CHANGE_ADJ = 0x11;
var STATES_ID_GROUP = 0x12;
var STATES_ID_PRE_CHANGE_ADJ_IN_GROUP = 0x13;
var STATES_ID_CHANGE_ADJ_IN_GROUP = 0x14;
var STATES_ID_PRE_ROTATE_IN_GROUP = 0x15;
var STATES_ID_ROTATE_IN_GROUP = 0x16;
var STATES_ID_PRE_RESIZE_IN_GROUP = 0x17;
var STATES_ID_RESIZE_IN_GROUP = 0x18;
......@@ -41,11 +44,14 @@ function NullState(drawingObjectsController, drawingObjects)
var hit_to_adj = selected_objects[0].hitToAdjustment(x, y);
if(hit_to_adj.hit)
{
if(hit_to_adj.adjPolarFlag === false)
this.drawingObjectsController.addPreTrackObject(new XYAdjustmentTrack(selected_objects[0], hit_to_adj.adjNum));
else
this.drawingObjectsController.addPreTrackObject(new PolarAdjustmentTrack(selected_objects[0], hit_to_adj.adjNum));
this.drawingObjectsController.changeCurrentState(new PreChangeAdjState(this.drawingObjectsController, this.drawingObjects));
if(selected_objects[0].canChangeAdjustments())
{
if(hit_to_adj.adjPolarFlag === false)
this.drawingObjectsController.addPreTrackObject(new XYAdjustmentTrack(selected_objects[0], hit_to_adj.adjNum));
else
this.drawingObjectsController.addPreTrackObject(new PolarAdjustmentTrack(selected_objects[0], hit_to_adj.adjNum));
this.drawingObjectsController.changeCurrentState(new PreChangeAdjState(this.drawingObjectsController, this.drawingObjects));
}
return;
}
}
......@@ -521,14 +527,50 @@ function GroupState(drawingObjectsController, drawingObjects, group)
var hit_to_adj = group_selected_objects[0].hitToAdjustment(x, y);
if(hit_to_adj.hit)
{
if(hit_to_adj.adjPolarFlag === false)
this.drawingObjectsController.addPreTrackObject(new XYAdjustmentTrack(group_selected_objects[0], hit_to_adj.adjNum));
if(group_selected_objects[0].canChangeAdjustments())
{
if(hit_to_adj.adjPolarFlag === false)
this.drawingObjectsController.addPreTrackObject(new XYAdjustmentTrack(group_selected_objects[0], hit_to_adj.adjNum));
else
this.drawingObjectsController.addPreTrackObject(new PolarAdjustmentTrack(group_selected_objects[0], hit_to_adj.adjNum));
this.drawingObjectsController.changeCurrentState(new PreChangeAdjInGroupState(this.drawingObjectsController, this.drawingObjects, this.group));
}
return;
}
}
for(var i = group_selected_objects.length - 1; i > -1; --i)
{
var hit_to_handles = group_selected_objects[i].hitToHandles(x, y);
if(hit_to_handles > -1)
{
if(hit_to_handles === 8)
{
if(!group_selected_objects[i].canRotate())
return;
for(var j = 0; j < group_selected_objects.length; ++j)
{
this.drawingObjectsController.addPreTrackObject(group_selected_objects[j].createRotateInGroupTrack())
}
this.drawingObjectsController.changeCurrentState(new PreRotateInGroupState(this.drawingObjectsController, this.drawingObjects, this.group, group_selected_objects[i]));
}
else
this.drawingObjectsController.addPreTrackObject(new PolarAdjustmentTrack(group_selected_objects[0], hit_to_adj.adjNum));
this.drawingObjectsController.changeCurrentState(new PreChangeAdjInGroupState(this.drawingObjectsController, this.drawingObjects, this.group));
{
if(!group_selected_objects[i].canResize())
return;
for(var j = 0; j < group_selected_objects.length; ++j)
{
this.drawingObjectsController.addPreTrackObject(group_selected_objects[j].createRotateInGroupTrack())
}
this.drawingObjectsController.changeCurrentState(new PreRotateInGroupState(this.drawingObjectsController, this.drawingObjects, this.group, group_selected_objects[i]));
}
return;
}
}
for(i = group_selected_objects.length - 1; i > -1; --i)
{
}
};
this.onMouseMove = function(e, x, y)
......@@ -585,6 +627,94 @@ function ChangeAdjInGroupState(drawingObjectsController, drawingObjects, group)
};
}
function PreRotateInGroupState(drawingObjectsController, drawingObjects, group, majorObject)
{
this.id = STATES_ID_PRE_ROTATE_IN_GROUP;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.group = group;
this.majorObject = majorObject;
this.onMouseDown = function(e, x, y)
{
};
this.onMouseMove = function(e, x, y)
{
this.drawingObjectsController.swapTrackObjects();
this.drawingObjectsController.changeCurrentState(new RotateInGroupState(this.drawingObjectsController, this.drawingObjects, this.group, this.majorObject))
};
this.onMouseUp = function(e, x, y)
{};
}
function RotateInGroupState(drawingObjectsController, drawingObjects, group, majorObject)
{
this.id = STATES_ID_ROTATE_IN_GROUP;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.group = group;
this.majorObject = majorObject;
this.onMouseDown = function(e, x, y)
{};
this.onMouseMove = function(e, x, y)
{
};
this.onMouseUp = function(e, x, y)
{
// this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjectsController.changeCurrentState(new GroupState(this.drawingObjectsController, this.drawingObjects, this.group));
};
}
function PreResizeInGroupState(drawingObjectsController, drawingObjects, group, majorObject)
{
this.id = STATES_ID_PRE_RESIZE_IN_GROUP;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.group = group;
this.majorObject = majorObject;
this.onMouseDown = function(e, x, y)
{
};
this.onMouseMove = function(e, x, y)
{
this.drawingObjectsController.swapTrackObjects();
this.drawingObjectsController.changeCurrentState(new RotateInGroupState(this.drawingObjectsController, this.drawingObjects, this.group, this.majorObject))
};
this.onMouseUp = function(e, x, y)
{};
}
function ResizeInGroupState(drawingObjectsController, drawingObjects, group, majorObject)
{
this.id = STATES_ID_RESIZE_IN_GROUP;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.group = group;
this.majorObject = majorObject;
this.onMouseDown = function(e, x, y)
{};
this.onMouseMove = function(e, x, y)
{
};
this.onMouseUp = function(e, x, y)
{
// this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjectsController.changeCurrentState(new GroupState(this.drawingObjectsController, this.drawingObjects, this.group));
};
}
......@@ -113,6 +113,64 @@ function RotateTrackShapeImage(originalObject)
global_MatrixTransformer.TranslateAppend(this.transform, this.originalObject.x + hc, this.originalObject.y + vc);
};
this.trackEnd = function()
{
this.originalObject.setRotate(this.angle);
this.originalObject.recalculateTransform();
}
}
function RotateTrackShapeImageInGroup(originalObject)
{
this.originalObject = originalObject;
this.transform = new CMatrix();
this.overlayObject = new OverlayObject(originalObject.spPr.geometry, originalObject.extX, originalObject.extY, originalObject.brush, originalObject.pen, this.transform);
this.angle = originalObject.rot;
this.draw = function(overlay)
{
this.overlayObject.draw(overlay);
};
this.track = function(angle, e)
{
var new_rot = angle + this.originalObject.rot;
while(new_rot < 0)
new_rot += 2*Math.PI;
while(new_rot >= 2*Math.PI)
new_rot -= 2*Math.PI;
if(new_rot < MIN_ANGLE || new_rot > 2*Math.PI - MIN_ANGLE)
new_rot = 0;
if(Math.abs(new_rot-Math.PI*0.5) < MIN_ANGLE)
new_rot = Math.PI*0.5;
if(Math.abs(new_rot-Math.PI) < MIN_ANGLE)
new_rot = Math.PI;
if(Math.abs(new_rot-1.5*Math.PI) < MIN_ANGLE)
new_rot = 1.5*Math.PI;
if(e.shiftKey)
new_rot = (Math.PI/12)*Math.floor(12*new_rot/(Math.PI));
this.angle = new_rot;
var hc, vc;
hc = this.originalObject.extX*0.5;
vc = this.originalObject.extY*0.5;
this.transform.Reset();
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
if(this.originalObject.flipH)
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
if(this.originalObject.flipV)
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
global_MatrixTransformer.RotateRadAppend(this.transform, -this.angle);
global_MatrixTransformer.TranslateAppend(this.transform, this.originalObject.x + hc, this.originalObject.y + vc);
global_MatrixTransformer.MultiplyAppend(this.transform, this.originalObject.group.getTransform());
};
this.trackEnd = function()
{
this.originalObject.setRotate(this.angle);
......
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