[iphonex] [ios] Fixed compass position estimation.

This commit is contained in:
Ilya Grechuhin 2018-01-10 16:33:31 +03:00 committed by Roman Kuznetsov
parent 60a1819ac7
commit ab6cc9ca2e
2 changed files with 14 additions and 2 deletions

View file

@ -49,15 +49,18 @@
gui::TWidgetsLayoutInfo layout;
auto const vs = self.visualScale;
auto const viewHeight = [MapViewController controller].view.height;
auto const viewWidth = [MapViewController controller].view.width;
auto const rulerOffset =
m2::PointF(frame.origin.x * vs, (frame.origin.y + frame.size.height - viewHeight) * vs);
m_skin->ForEach([&layout, &rulerOffset](gui::EWidget w, gui::Position const & pos) {
auto const compassOffset =
m2::PointF((frame.origin.x + frame.size.width - viewWidth) * vs, frame.origin.y * vs);
m_skin->ForEach([&](gui::EWidget w, gui::Position const & pos) {
m2::PointF pivot = pos.m_pixelPivot;
switch (w)
{
case gui::WIDGET_RULER:
case gui::WIDGET_COPYRIGHT: pivot += rulerOffset; break;
case gui::WIDGET_COMPASS:
case gui::WIDGET_COMPASS: pivot += compassOffset; break;
case gui::WIDGET_SCALE_LABEL:
case gui::WIDGET_CHOOSE_POSITION_MARK: break;
}

View file

@ -1,4 +1,13 @@
final class WidgetsArea: AvailableArea {
override var areaFrame: CGRect {
return alternative(iPhone: {
var frame = super.areaFrame
frame.origin.y -= 16
frame.size.height += 16
return frame
}, iPad: { super.areaFrame })()
}
override func isAreaAffectingView(_ other: UIView) -> Bool {
return !other.widgetsAreaAffectDirections.isEmpty
}