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 10, 2023
1 parent c72a65d commit 5a29f46
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1239,18 +1239,26 @@ class AdaptiveModalManager: NSObject {

func onModalWillSnap(){
let interpolationSteps = self.interpolationSteps!;
let closestSnapPoint = self.getClosestSnapPoint();

let prevIndex = self.currentInterpolationIndex;
let nextIndex = closestSnapPoint.interpolationPoint.snapPointIndex;

let nextIndex: Int = {
guard let nextIndex = self.nextInterpolationIndex else {
let closestSnapPoint = self.getClosestSnapPoint();
return closestSnapPoint.interpolationPoint.snapPointIndex;
};

return nextIndex;
}();

let nextPoint = self.interpolationSteps[nextIndex];

guard prevIndex != nextIndex else { return };

self.eventDelegate?.notifyOnModalWillSnap(
prevSnapPointIndex: interpolationSteps[prevIndex].snapPointIndex,
nextSnapPointIndex: interpolationSteps[nextIndex].snapPointIndex,
snapPointConfig: closestSnapPoint.snapPointConfig,
interpolationPoint: closestSnapPoint.interpolationPoint
snapPointConfig: self.modalConfig.snapPoints[nextPoint.snapPointIndex],
interpolationPoint: nextPoint
);
};

Expand Down

0 comments on commit 5a29f46

Please sign in to comment.