Commit 0372830d 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@47604 954022d7-b5bf-4e40-9824-e11837661b57
parent 196b6875
......@@ -44,6 +44,12 @@ DrawingObjectsController.prototype =
this.changeCurrentState(new NullState(this, this.drawingObjects));
},
resetSelection: function()
{
while(this.selectedObjects.length > 0)
this.selectedObjects[0].deselect(this);
},
clearPreTrackObjects: function()
{
this.arrPreTrackObjects.length = 0;
......@@ -105,6 +111,7 @@ DrawingObjectsController.prototype =
{
for(var i = 0; i < this.arrTrackObjects.length; ++i)
this.arrTrackObjects[i].trackEnd();
this.drawingObjects.showDrawingObjects(true);
},
startTrackNewShape: function(presetGeom)
......
......@@ -76,6 +76,12 @@ CGroupShape.prototypr =
},
updateDrawingBaseCoordinates: function()
{
if(isRealObject(this.drawingBase))
this.drawingBase.setGraphicObjectCoords();
},
setGroup: function(group)
{
this.group = group;
......
......@@ -137,6 +137,12 @@ CImage.prototype =
this.spPr.xfrm.rot = rot;
},
updateDrawingBaseCoordinates: function()
{
if(isRealObject(this.drawingBase))
this.drawingBase.setGraphicObjectCoords();
},
setImageId: function(imageId)
{
this.blipFill.RasterImageId = imageId;
......
......@@ -22,8 +22,6 @@ function CShape(drawingBase)
recalculatePen: true
};
this.x = null;
this.y = null;
this.x = null;
this.y = null;
this.extX = null;
......@@ -106,6 +104,12 @@ CShape.prototype =
this.spPr.xfrm.offY = y;
},
updateDrawingBaseCoordinates: function()
{
if(isRealObject(this.drawingBase))
this.drawingBase.setGraphicObjectCoords();
},
setExtents: function(extX, extY)
{
this.spPr.xfrm.extX = extX;
......@@ -318,6 +322,14 @@ CShape.prototype =
this.pen = _calculated_line;
},
recalculateGeometry: function()
{
if(isRealObject(this.spPr.geometry))
{
this.spPr.geometry.Recalculate(this.extX, this.extY);
}
},
draw: function(graphics)
{
graphics.SetIntegerGrid(false);
......@@ -463,10 +475,6 @@ CShape.prototype =
getRotateAngle: function(x, y)
{
var transform = this.getTransform();
var rotate_distance = 5;/*TODO*/
var hc = this.extX*0.5;
......
......@@ -110,13 +110,15 @@ function NullState(drawingObjectsController, drawingObjects)
var hit_in_text_rect = cur_drawing.hitInTextRect(x, y);
if(hit_in_inner_area && !hit_in_text_rect || hit_in_path)
{
if(!cur_drawing.canMove())
return;
var is_selected = cur_drawing.selected;
if(!(e.ctrlKey || e.shiftKey))
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
for(var j = 0; j < selected_objects.length; ++j)
{
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;
}
else if(hit_in_text_rect)
......@@ -130,6 +132,7 @@ function NullState(drawingObjectsController, drawingObjects)
}
}
}
this.drawingObjectsController.resetSelection();
};
this.onMouseMove = function(e, x, y)
......@@ -185,6 +188,7 @@ function RotateState(drawingObjectsController, drawingObjects, majorObject)
this.onMouseUp = function(e, x, y)
{
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
asc.editor.asc_endAddShape();
}
......@@ -236,6 +240,7 @@ function ResizeState(drawingObjectsController, drawingObjects, majorObject, card
this.onMouseUp = function(e, x, y)
{
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
asc.editor.asc_endAddShape();
}
......@@ -310,6 +315,7 @@ function TrackNewShapeState(drawingObjectsController, drawingObjects)
this.onMouseUp = function(e, x, y)
{
this.drawingObjectsController.resetSelection();
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.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.drawingObjectsController = drawingObjectsController;
......@@ -327,6 +333,7 @@ function PreMoveState(drawingObjectsController, drawingObjects, startX, startY,
this.shift = shift;
this.ctrl = ctrl;
this.group = group;
this.majorObjectIsSelected = majorObjectIsSelected;
this.onMouseDown = function(e, x, y)
{
......@@ -418,6 +425,7 @@ function ChangeAdjState(drawingObjectsController, drawingObjects)
this.onMouseUp = function(e, x, y)
{
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
}
......
......@@ -166,6 +166,7 @@ function XYAdjustmentTrack(originalShape, adjIndex)
this.trackEnd = function()
{
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)
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.RotateRadAppend(this.transform, -original.rot);
global_MatrixTransformer.TranslateAppend(this.transform, this.x + hc, this.y + vc);
};
......@@ -39,6 +39,8 @@ function MoveShapeImageTrack(originalObject)
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)
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)
if(Math.abs(new_rot-1.5*Math.PI) < MIN_ANGLE)
new_rot = 1.5*Math.PI;
if(e.ShiftKey)
if(e.shiftKey)
new_rot = (Math.PI/12)*Math.floor(12*new_rot/(Math.PI));
this.angle = new_rot;
......@@ -115,6 +115,7 @@ function RotateTrackShapeImage(originalObject)
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