protected internal virtual void GetSnappingPosition(ref float xValue, ref float yValue)
{
int cnt = _children.Count;
if (cnt == 0)
return;
EnsureBoundsCorrect();
GObject obj = null;
int i = 0;
if (yValue != 0)
{
for (; i < cnt; i++)
{
obj = _children[i];
if (yValue < obj.y)
{
if (i == 0)
{
yValue = 0;
break;
}
else
{
GObject prev = _children[i - 1];
if (yValue < prev.y + prev.height / 2) //top half part
yValue = prev.y;
else //bottom half part
yValue = obj.y;
break;
}
}
}
if (i == cnt)
yValue = obj.y;
}
if (xValue != 0)
{
if (i > 0)
i--;
for (; i < cnt; i++)
{
obj = _children[i];
if (xValue < obj.x)
{
if (i == 0)
{
xValue = 0;
break;
}
else
{
GObject prev = _children[i - 1];
if (xValue < prev.x + prev.width / 2) // top half part
xValue = prev.x;
else//bottom half part
xValue = obj.x;
break;
}
}
}
if (i == cnt)
xValue = obj.x;
}
}