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 4, 2023
1 parent 0de7e25 commit 7ca4db2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ struct AdaptiveModalInterpolationPoint: Equatable {

func apply(toModalView modalView: UIView){
modalView.frame = self.computedRect;
modalView.layer.cornerRadius = self.modalCornerRadius;
modalView.layer.maskedCorners = self.modalMaskedCorners;
// modalView.layer.cornerRadius = self.modalCornerRadius;
// modalView.layer.maskedCorners = self.modalMaskedCorners;
};

func apply(toDummyModalView dummyModalView: UIView){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ class AdaptiveModalManager {
rangeInput: [CGFloat]? = nil,
rangeOutput: [AdaptiveModalInterpolationPoint]? = nil
) -> CGFloat? {
return nil;

guard let interpolationSteps = rangeOutput ?? self.interpolationStepsSorted,
let interpolationRangeInput = rangeInput ?? self.interpolationRangeInput
Expand Down Expand Up @@ -626,6 +627,23 @@ class AdaptiveModalManager {
self.applyInterpolationToModalBackgroundVisualEffect(
forInputPercentValue: inputPercentValue
);

let layerMask: CAShapeLayer = {
let path = UIBezierPath(
shouldRoundRect: modalView.bounds,
topLeftRadius: 20,
topRightRadius: 20,
bottomLeftRadius: 20,
bottomRightRadius: 20
);

let shape = CAShapeLayer();
shape.path = path.cgPath;

return shape;
}();

self.modalView!.layer.mask = layerMask;
};

func applyInterpolationToModal(forPoint point: CGPoint){
Expand Down Expand Up @@ -885,6 +903,26 @@ class AdaptiveModalManager {
);

self.prevModalFrame = nextModalFrame;

print("onDisplayLinkTick - timestamp: \(displayLink.timestamp)");


let layerMask: CAShapeLayer = {
let path = UIBezierPath(
shouldRoundRect: dummyModalViewPresentationLayer.bounds,
topLeftRadius: 20,
topRightRadius: 20,
bottomLeftRadius: 20,
bottomRightRadius: 20
);

let shape = CAShapeLayer();
shape.path = path.cgPath;

return shape;
}();

self.modalView!.layer.mask = layerMask;
};

// MARK: - User-Invoked Functions
Expand Down

0 comments on commit 7ca4db2

Please sign in to comment.