Commit c77edbfe 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@47492 954022d7-b5bf-4e40-9824-e11837661b57
parent 06cc9fa8
......@@ -10,10 +10,18 @@ function DrawingObjectsController(drawingObjects)
this.drawingObjects = drawingObjects;
this.curState = new NullState(this, drawingObjects);
this.selectedObjects = [];
this.arrPreTrackObjects = [];
this.arrTrackObjects = [];
}
DrawingObjectsController.prototype =
{
changeCurrentState: function(newState)
{
this.curState = newState;
},
onMouseDown: function(e, x, y)
{
this.curState.onMouseDown(e, x, y);
......@@ -27,5 +35,45 @@ DrawingObjectsController.prototype =
onMouseUp: function(e, x, y)
{
this.curState.onMouseUp(e, x, y);
},
clearPreTrackObjects: function()
{
this.arrPreTrackObjects.length = 0;
},
addPreTrackObject: function(preTrackObject)
{
this.arrPreTrackObjects.push(preTrackObject);
},
clearTrackObjects: function()
{
this.arrTrackObjects.length = 0;
},
addTrackObject: function(trackObject)
{
this.arrTrackObjects.push(trackObject);
},
swapTrackObjects: function()
{
this.clearTrackObjects();
for(var i = 0; i < this.arrPreTrackObjects.length; ++i)
this.addTrackObject(this.arrPreTrackObjects[i]);
this.clearPreTrackObjects();
},
rotateTrackObjects: function(angle, e)
{
for(var i = 0; i < this.arrTrackObjects.length; ++i)
this.arrTrackObjects[i].track(angle, e);
},
trackEnd: function()
{
for(var i = 0; i < this.arrTrackObjects.length; ++i)
this.arrTrackObjects[i].trackEnd();
}
};
\ No newline at end of file
/**
* Created with JetBrains WebStorm.
* User: Sergey.Luzyanin
* Date: 6/27/13
* Time: 12:06 PM
* To change this template use File | Settings | File Templates.
*/
function CGroupShape(drawingBase)
{
this.drawingBase = drawingBase;
this.nvSpPr = null;
this.spPr = new CSpPr();
this.spTree = [];
this.arrGraphicObjects = [];
this.selectedObjects = [];
this.group = null;
this.x = null;
this.y = null;
this.x = null;
this.y = null;
this.extX = null;
this.extY = null;
this.rot = null;
this.flipH = null;
this.flipV = null;
this.transform = null;
this.invertTransform = null;
this.transformText = null;
this.invertTransformText = null;
this.cursorTypes = [];
this.brush = null;
this.pen = null;
this.selected = false;
}
CGroupShape.prototypr =
{
setGroup: function(group)
{
this.group = group;
},
getMainGroup: function()
{
if(!isRealObject(this.group))
return this;
return this.group.getMainGroup();
}
};
\ No newline at end of file
......@@ -5,6 +5,24 @@
* Time: 6:24 PM
* To change this template use File | Settings | File Templates.
*/
var MIN_SHAPE_DIST = 5.08;
var CARD_DIRECTION_N = 0;
var CARD_DIRECTION_NE = 1;
var CARD_DIRECTION_E = 2;
var CARD_DIRECTION_SE = 3;
var CARD_DIRECTION_S = 4;
var CARD_DIRECTION_SW = 5;
var CARD_DIRECTION_W = 6;
var CARD_DIRECTION_NW = 7;
function isRealNumber(number)
{
return number === number && typeof number === "number";
}
function CImage(drawingBase)
{
this.drawingBase = drawingBase;
......@@ -14,6 +32,8 @@ function CImage(drawingBase)
this.nvSpPr = null;
this.style = null;
this.group = null;
this.x = null;
this.y = null;
this.x = null;
......@@ -23,10 +43,18 @@ function CImage(drawingBase)
this.rot = null;
this.flipH = null;
this.flipV = null;
this.transform = null;
this.transform = new CMatrix();
this.invertTransform = null;
this.cursorTypes = [];
this.recalcInfo =
{
recalculateTransform: true,
recalculateGeometry: true,
recalculateBrush: true
};
this.brush = null;
this.pen = null;
......@@ -35,5 +63,272 @@ function CImage(drawingBase)
CImage.prototype =
{
init: function(x, y, extX, extY, imageId)
{
this.setPosition(x, y);
this.setExtents(extX, extY);
this.setImageId(imageId);
this.setPresetGeometry("rect");
this.recalculate();
},
setPresetGeometry: function(preset)
{
this.spPr.geometry = CreateGeometry(preset);
},
setPosition: function(x, y)
{
this.spPr.xfrm.offX = x;
this.spPr.xfrm.offY = y;
},
setExtents: function(extX, extY)
{
this.spPr.xfrm.extX = extX;
this.spPr.xfrm.extY = extY;
},
setFlips: function(flipH, flipV)
{
this.spPr.xfrm.flipH = flipH;
this.spPr.xfrm.flipV = flipV;
},
setRotate: function(rot)
{
this.spPr.xfrm.rot = rot;
},
setImageId: function(imageId)
{
this.blipFill.RasterImageId = imageId;
},
recalculate: function()
{
if(this.recalcInfo.recalculateTransform)
this.recalculateTransform();
},
recalculateTransform: function()
{
var xfrm = this.spPr.xfrm;
if(!isRealObject(this.group))
{
this.x = xfrm.offX;
this.y = xfrm.offY;
this.extX = xfrm.extX;
this.extY = xfrm.extY;
this.rot = isRealNumber(xfrm.rot) ? xfrm.rot : 0;
this.flipH = xfrm.flipH === true;
this.flipV = xfrm.flipV === true;
}
else
{
//TODO
this.x = xfrm.offX;
this.y = xfrm.offY;
this.extX = xfrm.extX;
this.extY = xfrm.extY;
this.rot = isRealNumber(xfrm.rot) ? xfrm.rot : 0;
this.flipH = xfrm.flipH === true;
this.flipV = xfrm.flipV === true;
}
this.transform.Reset();
var hc, vc;
hc = this.extX*0.5;
vc = this.extY*0.5;
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
if(this.flipH)
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
if(this.flipV)
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
global_MatrixTransformer.RotateAppend(this.transform, -this.rot);
global_MatrixTransformer.TranslateAppend(this.transform, this.x + hc, this.y + vc);
if(isRealObject(this.group))
{
global_MatrixTransformer.MultiplyAppend(t, this.group.getTransform());
}
},
getTransform: function()
{
if(this.recalcInfo.recalculateTransform)
this.recalculateTransform();
return this.transform;
},
getInvertTransform: function()
{
if(this.recalcInfo.recalculateTransform)
this.recalculateTransform();
return this.invertTransform;
},
getCardDirectionByNum: function(num)
{
//TODO
return CARD_DIRECTION_N;
},
getNumByCardDirection: function(cardDirection)
{
//TODO
return 1;
},
setGroup: function(group)
{
this.group = group;
},
select: function(drawingObjectsController)
{
this.selected = true;
var selected_objects;
if(!isRealObject(this.group))
selected_objects = drawingObjectsController.selectedObjects;
else
selected_objects = this.group.getMainGroup().selectedObjects;
for(var i = 0; i < selected_objects.length; ++i)
{
if(selected_objects[i] === this)
break;
}
if(i === selected_objects.length)
selected_objects.push(this);
},
deselect: function(drawingObjectsController)
{
this.selected = false;
var selected_objects;
if(!isRealObject(this.group))
selected_objects = drawingObjectsController.selectedObjects;
else
selected_objects = this.group.getMainGroup().selectedObjects;
for(var i = 0; i < selected_objects.length; ++i)
{
if(selected_objects[i] === this)
{
selected_objects.splice(i, 1);
break;
}
}
},
hitToAdjustment: function(x, y)
{
return {hit: false, adjPolarFlag: null, adjNum: null};
},
hitToHandles: function(x, y)
{
var invert_transform = this.getInvertTransform();
var t_x, t_y;
t_x = invert_transform.TransformPointX(x, y);
t_y = invert_transform.TransformPointY(x, y);
var radius = 5;/*TODO*/
var sqr_x = t_x*t_y, sqr_y = t_y*t_y;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 0;
var hc = this.extX*0.5;
var dist_x = t_x - hc;
sqr_x = dist_x*dist_x;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 1;
dist_x = t_x - this.extX;
sqr_x = dist_x*dist_x;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 2;
var vc = this.extY*0.5;
var dist_y = t_y - vc;
sqr_y = dist_y*dist_y;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 3;
dist_y = t_y - this.extY;
sqr_y = dist_y*dist_y;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 4;
dist_x = t_x - hc;
sqr_x = dist_x*dist_x;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 5;
dist_x = t_x;
sqr_x = dist_x*dist_x;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 6;
dist_y = t_y - vc;
sqr_y = dist_y*dist_y;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 7;
var rotate_distance = 5;/*TODO*/
dist_y = t_y - rotate_distance;
sqr_y = dist_y*dist_y;
dist_x = t_x - hc;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 8;
return -1;
},
canRotate: function()
{
return !this.isChart(); //TODO
},
canResize: function()
{
return true;//TODO
},
createRotateTrack: function()
{
return new RotateTrackShapeImage(this);
},
createResizeTrack: function(cardDirection)
{
return new ResizeTrackShapeImage(this, cardDirection);
},
getRotateAngle: function(x, y)
{
var transform = this.getTransform();
var rotate_distance = 5;/*TODO*/
var hc = this.extX*0.5;
var vc = this.extY*0.5;
var xc_t = transform.TransformPointX(hc, vc);
var yc_t = transform.TransformPointY(hc, vc);
var rot_x_t = transform.TransformPointX(hc, - rotate_distance);
var rot_y_t = transform.TransformPointY(hc, - rotate_distance);
var v1_x, v1_y, v2_x, v2_y;
v1_x = x - xc_t;
v1_y = y - yc_t;
v2_x = rot_x_t - xc_t;
v2_y = rot_y_t - yc_t;
return Math.atan2( Math.abs(v1_x*v2_y - v1_y*v2_x), v1_x*v2_x + v1_y*v2_y);
},
isChart: function()
{
return false;/*TODO*/
}
};
\ No newline at end of file
......@@ -13,6 +13,8 @@ function CShape(drawingBase)
this.style = null;
this.txBody = null;
this.group = null;
this.x = null;
this.y = null;
this.x = null;
......@@ -43,8 +45,189 @@ CShape.prototype =
initDefaultTextRect: function()
{},
setGroup: function(group)
{
this.group = group;
},
setPosition: function(x, y)
{
this.spPr.xfrm.offX = x;
this.spPr.xfrm.offY = y;
},
setExtents: function(extX, extY)
{
this.spPr.xfrm.extX = extX;
this.spPr.xfrm.extY = extY;
},
setFlips: function(flipH, flipV)
{
this.spPr.xfrm.flipH = flipH;
this.spPr.xfrm.flipV = flipV;
},
setRotate: function(rot)
{
this.spPr.xfrm.rot = rot;
},
select: function(drawingObjectsController)
{
this.selected = true;
var selected_objects;
if(!isRealObject(this.group))
selected_objects = drawingObjectsController.selectedObjects;
else
selected_objects = this.group.getMainGroup().selectedObjects;
for(var i = 0; i < selected_objects.length; ++i)
{
if(selected_objects[i] === this)
break;
}
if(i === selected_objects.length)
selected_objects.push(this);
},
deselect: function(drawingObjectsController)
{
this.selected = false;
var selected_objects;
if(!isRealObject(this.group))
selected_objects = drawingObjectsController.selectedObjects;
else
selected_objects = this.group.getMainGroup().selectedObjects;
for(var i = 0; i < selected_objects.length; ++i)
{
if(selected_objects[i] === this)
{
selected_objects.splice(i, 1);
break;
}
}
},
recalculateBrush: function()
{
},
getTransform: function()
{
if(this.recalcInfo.recalculateTransform)
this.recalculateTransform();
return this.transform;
},
getInvertTransform: function()
{
if(this.recalcInfo.recalculateTransform)
this.recalculateTransform();
return this.invertTransform;
},
getCardDirectionByNum: function(num)
{
//TODO
return CARD_DIRECTION_N;
},
getNumByCardDirection: function(cardDirection)
{
//TODO
return 1;
},
hitToAdjustment: function(x, y)
{
var invert_transform = this.getInvertTransform();
var t_x, t_y;
t_x = invert_transform.TransformPointX(x, y);
t_y = invert_transform.TransformPointY(x, y);
if(isRealObject(this.spPr.geometry))
return this.spPr.recalculateGeometry.hitToAdj(t_x, t_y, /*TODO*/ 5);
return {hit: false, adjPolarFlag: null, adjNum: null};
},
hitToHandles: function(x, y)
{
var invert_transform = this.getInvertTransform();
var t_x, t_y;
t_x = invert_transform.TransformPointX(x, y);
t_y = invert_transform.TransformPointY(x, y);
var radius = 5;/*TODO*/
var sqr_x = t_x*t_y, sqr_y = t_y*t_y;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 0;
var hc = this.extX*0.5;
var dist_x = t_x - hc;
sqr_x = dist_x*dist_x;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 1;
dist_x = t_x - this.extX;
sqr_x = dist_x*dist_x;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 2;
var vc = this.extY*0.5;
var dist_y = t_y - vc;
sqr_y = dist_y*dist_y;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 3;
dist_y = t_y - this.extY;
sqr_y = dist_y*dist_y;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 4;
dist_x = t_x - hc;
sqr_x = dist_x*dist_x;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 5;
dist_x = t_x;
sqr_x = dist_x*dist_x;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 6;
dist_y = t_y - vc;
sqr_y = dist_y*dist_y;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 7;
var rotate_distance = 5;/*TODO*/
dist_y = t_y - rotate_distance;
sqr_y = dist_y*dist_y;
dist_x = t_x - hc;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 8;
return -1;
},
canRotate: function()
{
return true;
},
canResize: function()
{
return true;//TODO
},
createRotateTrack: function()
{
return new RotateTrackShapeImage(this);
},
createResizeTrack: function(cardDirection)
{
return new ResizeTrackShapeImage(this, cardDirection);
}
};
\ No newline at end of file
......@@ -7,17 +7,171 @@
*/
var STATES_ID_NULL = 0x00;
var STATES_ID_PRE_ROTATE = 0x01;
var STATES_ID_ROTATE = 0x02;
var STATES_ID_PRE_RESIZE = 0x03;
var STATES_ID_RESIZE = 0x04;
function NullState(drawingObjectsController, drawingObjects)
{
this.id = STATES_ID_NULL;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.onMouseDown = function(e, x, y)
{};
{
var selected_objects = this.drawingObjectsController.selectedObjects;
if(selected_objects.length === 1)
{
var hit_to_adj = selected_objects[0].hitToAdjustment(x, y);
if(hit_to_adj.hit)
{
//TODO
}
}
for(var i = selected_objects.length - 1; i > -1; --i)
{
var hit_to_handles = selected_objects[i].hitToHandles(x, y);
if(hit_to_handles > -1)
{
if(hit_to_handles === 8)
{
if(!selected_objects[i].canRotate())
return;
this.drawingObjectsController.clearPreTrackObjects();
for(var j = 0; j < selected_objects.length; ++j)
{
if(selected_objects[j].canRotate())
{
this.drawingObjectsController.addPreTrackObject(selected_objects[j].createRotateTrack());
}
}
this.drawingObjectsController.changeCurrentState(new PreRotateState(this.drawingObjectsController, this.drawingObjects, selected_objects[i]));
}
else
{
if(!selected_objects[i].canResize())
return;
this.drawingObjectsController.clearPreTrackObjects();
var card_direction = selected_objects[i].getCardDirectionByNum(hit_to_handles);
for(var j = 0; j < selected_objects.length; ++j)
{
if(selected_objects[j].canResize())
this.drawingObjectsController.addPreTrackObject(selected_objects[j].createResizeTrack(card_direction));
}
this.drawingObjectsController.changeCurrentState(new PreResizeState(this.drawingObjectsController, this.drawingObjects, selected_objects[i], card_direction))
}
return;
}
}
var arr_drawing_objects = [];
for(i = arr_drawing_objects.length-1; i > -1; ++i)
{
var cur_drawing_object = arr_drawing_objects[i];
}
};
this.onMouseMove = function(e, x, y)
{};
this.onMouseUp = function(e, x, y)
{}
}
function PreRotateState(drawingObjectsController, drawingObjects, majorObject)
{
this.id = STATES_ID_PRE_ROTATE;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.majorObject = majorObject;
this.onMouseDown = function(e, x, y)
{
};
this.onMouseMove = function(e, x, y)
{
this.drawingObjectsController.swapTrackObjects();
this.drawingObjectsController.changeCurrentState(new RotateState(this.drawingObjectsController, this.drawingObjects, this.majorObject));
};
this.onMouseUp = function(e, x, y)
{
this.drawingObjectsController.clearPreTrackObjects();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
}
}
function RotateState(drawingObjectsController, drawingObjects, majorObject)
{
this.id = STATES_ID_ROTATE;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.majorObject = majorObject;
this.onMouseDown = function(e, x, y)
{};
this.onMouseMove = function(e, x, y)
{
var angle = this.majorObject.getRotateAngle(x, y);
this.drawingObjectsController.rotateTrackObjects(angle, e);
};
this.onMouseUp = function(e, x, y)
{
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
}
}
function PreResizeState(drawingObjectsController, drawingObjects, majorObject, cardDirection)
{
this.id = STATES_ID_PRE_RESIZE;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.majorObject = majorObject;
this.cardDirection = cardDirection;
this.onMouseDown = function(e, x, y)
{};
this.onMouseMove = function(e, x, y)
{
this.drawingObjectsController.swapTrackObjects();
this.drawingObjectsController.changeCurrentState(new ResizeState(this.drawingObjectsController, this.drawingObjects, this.majorObject, this.cardDirection))
};
this.onMouseUp = function(e, x, y)
{
this.drawingObjectsController.clearPreTrackObjects();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
}
}
function ResizeState(drawingObjectsController, drawingObjects, majorObject, cardDirection)
{
this.id = STATES_ID_PRE_RESIZE;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.majorObject = majorObject;
this.cardDirection = cardDirection;
this.onMouseDown = function(e, x, y)
{};
this.onMouseMove = function(e, x, y)
{
//TODO
};
this.onMouseUp = function(e, x, y)
{
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
}
}
\ No newline at end of file
/**
* Created with JetBrains WebStorm.
* User: Sergey.Luzyanin
* Date: 6/27/13
* Time: 4:35 PM
* To change this template use File | Settings | File Templates.
*/
function ResizeTrackShapeImage(originalObject, cardDirection)
{
this.originalObject = originalObject;
this.cardDirection = cardDirection;
this.transform = new CMatrix();
this.x = originalObject.x;
this.y = originalObject.y;
this.extX = originalObject.extX;
this.extY = originalObject.extY;
this.flipH = originalObject.flipH;
this.flipV = originalObject.flipV;
this.geometry = originalObject.spPr.geometry.createDuplicate();
this.overlayObject = new OverlayObject(this.geometry, this.extX, this.extY, originalObject.brush, originalObject.pen, this.transform);
this.track = function(kd1, kd2, e)
{
//TODO
};
this.draw = function(overlay)
{
this.overlayObject.draw(overlay);
};
this.trackEnd = function()
{
this.originalObject.setPosition(this.x, this.y);
this.originalObject.setExtents(this.extX, this.extY);
this.originalObject.setFlips(this.flipH, this.flipV);
}
}
\ No newline at end of file
/**
* Created with JetBrains WebStorm.
* User: Sergey.Luzyanin
* Date: 6/27/13
* Time: 3:29 PM
* To change this template use File | Settings | File Templates.
*/
var MIN_SHAPE_SIZE = 1.27;//размер меньше которого нельзя уменшить автофигуру или картинку по горизонтали или вертикали
var MIN_SHAPE_SIZE_DIV2 = MIN_SHAPE_SIZE/2.0;
var MIN_ANGLE = 0.07;
function OverlayObject(geometry, extX, extY, brush, pen, transform)
//({check_bounds: function(){},brush: this.originalShape.brush, pen: this.originalShape.pen, ext:{cx:this.originalShape.absExtX, cy:this.originalShape.absExtY}, geometry: this.geometry, TransformMatrix: this.originalShape.transform})
{
this.geometry = geometry;
this.ext = {};
this.ext.cx = extX;
this.ext.cy = extY;
this.brush = brush;
this.pen = pen;
this.TransformMatrix = transform;
this.shapeDrawer = new CShapeDrawer();
this.updateTransform = function(extX, extY, transform)
{
this.ext.cx = extX;
this.ext.cy = extY;
this.transform = transform;
};
this.updateExtents = function(extX, extY)
{
this.ext.cx = extX;
this.ext.cy = extY;
};
this.draw = function(overlay)
{
overlay.SaveGrState();
overlay.SetIntegerGrid(false);
overlay.transform3(this.transform, false);
this.shapeDrawer.fromShape(this, overlay);
this.shapeDrawer.draw(this.spPr.geometry);
overlay.RestoreGrState();
};
this.check_bounds = function(boundsChecker)
{
if(this.geometry)
{
this.geometry.check_bounds(boundsChecker);
}
else
{
boundsChecker._s();
boundsChecker._m(0, 0);
boundsChecker._l(this.ext.cx, 0);
boundsChecker._l(this.ext.cx, this.ext.cy);
boundsChecker._l(0, this.ext.cy);
boundsChecker._z();
boundsChecker._e();
}
}
}
function RotateTrackShapeImage(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;
};
this.trackEnd = function()
{
this.originalObject.setRotate(this.angle)
}
}
\ 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