Commit 3022501b 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@53359 954022d7-b5bf-4e40-9824-e11837661b57
parent 2556039f
...@@ -3370,14 +3370,6 @@ function MoveState(drawingObjectsController, drawingObjects, startX, startY, rec ...@@ -3370,14 +3370,6 @@ function MoveState(drawingObjectsController, drawingObjects, startX, startY, rec
var dx = x - this.startX; var dx = x - this.startX;
var dy = y - this.startY; var dy = y - this.startY;
var shiftX = 0, shiftY = 0; var shiftX = 0, shiftY = 0;
if(!e.ShiftKey)
{
}
else
{
}
this.drawingObjectsController.trackMoveObjects(dx, dy); this.drawingObjectsController.trackMoveObjects(dx, dy);
this.drawingObjects.OnUpdateOverlay(); this.drawingObjects.OnUpdateOverlay();
}; };
......
...@@ -84,6 +84,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY) ...@@ -84,6 +84,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
pen.Fill.calculate(theme, drawingObjects, drawingObjects.Layout, drawingObjects.Layout.Master, RGBA); pen.Fill.calculate(theme, drawingObjects, drawingObjects.Layout, drawingObjects.Layout.Master, RGBA);
brush.calculate(theme, drawingObjects, drawingObjects.Layout, drawingObjects.Layout.Master, RGBA); brush.calculate(theme, drawingObjects, drawingObjects.Layout, drawingObjects.Layout.Master, RGBA);
this.isLine = this.presetGeom === "line";
this.overlayObject = new OverlayObject(geometry, 5, 5, brush, pen, this.transform); this.overlayObject = new OverlayObject(geometry, 5, 5, brush, pen, this.transform);
this.shape = null; this.shape = null;
...@@ -93,7 +94,19 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY) ...@@ -93,7 +94,19 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
var abs_dist_x = Math.abs(real_dist_x); var abs_dist_x = Math.abs(real_dist_x);
var real_dist_y = y - this.startY; var real_dist_y = y - this.startY;
var abs_dist_y = Math.abs(real_dist_y); var abs_dist_y = Math.abs(real_dist_y);
this.flipH = false;
this.flipV = false;
if(this.isLine)
{
if(x < this.startX)
{
this.flipH = true;
}
if(y < this.startY)
{
this.flipV = true;
}
}
if(!(e.CtrlKey || e.ShiftKey)) if(!(e.CtrlKey || e.ShiftKey))
{ {
if(real_dist_x >= 0) if(real_dist_x >= 0)
...@@ -102,7 +115,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY) ...@@ -102,7 +115,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
} }
else else
{ {
this.x = abs_dist_x >= MIN_SHAPE_SIZE ? x : this.startX - MIN_SHAPE_SIZE; this.x = abs_dist_x >= MIN_SHAPE_SIZE || this.isLine ? x : this.startX - MIN_SHAPE_SIZE;
} }
if(real_dist_y >= 0) if(real_dist_y >= 0)
...@@ -111,7 +124,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY) ...@@ -111,7 +124,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
} }
else else
{ {
this.y = abs_dist_y >= MIN_SHAPE_SIZE ? y : this.startY - MIN_SHAPE_SIZE; this.y = abs_dist_y >= MIN_SHAPE_SIZE || this.isLine ? y : this.startY - MIN_SHAPE_SIZE;
} }
this.extX = abs_dist_x >= MIN_SHAPE_SIZE ? abs_dist_x : MIN_SHAPE_SIZE; this.extX = abs_dist_x >= MIN_SHAPE_SIZE ? abs_dist_x : MIN_SHAPE_SIZE;
...@@ -120,7 +133,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY) ...@@ -120,7 +133,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
} }
else if(e.CtrlKey && !e.ShiftKey) else if(e.CtrlKey && !e.ShiftKey)
{ {
if(abs_dist_x >= MIN_SHAPE_SIZE_DIV2) if(abs_dist_x >= MIN_SHAPE_SIZE_DIV2 || this.isLine)
{ {
this.x = this.startX - abs_dist_x; this.x = this.startX - abs_dist_x;
this.extX = 2*abs_dist_x; this.extX = 2*abs_dist_x;
...@@ -131,7 +144,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY) ...@@ -131,7 +144,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
this.extX = MIN_SHAPE_SIZE; this.extX = MIN_SHAPE_SIZE;
} }
if(abs_dist_y >= MIN_SHAPE_SIZE_DIV2) if(abs_dist_y >= MIN_SHAPE_SIZE_DIV2 || this.isLine)
{ {
this.y = this.startY - abs_dist_y; this.y = this.startY - abs_dist_y;
this.extY = 2*abs_dist_y; this.extY = 2*abs_dist_y;
...@@ -144,6 +157,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY) ...@@ -144,6 +157,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
} }
else if(!e.CtrlKey && e.ShiftKey) else if(!e.CtrlKey && e.ShiftKey)
{ {
var new_width, new_height; var new_width, new_height;
var prop_coefficient = (typeof SHAPE_ASPECTS[this.presetGeom] === "number" ? SHAPE_ASPECTS[this.presetGeom] : 1); var prop_coefficient = (typeof SHAPE_ASPECTS[this.presetGeom] === "number" ? SHAPE_ASPECTS[this.presetGeom] : 1);
if(abs_dist_y === 0) if(abs_dist_y === 0)
...@@ -204,6 +218,24 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY) ...@@ -204,6 +218,24 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
this.y = this.startY; this.y = this.startY;
else else
this.y = this.startY - this.extY; this.y = this.startY - this.extY;
if(this.isLine)
{
var angle = Math.atan2(real_dist_y, real_dist_x);
if(angle >=0 && angle <= Math.PI/8
|| angle <= 0 && angle >= -Math.PI/8
|| angle >= 7*Math.PI/8 && angle <= Math.PI )
{
this.extY = 0;
this.y = this.startY;
}
else if(angle >= 3*Math.PI/8 && angle <= 5*Math.PI/8
|| angle <= -3*Math.PI/8 && angle >= -5*Math.PI/8)
{
this.extX = 0;
this.x = this.startX;
}
}
} }
else else
{ {
...@@ -263,7 +295,14 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY) ...@@ -263,7 +295,14 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
} }
this.overlayObject.updateExtents(this.extX, this.extY); this.overlayObject.updateExtents(this.extX, this.extY);
this.transform.Reset(); this.transform.Reset();
global_MatrixTransformer.TranslateAppend(this.transform, this.x, this.y); var hc = this.extX * 0.5;
var 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.TranslateAppend(this.transform, this.x + hc, this.y + vc);
}; };
this.ctrlDown = function() this.ctrlDown = function()
......
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