Commit 27e04794 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@47643 954022d7-b5bf-4e40-9824-e11837661b57
parent 2eb55c87
...@@ -167,9 +167,9 @@ CGroupShape.prototypr = ...@@ -167,9 +167,9 @@ CGroupShape.prototypr =
getFullFlipV: function() getFullFlipV: function()
{ {
if(!isRealObject(this.group)) if(!isRealObject(this.group))
return this.flipH; return this.flipV;
else else
return this.group.getFullFlipH() ? !this.flipH : this.flipH; return this.group.getFullFlipV() ? !this.flipV : this.flipV;
}, },
getFullRotate: function() getFullRotate: function()
......
...@@ -284,9 +284,9 @@ CImage.prototype = ...@@ -284,9 +284,9 @@ CImage.prototype =
getFullFlipV: function() getFullFlipV: function()
{ {
if(!isRealObject(this.group)) if(!isRealObject(this.group))
return this.flipH; return this.flipV;
else else
return this.group.getFullFlipH() ? !this.flipH : this.flipH; return this.group.getFullFlipV() ? !this.flipV : this.flipV;
}, },
setGroup: function(group) setGroup: function(group)
...@@ -453,6 +453,17 @@ CImage.prototype = ...@@ -453,6 +453,17 @@ CImage.prototype =
return new RotateTrackShapeImageInGroup(this); return new RotateTrackShapeImageInGroup(this);
}, },
createResizeInGroupTrack: function(cardDirection)
{
return new ResizeTrackShapeImageInGroup(this, cardDirection);
},
createMoveInGroupTrack: function()
{
return new MoveShapeImageInGroupTrack(this);
},
getRotateAngle: function(x, y) getRotateAngle: function(x, y)
{ {
var transform = this.getTransform(); var transform = this.getTransform();
......
...@@ -380,8 +380,8 @@ CShape.prototype = ...@@ -380,8 +380,8 @@ CShape.prototype =
getFullFlipV: function() getFullFlipV: function()
{ {
if(!isRealObject(this.group)) if(!isRealObject(this.group))
return this.flipH; return this.flipV;
return this.group.getFullFlipH() ? !this.flipH : this.flipH; return this.group.getFullFlipV() ? !this.flipV : this.flipV;
}, },
getAspect: function(num) getAspect: function(num)
...@@ -521,7 +521,12 @@ CShape.prototype = ...@@ -521,7 +521,12 @@ CShape.prototype =
v2_x = rot_x_t - xc_t; v2_x = rot_x_t - xc_t;
v2_y = rot_y_t - yc_t; v2_y = rot_y_t - yc_t;
return rel_x > this.extX*0.5 ? Math.atan2( Math.abs(v1_x*v2_y - v1_y*v2_x), v1_x*v2_x + v1_y*v2_y) : -Math.atan2( Math.abs(v1_x*v2_y - v1_y*v2_x), v1_x*v2_x + v1_y*v2_y);
var flip_h = this.getFullFlipH();
var flip_v = this.getFullFlipV();
var same_flip = flip_h && flip_v || !flip_h && !flip_v;
var angle = rel_x > this.extX*0.5 ? Math.atan2( Math.abs(v1_x*v2_y - v1_y*v2_x), v1_x*v2_x + v1_y*v2_y) : -Math.atan2( Math.abs(v1_x*v2_y - v1_y*v2_x), v1_x*v2_x + v1_y*v2_y);
return same_flip ? angle : -angle;
}, },
...@@ -559,8 +564,6 @@ CShape.prototype = ...@@ -559,8 +564,6 @@ CShape.prototype =
}, },
transformPointRelativeShape: function(x, y) transformPointRelativeShape: function(x, y)
{ {
...@@ -751,6 +754,11 @@ CShape.prototype = ...@@ -751,6 +754,11 @@ CShape.prototype =
createResizeInGroupTrack: function(cardDirection) createResizeInGroupTrack: function(cardDirection)
{ {
return new ResizeTrackShapeImageInGroup(this, cardDirection); return new ResizeTrackShapeImageInGroup(this, cardDirection);
},
createMoveInGroupTrack: function()
{
return new MoveShapeImageInGroupTrack(this);
} }
}; };
\ No newline at end of file
...@@ -25,6 +25,8 @@ var STATES_ID_PRE_ROTATE_IN_GROUP = 0x15; ...@@ -25,6 +25,8 @@ var STATES_ID_PRE_ROTATE_IN_GROUP = 0x15;
var STATES_ID_ROTATE_IN_GROUP = 0x16; var STATES_ID_ROTATE_IN_GROUP = 0x16;
var STATES_ID_PRE_RESIZE_IN_GROUP = 0x17; var STATES_ID_PRE_RESIZE_IN_GROUP = 0x17;
var STATES_ID_RESIZE_IN_GROUP = 0x18; var STATES_ID_RESIZE_IN_GROUP = 0x18;
var STATES_ID_PRE_MOVE_IN_GROUP = 0x19;
var STATES_ID_MOVE_IN_GROUP = 0x20;
...@@ -218,6 +220,7 @@ function RotateState(drawingObjectsController, drawingObjects, majorObject) ...@@ -218,6 +220,7 @@ function RotateState(drawingObjectsController, drawingObjects, majorObject)
{ {
var angle = this.majorObject.getRotateAngle(x, y); var angle = this.majorObject.getRotateAngle(x, y);
this.drawingObjectsController.rotateTrackObjects(angle, e); this.drawingObjectsController.rotateTrackObjects(angle, e);
this.drawingObjects.selectGraphicObject();
this.drawingObjects.showOverlayGraphicObjects(); this.drawingObjects.showOverlayGraphicObjects();
}; };
...@@ -225,6 +228,7 @@ function RotateState(drawingObjectsController, drawingObjects, majorObject) ...@@ -225,6 +228,7 @@ function RotateState(drawingObjectsController, drawingObjects, majorObject)
{ {
this.drawingObjectsController.trackEnd(); this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects(); this.drawingObjectsController.clearTrackObjects();
this.drawingObjects.selectGraphicObject();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects)); this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
asc.editor.asc_endAddShape(); asc.editor.asc_endAddShape();
} }
...@@ -269,6 +273,7 @@ function ResizeState(drawingObjectsController, drawingObjects, majorObject, card ...@@ -269,6 +273,7 @@ function ResizeState(drawingObjectsController, drawingObjects, majorObject, card
{ {
var resize_coefficients = this.majorObject.getResizeCoefficients(this.handleNum, x, y); var resize_coefficients = this.majorObject.getResizeCoefficients(this.handleNum, x, y);
this.drawingObjectsController.trackResizeObjects(resize_coefficients.kd1, resize_coefficients.kd2, e); this.drawingObjectsController.trackResizeObjects(resize_coefficients.kd1, resize_coefficients.kd2, e);
this.drawingObjects.selectGraphicObject();
this.drawingObjects.showOverlayGraphicObjects(); this.drawingObjects.showOverlayGraphicObjects();
}; };
...@@ -277,6 +282,7 @@ function ResizeState(drawingObjectsController, drawingObjects, majorObject, card ...@@ -277,6 +282,7 @@ function ResizeState(drawingObjectsController, drawingObjects, majorObject, card
{ {
this.drawingObjectsController.trackEnd(); this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects(); this.drawingObjectsController.clearTrackObjects();
this.drawingObjects.selectGraphicObject();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects)); this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
asc.editor.asc_endAddShape(); asc.editor.asc_endAddShape();
} }
...@@ -451,6 +457,7 @@ function MoveState(drawingObjectsController, drawingObjects, startX, startY, rec ...@@ -451,6 +457,7 @@ function MoveState(drawingObjectsController, drawingObjects, startX, startY, rec
var dy = y - this.startY; var dy = y - this.startY;
var check_position = this.drawingObjects.checkGraphicObjectPosition(this.rectX + dx, this.rectY + dy, this.rectW, this.rectH); 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.drawingObjectsController.trackMoveObjects(dx + check_position.x, dy + check_position.y);
this.drawingObjects.selectGraphicObject();
this.drawingObjects.showOverlayGraphicObjects(); this.drawingObjects.showOverlayGraphicObjects();
}; };
...@@ -458,6 +465,7 @@ function MoveState(drawingObjectsController, drawingObjects, startX, startY, rec ...@@ -458,6 +465,7 @@ function MoveState(drawingObjectsController, drawingObjects, startX, startY, rec
{ {
this.drawingObjectsController.trackEnd(); this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects(); this.drawingObjectsController.clearTrackObjects();
this.drawingObjects.selectGraphicObject();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects)); this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
asc.editor.asc_endAddShape(); asc.editor.asc_endAddShape();
} }
...@@ -503,6 +511,7 @@ function ChangeAdjState(drawingObjectsController, drawingObjects) ...@@ -503,6 +511,7 @@ function ChangeAdjState(drawingObjectsController, drawingObjects)
this.onMouseMove = function(e, x, y) this.onMouseMove = function(e, x, y)
{ {
this.drawingObjectsController.trackAdjObject(x, y); this.drawingObjectsController.trackAdjObject(x, y);
this.drawingObjects.selectGraphicObject();
this.drawingObjects.showOverlayGraphicObjects(); this.drawingObjects.showOverlayGraphicObjects();
}; };
...@@ -510,6 +519,7 @@ function ChangeAdjState(drawingObjectsController, drawingObjects) ...@@ -510,6 +519,7 @@ function ChangeAdjState(drawingObjectsController, drawingObjects)
{ {
this.drawingObjectsController.trackEnd(); this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects(); this.drawingObjectsController.clearTrackObjects();
this.drawingObjects.selectGraphicObject();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects)); this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
}; };
} }
...@@ -518,7 +528,10 @@ function ChangeAdjState(drawingObjectsController, drawingObjects) ...@@ -518,7 +528,10 @@ function ChangeAdjState(drawingObjectsController, drawingObjects)
function GroupState(drawingObjectsController, drawingObjects, group) function GroupState(drawingObjectsController, drawingObjects, group)
{ {
this.id = STATES_ID_GROUP; this.id = STATES_ID_GROUP;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.group = group; this.group = group;
this.onMouseDown = function(e, x, y) this.onMouseDown = function(e, x, y)
{ {
var group_selected_objects = this.group.selectedObjects; var group_selected_objects = this.group.selectedObjects;
...@@ -559,12 +572,26 @@ function GroupState(drawingObjectsController, drawingObjects, group) ...@@ -559,12 +572,26 @@ function GroupState(drawingObjectsController, drawingObjects, group)
return; return;
for(var j = 0; j < group_selected_objects.length; ++j) for(var j = 0; j < group_selected_objects.length; ++j)
{ {
this.drawingObjectsController.addPreTrackObject(group_selected_objects[j].createRotateInGroupTrack()) 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 PreRotateInGroupState(this.drawingObjectsController, this.drawingObjects, this.group, group_selected_objects[i]));
} }
return; 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;
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;
}
}
} }
for(i = group_selected_objects.length - 1; i > -1; --i) for(i = group_selected_objects.length - 1; i > -1; --i)
...@@ -580,6 +607,52 @@ function GroupState(drawingObjectsController, drawingObjects, group) ...@@ -580,6 +607,52 @@ function GroupState(drawingObjectsController, drawingObjects, group)
{}; {};
} }
function PreMoveInGroupState(drawingObjectsController, drawingObjects, group, startX, startY, shiftKey, ctrlKey, majorObject, majorObjectIsSelected)
{
this.id = STATES_ID_PRE_MOVE_IN_GROUP;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.group = group;
this.onMouseDown = function(e, x, y)
{
};
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))
};
this.onMouseUp = function(e, x, y)
{};
}
function MoveInGroupState(drawingObjectsController, drawingObjects, group)
{
this.id = STATES_ID_MOVE_IN_GROUP;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.group = group;
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 PreChangeAdjInGroupState(drawingObjectsController, drawingObjects, group) function PreChangeAdjInGroupState(drawingObjectsController, drawingObjects, group)
{ {
this.id = STATES_ID_PRE_CHANGE_ADJ_IN_GROUP; this.id = STATES_ID_PRE_CHANGE_ADJ_IN_GROUP;
...@@ -718,3 +791,6 @@ function ResizeInGroupState(drawingObjectsController, drawingObjects, group, maj ...@@ -718,3 +791,6 @@ function ResizeInGroupState(drawingObjectsController, drawingObjects, group, maj
...@@ -15,6 +15,51 @@ function MoveShapeImageTrack(originalObject) ...@@ -15,6 +15,51 @@ function MoveShapeImageTrack(originalObject)
this.overlayObject = new OverlayObject(this.originalObject.spPr.geometry, this.originalObject.extX, this.originalObject.extY, this.originalObject.brush, this.originalObject.pen, this.transform); 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()
{
return this.originalObject.getRectBounds();
};
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;
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.draw = function(overlay)
{
this.overlayObject.draw(overlay);
};
this.trackEnd = function()
{
this.originalObject.setPosition(this.x, this.y);
this.originalObject.recalculateTransform();
this.originalObject.updateDrawingBaseCoordinates();
};
}
function MoveShapeImageInGroupTrack(originalObject)
{
this.originalObject = originalObject;
this.transform = new CMatrix();
this.x = null;
this.y = null;
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.getOriginalBoundsRect = function()
{ {
return this.originalObject.getRectBounds(); return this.originalObject.getRectBounds();
......
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