Skip to content

Commit

Permalink
💫 Update: Exp - AdaptiveModal
Browse files Browse the repository at this point in the history
Summary: Update experiment/test - `swift-programmatic-modal/AdaptiveModal`.
  • Loading branch information
dominicstop committed Jun 15, 2023
1 parent d94b1e6 commit 66f395b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ class AdaptiveModalManager: NSObject {
);
}();

self.modalAnimator?.stopAnimation(true);
self.modalAnimator = animator;

animator.addAnimations {
Expand All @@ -1064,10 +1065,12 @@ class AdaptiveModalManager: NSObject {
};

animator.addCompletion { _ in
self.endDisplayLink();
self.modalAnimator = nil;
};

animator.startAnimation();
self.startDisplayLink();
};

@objc private func onDragPanGesture(_ sender: UIPanGestureRecognizer) {
Expand Down Expand Up @@ -1095,17 +1098,15 @@ class AdaptiveModalManager: NSObject {
let gestureFinalPointRaw = self.gestureFinalPoint ?? gesturePoint;

let gestureFinalPoint = CGPoint(
x: gestureFinalPointRaw.x - self.gestureOffset!.x,
y: gestureFinalPointRaw.y - self.gestureOffset!.y
x: gestureFinalPointRaw.x - (self.gestureOffset?.x ?? 0),
y: gestureFinalPointRaw.y - (self.gestureOffset?.y ?? 0)
);

self.snapToClosestSnapPoint(forPoint: gestureFinalPoint) {
self.endDisplayLink();
self.notifyOnModalDidSnap();
};

self.clearGestureValues();
self.startDisplayLink();

default:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,35 +65,12 @@ class RNIDraggableTestViewController : UIViewController {
return view;
}();

lazy var dummyBackgroundView: UIView = {
let view = UIView();

let imageView = UIImageView(
image: UIImage(named: "DummyBackgroundImage")
);

imageView.contentMode = .scaleAspectFill;

view.addSubview(imageView);

imageView.translatesAutoresizingMaskIntoConstraints = false;

NSLayoutConstraint.activate([
imageView.topAnchor.constraint(equalTo: view.topAnchor),
imageView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
imageView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
imageView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
]);

return view;
}();

override func viewDidLoad() {
self.view.backgroundColor = .white;

let dummyBackgroundView: UIView = {
let imageView = UIImageView(
image: UIImage(named: "DummyBackgroundImage")
image: UIImage(named: "DummyBackgroundImage3")
);

imageView.contentMode = .scaleAspectFill;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "DummyBackgroundImage3 1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 66f395b

Please sign in to comment.