| 53 | } |
| 54 | |
| 55 | m2::PointD OverlayHandle::GetPivot(ScreenBase const & screen, bool perspective) const |
| 56 | { |
| 57 | m2::RectD r = GetPixelRect(screen, false); |
| 58 | m2::PointD size(0.5 * r.SizeX(), 0.5 * r.SizeY()); |
| 59 | m2::PointD result = r.Center(); |
| 60 | |
| 61 | if (m_anchor & dp::Left) |
| 62 | result.x -= size.x; |
| 63 | else if (m_anchor & dp::Right) |
| 64 | result.x += size.x; |
| 65 | |
| 66 | if (m_anchor & dp::Top) |
| 67 | result.y -= size.y; |
| 68 | else if (m_anchor & dp::Bottom) |
| 69 | result.y += size.y; |
| 70 | |
| 71 | if (perspective) |
| 72 | result = screen.PtoP3d(result, -m_pivotZ); |
| 73 | |
| 74 | return result; |
| 75 | } |
| 76 | |
| 77 | bool OverlayHandle::IsIntersect(ScreenBase const & screen, ref_ptr<OverlayHandle> const h) const |
| 78 | { |