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 dda1dd9 commit 91912d6
Showing 1 changed file with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,14 @@ class AdaptiveModalManager {
// MARK: - Computed Properties
// ---------------------------

var modalRect: CGRect? {
var modalFrame: CGRect? {
set {
guard let modalView = self.modalView,
let newValue = newValue
else { return };

if let modalPresentationLayer = modalView.layer.presentation() {
self.prevModalFrame = modalPresentationLayer.frame;
};

modalView.bounds.size = newValue.size;

modalView.transform = CGAffineTransform(
translationX: newValue.midX,
y: newValue.midY
);
self.prevModalFrame = modalView.frame;
modalView.frame = newValue;
}
get {
self.modalView?.frame;
Expand Down Expand Up @@ -328,7 +320,7 @@ class AdaptiveModalManager {
if let nextModalRect = self.interpolateModalRect(
forInputValue: gestureInput
) {
self.modalRect = nextModalRect;
self.modalFrame = nextModalRect;
};

if let modalBorderRadiusMask = self.interpolateModalBorderRadius(
Expand Down Expand Up @@ -390,8 +382,7 @@ class AdaptiveModalManager {
self.animator = animator;

animator.addAnimations {
self.modalRect = interpolationPoint.computedRect;
modalView.layer.mask = interpolationPoint.modalRadiusMask
modalView.frame = interpolationPoint.computedRect;
};

if let completion = completion {
Expand Down Expand Up @@ -502,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 Expand Up @@ -553,8 +543,7 @@ class AdaptiveModalManager {
print(
"onDisplayLinkTick"
+ "\n - displayLink.timestamp: \(displayLink.timestamp)"
+ "\n - inputValueNext: \(inputValueNext)"
+ "\n - inputValuePrev: \(inputValuePrev)"
+ "\n - presentation frame: \(modalView.layer.presentation()?.frame)"
);
};

Expand Down Expand Up @@ -633,7 +622,7 @@ class AdaptiveModalManager {
currentSize: self.currentSizeProvider()
);

self.modalRect = computedRect;
self.modalFrame = computedRect;
};
};

Expand Down

0 comments on commit 91912d6

Please sign in to comment.