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

поправлено попадание в маркеры (ближайший)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@61544 954022d7-b5bf-4e40-9824-e11837661b57
parent e278fb69
......@@ -95352,59 +95352,108 @@ function hitToHandles(x, y, object)
radius *= global_mouseEvent.KoefPixToMM;
}
// чтобы не считать корни
radius *= radius;
// считаем ближайший маркер, так как окрестность может быть большой, и пересекаться.
var _min_dist = 2 * radius; // главное что больше
var _ret_value = -1;
var check_line = CheckObjectLine(object);
var sqr_x = t_x * t_x, sqr_y = t_y * t_y;
if (Math.sqrt(sqr_x + sqr_y) < radius)
return 0;
var _tmp_dist = sqr_x + sqr_y;
if (_tmp_dist < _min_dist)
{
_min_dist = _tmp_dist;
_ret_value = 0;
}
var hc = object.extX * 0.5;
var dist_x = t_x - hc;
sqr_x = dist_x * dist_x;
if (Math.sqrt(sqr_x + sqr_y) < radius && !check_line)
return 1;
_tmp_dist = sqr_x + sqr_y;
if (_tmp_dist < _min_dist && !check_line)
{
_min_dist = _tmp_dist;
_ret_value = 1;
}
dist_x = t_x - object.extX;
sqr_x = dist_x * dist_x;
if (Math.sqrt(sqr_x + sqr_y) < radius && !check_line)
return 2;
_tmp_dist = sqr_x + sqr_y;
if (_tmp_dist < _min_dist && !check_line)
{
_min_dist = _tmp_dist;
_ret_value = 2;
}
var vc = object.extY * 0.5;
var dist_y = t_y - vc;
sqr_y = dist_y * dist_y;
if (Math.sqrt(sqr_x + sqr_y) < radius && !check_line)
return 3;
_tmp_dist = sqr_x + sqr_y;
if (_tmp_dist < _min_dist && !check_line)
{
_min_dist = _tmp_dist;
_ret_value = 3;
}
dist_y = t_y - object.extY;
sqr_y = dist_y * dist_y;
if (Math.sqrt(sqr_x + sqr_y) < radius)
return 4;
_tmp_dist = sqr_x + sqr_y;
if (_tmp_dist < _min_dist)
{
_min_dist = _tmp_dist;
_ret_value = 4;
}
dist_x = t_x - hc;
sqr_x = dist_x * dist_x;
if (Math.sqrt(sqr_x + sqr_y) < radius && !check_line)
return 5;
_tmp_dist = sqr_x + sqr_y;
if (_tmp_dist < _min_dist && !check_line)
{
_min_dist = _tmp_dist;
_ret_value = 5;
}
dist_x = t_x;
sqr_x = dist_x * dist_x;
if (Math.sqrt(sqr_x + sqr_y) < radius && !check_line)
return 6;
_tmp_dist = sqr_x + sqr_y;
if (_tmp_dist < _min_dist && !check_line)
{
_min_dist = _tmp_dist;
_ret_value = 6;
}
dist_y = t_y - vc;
sqr_y = dist_y * dist_y;
if (Math.sqrt(sqr_x + sqr_y) < radius && !check_line)
return 7;
_tmp_dist = sqr_x + sqr_y;
if (_tmp_dist < _min_dist && !check_line)
{
_min_dist = _tmp_dist;
_ret_value = 7;
}
if(object.canRotate && object.canRotate())
if(object.canRotate && object.canRotate() && !check_line)
{
var rotate_distance = object.convertPixToMM(TRACK_DISTANCE_ROTATE);
dist_y = t_y + rotate_distance;
sqr_y = dist_y * dist_y;
dist_x = t_x - hc;
sqr_x = dist_x * dist_x;
if (Math.sqrt(sqr_x + sqr_y) < radius && !check_line)
return 8;
_tmp_dist = sqr_x + sqr_y;
if (_tmp_dist < _min_dist)
{
_min_dist = _tmp_dist;
_ret_value = 8;
}
}
if (_min_dist < radius)
return _ret_value;
return -1;
}
......@@ -292243,8 +292292,9 @@ function CHorRuler()
var dKoef_mm_to_pix = g_dKoef_mm_to_pix * this.m_dZoom;
this.m_nTop = (1.8 * g_dKoef_mm_to_pix) >> 0;
this.m_nBottom = (5.2 * g_dKoef_mm_to_pix) >> 0;
// не править !!!
this.m_nTop = 6;//(1.8 * g_dKoef_mm_to_pix) >> 0;
this.m_nBottom = 19;//(5.2 * g_dKoef_mm_to_pix) >> 0;
var context = this.m_oCanvas.getContext('2d');
if (!this.IsRetina)
......@@ -293427,8 +293477,9 @@ function CHorRuler()
var _positon_y = this.m_nBottom - 5;
context.strokeStyle = "#81878F";
var2 = parseInt(1.4 * g_dKoef_mm_to_pix);
var3 = parseInt(1 * g_dKoef_mm_to_pix);
// не менять!!!
var2 = 5;//(1.4 * g_dKoef_mm_to_pix) >> 0;
var3 = 3;//(1 * g_dKoef_mm_to_pix) >> 0;
checker.BlitMarginLeftInd = _margin_left;
checker.BlitMarginRightInd = _margin_right;
......@@ -293556,8 +293607,10 @@ function CHorRuler()
// left indent
dCenterX = left + (_margin_left + this.m_dIndentLeft) * dKoef_mm_to_pix;
var1 = parseInt(dCenterX - 1 * g_dKoef_mm_to_pix) - 0.5;
var4 = parseInt(dCenterX + 1 * g_dKoef_mm_to_pix) + 0.5;
var _1mm_to_pix = g_dKoef_mm_to_pix;
var1 = parseInt(dCenterX - _1mm_to_pix) - 0.5;
var4 = parseInt(dCenterX + _1mm_to_pix) + 0.5;
context.beginPath();
context.moveTo(var1, this.m_nBottom + 0.5);
......@@ -293575,8 +293628,8 @@ function CHorRuler()
// right indent
dCenterX = left + (_margin_right - this.m_dIndentRight) * dKoef_mm_to_pix;
var1 = parseInt(dCenterX - 1 * g_dKoef_mm_to_pix) - 0.5;
var4 = parseInt(dCenterX + 1 * g_dKoef_mm_to_pix) + 0.5;
var1 = parseInt(dCenterX - _1mm_to_pix) - 0.5;
var4 = parseInt(dCenterX + _1mm_to_pix) + 0.5;
context.beginPath();
context.moveTo(var1, this.m_nBottom + 0.5);
......@@ -293591,8 +293644,8 @@ function CHorRuler()
// first line indent
dCenterX = left + (_margin_left + this.m_dIndentLeftFirst) * dKoef_mm_to_pix;
var1 = parseInt(dCenterX - 1 * g_dKoef_mm_to_pix) - 0.5;
var4 = parseInt(dCenterX + 1 * g_dKoef_mm_to_pix) + 0.5;
var1 = parseInt(dCenterX - _1mm_to_pix) - 0.5;
var4 = parseInt(dCenterX + _1mm_to_pix) + 0.5;
context.beginPath();
context.moveTo(var1, this.m_nTop + 0.5);
......@@ -293855,8 +293908,9 @@ function CVerRuler()
var dKoef_mm_to_pix = g_dKoef_mm_to_pix * this.m_dZoom;
this.m_nLeft = (0.8 * g_dKoef_mm_to_pix) >> 0;
this.m_nRight = (4.2 * g_dKoef_mm_to_pix) >> 0;
// не править !!!
this.m_nLeft = 3;//(0.8 * g_dKoef_mm_to_pix) >> 0;
this.m_nRight = 15;//(4.2 * g_dKoef_mm_to_pix) >> 0;
var context = this.m_oCanvas.getContext('2d');
if (!this.IsRetina)
......@@ -357260,6 +357314,15 @@ CDrawingDocument.prototype =
if (!this.IsViewMode)
{
global_mouseEvent.KoefPixToMM = 5;
if (this.Native["GetDeviceDPI"])
{
// 1см
global_mouseEvent.KoefPixToMM = 10 * this.Native["GetDeviceDPI"] / g_dKoef_in_to_mm;
// Серега ориентируется на эту константу
global_mouseEvent.KoefPixToMM /= TRACK_CIRCLE_RADIUS;
}
var _isDrawings = this.LogicDocument.DrawingObjects.isPointInDrawingObjects2(pos.X, pos.Y, pos.Page, true);
if (_isDrawings)
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