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
var dx = x - this.startX;
var dy = y - this.startY;
var shiftX = 0, shiftY = 0;
if(!e.ShiftKey)
{
}
else
{
}
this.drawingObjectsController.trackMoveObjects(dx, dy);
this.drawingObjects.OnUpdateOverlay();
};
......
......@@ -84,6 +84,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
pen.Fill.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.shape = null;
......@@ -93,7 +94,19 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
var abs_dist_x = Math.abs(real_dist_x);
var real_dist_y = y - this.startY;
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(real_dist_x >= 0)
......@@ -102,7 +115,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
}
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)
......@@ -111,7 +124,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
}
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;
......@@ -120,7 +133,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
}
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.extX = 2*abs_dist_x;
......@@ -131,7 +144,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
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.extY = 2*abs_dist_y;
......@@ -144,6 +157,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
}
else if(!e.CtrlKey && e.ShiftKey)
{
var new_width, new_height;
var prop_coefficient = (typeof SHAPE_ASPECTS[this.presetGeom] === "number" ? SHAPE_ASPECTS[this.presetGeom] : 1);
if(abs_dist_y === 0)
......@@ -204,6 +218,24 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
this.y = this.startY;
else
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
{
......@@ -263,7 +295,14 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
}
this.overlayObject.updateExtents(this.extX, this.extY);
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()
......
......@@ -161,6 +161,8 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
this.brush = originalObject.brush;
this.pen = originalObject.pen;
this.isLine = originalObject.spPr.geometry && originalObject.spPr.geometry.preset === "line";
this.bChangeCoef = this.translatetNumberHandle % 2 === 0 && this.originalFlipH !== this.originalFlipV;
this.overlayObject = new OverlayObject(this.geometry, this.resizedExtX, this.resizedExtY, this.brush, this.pen, this.transform);
......@@ -212,7 +214,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
{
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE ? _abs_width : MIN_SHAPE_SIZE;
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0)
this.resizedflipH = !this.originalFlipH;
else
......@@ -227,7 +229,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE ? _abs_height : MIN_SHAPE_SIZE;
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0)
this.resizedflipV = !this.originalFlipV;
else
......@@ -268,7 +270,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
kd1 = _temp;
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE ? _abs_height : MIN_SHAPE_SIZE;
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0)
this.resizedflipV = !this.originalFlipV;
else
......@@ -277,7 +279,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE ? _abs_width : MIN_SHAPE_SIZE;
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0)
this.resizedflipH = !this.originalFlipH;
else
......@@ -317,7 +319,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
{
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE ? _abs_width : MIN_SHAPE_SIZE;
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0)
this.resizedflipH = !this.originalFlipH;
else
......@@ -332,7 +334,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE ? _abs_height : MIN_SHAPE_SIZE;
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0)
this.resizedflipV = !this.originalFlipV;
else
......@@ -371,7 +373,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
{
_real_height = this.usedExtY*kd1;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE ? _abs_height : MIN_SHAPE_SIZE;
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0)
this.resizedflipV = !this.originalFlipV;
else
......@@ -386,7 +388,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
_real_width = this.usedExtX*kd2;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE ? _abs_width : MIN_SHAPE_SIZE;
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0)
this.resizedflipH = !this.originalFlipH;
else
......@@ -475,7 +477,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
{
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE ? _abs_width : MIN_SHAPE_SIZE;
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
this.resizedflipH = _real_width < 0 ? !this.originalFlipH : this.originalFlipH;
}
......@@ -488,7 +490,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE ? _abs_height : MIN_SHAPE_SIZE;
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
this.resizedflipV = _real_height < 0 ? !this.originalFlipV : this.originalFlipV;
......@@ -503,13 +505,13 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE ? _abs_height : MIN_SHAPE_SIZE;
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
this.resizedflipV = _real_height < 0 ? !this.originalFlipV : this.originalFlipV;
}
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE ? _abs_width : MIN_SHAPE_SIZE;
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
this.resizedflipH = _real_width < 0 ? !this.originalFlipH : this.originalFlipH;
}
......@@ -690,6 +692,7 @@ function ResizeTrackShapeImageInGroup(originalObject, cardDirection)
this.geometry = originalObject.spPr.geometry.createDuplicate();
this.brush = originalObject.brush;
this.pen = originalObject.pen;
this.isLine = originalObject.spPr.geometry && originalObject.spPr.geometry.preset === "line";
this.bChangeCoef = this.translatetNumberHandle % 2 === 0 && this.originalFlipH !== this.originalFlipV;
......@@ -742,7 +745,7 @@ function ResizeTrackShapeImageInGroup(originalObject, cardDirection)
{
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE ? _abs_width : MIN_SHAPE_SIZE;
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0)
this.resizedflipH = !this.originalFlipH;
else
......@@ -757,7 +760,7 @@ function ResizeTrackShapeImageInGroup(originalObject, cardDirection)
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE ? _abs_height : MIN_SHAPE_SIZE;
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0)
this.resizedflipV = !this.originalFlipV;
else
......@@ -798,7 +801,7 @@ function ResizeTrackShapeImageInGroup(originalObject, cardDirection)
kd1 = _temp;
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE ? _abs_height : MIN_SHAPE_SIZE;
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0)
this.resizedflipV = !this.originalFlipV;
else
......@@ -807,7 +810,7 @@ function ResizeTrackShapeImageInGroup(originalObject, cardDirection)
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE ? _abs_width : MIN_SHAPE_SIZE;
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0)
this.resizedflipH = !this.originalFlipH;
else
......@@ -847,7 +850,7 @@ function ResizeTrackShapeImageInGroup(originalObject, cardDirection)
{
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE ? _abs_width : MIN_SHAPE_SIZE;
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0)
this.resizedflipH = !this.originalFlipH;
else
......@@ -862,7 +865,7 @@ function ResizeTrackShapeImageInGroup(originalObject, cardDirection)
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE ? _abs_height : MIN_SHAPE_SIZE;
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0)
this.resizedflipV = !this.originalFlipV;
else
......@@ -901,7 +904,7 @@ function ResizeTrackShapeImageInGroup(originalObject, cardDirection)
{
_real_height = this.usedExtY*kd1;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE ? _abs_height : MIN_SHAPE_SIZE;
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0)
this.resizedflipV = !this.originalFlipV;
else
......@@ -916,7 +919,7 @@ function ResizeTrackShapeImageInGroup(originalObject, cardDirection)
_real_width = this.usedExtX*kd2;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE ? _abs_width : MIN_SHAPE_SIZE;
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0)
this.resizedflipH = !this.originalFlipH;
else
......
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