Commit d96660b2 authored by Oleg.Korshul's avatar Oleg.Korshul

деление на ноль

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54610 954022d7-b5bf-4e40-9824-e11837661b57
parent 6a39677a
var double_eps = 0.00001;
var hit_error_eps = 0.5;
function HitInLine(context, px, py, x0, y0, x1, y1)
{
var tx, ty, dx, dy, d;
tx=x1-x0;
ty=y1-y0;
if (Math.abs(tx*tx+ty*ty) < double_eps)
return HitInLine(context, px, py, x0, y0, x1 + hit_error_eps, y1 + hit_error_eps);
d=1.5/Math.sqrt(tx*tx+ty*ty);
if(global_mouseEvent !== null && typeof global_mouseEvent === "object" && typeof global_mouseEvent.KoefPixToMM === "number" && !isNaN(global_mouseEvent.KoefPixToMM))
d *= global_mouseEvent.KoefPixToMM;
......@@ -27,6 +32,9 @@ function HitInBezier4(context, px, py, x0, y0, x1, y1, x2, y2, x3, y3)
tx=x3-x0;
ty=y3-y0;
if (Math.abs(tx*tx+ty*ty) < double_eps)
return HitInLine(context, px, py, x0, y0, x1, y1, x2, y2, x3 + hit_error_eps, y3 + hit_error_eps);
d=1.5/Math.sqrt(tx*tx+ty*ty);
if(global_mouseEvent !== null && typeof global_mouseEvent === "object" && typeof global_mouseEvent.KoefPixToMM === "number" && !isNaN(global_mouseEvent.KoefPixToMM))
d *= global_mouseEvent.KoefPixToMM;
......@@ -50,6 +58,9 @@ function HitInBezier3(context, px, py, x0, y0, x1, y1, x2, y2)
tx=x2-x0;
ty=y2-y0;
if (Math.abs(tx*tx+ty*ty) < double_eps)
return HitInLine(context, px, py, x0, y0, x1, y1, x2 + hit_error_eps, y2 + hit_error_eps);
d=1.5/Math.sqrt(tx*tx+ty*ty);
if(global_mouseEvent !== null && typeof global_mouseEvent === "object" && typeof global_mouseEvent.KoefPixToMM === "number" && !isNaN(global_mouseEvent.KoefPixToMM))
d *= global_mouseEvent.KoefPixToMM;
......
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