Commit fb6753d3 authored by Oleg Korshul's avatar Oleg Korshul Committed by Alexander.Trofimov

flip bug

parent 2133a8c1
......@@ -2397,6 +2397,59 @@ CMatrix.prototype =
}
};
function GradientGetAngleNoRotate(_angle, _transform)
{
var x1 = 0.0;
var y1 = 0.0;
var x2 = 1.0;
var y2 = 0.0;
var _matrixRotate = new CMatrix();
_matrixRotate.Rotate(-_angle / 60000);
var _x11 = _matrixRotate.TransformPointX(x1, y1);
var _y11 = _matrixRotate.TransformPointY(x1, y1);
var _x22 = _matrixRotate.TransformPointX(x2, y2);
var _y22 = _matrixRotate.TransformPointY(x2, y2);
_matrixRotate = global_MatrixTransformer.Invert(_transform);
var _x1 = _matrixRotate.TransformPointX(_x11, _y11);
var _y1 = _matrixRotate.TransformPointY(_x11, _y11);
var _x2 = _matrixRotate.TransformPointX(_x22, _y22);
var _y2 = _matrixRotate.TransformPointY(_x22, _y22);
var _y = _y2 - _y1;
var _x = _x2 - _x1;
var a = 0;
if (Math.abs(_y) < 0.001)
{
if (_x > 0)
a = 0;
else
a = 180;
}
else if (Math.abs(_x) < 0.001)
{
if (_y > 0)
a = 90;
else
a = 270;
}
else
{
a = Math.atan2(_y,_x);
a = rad2deg(a);
}
if (a < 0)
a += 360;
console.log(a);
return a * 60000;
};
var CMatrixL = CMatrix;
function CGlobalMatrixTransformer()
......@@ -2803,4 +2856,5 @@ var CMatrixL = CMatrix;
window['AscCommon'].g_dDpiX = g_dDpiX;
window['AscCommon'].g_dKoef_mm_to_pix = g_dKoef_mm_to_pix;
window['AscCommon'].g_dKoef_pix_to_mm = g_dKoef_pix_to_mm;
window['AscCommon'].GradientGetAngleNoRotate = GradientGetAngleNoRotate;
})(window);
......@@ -1060,9 +1060,14 @@ CShapeDrawer.prototype =
if (_fill.lin)
{
var _angle = _fill.lin.angle;
if (_fill.rotateWithShape === false && this.Graphics.m_oTransform)
if (_fill.rotateWithShape === false)
{
var matrix_transform = (this.Graphics.IsTrack === true) ? this.Graphics.Graphics.m_oTransform : this.Graphics.m_oTransform;
if (matrix_transform)
{
_angle -= (60000 * this.Graphics.m_oTransform.GetRotation());
//_angle -= (60000 * this.Graphics.m_oTransform.GetRotation());
_angle = AscCommon.GradientGetAngleNoRotate(_angle, matrix_transform);
}
}
var points = this.getGradientPoints(this.min_x, this.min_y, this.max_x, this.max_y, _angle, _fill.lin.scale);
......@@ -1417,7 +1422,8 @@ CShapeDrawer.prototype =
var _angle = _fill.lin.angle;
if (_fill.rotateWithShape === false && this.Graphics.m_oTransform)
{
_angle -= (60000 * this.Graphics.m_oTransform.GetRotation());
//_angle -= (60000 * this.Graphics.m_oTransform.GetRotation());
_angle = AscCommon.GradientGetAngleNoRotate(_angle, this.Graphics.m_oTransform);
}
points = this.getGradientPoints(this.min_x, this.min_y, this.max_x, this.max_y, _angle, _fill.lin.scale);
......
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