forked from organicmaps/organicmaps
[ios] Updated compass widget position estimation.
This commit is contained in:
parent
f1878adf92
commit
843e74c796
5 changed files with 20 additions and 1 deletions
|
@ -35,6 +35,7 @@ typedef NS_ENUM(NSUInteger, MWMNavigationDashboardState) {
|
|||
@property(weak, nonatomic, readonly) id<MWMNavigationDashboardManagerProtocol> delegate;
|
||||
@property(nonatomic) CGFloat topBound;
|
||||
@property(nonatomic) CGFloat leftBound;
|
||||
@property(nonatomic, readonly) CGFloat extraCompassBottomOffset;
|
||||
@property(nonatomic, readonly) CGFloat height;
|
||||
|
||||
- (instancetype)init __attribute__((unavailable("init is not available")));
|
||||
|
|
|
@ -238,4 +238,11 @@ using TInfoDisplays = NSHashTable<__kindof TInfoDisplay>;
|
|||
return _entity;
|
||||
}
|
||||
|
||||
- (CGFloat)extraCompassBottomOffset
|
||||
{
|
||||
if (!_navigationInfoView)
|
||||
return 0;
|
||||
return self.navigationInfoView.extraCompassBottomOffset;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
@interface MWMNavigationInfoView : UIView<MWMNavigationDashboardInfoProtocol>
|
||||
|
||||
@property(nonatomic) CGFloat leftBound;
|
||||
@property(nonatomic, readonly) CGFloat extraCompassBottomOffset;
|
||||
@property(nonatomic, readonly) CGFloat visibleHeight;
|
||||
|
||||
- (void)addToView:(UIView *)superview;
|
||||
|
|
|
@ -358,4 +358,9 @@ BOOL defaultOrientation()
|
|||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (CGFloat)extraCompassBottomOffset
|
||||
{
|
||||
return defaultOrientation() || self.searchView.hidden ? 0 : kSearchButtonsViewHeightLandscape;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#import "MWMMapWidgets.h"
|
||||
#import "MWMNavigationDashboardManager.h"
|
||||
|
||||
#include "drape_frontend/gui/skin.hpp"
|
||||
#include "std/unique_ptr.hpp"
|
||||
|
@ -56,8 +57,12 @@
|
|||
pivot -= m2::PointF(0.0, self.bottomBound * self.visualScale);
|
||||
break;
|
||||
case gui::WIDGET_COMPASS:
|
||||
pivot += m2::PointF(self.leftBound, -self.bottomBound) * self.visualScale;
|
||||
{
|
||||
CGFloat const compassBottomBound =
|
||||
self.bottomBound + [MWMNavigationDashboardManager manager].extraCompassBottomOffset;
|
||||
pivot += m2::PointF(self.leftBound, -compassBottomBound) * self.visualScale;
|
||||
break;
|
||||
}
|
||||
case gui::WIDGET_SCALE_LABEL:
|
||||
case gui::WIDGET_CHOOSE_POSITION_MARK:
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue