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

track line

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57779 954022d7-b5bf-4e40-9824-e11837661b57
parent 94828f47
...@@ -827,927 +827,935 @@ CAutoshapeTrack.prototype = ...@@ -827,927 +827,935 @@ CAutoshapeTrack.prototype =
var _oldGlobalAlpha = ctx.globalAlpha; var _oldGlobalAlpha = ctx.globalAlpha;
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
switch (type) switch (type)
{ {
case TYPE_TRACK_SHAPE: case TYPE_TRACK_SHAPE:
case TYPE_TRACK_GROUP: case TYPE_TRACK_GROUP:
{ {
if (bIsClever) if (bIsClever)
{ {
overlay.CheckRect(x1, y1, x4 - x1, y4 - y1); overlay.CheckRect(x1, y1, x4 - x1, y4 - y1);
ctx.strokeStyle = _style_blue; ctx.strokeStyle = _style_blue;
if (!isLine) if (!isLine)
{ {
ctx.rect(x1 + 0.5, y2 + 0.5, x4 - x1, y4 - y1); ctx.rect(x1 + 0.5, y2 + 0.5, x4 - x1, y4 - y1);
ctx.stroke(); ctx.stroke();
ctx.beginPath(); ctx.beginPath();
} }
var xC = ((x1 + x2) / 2) >> 0; var xC = ((x1 + x2) / 2) >> 0;
if (!isLine && isCanRotate) if (!isLine && isCanRotate)
{ {
if (!bIsUseImageRotateTrack) if (!bIsUseImageRotateTrack)
{ {
ctx.beginPath(); ctx.beginPath();
overlay.AddEllipse(xC, y1 - TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(xC, y1 - TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS);
ctx.fillStyle = _style_green; ctx.fillStyle = _style_green;
ctx.fill(); ctx.fill();
ctx.stroke(); ctx.stroke();
} }
else else
{ {
if (window.g_track_rotate_marker.asc_complete) if (window.g_track_rotate_marker.asc_complete)
{ {
var _w = IMAGE_ROTATE_TRACK_W; var _w = IMAGE_ROTATE_TRACK_W;
var _xI = ((x1 + x2 - _w) / 2) >> 0; var _xI = ((x1 + x2 - _w) / 2) >> 0;
var _yI = y1 - TRACK_DISTANCE_ROTATE - (_w >> 1); var _yI = y1 - TRACK_DISTANCE_ROTATE - (_w >> 1);
overlay.CheckRect(_xI, _yI, _w, _w); overlay.CheckRect(_xI, _yI, _w, _w);
ctx.drawImage(window.g_track_rotate_marker, _xI, _yI, _w, _w); ctx.drawImage(window.g_track_rotate_marker, _xI, _yI, _w, _w);
} }
} }
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(xC + 0.5, y1); ctx.moveTo(xC + 0.5, y1);
ctx.lineTo(xC + 0.5, y1 - TRACK_DISTANCE_ROTATE2); ctx.lineTo(xC + 0.5, y1 - TRACK_DISTANCE_ROTATE2);
ctx.stroke(); ctx.stroke();
ctx.beginPath(); ctx.beginPath();
} }
ctx.fillStyle = _style_white; ctx.fillStyle = _style_white;
if (bIsEllipceCorner) if (bIsEllipceCorner)
{ {
overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS);
if (!isLine) if (!isLine)
{ {
overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS);
overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS);
} }
overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS);
} }
else else
{ {
overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE); overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE);
if (!isLine) if (!isLine)
{ {
overlay.AddRect2(x2 + 0.5, y2 + 0.5, TRACK_RECT_SIZE); overlay.AddRect2(x2 + 0.5, y2 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(x3 + 0.5, y3 + 0.5, TRACK_RECT_SIZE); overlay.AddRect2(x3 + 0.5, y3 + 0.5, TRACK_RECT_SIZE);
} }
overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE); overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE);
} }
if (bIsRectsTrack && !isLine) if (bIsRectsTrack && !isLine)
{ {
var _xC = (((x1 + x2) / 2) >> 0) + 0.5; var _xC = (((x1 + x2) / 2) >> 0) + 0.5;
var _yC = (((y1 + y3) / 2) >> 0) + 0.5; var _yC = (((y1 + y3) / 2) >> 0) + 0.5;
if (bIsRectsTrackX) if (bIsRectsTrackX)
{ {
overlay.AddRect2(_xC, y1+0.5, TRACK_RECT_SIZE); overlay.AddRect2(_xC, y1+0.5, TRACK_RECT_SIZE);
overlay.AddRect2(_xC, y3+0.5, TRACK_RECT_SIZE); overlay.AddRect2(_xC, y3+0.5, TRACK_RECT_SIZE);
} }
if (bIsRectsTrackY) if (bIsRectsTrackY)
{ {
overlay.AddRect2(x2+0.5, _yC, TRACK_RECT_SIZE); overlay.AddRect2(x2+0.5, _yC, TRACK_RECT_SIZE);
overlay.AddRect2(x1+0.5, _yC, TRACK_RECT_SIZE); overlay.AddRect2(x1+0.5, _yC, TRACK_RECT_SIZE);
} }
} }
ctx.fill(); ctx.fill();
ctx.stroke(); ctx.stroke();
ctx.beginPath(); ctx.beginPath();
} }
else else
{ {
var _x1 = x1; var _x1 = x1;
var _y1 = y1; var _y1 = y1;
var _x2 = x2; var _x2 = x2;
var _y2 = y2; var _y2 = y2;
var _x3 = x3; var _x3 = x3;
var _y3 = y3; var _y3 = y3;
var _x4 = x4; var _x4 = x4;
var _y4 = y4; var _y4 = y4;
if (nIsCleverWithTransform) if (nIsCleverWithTransform)
{ {
var _x1 = x1; var _x1 = x1;
if (x2 < _x1) if (x2 < _x1)
_x1 = x2; _x1 = x2;
if (x3 < _x1) if (x3 < _x1)
_x1 = x3; _x1 = x3;
if (x4 < _x1) if (x4 < _x1)
_x1 = x4; _x1 = x4;
var _x4 = x1; var _x4 = x1;
if (x2 > _x4) if (x2 > _x4)
_x4 = x2; _x4 = x2;
if (x3 > _x4) if (x3 > _x4)
_x4 = x3; _x4 = x3;
if (x4 > _x4) if (x4 > _x4)
_x4 = x4; _x4 = x4;
var _y1 = y1; var _y1 = y1;
if (y2 < _y1) if (y2 < _y1)
_y1 = y2; _y1 = y2;
if (y3 < _y1) if (y3 < _y1)
_y1 = y3; _y1 = y3;
if (y4 < _y1) if (y4 < _y1)
_y1 = y4; _y1 = y4;
var _y4 = y1; var _y4 = y1;
if (y2 > _y4) if (y2 > _y4)
_y4 = y2; _y4 = y2;
if (y3 > _y4) if (y3 > _y4)
_y4 = y3; _y4 = y3;
if (y4 > _y4) if (y4 > _y4)
_y4 = y4; _y4 = y4;
_x2 = _x4; _x2 = _x4;
_y2 = _y1; _y2 = _y1;
_x3 = _x1; _x3 = _x1;
_y3 = _y4; _y3 = _y4;
} }
ctx.strokeStyle = _style_blue; ctx.strokeStyle = _style_blue;
if (nIsCleverWithTransform) if (!isLine)
{ {
ctx.rect(_x1 + 0.5, _y2 + 0.5, _x4 - _x1, _y4 - _y1); if (nIsCleverWithTransform)
ctx.stroke(); {
ctx.beginPath(); ctx.rect(_x1 + 0.5, _y2 + 0.5, _x4 - _x1, _y4 - _y1);
} ctx.stroke();
else ctx.beginPath();
{ }
if (!isLine) else
{ {
ctx.moveTo(x1, y1); ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2); ctx.lineTo(x2, y2);
ctx.lineTo(x4, y4); ctx.lineTo(x4, y4);
ctx.lineTo(x3, y3); ctx.lineTo(x3, y3);
ctx.closePath(); ctx.closePath();
ctx.stroke(); ctx.stroke();
} }
} }
overlay.CheckPoint(x1, y1); overlay.CheckPoint(x1, y1);
overlay.CheckPoint(x2, y2); overlay.CheckPoint(x2, y2);
overlay.CheckPoint(x3, y3); overlay.CheckPoint(x3, y3);
overlay.CheckPoint(x4, y4); overlay.CheckPoint(x4, y4);
var ex1 = (x2 - x1) / _len_x; var ex1 = (x2 - x1) / _len_x;
var ey1 = (y2 - y1) / _len_x; var ey1 = (y2 - y1) / _len_x;
var ex2 = (x1 - x3) / _len_y; var ex2 = (x1 - x3) / _len_y;
var ey2 = (y1 - y3) / _len_y; var ey2 = (y1 - y3) / _len_y;
var _bAbsX1 = Math.abs(ex1) < 0.01; var _bAbsX1 = Math.abs(ex1) < 0.01;
var _bAbsY1 = Math.abs(ey1) < 0.01; var _bAbsY1 = Math.abs(ey1) < 0.01;
var _bAbsX2 = Math.abs(ex2) < 0.01; var _bAbsX2 = Math.abs(ex2) < 0.01;
var _bAbsY2 = Math.abs(ey2) < 0.01; var _bAbsY2 = Math.abs(ey2) < 0.01;
if (_bAbsX2 && _bAbsY2) if (_bAbsX2 && _bAbsY2)
{ {
if (_bAbsX1 && _bAbsY1) if (_bAbsX1 && _bAbsY1)
{ {
ex1 = 1; ex1 = 1;
ey1 = 0; ey1 = 0;
ex2 = 0; ex2 = 0;
ey2 = 1; ey2 = 1;
} }
else else
{ {
ex2 = -ey1; ex2 = -ey1;
ey2 = ex1; ey2 = ex1;
} }
} }
else if (_bAbsX1 && _bAbsY1) else if (_bAbsX1 && _bAbsY1)
{ {
ex1 = ey2; ex1 = ey2;
ey1 = -ex2; ey1 = -ex2;
} }
var xc1 = (x1 + x2) / 2; var xc1 = (x1 + x2) / 2;
var yc1 = (y1 + y2) / 2; var yc1 = (y1 + y2) / 2;
ctx.beginPath(); ctx.beginPath();
if (!isLine && isCanRotate) if (!isLine && isCanRotate)
{ {
if (!bIsUseImageRotateTrack) if (!bIsUseImageRotateTrack)
{ {
ctx.beginPath(); ctx.beginPath();
overlay.AddEllipse(xc1 + ex2 * TRACK_DISTANCE_ROTATE, yc1 + ey2 * TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(xc1 + ex2 * TRACK_DISTANCE_ROTATE, yc1 + ey2 * TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS);
ctx.fillStyle = _style_green; ctx.fillStyle = _style_green;
ctx.fill(); ctx.fill();
ctx.stroke(); ctx.stroke();
} }
else else
{ {
if (window.g_track_rotate_marker.asc_complete) if (window.g_track_rotate_marker.asc_complete)
{ {
var _xI = xc1 + ex2 * TRACK_DISTANCE_ROTATE; var _xI = xc1 + ex2 * TRACK_DISTANCE_ROTATE;
var _yI = yc1 + ey2 * TRACK_DISTANCE_ROTATE; var _yI = yc1 + ey2 * TRACK_DISTANCE_ROTATE;
var _w = IMAGE_ROTATE_TRACK_W; var _w = IMAGE_ROTATE_TRACK_W;
var _w2 = IMAGE_ROTATE_TRACK_W / 2; var _w2 = IMAGE_ROTATE_TRACK_W / 2;
if (nIsCleverWithTransform) if (nIsCleverWithTransform)
{ {
_xI >>= 0; _xI >>= 0;
_yI >>= 0; _yI >>= 0;
_w2 >>= 0; _w2 >>= 0;
_w2 += 1; _w2 += 1;
} }
//ctx.setTransform(ex1, ey1, -ey1, ex1, _xI, _yI); //ctx.setTransform(ex1, ey1, -ey1, ex1, _xI, _yI);
var _matrix = matrix.CreateDublicate(); var _matrix = matrix.CreateDublicate();
_matrix.tx = 0; _matrix.tx = 0;
_matrix.ty = 0; _matrix.ty = 0;
var _xx = _matrix.TransformPointX(0, 1); var _xx = _matrix.TransformPointX(0, 1);
var _yy = _matrix.TransformPointY(0, 1); var _yy = _matrix.TransformPointY(0, 1);
var _angle = Math.atan2(_xx, -_yy) - Math.PI; var _angle = Math.atan2(_xx, -_yy) - Math.PI;
var _px = Math.cos(_angle); var _px = Math.cos(_angle);
var _py = Math.sin(_angle); var _py = Math.sin(_angle);
ctx.translate(_xI, _yI); ctx.translate(_xI, _yI);
ctx.transform(_px, _py, -_py, _px, 0, 0); ctx.transform(_px, _py, -_py, _px, 0, 0);
ctx.drawImage(window.g_track_rotate_marker, -_w2, -_w2, _w, _w); ctx.drawImage(window.g_track_rotate_marker, -_w2, -_w2, _w, _w);
ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.setTransform(1, 0, 0, 1, 0, 0);
overlay.CheckRect(_xI - _w2, _yI - _w2, _w, _w); overlay.CheckRect(_xI - _w2, _yI - _w2, _w, _w);
} }
} }
ctx.beginPath(); ctx.beginPath();
if (!nIsCleverWithTransform) if (!nIsCleverWithTransform)
{ {
ctx.moveTo(xc1, yc1); ctx.moveTo(xc1, yc1);
ctx.lineTo(xc1 + ex2 * TRACK_DISTANCE_ROTATE2, yc1 + ey2 * TRACK_DISTANCE_ROTATE2); ctx.lineTo(xc1 + ex2 * TRACK_DISTANCE_ROTATE2, yc1 + ey2 * TRACK_DISTANCE_ROTATE2);
} }
else else
{ {
ctx.moveTo((xc1 >> 0) + 0.5, (yc1 >> 0) + 0.5); ctx.moveTo((xc1 >> 0) + 0.5, (yc1 >> 0) + 0.5);
ctx.lineTo(((xc1 + ex2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5, ((yc1 + ey2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5); ctx.lineTo(((xc1 + ex2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5, ((yc1 + ey2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5);
} }
ctx.stroke(); ctx.stroke();
ctx.beginPath(); ctx.beginPath();
} }
ctx.fillStyle = _style_white; ctx.fillStyle = _style_white;
if (!nIsCleverWithTransform) if (!nIsCleverWithTransform)
{ {
if (bIsEllipceCorner) if (bIsEllipceCorner)
{ {
overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS);
if (!isLine) if (!isLine)
{ {
overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS);
overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS);
} }
overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS);
} }
else else
{ {
overlay.AddRect3(x1, y1, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddRect3(x1, y1, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
if (!isLine) if (!isLine)
{ {
overlay.AddRect3(x2, y2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddRect3(x2, y2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
overlay.AddRect3(x3, y3, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddRect3(x3, y3, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
} }
overlay.AddRect3(x4, y4, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddRect3(x4, y4, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
} }
} }
else else
{ {
if (bIsEllipceCorner) if (bIsEllipceCorner)
{ {
overlay.AddEllipse(_x1, _y1, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(_x1, _y1, TRACK_CIRCLE_RADIUS);
if (!isLine) if (!isLine)
{ {
overlay.AddEllipse(_x2, _y2, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(_x2, _y2, TRACK_CIRCLE_RADIUS);
overlay.AddEllipse(_x3, _y3, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(_x3, _y3, TRACK_CIRCLE_RADIUS);
} }
overlay.AddEllipse(_x4, _y4, TRACK_CIRCLE_RADIUS); overlay.AddEllipse(_x4, _y4, TRACK_CIRCLE_RADIUS);
} }
else else
{ {
overlay.AddRect2(_x1 + 0.5, _y1 + 0.5, TRACK_RECT_SIZE); if (!isLine)
if (!isLine) {
{ overlay.AddRect2(_x1 + 0.5, _y1 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(_x2 + 0.5, _y2 + 0.5, TRACK_RECT_SIZE); overlay.AddRect2(_x2 + 0.5, _y2 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(_x3 + 0.5, _y3 + 0.5, TRACK_RECT_SIZE); overlay.AddRect2(_x3 + 0.5, _y3 + 0.5, TRACK_RECT_SIZE);
} overlay.AddRect2(_x4 + 0.5, _y4 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(_x4 + 0.5, _y4 + 0.5, TRACK_RECT_SIZE); }
} else
} {
overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE);
if (!nIsCleverWithTransform) overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE);
{ }
if (bIsRectsTrack && !isLine) }
{ }
if (bIsRectsTrackX)
{ if (!isLine)
overlay.AddRect3((x1 + x2) / 2, (y1 + y2) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); {
overlay.AddRect3((x3 + x4) / 2, (y3 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); if (!nIsCleverWithTransform)
} {
if (bIsRectsTrackY) if (bIsRectsTrack)
{ {
overlay.AddRect3((x2 + x4) / 2, (y2 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); if (bIsRectsTrackX)
overlay.AddRect3((x3 + x1) / 2, (y3 + y1) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); {
} overlay.AddRect3((x1 + x2) / 2, (y1 + y2) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
} overlay.AddRect3((x3 + x4) / 2, (y3 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
} }
else if (bIsRectsTrackY)
{ {
var _xC = (((_x1 + _x2) / 2) >> 0) + 0.5; overlay.AddRect3((x2 + x4) / 2, (y2 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
var _yC = (((_y1 + _y3) / 2) >> 0) + 0.5; overlay.AddRect3((x3 + x1) / 2, (y3 + y1) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
}
if (bIsRectsTrackX) }
{ }
overlay.AddRect2(_xC, _y1+0.5, TRACK_RECT_SIZE); else
overlay.AddRect2(_xC, _y3+0.5, TRACK_RECT_SIZE); {
} var _xC = (((_x1 + _x2) / 2) >> 0) + 0.5;
var _yC = (((_y1 + _y3) / 2) >> 0) + 0.5;
if (bIsRectsTrackY)
{ if (bIsRectsTrackX)
overlay.AddRect2(_x2+0.5, _yC, TRACK_RECT_SIZE); {
overlay.AddRect2(_x1+0.5, _yC, TRACK_RECT_SIZE); overlay.AddRect2(_xC, _y1+0.5, TRACK_RECT_SIZE);
} overlay.AddRect2(_xC, _y3+0.5, TRACK_RECT_SIZE);
} }
ctx.fill(); if (bIsRectsTrackY)
ctx.stroke(); {
overlay.AddRect2(_x2+0.5, _yC, TRACK_RECT_SIZE);
ctx.beginPath(); overlay.AddRect2(_x1+0.5, _yC, TRACK_RECT_SIZE);
} }
}
break; }
}
case TYPE_TRACK_TEXT: ctx.fill();
case TYPE_TRACK_GROUP_PASSIVE: ctx.stroke();
{
if (bIsClever) ctx.beginPath();
{ }
overlay.CheckRect(x1, y1, x4 - x1, y4 - y1);
this.AddRectDashClever(ctx, x1, y1, x4, y4, 8, 3); break;
}
ctx.strokeStyle = _style_blue; case TYPE_TRACK_TEXT:
ctx.stroke(); case TYPE_TRACK_GROUP_PASSIVE:
{
ctx.beginPath(); if (bIsClever)
{
if (isCanRotate) overlay.CheckRect(x1, y1, x4 - x1, y4 - y1);
{ this.AddRectDashClever(ctx, x1, y1, x4, y4, 8, 3);
if (!bIsUseImageRotateTrack)
{ ctx.strokeStyle = _style_blue;
ctx.beginPath(); ctx.stroke();
overlay.AddEllipse(xC, y1 - TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS);
ctx.beginPath();
ctx.fillStyle = _style_green;
ctx.fill(); if (isCanRotate)
ctx.stroke(); {
} if (!bIsUseImageRotateTrack)
else {
{ ctx.beginPath();
if (window.g_track_rotate_marker.asc_complete) overlay.AddEllipse(xC, y1 - TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS);
{
var _w = IMAGE_ROTATE_TRACK_W; ctx.fillStyle = _style_green;
var _xI = ((x1 + x2 - _w) / 2) >> 0; ctx.fill();
var _yI = y1 - TRACK_DISTANCE_ROTATE - (_w >> 1); ctx.stroke();
}
overlay.CheckRect(_xI, _yI, _w, _w); else
ctx.drawImage(window.g_track_rotate_marker, _xI, _yI, _w, _w); {
} if (window.g_track_rotate_marker.asc_complete)
} {
var _w = IMAGE_ROTATE_TRACK_W;
ctx.beginPath(); var _xI = ((x1 + x2 - _w) / 2) >> 0;
var _yI = y1 - TRACK_DISTANCE_ROTATE - (_w >> 1);
var xC = ((x1 + x2) / 2) >> 0;
ctx.moveTo(xC + 0.5, y1); overlay.CheckRect(_xI, _yI, _w, _w);
ctx.lineTo(xC + 0.5, y1 - TRACK_DISTANCE_ROTATE2); ctx.drawImage(window.g_track_rotate_marker, _xI, _yI, _w, _w);
ctx.stroke(); }
}
ctx.beginPath();
} ctx.beginPath();
ctx.fillStyle = _style_white; var xC = ((x1 + x2) / 2) >> 0;
ctx.moveTo(xC + 0.5, y1);
if (bIsEllipceCorner) ctx.lineTo(xC + 0.5, y1 - TRACK_DISTANCE_ROTATE2);
{ ctx.stroke();
overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS);
overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS); ctx.beginPath();
overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); }
overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS);
} ctx.fillStyle = _style_white;
else
{ if (bIsEllipceCorner)
overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE); {
overlay.AddRect2(x2 + 0.5, y2 + 0.5, TRACK_RECT_SIZE); overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS);
overlay.AddRect2(x3 + 0.5, y3 + 0.5, TRACK_RECT_SIZE); overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS);
overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE); overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS);
} overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS);
}
if (bIsRectsTrack) else
{ {
var _xC = (((x1 + x2) / 2) >> 0) + 0.5; overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE);
var _yC = (((y1 + y3) / 2) >> 0) + 0.5; overlay.AddRect2(x2 + 0.5, y2 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(x3 + 0.5, y3 + 0.5, TRACK_RECT_SIZE);
if (bIsRectsTrackX) overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE);
{ }
overlay.AddRect2(_xC, y1+0.5, TRACK_RECT_SIZE);
overlay.AddRect2(_xC, y3+0.5, TRACK_RECT_SIZE); if (bIsRectsTrack)
} {
if (bIsRectsTrackY) var _xC = (((x1 + x2) / 2) >> 0) + 0.5;
{ var _yC = (((y1 + y3) / 2) >> 0) + 0.5;
overlay.AddRect2(x2+0.5, _yC, TRACK_RECT_SIZE);
overlay.AddRect2(x1+0.5, _yC, TRACK_RECT_SIZE); if (bIsRectsTrackX)
} {
} overlay.AddRect2(_xC, y1+0.5, TRACK_RECT_SIZE);
overlay.AddRect2(_xC, y3+0.5, TRACK_RECT_SIZE);
ctx.fill(); }
ctx.stroke(); if (bIsRectsTrackY)
{
ctx.beginPath(); overlay.AddRect2(x2+0.5, _yC, TRACK_RECT_SIZE);
} overlay.AddRect2(x1+0.5, _yC, TRACK_RECT_SIZE);
else }
{ }
var _x1 = x1;
var _y1 = y1; ctx.fill();
var _x2 = x2; ctx.stroke();
var _y2 = y2;
var _x3 = x3; ctx.beginPath();
var _y3 = y3; }
var _x4 = x4; else
var _y4 = y4; {
var _x1 = x1;
if (nIsCleverWithTransform) var _y1 = y1;
{ var _x2 = x2;
var _x1 = x1; var _y2 = y2;
if (x2 < _x1) var _x3 = x3;
_x1 = x2; var _y3 = y3;
if (x3 < _x1) var _x4 = x4;
_x1 = x3; var _y4 = y4;
if (x4 < _x1)
_x1 = x4; if (nIsCleverWithTransform)
{
var _x4 = x1; var _x1 = x1;
if (x2 > _x4) if (x2 < _x1)
_x4 = x2; _x1 = x2;
if (x3 > _x4) if (x3 < _x1)
_x4 = x3; _x1 = x3;
if (x4 > _x4) if (x4 < _x1)
_x4 = x4; _x1 = x4;
var _y1 = y1; var _x4 = x1;
if (y2 < _y1) if (x2 > _x4)
_y1 = y2; _x4 = x2;
if (y3 < _y1) if (x3 > _x4)
_y1 = y3; _x4 = x3;
if (y4 < _y1) if (x4 > _x4)
_y1 = y4; _x4 = x4;
var _y4 = y1; var _y1 = y1;
if (y2 > _y4) if (y2 < _y1)
_y4 = y2; _y1 = y2;
if (y3 > _y4) if (y3 < _y1)
_y4 = y3; _y1 = y3;
if (y4 > _y4) if (y4 < _y1)
_y4 = y4; _y1 = y4;
_x2 = _x4; var _y4 = y1;
_y2 = _y1; if (y2 > _y4)
_x3 = _x1; _y4 = y2;
_y3 = _y4; if (y3 > _y4)
} _y4 = y3;
if (y4 > _y4)
overlay.CheckPoint(x1, y1); _y4 = y4;
overlay.CheckPoint(x2, y2);
overlay.CheckPoint(x3, y3); _x2 = _x4;
overlay.CheckPoint(x4, y4); _y2 = _y1;
_x3 = _x1;
if (!nIsCleverWithTransform) _y3 = _y4;
{ }
this.AddRectDash(ctx, x1, y1, x2, y2, x3, y3, x4, y4, 8, 3);
} overlay.CheckPoint(x1, y1);
else overlay.CheckPoint(x2, y2);
{ overlay.CheckPoint(x3, y3);
this.AddRectDashClever(ctx, _x1, _y1, _x4, _y4, 8, 3); overlay.CheckPoint(x4, y4);
}
if (!nIsCleverWithTransform)
ctx.strokeStyle = _style_blue; {
ctx.stroke(); this.AddRectDash(ctx, x1, y1, x2, y2, x3, y3, x4, y4, 8, 3);
}
var ex1 = (x2 - x1) / _len_x; else
var ey1 = (y2 - y1) / _len_x; {
var ex2 = (x1 - x3) / _len_y; this.AddRectDashClever(ctx, _x1, _y1, _x4, _y4, 8, 3);
var ey2 = (y1 - y3) / _len_y; }
var _bAbsX1 = Math.abs(ex1) < 0.01; ctx.strokeStyle = _style_blue;
var _bAbsY1 = Math.abs(ey1) < 0.01; ctx.stroke();
var _bAbsX2 = Math.abs(ex2) < 0.01;
var _bAbsY2 = Math.abs(ey2) < 0.01; var ex1 = (x2 - x1) / _len_x;
var ey1 = (y2 - y1) / _len_x;
if (_bAbsX2 && _bAbsY2) var ex2 = (x1 - x3) / _len_y;
{ var ey2 = (y1 - y3) / _len_y;
if (_bAbsX1 && _bAbsY1)
{ var _bAbsX1 = Math.abs(ex1) < 0.01;
ex1 = 1; var _bAbsY1 = Math.abs(ey1) < 0.01;
ey1 = 0; var _bAbsX2 = Math.abs(ex2) < 0.01;
ex2 = 0; var _bAbsY2 = Math.abs(ey2) < 0.01;
ey2 = 1;
} if (_bAbsX2 && _bAbsY2)
else {
{ if (_bAbsX1 && _bAbsY1)
ex2 = -ey1; {
ey2 = ex1; ex1 = 1;
} ey1 = 0;
} ex2 = 0;
else if (_bAbsX1 && _bAbsY1) ey2 = 1;
{ }
ex1 = ey2; else
ey1 = -ex2; {
} ex2 = -ey1;
ey2 = ex1;
var xc1 = (x1 + x2) / 2; }
var yc1 = (y1 + y2) / 2; }
else if (_bAbsX1 && _bAbsY1)
ctx.beginPath(); {
ex1 = ey2;
if (isCanRotate) ey1 = -ex2;
{ }
if (!bIsUseImageRotateTrack)
{ var xc1 = (x1 + x2) / 2;
ctx.beginPath(); var yc1 = (y1 + y2) / 2;
overlay.AddEllipse(xc1 + ex2 * TRACK_DISTANCE_ROTATE, yc1 + ey2 * TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS);
ctx.beginPath();
ctx.fillStyle = _style_green;
ctx.fill(); if (isCanRotate)
ctx.stroke(); {
} if (!bIsUseImageRotateTrack)
else {
{ ctx.beginPath();
if (window.g_track_rotate_marker.asc_complete) overlay.AddEllipse(xc1 + ex2 * TRACK_DISTANCE_ROTATE, yc1 + ey2 * TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS);
{
var _xI = xc1 + ex2 * TRACK_DISTANCE_ROTATE; ctx.fillStyle = _style_green;
var _yI = yc1 + ey2 * TRACK_DISTANCE_ROTATE; ctx.fill();
var _w = IMAGE_ROTATE_TRACK_W; ctx.stroke();
var _w2 = IMAGE_ROTATE_TRACK_W / 2; }
else
if (nIsCleverWithTransform) {
{ if (window.g_track_rotate_marker.asc_complete)
_xI >>= 0; {
_yI >>= 0; var _xI = xc1 + ex2 * TRACK_DISTANCE_ROTATE;
_w2 >>= 0; var _yI = yc1 + ey2 * TRACK_DISTANCE_ROTATE;
_w2 += 1; var _w = IMAGE_ROTATE_TRACK_W;
} var _w2 = IMAGE_ROTATE_TRACK_W / 2;
//ctx.setTransform(ex1, ey1, -ey1, ex1, _xI, _yI); if (nIsCleverWithTransform)
{
var _matrix = matrix.CreateDublicate(); _xI >>= 0;
_matrix.tx = 0; _yI >>= 0;
_matrix.ty = 0; _w2 >>= 0;
var _xx = _matrix.TransformPointX(0, 1); _w2 += 1;
var _yy = _matrix.TransformPointY(0, 1); }
var _angle = Math.atan2(_xx, -_yy) - Math.PI;
var _px = Math.cos(_angle); //ctx.setTransform(ex1, ey1, -ey1, ex1, _xI, _yI);
var _py = Math.sin(_angle);
var _matrix = matrix.CreateDublicate();
ctx.translate(_xI, _yI); _matrix.tx = 0;
ctx.transform(_px, _py, -_py, _px, 0, 0); _matrix.ty = 0;
ctx.drawImage(window.g_track_rotate_marker, -_w2, -_w2, _w, _w); var _xx = _matrix.TransformPointX(0, 1);
ctx.setTransform(1, 0, 0, 1, 0, 0); var _yy = _matrix.TransformPointY(0, 1);
var _angle = Math.atan2(_xx, -_yy) - Math.PI;
overlay.CheckRect(_xI - _w2, _yI - _w2, _w, _w); var _px = Math.cos(_angle);
} var _py = Math.sin(_angle);
}
ctx.translate(_xI, _yI);
ctx.beginPath(); ctx.transform(_px, _py, -_py, _px, 0, 0);
ctx.drawImage(window.g_track_rotate_marker, -_w2, -_w2, _w, _w);
if (!nIsCleverWithTransform) ctx.setTransform(1, 0, 0, 1, 0, 0);
{
ctx.moveTo(xc1, yc1); overlay.CheckRect(_xI - _w2, _yI - _w2, _w, _w);
ctx.lineTo(xc1 + ex2 * TRACK_DISTANCE_ROTATE2, yc1 + ey2 * TRACK_DISTANCE_ROTATE2); }
} }
else
{ ctx.beginPath();
ctx.moveTo((xc1 >> 0) + 0.5, (yc1 >> 0) + 0.5);
ctx.lineTo(((xc1 + ex2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5, ((yc1 + ey2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5); if (!nIsCleverWithTransform)
} {
ctx.moveTo(xc1, yc1);
ctx.stroke(); ctx.lineTo(xc1 + ex2 * TRACK_DISTANCE_ROTATE2, yc1 + ey2 * TRACK_DISTANCE_ROTATE2);
}
ctx.beginPath(); else
{
} ctx.moveTo((xc1 >> 0) + 0.5, (yc1 >> 0) + 0.5);
ctx.lineTo(((xc1 + ex2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5, ((yc1 + ey2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5);
ctx.fillStyle = _style_white; }
if (!nIsCleverWithTransform) ctx.stroke();
{
if (bIsEllipceCorner) ctx.beginPath();
{
overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); }
overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS);
overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); ctx.fillStyle = _style_white;
overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS);
} if (!nIsCleverWithTransform)
else {
{ if (bIsEllipceCorner)
overlay.AddRect3(x1, y1, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); {
overlay.AddRect3(x2, y2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS);
overlay.AddRect3(x3, y3, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS);
overlay.AddRect3(x4, y4, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS);
} overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS);
} }
else else
{ {
if (bIsEllipceCorner) overlay.AddRect3(x1, y1, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
{ overlay.AddRect3(x2, y2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); overlay.AddRect3(x3, y3, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS); overlay.AddRect3(x4, y4, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); }
overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS); }
} else
else {
{ if (bIsEllipceCorner)
overlay.AddRect2(_x1 + 0.5, _y1 + 0.5, TRACK_RECT_SIZE); {
overlay.AddRect2(_x2 + 0.5, _y2 + 0.5, TRACK_RECT_SIZE); overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS);
overlay.AddRect2(_x3 + 0.5, _y3 + 0.5, TRACK_RECT_SIZE); overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS);
overlay.AddRect2(_x4 + 0.5, _y4 + 0.5, TRACK_RECT_SIZE); overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS);
} overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS);
} }
else
if (!nIsCleverWithTransform) {
{ overlay.AddRect2(_x1 + 0.5, _y1 + 0.5, TRACK_RECT_SIZE);
if (bIsRectsTrack) overlay.AddRect2(_x2 + 0.5, _y2 + 0.5, TRACK_RECT_SIZE);
{ overlay.AddRect2(_x3 + 0.5, _y3 + 0.5, TRACK_RECT_SIZE);
if (bIsRectsTrackX) overlay.AddRect2(_x4 + 0.5, _y4 + 0.5, TRACK_RECT_SIZE);
{ }
overlay.AddRect3((x1 + x2) / 2, (y1 + y2) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); }
overlay.AddRect3((x3 + x4) / 2, (y3 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
} if (!nIsCleverWithTransform)
if (bIsRectsTrackY) {
{ if (bIsRectsTrack)
overlay.AddRect3((x2 + x4) / 2, (y2 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); {
overlay.AddRect3((x3 + x1) / 2, (y3 + y1) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); if (bIsRectsTrackX)
} {
} overlay.AddRect3((x1 + x2) / 2, (y1 + y2) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
} overlay.AddRect3((x3 + x4) / 2, (y3 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
else }
{ if (bIsRectsTrackY)
if (bIsRectsTrack) {
{ overlay.AddRect3((x2 + x4) / 2, (y2 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
var _xC = (((_x1 + _x2) / 2) >> 0) + 0.5; overlay.AddRect3((x3 + x1) / 2, (y3 + y1) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
var _yC = (((_y1 + _y3) / 2) >> 0) + 0.5; }
}
if (bIsRectsTrackX) }
{ else
overlay.AddRect2(_xC, _y1+0.5, TRACK_RECT_SIZE); {
overlay.AddRect2(_xC, _y3+0.5, TRACK_RECT_SIZE); if (bIsRectsTrack)
} {
if (bIsRectsTrackY) var _xC = (((_x1 + _x2) / 2) >> 0) + 0.5;
{ var _yC = (((_y1 + _y3) / 2) >> 0) + 0.5;
overlay.AddRect2(_x2+0.5, _yC, TRACK_RECT_SIZE);
overlay.AddRect2(_x1+0.5, _yC, TRACK_RECT_SIZE); if (bIsRectsTrackX)
} {
} overlay.AddRect2(_xC, _y1+0.5, TRACK_RECT_SIZE);
} overlay.AddRect2(_xC, _y3+0.5, TRACK_RECT_SIZE);
}
ctx.fill(); if (bIsRectsTrackY)
ctx.stroke(); {
overlay.AddRect2(_x2+0.5, _yC, TRACK_RECT_SIZE);
ctx.beginPath(); overlay.AddRect2(_x1+0.5, _yC, TRACK_RECT_SIZE);
} }
}
break; }
}
case TYPE_TRACK_EMPTY_PH: ctx.fill();
{ ctx.stroke();
if (bIsClever)
{ ctx.beginPath();
overlay.CheckRect(x1, y1, x4 - x1, y4 - y1); }
ctx.rect(x1 + 0.5, y2 + 0.5, x4 - x1 + 1, y4 - y1);
ctx.fillStyle = _style_white; break;
ctx.stroke(); }
case TYPE_TRACK_EMPTY_PH:
ctx.beginPath(); {
if (bIsClever)
this.AddRectDashClever(ctx, x1, y1, x4, y4, 8, 3); {
overlay.CheckRect(x1, y1, x4 - x1, y4 - y1);
ctx.strokeStyle = _style_blue; ctx.rect(x1 + 0.5, y2 + 0.5, x4 - x1 + 1, y4 - y1);
ctx.stroke(); ctx.fillStyle = _style_white;
ctx.stroke();
ctx.beginPath();
ctx.beginPath();
var xC = ((x1 + x2) / 2) >> 0;
this.AddRectDashClever(ctx, x1, y1, x4, y4, 8, 3);
if (!bIsUseImageRotateTrack)
{ ctx.strokeStyle = _style_blue;
ctx.beginPath(); ctx.stroke();
overlay.AddEllipse(xC, y1 - TRACK_DISTANCE_ROTATE);
ctx.beginPath();
ctx.fillStyle = _style_green;
ctx.fill(); var xC = ((x1 + x2) / 2) >> 0;
ctx.stroke();
} if (!bIsUseImageRotateTrack)
else {
{ ctx.beginPath();
if (window.g_track_rotate_marker.asc_complete) overlay.AddEllipse(xC, y1 - TRACK_DISTANCE_ROTATE);
{
var _w = IMAGE_ROTATE_TRACK_W; ctx.fillStyle = _style_green;
var _xI = ((x1 + x2 - _w) / 2) >> 0; ctx.fill();
var _yI = y1 - TRACK_DISTANCE_ROTATE - (_w >> 1); ctx.stroke();
}
overlay.CheckRect(_xI, _yI, _w, _w); else
ctx.drawImage(window.g_track_rotate_marker, _xI, _yI, _w, _w); {
} if (window.g_track_rotate_marker.asc_complete)
} {
var _w = IMAGE_ROTATE_TRACK_W;
ctx.beginPath(); var _xI = ((x1 + x2 - _w) / 2) >> 0;
ctx.moveTo(xC + 0.5, y1); var _yI = y1 - TRACK_DISTANCE_ROTATE - (_w >> 1);
ctx.lineTo(xC + 0.5, y1 - TRACK_DISTANCE_ROTATE2);
ctx.stroke(); overlay.CheckRect(_xI, _yI, _w, _w);
ctx.drawImage(window.g_track_rotate_marker, _xI, _yI, _w, _w);
ctx.beginPath(); }
}
ctx.fillStyle = _style_white;
ctx.beginPath();
if (bIsEllipceCorner) ctx.moveTo(xC + 0.5, y1);
{ ctx.lineTo(xC + 0.5, y1 - TRACK_DISTANCE_ROTATE2);
overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); ctx.stroke();
overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS);
overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); ctx.beginPath();
overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS);
} ctx.fillStyle = _style_white;
else
{ if (bIsEllipceCorner)
overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE); {
overlay.AddRect2(x2 + 0.5, y2 + 0.5, TRACK_RECT_SIZE); overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS);
overlay.AddRect2(x3 + 0.5, y3 + 0.5, TRACK_RECT_SIZE); overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS);
overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE); overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS);
} overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS);
}
if (bIsRectsTrack && false) else
{ {
var _xC = (((x1 + x2) / 2) >> 0) + 0.5; overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE);
var _yC = (((y1 + y3) / 2) >> 0) + 0.5; overlay.AddRect2(x2 + 0.5, y2 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(x3 + 0.5, y3 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(_xC, y1+0.5, TRACK_RECT_SIZE); overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(x2+0.5, _yC, TRACK_RECT_SIZE); }
overlay.AddRect2(_xC, y3+0.5, TRACK_RECT_SIZE);
overlay.AddRect2(x1+0.5, _yC, TRACK_RECT_SIZE); if (bIsRectsTrack && false)
} {
var _xC = (((x1 + x2) / 2) >> 0) + 0.5;
ctx.fill(); var _yC = (((y1 + y3) / 2) >> 0) + 0.5;
ctx.stroke();
overlay.AddRect2(_xC, y1+0.5, TRACK_RECT_SIZE);
ctx.beginPath(); overlay.AddRect2(x2+0.5, _yC, TRACK_RECT_SIZE);
} overlay.AddRect2(_xC, y3+0.5, TRACK_RECT_SIZE);
else overlay.AddRect2(x1+0.5, _yC, TRACK_RECT_SIZE);
{ }
overlay.CheckPoint(x1, y1);
overlay.CheckPoint(x2, y2); ctx.fill();
overlay.CheckPoint(x3, y3); ctx.stroke();
overlay.CheckPoint(x4, y4);
ctx.beginPath();
ctx.moveTo(x1, y1); }
ctx.lineTo(x2, y2); else
ctx.lineTo(x3, y3); {
ctx.lineTo(x4, y4); overlay.CheckPoint(x1, y1);
ctx.closePath(); overlay.CheckPoint(x2, y2);
overlay.CheckPoint(x3, y3);
overlay.CheckPoint(x1, y1); overlay.CheckPoint(x4, y4);
overlay.CheckPoint(x2, y2);
overlay.CheckPoint(x3, y3); ctx.moveTo(x1, y1);
overlay.CheckPoint(x4, y4); ctx.lineTo(x2, y2);
ctx.lineTo(x3, y3);
ctx.strokeStyle = _style_white; ctx.lineTo(x4, y4);
ctx.stroke(); ctx.closePath();
ctx.beginPath(); overlay.CheckPoint(x1, y1);
overlay.CheckPoint(x2, y2);
this.AddRectDash(ctx, x1, y1, x2, y2, x3, y3, x4, y4, 8, 3); overlay.CheckPoint(x3, y3);
overlay.CheckPoint(x4, y4);
ctx.strokeStyle = _style_blue;
ctx.stroke(); ctx.strokeStyle = _style_white;
ctx.stroke();
var ex1 = (x2 - x1) / _len_x;
var ey1 = (y2 - y1) / _len_x; ctx.beginPath();
var ex2 = (x1 - x3) / _len_y;
var ey2 = (y1 - y3) / _len_y; this.AddRectDash(ctx, x1, y1, x2, y2, x3, y3, x4, y4, 8, 3);
var _bAbsX1 = Math.abs(ex1) < 0.01; ctx.strokeStyle = _style_blue;
var _bAbsY1 = Math.abs(ey1) < 0.01; ctx.stroke();
var _bAbsX2 = Math.abs(ex2) < 0.01;
var _bAbsY2 = Math.abs(ey2) < 0.01; var ex1 = (x2 - x1) / _len_x;
var ey1 = (y2 - y1) / _len_x;
if (_bAbsX2 && _bAbsY2) var ex2 = (x1 - x3) / _len_y;
{ var ey2 = (y1 - y3) / _len_y;
if (_bAbsX1 && _bAbsY1)
{ var _bAbsX1 = Math.abs(ex1) < 0.01;
ex1 = 1; var _bAbsY1 = Math.abs(ey1) < 0.01;
ey1 = 0; var _bAbsX2 = Math.abs(ex2) < 0.01;
ex2 = 0; var _bAbsY2 = Math.abs(ey2) < 0.01;
ey2 = 1;
} if (_bAbsX2 && _bAbsY2)
else {
{ if (_bAbsX1 && _bAbsY1)
ex2 = -ey1; {
ey2 = ex1; ex1 = 1;
} ey1 = 0;
} ex2 = 0;
else if (_bAbsX1 && _bAbsY1) ey2 = 1;
{ }
ex1 = ey2; else
ey1 = -ex2; {
} ex2 = -ey1;
ey2 = ex1;
var xc1 = (x1 + x2) / 2; }
var yc1 = (y1 + y2) / 2; }
else if (_bAbsX1 && _bAbsY1)
ctx.beginPath(); {
ex1 = ey2;
if (!bIsUseImageRotateTrack) ey1 = -ex2;
{ }
ctx.beginPath();
overlay.AddEllipse(xc1 + ex2 * TRACK_DISTANCE_ROTATE, yc1 + ey2 * TRACK_DISTANCE_ROTATE, TRACK_DISTANCE_ROTATE); var xc1 = (x1 + x2) / 2;
var yc1 = (y1 + y2) / 2;
ctx.fillStyle = _style_green;
ctx.fill(); ctx.beginPath();
ctx.stroke();
} if (!bIsUseImageRotateTrack)
else {
{ ctx.beginPath();
if (window.g_track_rotate_marker.asc_complete) overlay.AddEllipse(xc1 + ex2 * TRACK_DISTANCE_ROTATE, yc1 + ey2 * TRACK_DISTANCE_ROTATE, TRACK_DISTANCE_ROTATE);
{
var _xI = xc1 + ex2 * TRACK_DISTANCE_ROTATE; ctx.fillStyle = _style_green;
var _yI = yc1 + ey2 * TRACK_DISTANCE_ROTATE; ctx.fill();
var _w = IMAGE_ROTATE_TRACK_W; ctx.stroke();
var _w2 = IMAGE_ROTATE_TRACK_W / 2; }
else
ctx.setTransform(ex1, ey1, -ey1, ex1, _xI, _yI); {
ctx.drawImage(window.g_track_rotate_marker, -_w2, -_w2, _w, _w); if (window.g_track_rotate_marker.asc_complete)
ctx.setTransform(1, 0, 0, 1, 0, 0); {
var _xI = xc1 + ex2 * TRACK_DISTANCE_ROTATE;
overlay.CheckRect(_xI - _w2, _yI - _w2, _w, _w); var _yI = yc1 + ey2 * TRACK_DISTANCE_ROTATE;
} var _w = IMAGE_ROTATE_TRACK_W;
} var _w2 = IMAGE_ROTATE_TRACK_W / 2;
ctx.beginPath(); ctx.setTransform(ex1, ey1, -ey1, ex1, _xI, _yI);
ctx.moveTo(xc1, yc1); ctx.drawImage(window.g_track_rotate_marker, -_w2, -_w2, _w, _w);
ctx.lineTo(xc1 + ex2 * TRACK_DISTANCE_ROTATE2, yc1 + ey2 * TRACK_DISTANCE_ROTATE2); ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.stroke();
overlay.CheckRect(_xI - _w2, _yI - _w2, _w, _w);
ctx.beginPath(); }
}
ctx.fillStyle = _style_white;
ctx.beginPath();
if (bIsEllipceCorner) ctx.moveTo(xc1, yc1);
{ ctx.lineTo(xc1 + ex2 * TRACK_DISTANCE_ROTATE2, yc1 + ey2 * TRACK_DISTANCE_ROTATE2);
overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); ctx.stroke();
overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS);
overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); ctx.beginPath();
overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS);
} ctx.fillStyle = _style_white;
else
{ if (bIsEllipceCorner)
overlay.AddRect3(x1, y1, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); {
overlay.AddRect3(x2, y2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS);
overlay.AddRect3(x3, y3, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS);
overlay.AddRect3(x4, y4, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS);
} overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS);
}
if (bIsRectsTrack) else
{ {
overlay.AddRect3((x1 + x2) / 2, (y1 + y2) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddRect3(x1, y1, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
overlay.AddRect3((x2 + x4) / 2, (y2 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddRect3(x2, y2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
overlay.AddRect3((x3 + x4) / 2, (y3 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddRect3(x3, y3, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
overlay.AddRect3((x3 + x1) / 2, (y3 + y1) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); overlay.AddRect3(x4, y4, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
} }
ctx.fill(); if (bIsRectsTrack)
ctx.stroke(); {
overlay.AddRect3((x1 + x2) / 2, (y1 + y2) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
ctx.beginPath(); overlay.AddRect3((x2 + x4) / 2, (y2 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
} overlay.AddRect3((x3 + x4) / 2, (y3 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
overlay.AddRect3((x3 + x1) / 2, (y3 + y1) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
break; }
}
ctx.fill();
default: ctx.stroke();
break;
} ctx.beginPath();
}
break;
}
default:
break;
}
ctx.globalAlpha = _oldGlobalAlpha; ctx.globalAlpha = _oldGlobalAlpha;
}, },
......
...@@ -1093,24 +1093,24 @@ CAutoshapeTrack.prototype = ...@@ -1093,24 +1093,24 @@ CAutoshapeTrack.prototype =
ctx.strokeStyle = _style_blue; ctx.strokeStyle = _style_blue;
if (nIsCleverWithTransform) if (!isLine)
{ {
ctx.rect(_x1 + 0.5, _y2 + 0.5, _x4 - _x1, _y4 - _y1); if (nIsCleverWithTransform)
ctx.stroke(); {
ctx.beginPath(); ctx.rect(_x1 + 0.5, _y2 + 0.5, _x4 - _x1, _y4 - _y1);
} ctx.stroke();
else ctx.beginPath();
{ }
if (!isLine) else
{ {
ctx.moveTo(x1, y1); ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2); ctx.lineTo(x2, y2);
ctx.lineTo(x4, y4); ctx.lineTo(x4, y4);
ctx.lineTo(x3, y3); ctx.lineTo(x3, y3);
ctx.closePath(); ctx.closePath();
ctx.stroke(); ctx.stroke();
} }
} }
overlay.CheckPoint(x1, y1); overlay.CheckPoint(x1, y1);
overlay.CheckPoint(x2, y2); overlay.CheckPoint(x2, y2);
...@@ -1258,49 +1258,57 @@ CAutoshapeTrack.prototype = ...@@ -1258,49 +1258,57 @@ CAutoshapeTrack.prototype =
} }
else else
{ {
overlay.AddRect2(_x1 + 0.5, _y1 + 0.5, TRACK_RECT_SIZE); if (!isLine)
if (!isLine) {
{ overlay.AddRect2(_x1 + 0.5, _y1 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(_x2 + 0.5, _y2 + 0.5, TRACK_RECT_SIZE); overlay.AddRect2(_x2 + 0.5, _y2 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(_x3 + 0.5, _y3 + 0.5, TRACK_RECT_SIZE); overlay.AddRect2(_x3 + 0.5, _y3 + 0.5, TRACK_RECT_SIZE);
} overlay.AddRect2(_x4 + 0.5, _y4 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(_x4 + 0.5, _y4 + 0.5, TRACK_RECT_SIZE); }
else
{
overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE);
overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE);
}
} }
} }
if (!nIsCleverWithTransform) if (!isLine)
{ {
if (bIsRectsTrack && !isLine) if (!nIsCleverWithTransform)
{ {
if (bIsRectsTrackX) if (bIsRectsTrack)
{ {
overlay.AddRect3((x1 + x2) / 2, (y1 + y2) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); if (bIsRectsTrackX)
overlay.AddRect3((x3 + x4) / 2, (y3 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); {
} overlay.AddRect3((x1 + x2) / 2, (y1 + y2) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
if (bIsRectsTrackY) overlay.AddRect3((x3 + x4) / 2, (y3 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
{ }
overlay.AddRect3((x2 + x4) / 2, (y2 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); if (bIsRectsTrackY)
overlay.AddRect3((x3 + x1) / 2, (y3 + y1) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); {
} overlay.AddRect3((x2 + x4) / 2, (y2 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
} overlay.AddRect3((x3 + x1) / 2, (y3 + y1) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2);
} }
else }
{ }
var _xC = (((_x1 + _x2) / 2) >> 0) + 0.5; else
var _yC = (((_y1 + _y3) / 2) >> 0) + 0.5; {
var _xC = (((_x1 + _x2) / 2) >> 0) + 0.5;
var _yC = (((_y1 + _y3) / 2) >> 0) + 0.5;
if (bIsRectsTrackX) if (bIsRectsTrackX)
{ {
overlay.AddRect2(_xC, _y1+0.5, TRACK_RECT_SIZE); overlay.AddRect2(_xC, _y1+0.5, TRACK_RECT_SIZE);
overlay.AddRect2(_xC, _y3+0.5, TRACK_RECT_SIZE); overlay.AddRect2(_xC, _y3+0.5, TRACK_RECT_SIZE);
} }
if (bIsRectsTrackY) if (bIsRectsTrackY)
{ {
overlay.AddRect2(_x2+0.5, _yC, TRACK_RECT_SIZE); overlay.AddRect2(_x2+0.5, _yC, TRACK_RECT_SIZE);
overlay.AddRect2(_x1+0.5, _yC, TRACK_RECT_SIZE); overlay.AddRect2(_x1+0.5, _yC, TRACK_RECT_SIZE);
} }
} }
}
ctx.fill(); ctx.fill();
ctx.stroke(); ctx.stroke();
......
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