[ios, macos] MGLMapView logging improvements. (#13776)
Added NSEdgeInsets to NSString function to improve the debugging on macOS. Added debug logs to MGLMapView.
This commit is contained in:
committed by
GitHub
parent
b460efdf00
commit
ca129e0c79
@@ -4,6 +4,12 @@ NS_INLINE NSString *MGLStringFromBOOL(BOOL value) {
|
||||
return value ? @"YES" : @"NO";
|
||||
}
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
NS_INLINE NSString *MGLStringFromNSEdgeInsets(NSEdgeInsets insets) {
|
||||
return [NSString stringWithFormat:@"{ top: %f, left: %f, bottom: %f, right: %f", insets.top, insets.left, insets.bottom, insets.right];
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MGL_LOGGING_DISABLED
|
||||
|
||||
#define MGLLogInfo(...)
|
||||
|
||||
@@ -1109,11 +1109,13 @@ public:
|
||||
|
||||
- (void)setContentInset:(UIEdgeInsets)contentInset
|
||||
{
|
||||
MGLLogDebug(@"Setting contentInset: %@", NSStringFromUIEdgeInsets(contentInset));
|
||||
[self setContentInset:contentInset animated:NO];
|
||||
}
|
||||
|
||||
- (void)setContentInset:(UIEdgeInsets)contentInset animated:(BOOL)animated
|
||||
{
|
||||
MGLLogDebug(@"Setting contentInset: %@ animated:", NSStringFromUIEdgeInsets(contentInset), MGLStringFromBOOL(animated));
|
||||
if (UIEdgeInsetsEqualToEdgeInsets(contentInset, self.contentInset))
|
||||
{
|
||||
return;
|
||||
@@ -1275,6 +1277,7 @@ public:
|
||||
|
||||
- (void)setPreferredFramesPerSecond:(MGLMapViewPreferredFramesPerSecond)preferredFramesPerSecond
|
||||
{
|
||||
MGLLogDebug(@"Setting preferredFramesPerSecond: %ld", preferredFramesPerSecond);
|
||||
if (_preferredFramesPerSecond == preferredFramesPerSecond)
|
||||
{
|
||||
return;
|
||||
@@ -5322,11 +5325,13 @@ public:
|
||||
|
||||
- (void)setTargetCoordinate:(CLLocationCoordinate2D)targetCoordinate
|
||||
{
|
||||
MGLLogDebug(@"Setting targetCoordinate: %@", MGLStringFromCLLocationCoordinate2D(targetCoordinate));
|
||||
[self setTargetCoordinate:targetCoordinate animated:YES];
|
||||
}
|
||||
|
||||
- (void)setTargetCoordinate:(CLLocationCoordinate2D)targetCoordinate animated:(BOOL)animated
|
||||
{
|
||||
MGLLogDebug(@"Setting targetCoordinate: %@ animated: %@", MGLStringFromCLLocationCoordinate2D(targetCoordinate), MGLStringFromBOOL(animated));
|
||||
if (targetCoordinate.latitude != self.targetCoordinate.latitude
|
||||
|| targetCoordinate.longitude != self.targetCoordinate.longitude)
|
||||
{
|
||||
|
||||
@@ -1389,14 +1389,16 @@ public:
|
||||
}
|
||||
|
||||
- (void)setContentInsets:(NSEdgeInsets)contentInsets {
|
||||
MGLLogDebug(@"Setting contentInset: %@", MGLStringFromNSEdgeInsets(contentInsets));
|
||||
[self setContentInsets:contentInsets animated:NO];
|
||||
}
|
||||
|
||||
- (void)setContentInsets:(NSEdgeInsets)contentInsets animated:(BOOL)animated {
|
||||
|
||||
if (NSEdgeInsetsEqual(contentInsets, self.contentInsets)) {
|
||||
return;
|
||||
}
|
||||
|
||||
MGLLogDebug(@"Setting contentInset: %@ animated:", MGLStringFromNSEdgeInsets(contentInsets), MGLStringFromBOOL(animated));
|
||||
// After adjusting the content insets, move the center coordinate from the
|
||||
// old frame of reference to the new one represented by the newly set
|
||||
// content insets.
|
||||
|
||||
Reference in New Issue
Block a user