Commit 0372830d authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47604 954022d7-b5bf-4e40-9824-e11837661b57
parent 196b6875
...@@ -44,6 +44,12 @@ DrawingObjectsController.prototype = ...@@ -44,6 +44,12 @@ DrawingObjectsController.prototype =
this.changeCurrentState(new NullState(this, this.drawingObjects)); this.changeCurrentState(new NullState(this, this.drawingObjects));
}, },
resetSelection: function()
{
while(this.selectedObjects.length > 0)
this.selectedObjects[0].deselect(this);
},
clearPreTrackObjects: function() clearPreTrackObjects: function()
{ {
this.arrPreTrackObjects.length = 0; this.arrPreTrackObjects.length = 0;
...@@ -105,6 +111,7 @@ DrawingObjectsController.prototype = ...@@ -105,6 +111,7 @@ DrawingObjectsController.prototype =
{ {
for(var i = 0; i < this.arrTrackObjects.length; ++i) for(var i = 0; i < this.arrTrackObjects.length; ++i)
this.arrTrackObjects[i].trackEnd(); this.arrTrackObjects[i].trackEnd();
this.drawingObjects.showDrawingObjects(true);
}, },
startTrackNewShape: function(presetGeom) startTrackNewShape: function(presetGeom)
......
...@@ -76,6 +76,12 @@ CGroupShape.prototypr = ...@@ -76,6 +76,12 @@ CGroupShape.prototypr =
}, },
updateDrawingBaseCoordinates: function()
{
if(isRealObject(this.drawingBase))
this.drawingBase.setGraphicObjectCoords();
},
setGroup: function(group) setGroup: function(group)
{ {
this.group = group; this.group = group;
......
...@@ -137,6 +137,12 @@ CImage.prototype = ...@@ -137,6 +137,12 @@ CImage.prototype =
this.spPr.xfrm.rot = rot; this.spPr.xfrm.rot = rot;
}, },
updateDrawingBaseCoordinates: function()
{
if(isRealObject(this.drawingBase))
this.drawingBase.setGraphicObjectCoords();
},
setImageId: function(imageId) setImageId: function(imageId)
{ {
this.blipFill.RasterImageId = imageId; this.blipFill.RasterImageId = imageId;
......
...@@ -22,8 +22,6 @@ function CShape(drawingBase) ...@@ -22,8 +22,6 @@ function CShape(drawingBase)
recalculatePen: true recalculatePen: true
}; };
this.x = null;
this.y = null;
this.x = null; this.x = null;
this.y = null; this.y = null;
this.extX = null; this.extX = null;
...@@ -106,6 +104,12 @@ CShape.prototype = ...@@ -106,6 +104,12 @@ CShape.prototype =
this.spPr.xfrm.offY = y; this.spPr.xfrm.offY = y;
}, },
updateDrawingBaseCoordinates: function()
{
if(isRealObject(this.drawingBase))
this.drawingBase.setGraphicObjectCoords();
},
setExtents: function(extX, extY) setExtents: function(extX, extY)
{ {
this.spPr.xfrm.extX = extX; this.spPr.xfrm.extX = extX;
...@@ -318,6 +322,14 @@ CShape.prototype = ...@@ -318,6 +322,14 @@ CShape.prototype =
this.pen = _calculated_line; this.pen = _calculated_line;
}, },
recalculateGeometry: function()
{
if(isRealObject(this.spPr.geometry))
{
this.spPr.geometry.Recalculate(this.extX, this.extY);
}
},
draw: function(graphics) draw: function(graphics)
{ {
graphics.SetIntegerGrid(false); graphics.SetIntegerGrid(false);
...@@ -463,10 +475,6 @@ CShape.prototype = ...@@ -463,10 +475,6 @@ CShape.prototype =
getRotateAngle: function(x, y) getRotateAngle: function(x, y)
{ {
var transform = this.getTransform(); var transform = this.getTransform();
var rotate_distance = 5;/*TODO*/ var rotate_distance = 5;/*TODO*/
var hc = this.extX*0.5; var hc = this.extX*0.5;
......
...@@ -110,13 +110,15 @@ function NullState(drawingObjectsController, drawingObjects) ...@@ -110,13 +110,15 @@ function NullState(drawingObjectsController, drawingObjects)
var hit_in_text_rect = cur_drawing.hitInTextRect(x, y); var hit_in_text_rect = cur_drawing.hitInTextRect(x, y);
if(hit_in_inner_area && !hit_in_text_rect || hit_in_path) if(hit_in_inner_area && !hit_in_text_rect || hit_in_path)
{ {
if(!cur_drawing.canMove()) var is_selected = cur_drawing.selected;
return; if(!(e.ctrlKey || e.shiftKey))
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
for(var j = 0; j < selected_objects.length; ++j) for(var j = 0; j < selected_objects.length; ++j)
{ {
this.drawingObjectsController.addPreTrackObject(selected_objects[j].createMoveTrack()); this.drawingObjectsController.addPreTrackObject(selected_objects[j].createMoveTrack());
} }
this.drawingObjectsController.changeCurrentState(new PreMoveState(this.drawingObjectsController, this.drawingObjects,x, y, e.shiftKey, e.ctrl, cur_drawing.isGroup() ? cur_drawing : null)); this.drawingObjectsController.changeCurrentState(new PreMoveState(this.drawingObjectsController, this.drawingObjects,x, y, e.shiftKey, e.ctrl, cur_drawing.isGroup() ? cur_drawing : null, is_selected));
return; return;
} }
else if(hit_in_text_rect) else if(hit_in_text_rect)
...@@ -130,6 +132,7 @@ function NullState(drawingObjectsController, drawingObjects) ...@@ -130,6 +132,7 @@ function NullState(drawingObjectsController, drawingObjects)
} }
} }
} }
this.drawingObjectsController.resetSelection();
}; };
this.onMouseMove = function(e, x, y) this.onMouseMove = function(e, x, y)
...@@ -185,6 +188,7 @@ function RotateState(drawingObjectsController, drawingObjects, majorObject) ...@@ -185,6 +188,7 @@ function RotateState(drawingObjectsController, drawingObjects, majorObject)
this.onMouseUp = function(e, x, y) this.onMouseUp = function(e, x, y)
{ {
this.drawingObjectsController.trackEnd(); this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
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();
} }
...@@ -236,6 +240,7 @@ function ResizeState(drawingObjectsController, drawingObjects, majorObject, card ...@@ -236,6 +240,7 @@ function ResizeState(drawingObjectsController, drawingObjects, majorObject, card
this.onMouseUp = function(e, x, y) this.onMouseUp = function(e, x, y)
{ {
this.drawingObjectsController.trackEnd(); this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
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();
} }
...@@ -310,6 +315,7 @@ function TrackNewShapeState(drawingObjectsController, drawingObjects) ...@@ -310,6 +315,7 @@ function TrackNewShapeState(drawingObjectsController, drawingObjects)
this.onMouseUp = function(e, x, y) this.onMouseUp = function(e, x, y)
{ {
this.drawingObjectsController.resetSelection();
this.drawingObjectsController.trackEnd(); this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects(); this.drawingObjectsController.clearTrackObjects();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects)); this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
...@@ -317,7 +323,7 @@ function TrackNewShapeState(drawingObjectsController, drawingObjects) ...@@ -317,7 +323,7 @@ function TrackNewShapeState(drawingObjectsController, drawingObjects)
} }
} }
function PreMoveState(drawingObjectsController, drawingObjects, startX, startY, shift, ctrl, group) function PreMoveState(drawingObjectsController, drawingObjects, startX, startY, shift, ctrl, group, majorObjectIsSelected)
{ {
this.id = STATES_ID_PRE_MOVE; this.id = STATES_ID_PRE_MOVE;
this.drawingObjectsController = drawingObjectsController; this.drawingObjectsController = drawingObjectsController;
...@@ -327,6 +333,7 @@ function PreMoveState(drawingObjectsController, drawingObjects, startX, startY, ...@@ -327,6 +333,7 @@ function PreMoveState(drawingObjectsController, drawingObjects, startX, startY,
this.shift = shift; this.shift = shift;
this.ctrl = ctrl; this.ctrl = ctrl;
this.group = group; this.group = group;
this.majorObjectIsSelected = majorObjectIsSelected;
this.onMouseDown = function(e, x, y) this.onMouseDown = function(e, x, y)
{ {
...@@ -418,6 +425,7 @@ function ChangeAdjState(drawingObjectsController, drawingObjects) ...@@ -418,6 +425,7 @@ function ChangeAdjState(drawingObjectsController, drawingObjects)
this.onMouseUp = function(e, x, y) this.onMouseUp = function(e, x, y)
{ {
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects(); this.drawingObjectsController.clearTrackObjects();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects)); this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
} }
......
...@@ -166,6 +166,7 @@ function XYAdjustmentTrack(originalShape, adjIndex) ...@@ -166,6 +166,7 @@ function XYAdjustmentTrack(originalShape, adjIndex)
this.trackEnd = function() this.trackEnd = function()
{ {
this.originalShape.setAdjustmentValue(this.refX, this.geometry.gdLst[this.adjastment.gdRefX], this.refY, this.geometry.gdLst[this.adjastment.gdRefY]); this.originalShape.setAdjustmentValue(this.refX, this.geometry.gdLst[this.adjastment.gdRefX], this.refY, this.geometry.gdLst[this.adjastment.gdRefY]);
this.originalShape.recalculateGeometry();
}; };
} }
......
...@@ -28,7 +28,7 @@ function MoveShapeImageTrack(originalObject) ...@@ -28,7 +28,7 @@ function MoveShapeImageTrack(originalObject)
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1); global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
if(original.flipV) if(original.flipV)
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1); global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
global_MatrixTransformer.RotateRadAppend(this.transform, original.rot); global_MatrixTransformer.RotateRadAppend(this.transform, -original.rot);
global_MatrixTransformer.TranslateAppend(this.transform, this.x + hc, this.y + vc); global_MatrixTransformer.TranslateAppend(this.transform, this.x + hc, this.y + vc);
}; };
...@@ -39,6 +39,8 @@ function MoveShapeImageTrack(originalObject) ...@@ -39,6 +39,8 @@ function MoveShapeImageTrack(originalObject)
this.trackEnd = function() this.trackEnd = function()
{ {
this.originalObject.setPosition(this.x, this.y);
this.originalObject.recalculateTransform();
this.originalObject.updateDrawingBaseCoordinates();
}; };
} }
\ No newline at end of file
...@@ -586,6 +586,10 @@ function ResizeTrackShapeImage(originalObject, cardDirection) ...@@ -586,6 +586,10 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
this.trackEnd = function() this.trackEnd = function()
{ {
//TODO this.originalObject.setPosition(this.resizedPosX, this.resizedPosY);
this.originalObject.setExtents(this.resizedExtX, this.resizedExtY);
this.originalObject.setFlips(this.resizedflipH, this.resizedflipV);
this.originalObject.recalculateTransform();
this.originalObject.updateDrawingBaseCoordinates();
}; };
} }
\ No newline at end of file
...@@ -96,7 +96,7 @@ function RotateTrackShapeImage(originalObject) ...@@ -96,7 +96,7 @@ function RotateTrackShapeImage(originalObject)
if(Math.abs(new_rot-1.5*Math.PI) < MIN_ANGLE) if(Math.abs(new_rot-1.5*Math.PI) < MIN_ANGLE)
new_rot = 1.5*Math.PI; new_rot = 1.5*Math.PI;
if(e.ShiftKey) if(e.shiftKey)
new_rot = (Math.PI/12)*Math.floor(12*new_rot/(Math.PI)); new_rot = (Math.PI/12)*Math.floor(12*new_rot/(Math.PI));
this.angle = new_rot; this.angle = new_rot;
...@@ -115,6 +115,7 @@ function RotateTrackShapeImage(originalObject) ...@@ -115,6 +115,7 @@ function RotateTrackShapeImage(originalObject)
this.trackEnd = function() this.trackEnd = function()
{ {
this.originalObject.setRotate(this.angle) this.originalObject.setRotate(this.angle);
this.originalObject.recalculateTransform();
} }
} }
\ No newline at end of file
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