From 7ca4db21ae864dbbf458014155db1805167f949f Mon Sep 17 00:00:00 2001 From: Dominic Go <18517029+dominicstop@users.noreply.github.com> Date: Sun, 4 Jun 2023 20:54:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20Update:=20Exp=20-=20`AdaptiveMod?= =?UTF-8?q?al`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Update experiment/test - `swift-programmatic-modal/AdaptiveModal`. --- .../AdaptiveModalInterpolationPoint.swift | 4 +- .../AdaptiveModal/AdaptiveModalManager.swift | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalInterpolationPoint.swift b/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalInterpolationPoint.swift index 3caff1d8..4fc31b7d 100644 --- a/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalInterpolationPoint.swift +++ b/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalInterpolationPoint.swift @@ -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){ diff --git a/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalManager.swift b/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalManager.swift index 36251c5c..4040a8bb 100644 --- a/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalManager.swift +++ b/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalManager.swift @@ -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 @@ -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){ @@ -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