Commit efcd5c87 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@47535 954022d7-b5bf-4e40-9824-e11837661b57
parent 53b9d5c5
......@@ -91,5 +91,28 @@ DrawingObjectsController.prototype =
{
for(var i = 0; i < this.arrTrackObjects.length; ++i)
this.arrTrackObjects[i].draw(overlay);
},
isPointInDrawingObjects: function(x, y)
{
var selected_objects = this.selectedObjects;
if(selected_objects.length === 1)
{
if(selected_objects[0].hitToAdjustment(x, y).hit)
return true;
}
for(var i = selected_objects.length - 1; i > -1; --i)
{
if(selected_objects[i].hitToHandles(x, y) > -1)
return true;
}
var arr_objects = [];//TODO
for(i = arr_objects.length - 1; i > -1; --i)
{
if(arr_objects[i].hit(x, y))
return true;
}
return false;
}
};
\ No newline at end of file
......@@ -18,6 +18,13 @@ function CGroupShape(drawingBase)
this.group = null;
this.recalcInfo =
{
recalculateTransform: true,
recalculateArrGraphicObjects: true
};
this.x = null;
this.y = null;
this.x = null;
......@@ -42,6 +49,26 @@ function CGroupShape(drawingBase)
CGroupShape.prototypr =
{
isShape: function()
{
return false;
},
isGroup: function()
{
return true;
},
isImage: function()
{
return false;
},
isChart: function()
{
return false;
},
setGroup: function(group)
{
this.group = group;
......@@ -83,12 +110,34 @@ CGroupShape.prototypr =
return this.group.getFullFlipH() ? !this.flipH : this.flipH;
},
getFullFlipV: function()
{
if(!isRealObject(this.group))
return this.flipH;
else
return this.group.getFullFlipH() ? !this.flipH : this.flipH;
},
getArrGraphicObjects: function()
{
if(this.recalcInfo.recalculateArrGraphicObjects)
this.recalculateArrGraphicObjects();
return this.arrGraphicObjects;
},
recalculateArrGraphicObjects: function()
{
this.arrGraphicObjects.length = 0;
for(var i = 0; i < this.spTree.length; ++i)
{
if(!this.spTree[i].isGroup())
this.arrGraphicObjects.push(this.spTree[i]);
else
{
var arr_graphic_objects = this.spTree.getArrGraphicObjects();
for(var j = 0; j < arr_graphic_objects.length; ++j)
this.arrGraphicObjects.push(arr_graphic_objects[i]);
}
}
}
};
\ No newline at end of file
......@@ -63,6 +63,27 @@ function CImage(drawingBase)
CImage.prototype =
{
isShape: function()
{
return false;
},
isGroup: function()
{
return false;
},
isImage: function()
{
return true;//TODO
},
isChart: function()
{
return false;/*TODO*/
},
init: function(x, y, extX, extY, imageId)
{
this.setPosition(x, y);
......@@ -384,11 +405,8 @@ CImage.prototype =
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
......@@ -46,6 +46,27 @@ function CShape(drawingBase)
CShape.prototype =
{
isShape: function()
{
return true;
},
isGroup: function()
{
return false;
},
isImage: function()
{
return false;
},
isChart: function()
{
return false;
},
initDefault: function(x, y, extX, extY, flipH, flipV, presetGeom)
{
this.setPosition(x, y);
......@@ -284,12 +305,6 @@ CShape.prototype =
return this.invertTransform;
},
getCardDirectionByNum: function(num)
{
return CARD_DIRECTION_N;
},
getFullFlipH: function()
{
if(!isRealObject(this.group))
......@@ -307,12 +322,61 @@ CShape.prototype =
return this.group.getFullFlipH() ? !this.flipH : this.flipH;
},
getNumByCardDirection: function(cardDirection)
getCardDirectionByNum: function(num)
{
//TODO
return 1;
var num_north = this.getNumByCardDirection(CARD_DIRECTION_N);
var full_flip_h = this.getFullFlipH();
var full_flip_v = this.getFullFlipV();
var same_flip = !full_flip_h && !full_flip_v || full_flip_h && full_flip_v;
if(same_flip)
return ((num - num_north) + CARD_DIRECTION_N + 8)%8;
return (CARD_DIRECTION_N - (num - num_north)+ 8)%8;
},
getNumByCardDirection: function(cardDirection)
{
var hc = this.extX*0.5;
var vc = this.extY*0.5;
var transform = this.getTransform();
var y1, y3, y5, y7;
y1 = transform.TransformPointY(hc, 0);
y3 = transform.TransformPointY(this.extX, vc);
y5 = transform.TransformPointY(hc, this.extY);
y7 = transform.TransformPointY(0, vc);
var north_number;
var full_flip_h = this.getFullFlipH();
var full_flip_v = this.getFullFlipV();
switch(Math.min(y1, y3, y5, y7))
{
case y1:
{
north_number = !full_flip_v ? 1 : 5;
break;
}
case y3:
{
north_number = !full_flip_h ? 3 : 7;
break;
}
case y5:
{
north_number = !full_flip_v ? 5 : 1;
break;
}
default:
{
north_number = !full_flip_h ? 7 : 3;
break;
}
}
var same_flip = !full_flip_h && !full_flip_v || full_flip_h && full_flip_v;
if(same_flip)
return (north_number + cardDirection)%8;
return (north_number - cardDirection + 8)%8;
},
hitToAdjustment: function(x, y)
{
......@@ -385,6 +449,36 @@ CShape.prototype =
},
hit: function(x, y)
{
return this.hitInInnerArea(x, y) || this.hitInPath(x, y) || this.hitInTextRect(x, y);
},
hitInPath: function(x, y)
{
var invert_transform = this.getInvertTransform();
var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y);
if(isRealObject(this.spPr.geometry))
return this.spPr.geometry.hitInPath({}, x_t, y_t);
return false;
},
hitInInnerArea: function(x, y)
{
var invert_transform = this.getInvertTransform();
var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y);
if(isRealObject(this.spPr.geometry))
return this.spPr.geometry.hitInInnerArea({}, x_t, y_t);
return x_t > 0 && x_t < this.extX && y_t > 0 && y_t < this.extY;
},
hitInTextRect: function(x, y)
{
return false;
},
canRotate: function()
{
return true;
......@@ -404,4 +498,5 @@ CShape.prototype =
{
return new ResizeTrackShapeImage(this, cardDirection);
}
};
\ No newline at end of file
......@@ -157,7 +157,7 @@ function PreResizeState(drawingObjectsController, drawingObjects, majorObject, c
function ResizeState(drawingObjectsController, drawingObjects, majorObject, cardDirection)
{
this.id = STATES_ID_PRE_RESIZE;
this.id = STATES_ID_RESIZE;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.majorObject = majorObject;
......@@ -246,6 +246,8 @@ function TrackNewShapeState(drawingObjectsController, drawingObjects)
this.onMouseUp = function(e, x, y)
{
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
}
}
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