25 lines
770 B
Swift
25 lines
770 B
Swift
|
|
final class VisibleArea: AvailableArea {
|
||
|
|
override func isAreaAffectingView(_ other: UIView) -> Bool {
|
||
|
|
return !other.visibleAreaAffectDirections.isEmpty
|
||
|
|
}
|
||
|
|
|
||
|
|
override func addAffectingView(_ other: UIView) {
|
||
|
|
let ov = other.visibleAreaAffectView
|
||
|
|
let directions = ov.visibleAreaAffectDirections
|
||
|
|
addConstraints(otherView: ov, directions: directions)
|
||
|
|
}
|
||
|
|
|
||
|
|
override func notifyObserver() {
|
||
|
|
if CarPlayService.shared.isCarplayActivated {
|
||
|
|
return
|
||
|
|
}
|
||
|
|
FrameworkHelper.setVisibleViewport(areaFrame, scaleFactor: MapViewController.shared()?.mapView.contentScaleFactor ?? 1.0)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
extension UIView {
|
||
|
|
@objc var visibleAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] }
|
||
|
|
|
||
|
|
var visibleAreaAffectView: UIView { return self }
|
||
|
|
}
|