mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 21:13:35 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
class DimmedModalPresentationController: UIPresentationController {
|
||||
private lazy var onTapGr: UITapGestureRecognizer = {
|
||||
return UITapGestureRecognizer(target: self, action: #selector(onTap))
|
||||
}()
|
||||
|
||||
private lazy var dimView: UIView = {
|
||||
let view = UIView()
|
||||
view.setStyle(.blackStatusBarBackground)
|
||||
if isCancellable {
|
||||
view.addGestureRecognizer(onTapGr)
|
||||
}
|
||||
return view
|
||||
}()
|
||||
|
||||
let isCancellable: Bool
|
||||
|
||||
required init(presentedViewController: UIViewController, presenting presentingViewController: UIViewController?, cancellable: Bool = true) {
|
||||
isCancellable = cancellable
|
||||
super.init(presentedViewController: presentedViewController, presenting: presentingViewController)
|
||||
}
|
||||
|
||||
@objc private func onTap() {
|
||||
presentingViewController.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
override func presentationTransitionWillBegin() {
|
||||
guard let containerView = containerView else { return }
|
||||
containerView.addSubview(dimView)
|
||||
dimView.frame = containerView.bounds
|
||||
dimView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||
dimView.alpha = 0
|
||||
presentingViewController.transitionCoordinator?.animate(alongsideTransition: { _ in
|
||||
self.dimView.alpha = 1
|
||||
})
|
||||
}
|
||||
|
||||
override func presentationTransitionDidEnd(_ completed: Bool) {
|
||||
if !completed { dimView.removeFromSuperview() }
|
||||
}
|
||||
|
||||
override func dismissalTransitionWillBegin() {
|
||||
presentingViewController.transitionCoordinator?.animate(alongsideTransition: { _ in
|
||||
self.dimView.alpha = 0
|
||||
})
|
||||
}
|
||||
|
||||
override func dismissalTransitionDidEnd(_ completed: Bool) {
|
||||
if completed { dimView.removeFromSuperview() }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user