Skip to content

Commit

Permalink
Include insets when calculating minOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
eimantas committed Oct 13, 2017
1 parent f23e23d commit ba68688
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Source/SlideOutable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,21 @@ open class SlideOutable: ClearContainerView {
return bounds.height - currentOffset
}

var minOffset: CGFloat { return isScrollStretchable ? topPadding : max(topPadding, bounds.height - (header?.bounds.height ?? 0) - scroll.contentSize.height) }
var minOffset: CGFloat {
if isScrollStretchable {
return topPadding
} else {
let insets: UIEdgeInsets
if #available(iOS 11.0, *) {
insets = scroll.adjustedContentInset
} else {
insets = scroll.contentInset
}
let insetsOffset = insets.bottom + insets.top
let calculatedOffset = bounds.height - (header?.bounds.height ?? 0) - scroll.contentSize.height - insetsOffset
return max(topPadding, calculatedOffset)
}
}
var maxOffset: CGFloat { return max(minOffset, bounds.height - minContentHeight) }
var anchorOffset: CGFloat? { return anchorFraction.flatMap { bounds.height * (1 - $0) } }

Expand Down

0 comments on commit ba68688

Please sign in to comment.