mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-10 21:36:49 +10:00
new logic for menuDirectionUpThreshold
This commit is contained in:
@@ -81,10 +81,6 @@ class YepConfig {
|
||||
return 100
|
||||
}
|
||||
|
||||
struct Conversation {
|
||||
static let menuDirectionUpThreshold: CGFloat = 64 + 60
|
||||
}
|
||||
|
||||
struct AudioRecord {
|
||||
static let shortestDuration: NSTimeInterval = 0.5
|
||||
static let longestDuration: NSTimeInterval = 60
|
||||
|
||||
@@ -83,6 +83,9 @@ class ConversationViewController: BaseViewController {
|
||||
|
||||
@IBOutlet weak var swipeUpView: UIView!
|
||||
|
||||
lazy var menuDirectionUpThreshold: CGFloat = {
|
||||
return self.topBarsHeight + 60
|
||||
}()
|
||||
var currentMenu: BubbleMenuView?
|
||||
|
||||
func removeOldMenu() {
|
||||
@@ -1766,7 +1769,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi
|
||||
|
||||
let bubbleFrame = cell.convertRect(cell.bubbleBodyImageView.frame, toView: strongSelf.view)
|
||||
|
||||
let arrowDirection: BubbleMenuView.ArrowDirection = CGRectGetMidY(bubbleFrame) < YepConfig.Conversation.menuDirectionUpThreshold ? .Up : .Down
|
||||
let arrowDirection: BubbleMenuView.ArrowDirection = CGRectGetMidY(bubbleFrame) < strongSelf.menuDirectionUpThreshold ? .Up : .Down
|
||||
|
||||
let menu = BubbleMenuView(arrowDirection: arrowDirection, items: [copyItem])
|
||||
|
||||
@@ -2044,7 +2047,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi
|
||||
|
||||
let bubbleFrame = cell.convertRect(cell.bubbleBodyImageView.frame, toView: strongSelf.view)
|
||||
|
||||
let arrowDirection: BubbleMenuView.ArrowDirection = CGRectGetMidY(bubbleFrame) < YepConfig.Conversation.menuDirectionUpThreshold ? .Up : .Down
|
||||
let arrowDirection: BubbleMenuView.ArrowDirection = CGRectGetMidY(bubbleFrame) < strongSelf.menuDirectionUpThreshold ? .Up : .Down
|
||||
|
||||
let menu = BubbleMenuView(arrowDirection: arrowDirection, items: [copyItem, deleteItem])
|
||||
|
||||
|
||||
@@ -12,10 +12,12 @@ class ProfileLayout: UICollectionViewFlowLayout {
|
||||
|
||||
var scrollUpAction: ((progress: CGFloat) -> Void)?
|
||||
|
||||
let topBarsHeight: CGFloat = 64
|
||||
|
||||
let leftEdgeInset: CGFloat = YepConfig.Profile.leftEdgeInset
|
||||
|
||||
override func layoutAttributesForElementsInRect(rect: CGRect) -> [AnyObject]? {
|
||||
|
||||
let layoutAttributes = super.layoutAttributesForElementsInRect(rect) as! [UICollectionViewLayoutAttributes]
|
||||
let contentInset = collectionView!.contentInset
|
||||
let contentOffset = collectionView!.contentOffset
|
||||
|
||||
@@ -316,7 +316,7 @@ class ProfileViewController: UIViewController {
|
||||
|
||||
if let coverCell = self.profileCollectionView.cellForItemAtIndexPath(indexPath) as? ProfileHeaderCell {
|
||||
|
||||
let beginChangePercentage: CGFloat = 1 - topBarsHeight / self.collectionViewWidth * profileAvatarAspectRatio
|
||||
let beginChangePercentage: CGFloat = 1 - self.topBarsHeight / self.collectionViewWidth * profileAvatarAspectRatio
|
||||
let normalizedProgressForChange: CGFloat = (progress - beginChangePercentage) / (1 - beginChangePercentage)
|
||||
|
||||
coverCell.avatarBlurImageView.alpha = progress < beginChangePercentage ? 0 : normalizedProgressForChange
|
||||
|
||||
Reference in New Issue
Block a user