Skip to content

Commit

Permalink
Merge pull request #22 from flipkart-incubator/gestureSetting
Browse files Browse the repository at this point in the history
gesture setting exposed
  • Loading branch information
rajatgupta26 authored Jul 18, 2018
2 parents 73883a7 + bd3c08b commit 5b9a5bb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ContentSheet/Classes/ContentSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ public class ContentSheet: UIViewController {
}
}
}
public var enablePanGesture: Bool = true {
didSet {
self._panGesture.isEnabled = enablePanGesture
}
}

//Scroll management related
fileprivate weak var _scrollviewToObserve: UIScrollView?
Expand Down Expand Up @@ -504,7 +509,7 @@ public class ContentSheet: UIViewController {
}
}

public func resetBottomSheetHeight(collapsedHeight: CGFloat, expandedHeight: CGFloat) {
public func resetContentSheetHeight(collapsedHeight: CGFloat, expandedHeight: CGFloat) {
self.collapsedHeight = collapsedHeight
self.expandedHeight = expandedHeight

Expand Down Expand Up @@ -575,7 +580,7 @@ public class ContentSheet: UIViewController {

let maxHeight = maxExpandableHeight();

resetBottomSheetHeight(collapsedHeight: min(maxHeight, self._oldCollapsedHeight + keyboardHeight), expandedHeight: min(maxHeight, self._oldExpandedHeight + keyboardHeight))
resetContentSheetHeight(collapsedHeight: min(maxHeight, self._oldCollapsedHeight + keyboardHeight), expandedHeight: min(maxHeight, self._oldExpandedHeight + keyboardHeight))
}

@objc private func _keyboardDidAppear(_ notification: Notification) {
Expand Down Expand Up @@ -622,7 +627,7 @@ public class ContentSheet: UIViewController {

@objc private func _keyboardWillDisappear(_ notification: Notification) {
if self._keyboardPresent {
resetBottomSheetHeight(collapsedHeight: self._oldCollapsedHeight, expandedHeight: self._oldExpandedHeight)
resetContentSheetHeight(collapsedHeight: self._oldCollapsedHeight, expandedHeight: self._oldExpandedHeight)
}
}

Expand All @@ -637,7 +642,7 @@ public class ContentSheet: UIViewController {

let maxHeight = maxExpandableHeight();

resetBottomSheetHeight(collapsedHeight: min(maxHeight, self.collapsedHeight + keyboardHeight), expandedHeight: min(maxHeight, self.expandedHeight + keyboardHeight))
resetContentSheetHeight(collapsedHeight: min(maxHeight, self.collapsedHeight + keyboardHeight), expandedHeight: min(maxHeight, self.expandedHeight + keyboardHeight))
}
}

Expand Down

0 comments on commit 5b9a5bb

Please sign in to comment.