Commit 806e14be 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@47552 954022d7-b5bf-4e40-9824-e11837661b57
parent 651e938d
function HitInLine(context, px, py, x0, y0, x1, y1)
{
var tx, ty, dx, dy, d;
tx=x1-x0;
ty=y1-y0;
d=1.5/Math.sqrt(tx*tx+ty*ty);
dx=-ty*d;
dy=tx*d;
context.beginPath();
context.moveTo(x0, y0);
context.lineTo(x0+dx, y0+dy);
context.lineTo(x1+dx, y1+dy);
context.lineTo(x1-dx, y1-dy);
context.lineTo(x0-dx, y0-dy);
context.closePath();
return context.isPointInPath(px, py);
}
function HitInBezier4(context, px, py, x0, y0, x1, y1, x2, y2, x3, y3)
{
var tx, ty, dx, dy, d;
tx=x3-x0;
ty=y3-y0;
d=1.5/Math.sqrt(tx*tx+ty*ty);
dx=-ty*d;
dy=tx*d;
context.beginPath();
context.moveTo(x0, y0);
context.lineTo(x0+dx, y0+dy);
context.bezierCurveTo(x1+dx, y1+dy, x2+dx, y2+dy, x3+dx, y3+dy);
context.lineTo(x3-dx, y3-dy);
context.bezierCurveTo(x2-dx, y2-dy, x1-dx, y1-dy, x0-dx, y0-dy);
context.closePath();
return context.isPointInPath(px, py);
}
function HitInBezier3(context, px, py, x0, y0, x1, y1, x2, y2)
{
var tx, ty, dx, dy, d;
tx=x2-x0;
ty=y2-y0;
d=1.5/Math.sqrt(tx*tx+ty*ty);
dx=-ty*d;
dy=tx*d;
context.beginPath();
context.moveTo(x0, y0);
context.lineTo(x0+dx, y0+dy);
context.quadraticCurveTo(x1+dx, y1+dy, x2+dx, y2+dy);
context.lineTo(x2-dx, y2-dy);
context.quadraticCurveTo(x1-dx, y1-dy, x0-dx, y0-dy);
context.closePath();
return context.isPointInPath(px, py);
}
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