Some fixes for macOS
This commit is contained in:
@@ -18,18 +18,16 @@ class ScriptPolicyControl: UIControl
|
||||
didSet { setNeedsLayout() }
|
||||
}
|
||||
|
||||
private class PolicyButton: UIButton {
|
||||
override func imageRect(forContentRect contentRect: CGRect) -> CGRect {
|
||||
contentRect.insetBy(dx: 8.0, dy: 8.0)
|
||||
}
|
||||
}
|
||||
|
||||
private let allowButton = PolicyButton(frame: .zero)
|
||||
private let denyButton = PolicyButton(frame: .zero)
|
||||
private let allowButton = ReliefButton()
|
||||
private let denyButton = ReliefButton()
|
||||
private let segmentContainer = SegmentedReliefButton(children: [])
|
||||
|
||||
convenience init() {
|
||||
self.init(frame: .zero)
|
||||
|
||||
segmentContainer.children = [ allowButton, denyButton ]
|
||||
addSubview(segmentContainer)
|
||||
|
||||
allowButton.addAction(UIAction(handler: { [unowned self] _ in
|
||||
self.policyStatus = .allowed
|
||||
self.sendActions(for: .valueChanged)
|
||||
@@ -52,8 +50,7 @@ class ScriptPolicyControl: UIControl
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
allowButton.frame = CGRect(origin: .zero, size: CGSize(width: bounds.width / 2, height: bounds.height))
|
||||
denyButton.frame = CGRect(origin: CGPoint(x: allowButton.frame.maxX, y: 0), size: allowButton.frame.size)
|
||||
segmentContainer.frame = bounds
|
||||
|
||||
if policyStatus == .allowed {
|
||||
allowButton.tintColor = .blue
|
||||
|
||||
Reference in New Issue
Block a user