-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios] Don't use negative content insets #4504
[ios] Don't use negative content insets #4504
Conversation
/// Returns edge insets with negative values replaced with 0. | ||
- (UIEdgeInsets)removeNegativeInsets:(UIEdgeInsets)insets | ||
{ | ||
return UIEdgeInsetsMake((insets.top > 0 ? insets.top : 0), (insets.left > 0 ? insets.left : 0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be expressed with the MIN macro for brevity. And since it's only used in one place, it should be inclined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course I mean the MAX macro. Definitely keep the comment. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will incline the MAXes. 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Force pushed these changes at 0b3c67d.
9e7aad7
to
88af52f
Compare
The iOS build on Bitrise is failing with |
Seeing tests fail intermittently on my machine, too:
|
9e91e6c
to
9e8cc83
Compare
Tests pass reliably (five in a row on Bitrise) after switching to KVO in 9e91e6c886dc15257093d032df3f6c83e947df84, which I rebased back into 183f55e. |
@"map should not have bottom content inset"); | ||
return YES; | ||
}]; | ||
[self waitForExpectationsWithTimeout:5.0 handler:nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Five seconds seems rather generous. Is it necessary to make this test take 10 seconds for a frame change that should be instant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll lower this to 1.0
.
This is mainly a buffer against slow CI machines. waitForExpectationsWithTimeout:handler:
should never add more than a tick or two to the execution time, no matter the timeout length — if it exceeds the timeout, it’s a failure and everything stops.
I think xcpretty is swallowing our test output and the elapsed time per test on Bitrise, but locally this test completes in the blink of an eye.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9e8cc83
to
60a4429
Compare
ca2abc2
to
5c45ffc
Compare
60a4429
to
203849f
Compare
When a map view was smaller than the entire viewport, negative content insets would be applied. Negative content insets would only be valid if the map view extended outside of its frame, which cannot happen. Fixes #4440.
203849f
to
9f24ebd
Compare
This PR got jumped by another into |
When a map view was smaller than the entire viewport, negative content insets would be applied. This had the effect of making the visual "center" of every map the center of the viewport, ignoring the map view’s true center. Negative content insets would have only been valid if the map view extended outside of its frame, which cannot happen.
Applying negative content insets would erroneously offset
showAnnotations:
,setCenterCoordinate:
, “follow” user tracking mode, and so on.Fixes #4440.
9e7aad7d00ef09cf74f6d08f4d1e4189d613ac5a also slightly tweaks annotation padding behavior so that smaller views use proportional padding.
/cc @1ec5