mild updates to caret
This commit is contained in:
parent
9079d6dcae
commit
1ac94059db
@ -103,8 +103,10 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
let width = CGFloat(rightViewWidth?.floatValue ?? CARET_VIEW_WIDTH)
|
let width = CGFloat(rightViewWidth?.floatValue ?? CARET_VIEW_WIDTH)
|
||||||
let height = CGFloat(rightViewHeight?.floatValue ?? CARET_VIEW_HEIGHT)
|
let height = CGFloat(rightViewHeight?.floatValue ?? CARET_VIEW_HEIGHT)
|
||||||
|
|
||||||
let edgeInsets: UIEdgeInsets = contentEdgeInsets
|
contentEdgeInsets = UIEdgeInsets(top: contentEdgeInsets.top,
|
||||||
contentEdgeInsets = UIEdgeInsets(top: edgeInsets.top, left: edgeInsets.left, bottom: edgeInsets.bottom, right: 4 + width)
|
left: contentEdgeInsets.left,
|
||||||
|
bottom: contentEdgeInsets.bottom,
|
||||||
|
right: 4 + width)
|
||||||
|
|
||||||
let caretView: UIView = rightView ?? createCaretView()
|
let caretView: UIView = rightView ?? createCaretView()
|
||||||
rightView = caretView
|
rightView = caretView
|
||||||
@ -118,8 +120,8 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
caretLabelSpacing.isActive = true
|
caretLabelSpacing.isActive = true
|
||||||
caretSpacingConstraint = caretLabelSpacing
|
caretSpacingConstraint = caretLabelSpacing
|
||||||
|
|
||||||
NSLayoutConstraint(item: caretView, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1.0, constant: 0).isActive = true
|
caretView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
|
||||||
NSLayoutConstraint(item: self, attribute: .right, relatedBy: .greaterThanOrEqual, toItem: caretView, attribute: .right, multiplier: 1.0, constant: 0).isActive = true
|
trailingAnchor.constraint(greaterThanOrEqualTo: caretView.trailingAnchor).isActive = true
|
||||||
caretView.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true
|
caretView.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true
|
||||||
bottomAnchor.constraint(greaterThanOrEqualTo: caretView.bottomAnchor).isActive = true
|
bottomAnchor.constraint(greaterThanOrEqualTo: caretView.bottomAnchor).isActive = true
|
||||||
contentHorizontalAlignment = .left
|
contentHorizontalAlignment = .left
|
||||||
@ -137,17 +139,21 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
// MARK: - Atomization
|
// MARK: - Atomization
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let caretLinkModel = model as? CaretLinkModel else { return }
|
|
||||||
if let color = caretLinkModel.backgroundColor {
|
guard let model = model as? CaretLinkModel else { return }
|
||||||
|
|
||||||
|
if let color = model.backgroundColor {
|
||||||
backgroundColor = color.uiColor
|
backgroundColor = color.uiColor
|
||||||
}
|
}
|
||||||
enabledColor = caretLinkModel.enabledColor.uiColor
|
|
||||||
if let color = caretLinkModel.disabledColor {
|
enabledColor = model.enabledColor.uiColor
|
||||||
|
if let color = model.disabledColor {
|
||||||
disabledColor = color.uiColor
|
disabledColor = color.uiColor
|
||||||
}
|
}
|
||||||
isEnabled = caretLinkModel.enabled
|
|
||||||
set(with: caretLinkModel.action, delegateObject: delegateObject, additionalData: additionalData)
|
isEnabled = model.enabled
|
||||||
setTitle(caretLinkModel.title, for: .normal)
|
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
setTitle(model.title, for: .normal)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func needsToBeConstrained() -> Bool {
|
public func needsToBeConstrained() -> Bool {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user