Skip to content

Commit

Permalink
💫 Update: Exp - AdaptiveModal
Browse files Browse the repository at this point in the history
Revert prev. commit
  • Loading branch information
dominicstop committed May 31, 2023
1 parent 3a97f74 commit 8e31c61
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ struct AdaptiveModalInterpolationPoint {
let modalRadiusBottomRight: CGFloat;

var modalRadiusMask: CAShapeLayer {
let bounds = CGRect(
origin: .zero,
size: self.computedRect.size
);

let radiusPath = UIBezierPath(
shouldRoundRect: bounds,
shouldRoundRect: CGRect(
origin: .zero,
size: self.computedRect.size
),
topLeftRadius: self.modalRadiusTopLeft,
topRightRadius: self.modalRadiusTopRight,
bottomLeftRadius: self.modalRadiusBottomLeft,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,6 @@

import UIKit

class MaskedView: UIView {
var maskShape: CAShapeLayer?;

var maskingView: UIView?;

override init(frame: CGRect) {
self.maskingView = UIView(frame: frame);
self.maskingView!.backgroundColor = .blue;

super.init(frame: frame);

self.mask = self.maskingView;
};

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func layoutSubviews() {
super.layoutSubviews();

self.maskingView!.frame = self.frame;
print("MaskedView.layoutSubviews - frame: \(self.frame)")
};
};


class AdaptiveModalManager {

Expand All @@ -50,7 +24,7 @@ class AdaptiveModalManager {
var currentSizeProvider: () -> CGSize;

weak var targetView: UIView?;
weak var modalView: MaskedView?;
weak var modalView: UIView?;

var gestureOffset: CGFloat?;
var gestureVelocity: CGPoint?;
Expand Down Expand Up @@ -176,7 +150,7 @@ class AdaptiveModalManager {

init(
modalConfig: AdaptiveModalConfig,
modalView: MaskedView,
modalView: UIView,
targetView: UIView,
currentSizeProvider: @escaping () -> CGSize
) {
Expand Down Expand Up @@ -353,7 +327,7 @@ class AdaptiveModalManager {
forInputValue: gestureInput,
modalBounds: modalView.bounds
) {
modalView.maskShape = modalBorderRadiusMask;
modalView.layer.mask = modalBorderRadiusMask;
};
};

Expand Down Expand Up @@ -409,8 +383,6 @@ class AdaptiveModalManager {

animator.addAnimations {
modalView.frame = interpolationPoint.computedRect;
modalView.maskShape = interpolationPoint.modalRadiusMask;
modalView.layoutSubviews();
};

if let completion = completion {
Expand All @@ -420,7 +392,7 @@ class AdaptiveModalManager {
animator.addCompletion { _ in
self.animator = nil;
};

animator.startAnimation();
};

Expand Down Expand Up @@ -521,7 +493,6 @@ class AdaptiveModalManager {
};

@objc func onDisplayLinkTick(displayLink: CADisplayLink){
return;
/// `Note:2023-05-30-16-13-29`
///
/// The interpolation can be driven by either via **Method-A** or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ extension UIBezierPath {
} else {
path.addLine(to: topLeft);
};



path.closeSubpath();
cgPath = path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ class RNIDraggableTestViewController : UIViewController {
return label;
}();

lazy var floatingView: MaskedView = {
let view = MaskedView();
lazy var floatingView: UIView = {
let view = UIView();

view.backgroundColor = UIColor(
hue: 0/360,
Expand Down

0 comments on commit 8e31c61

Please sign in to comment.