10000 Disable pan gesture recognizer by uladzislau-kruhlou · Pull Request #235 · gordontucker/FittedSheets · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Disable pan gesture recognizer #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
8 changes: 4 additions & 4 deletions FittedSheets.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 478Z685Y37;
INFOPLIST_FILE = Demos/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -702,7 +702,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 478Z685Y37;
INFOPLIST_FILE = Demos/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -727,7 +727,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = FittedSheets/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -758,7 +758,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = FittedSheets/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
11 changes: 9 additions & 2 deletions FittedSheets/SheetViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public class SheetViewController: UIViewController {
return childViewController.supportedInterfaceOrientations
}

public var mayEndEditingOnResize = true

public static var hasBlurBackground = false
public var hasBlurBackground = SheetViewController.hasBlurBackground {
didSet {
Expand Down Expand Up @@ -104,7 +106,10 @@ public class SheetViewController: UIViewController {
self.overlayTapView.isUserInteractionEnabled = !self.allowGestureThroughOverlay
}
}


public static var enableGestureRecognizer: Bool = true
public var enableGestureRecognizer = SheetViewController.enableGestureRecognizer

public static var cornerRadius: CGFloat = 12
public var cornerRadius: CGFloat {
get { return self.contentViewController.cornerRadius }
Expand Down Expand Up @@ -357,6 +362,8 @@ public class SheetViewController: UIViewController {
}

private func addPanGestureRecognizer() {
guard enableGestureRecognizer else { return }

let panGestureRecognizer = InitialTouchPanGestureRecognizer(target: self, action: #selector(panned(_:)))
self.view.addGestureRecognizer(panGestureRecognizer)
panGestureRecognizer.delegate = self
Expand Down Expand Up @@ -725,7 +732,7 @@ extension SheetViewController: UIGestureRecognizerDelegate {

let velocity = panGestureRecognizer.velocity(in: panGestureRecognizer.view?.superview)
guard pointInChildScrollView > 0, pointInChildScrollView < childScrollView.bounds.height else {
if keyboardHeight > 0 {
if keyboardHeight > 0 && mayEndEditingOnResize {
childScrollView.endEditing(true)
}
return true
Expand Down
8 changes: 4 additions & 4 deletions FittedSheets/Yalta.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func * <Type, Axis>(anchor: Anchor<Type, Axis>, multiplier: CGFloat) -> Anchor<T

extension Anchor where Type: AnchorType.Alignment {
/// Aligns two anchors.
@discardableResult func align<Type: AnchorType.Alignment>(with anchor: Anchor<Type, Axis>, relation: NSLayoutConstraint.Relation = .equal) -> NSLayoutConstraint {
@discardableResult func align(with anchor: Anchor<Type, Axis>, relation: NSLayoutConstraint.Relation = .equal) -> NSLayoutConstraint {
return Constraints.constrain(self, anchor, relation: relation)
}
}
Expand Down Expand Up @@ -188,7 +188,7 @@ extension Anchor where Type: AnchorType.Dimension {
return Constraints.constrain(item: item, attribute: attribute, relatedBy: relation, constant: constant)
}

@discardableResult func match<Axis>(_ anchor: Anchor<AnchorType.Dimension, Axis>, relation: NSLayoutConstraint.Relation = .equal) -> NSLayoutConstraint {
@discardableResult func match(_ anchor: Anchor<AnchorType.Dimension, Axis>, relation: NSLayoutConstraint.Relation = .equal) -> NSLayoutConstraint {
return Constraints.constrain(self, anchor, relation: relation)
}
}
Expand Down Expand Up @@ -405,14 +405,14 @@ internal extension UIEdgeInsets {

extension Anchor where Type: AnchorType.Alignment {
@available(*, deprecated, message: "Please use operators instead, e.g. `view.top.align(with: view.bottom * 2 + 10)`.")
@discardableResult func align<Type: AnchorType.Alignment>(with anchor: Anchor<Type, Axis>, offset: CGFloat = 0, multiplier: CGFloat = 1, relation: NSLayoutConstraint.Relation = .equal) -> NSLayoutConstraint {
@discardableResult func align(with anchor: Anchor<Type, Axis>, offset: CGFloat = 0, multiplier: CGFloat = 1, relation: NSLayoutConstraint.Relation = .equal) -> NSLayoutConstraint {
return Constraints.constrain(self, anchor, offset: offset, multiplier: multiplier, relation: relation)
}
}

extension Anchor where Type: AnchorType.Dimension {
@available(*, deprecated, message: "Please use operators instead, e.g. `view.width.match(view.height * 2 + 10)`.")
@discardableResult func match<Axis>(_ anchor: Anchor<AnchorType.Dimension, Axis>, offset: CGFloat = 0, multiplier: CGFloat = 1, relation: NSLayoutConstraint.Relation = .equal) -> NSLayoutConstraint {
@discardableResult func match(_ anchor: Anchor<AnchorType.Dimension, Axis>, offset: CGFloat = 0, multiplier: CGFloat = 1, relation: NSLayoutConstraint.Relation = .equal) -> NSLayoutConstraint {
return Constraints.constrain(self, anchor, offset: offset, multiplier: multiplier, relation: relation)
}
}
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# FittedSheets
# FittedSheets (Asana fork)
Bottom sheets for iOS

![Bitrise Status](https://app.bitrise.io/app/13f283bd401bbe1c.svg?token=MGSP3TGNYPSgB5gWq4MEQg)
<!-- ![Bitrise Status](https://app.bitrise.io/app/13f283bd401bbe1c.svg?token=MGSP3TGNYPSgB5gWq4MEQg) -->

Minimum requirement:
![iOSVersion](https://img.shields.io/badge/iOS-11-green.svg)
![SwiftVersion](https://img.shields.io/badge/Swift-5-green.svg)
![XcodeVersion](https://img.shields.io/badge/Xcode-11-green.svg)
![iOSVersion](https://img.shields.io/badge/iOS-14-green.svg)
![SwiftVersion](https://img.shields.io/badge/Swift-5-green.svg)
![XcodeVersion](https://img.shields.io/badge/Xcode-14-green.svg)

## About
This project is to enable easily presenting view controllers in a bottom sheet that supports scrollviews and multiple sizes. Contributions and feedback are very welcome.
This project is to enable easily presenting view controllers in a bottom sheet that supports scrollviews and multiple sizes. Contributions and feedback are very welcome.

Asana maintains this fork in order to make sure bug fixes are accessible as tagged releases.

The bottom sheet tries to be smart about the height it takes. If the view controller is smaller than the sizes specified, it will only grow as large as the intrinsic height of the presented view controller. If it is larger, it will stop at each height specified in the initializer or setSizes function.

Expand Down
0