mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 22:03:37 +00:00
[ios] update side buttons animation
The old implementation was rigidly tightened to the place page top bound that breaks the side buttons (zoom, location) hiding/showing logic when the PP is big. Now the side buttons follow the PP top edge with animation and disappear animated when they out of bounds. Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
7117a1b954
commit
3525f36919
@@ -59,25 +59,28 @@ CGFloat const kButtonsBottomOffset = 6;
|
||||
|
||||
- (void)layoutYPosition {
|
||||
CGFloat const centerShift = (self.height - self.zoomIn.midY - self.zoomOut.midY) / 2;
|
||||
self.midY = centerShift + self.superview.height / 2;
|
||||
if (self.maxY > self.bottomBound)
|
||||
self.maxY = self.bottomBound;
|
||||
[UIView animateWithDuration:kDefaultAnimationDuration
|
||||
animations:^{
|
||||
self.midY = centerShift + self.superview.height / 2;
|
||||
if (self.maxY > self.bottomBound)
|
||||
self.maxY = self.bottomBound;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)fadeZoomButtonsShow:(BOOL)show {
|
||||
CGFloat const alpha = show ? 1.0 : 0.0;
|
||||
[UIView animateWithDuration:kDefaultAnimationDuration
|
||||
animations:^{
|
||||
self.zoomIn.alpha = alpha;
|
||||
self.zoomOut.alpha = alpha;
|
||||
}];
|
||||
self.zoomIn.alpha = alpha;
|
||||
self.zoomOut.alpha = alpha;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)fadeLocationButtonShow:(BOOL)show {
|
||||
[UIView animateWithDuration:kDefaultAnimationDuration
|
||||
animations:^{
|
||||
self.location.alpha = show ? 1.0 : 0.0;
|
||||
}];
|
||||
self.location.alpha = show ? 1.0 : 0.0;
|
||||
}];
|
||||
}
|
||||
|
||||
// Show/hide zoom and location buttons depending on available vertical space.
|
||||
|
||||
Reference in New Issue
Block a user