From aaa8e4132ebb454db8a3cd8244a7ea8d64128bf0 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 4 Dec 2019 16:25:31 -0500 Subject: [PATCH] Brought back resizing to checkbox. --- MVMCoreUI/Atoms/Views/Checkbox.swift | 11 +++++++++-- MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift | 3 +-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Checkbox.swift b/MVMCoreUI/Atoms/Views/Checkbox.swift index 370f5826..2dc32675 100644 --- a/MVMCoreUI/Atoms/Views/Checkbox.swift +++ b/MVMCoreUI/Atoms/Views/Checkbox.swift @@ -16,6 +16,8 @@ import MVMCore // MARK: - Properties //-------------------------------------------------- + public var sizeObject: MFSizeObject? = MFSizeObject(standardSize: Checkbox.defaultHeightWidth, standardiPadPortraitSize: Checkbox.defaultHeightWidth + 6.0) + // Form Validation var isRequired = false var fieldKey: String? @@ -117,8 +119,8 @@ import MVMCore // MARK: - Constraints //-------------------------------------------------- - private var heightConstraint: NSLayoutConstraint? - private var widthConstraint: NSLayoutConstraint? + public var heightConstraint: NSLayoutConstraint? + public var widthConstraint: NSLayoutConstraint? /// Updates the height and width anchors of the Checkbox with the assigned value. public var heigthWidthConstant: CGFloat = Checkbox.defaultHeightWidth { @@ -398,6 +400,11 @@ import MVMCore public func updateView(_ size: CGFloat) { + if let dimension = sizeObject?.getValueBased(onSize: size) { + widthConstraint?.constant = dimension + heightConstraint?.constant = dimension + } + layoutIfNeeded() } diff --git a/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift b/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift index 30722295..b2ef5ab2 100644 --- a/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift +++ b/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift @@ -19,8 +19,6 @@ // MARK: - Properties //-------------------------------------------------- - public var sizeObject: MFSizeObject? = MFSizeObject(standardSize: Checkbox.defaultHeightWidth, standardiPadPortraitSize: Checkbox.defaultHeightWidth + 6.0) - public var checkboxPosition: CheckboxPosition = .center public enum CheckboxPosition: String { @@ -139,6 +137,7 @@ extension CheckboxWithLabelView { super.updateView(size) label.updateView(size) + checkbox.updateView(size) layoutIfNeeded() }