From 44bd74c6836f8f086cebd173770485e89ee01f2e Mon Sep 17 00:00:00 2001 From: "Robinson, Blake" Date: Wed, 18 Mar 2020 11:27:37 -0400 Subject: [PATCH 1/2] Makes drawBottomCurvedShadowsOnRect more flexible by allowing the rect to be passed in with a non (0,0) origin --- MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m index 4a21b1a5..5c796417 100644 --- a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m +++ b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m @@ -260,15 +260,15 @@ static const CGFloat VertialShadowOffset = 6; UIBezierPath *shadowPath = [UIBezierPath bezierPath]; //get the variables for frame - CGFloat x = 0; - CGFloat y = 0; + CGFloat x = rect.origin.x; + CGFloat y = rect.origin.y; CGFloat width = CGRectGetWidth(rect); CGFloat height = CGRectGetHeight(rect); [shadowPath moveToPoint:CGPointMake(x + HorizontalShadowInset, y)]; - [shadowPath addLineToPoint:CGPointMake(width - HorizontalShadowInset, y)]; - [shadowPath addLineToPoint:CGPointMake(width - HorizontalShadowInset, height-VertialShadowOffset/2)]; - [shadowPath addQuadCurveToPoint:CGPointMake(x + HorizontalShadowInset, height - VertialShadowOffset/2) controlPoint:CGPointMake(width/2.f, height - VertialShadowOffset * 1.5)]; + [shadowPath addLineToPoint:CGPointMake(x + width - HorizontalShadowInset, y)]; + [shadowPath addLineToPoint:CGPointMake(x + width - HorizontalShadowInset, height-VertialShadowOffset/2)]; + [shadowPath addQuadCurveToPoint:CGPointMake(x + HorizontalShadowInset, height - VertialShadowOffset/2) controlPoint:CGPointMake((x + width)/2.f, height - VertialShadowOffset * 1.5)]; [shadowPath addLineToPoint:CGPointMake(x + HorizontalShadowInset, y)]; [shadowPath closePath]; From cb6f2059948c96409d2dac881264fafec05ba4fe Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Fri, 20 Mar 2020 19:33:53 -0400 Subject: [PATCH 2/2] radio selection fix --- MVMCoreUI/Atoms/Views/RadioButton.swift | 4 +--- .../Molecules/RadioButtonSelectionHelper.swift | 16 ++++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/RadioButton.swift b/MVMCoreUI/Atoms/Views/RadioButton.swift index 7dd5976a..4158cb3f 100644 --- a/MVMCoreUI/Atoms/Views/RadioButton.swift +++ b/MVMCoreUI/Atoms/Views/RadioButton.swift @@ -128,9 +128,7 @@ import UIKit self.delegateObject = delegateObject isSelected = model.state - let radioButtonModel = RadioButtonSelectionHelper.setupForRadioButtonGroup(model, - formValidator: delegateObject?.formHolderDelegate?.formValidator) - FormValidator.setupValidation(molecule: radioButtonModel, delegate: delegateObject?.formHolderDelegate) + RadioButtonSelectionHelper.setupForRadioButtonGroup(model, self, delegateObject: delegateObject) } public override func reset() { diff --git a/MVMCoreUI/Molecules/RadioButtonSelectionHelper.swift b/MVMCoreUI/Molecules/RadioButtonSelectionHelper.swift index 263a85a4..601588db 100644 --- a/MVMCoreUI/Molecules/RadioButtonSelectionHelper.swift +++ b/MVMCoreUI/Molecules/RadioButtonSelectionHelper.swift @@ -14,7 +14,7 @@ import UIKit public var fieldKey: String? public var groupName: String? = FormValidator.defaultGroupName - private var selectedRadioButton: RadioButton? + var selectedRadioButton: RadioButton? private var fieldGroupName: String? public var baseValue: AnyHashable? @@ -22,16 +22,20 @@ import UIKit self.fieldKey = fieldKey } - public static func setupForRadioButtonGroup(_ radioButtonModel: RadioButtonModel, formValidator: FormValidator?) -> RadioButtonSelectionHelper { + public static func setupForRadioButtonGroup(_ radioButtonModel: RadioButtonModel, _ radioButton: RadioButton, delegateObject: MVMCoreUIDelegateObject?) { guard let groupName = radioButtonModel.fieldKey, - let formValidator = formValidator else { - return RadioButtonSelectionHelper(radioButtonModel.fieldKey) + let formValidator = delegateObject?.formHolderDelegate?.formValidator else { + return } - let radioButtonSelectionHelper = formValidator.radioButtonsModelByGroup[groupName] ?? RadioButtonSelectionHelper(radioButtonModel.fieldKey) + let radioButtonSelectionHelper = formValidator.radioButtonsModelByGroup[groupName] ?? RadioButtonSelectionHelper(radioButtonModel.fieldKey) radioButtonSelectionHelper.fieldGroupName = radioButtonModel.fieldKey formValidator.radioButtonsModelByGroup[groupName] = radioButtonSelectionHelper - return radioButtonSelectionHelper + + if radioButtonModel.state { + radioButtonSelectionHelper.selectedRadioButton = radioButton + } + FormValidator.setupValidation(molecule: radioButtonSelectionHelper, delegate: delegateObject?.formHolderDelegate) } public func selected(_ radioButton: RadioButton) {