Skip to content

Commit

Permalink
Merge pull request #3 from trafi/feature/content-inset-fix
Browse files Browse the repository at this point in the history
Include insets when calculating `minOffset`
  • Loading branch information
Domas Nutautas authored Oct 13, 2017
2 parents f23e23d + ba68688 commit 4f823d8
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 4f823d8

Please sign in to comment.