From eb193b16de0e51fd55d137ddcde323cc704cb758 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 17:35:59 -0400 Subject: [PATCH 1/3] dimension changes as per invision --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 17fabef7..ed2a015b 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -44,8 +44,8 @@ public typealias ActionBlockConfirmation = () -> (Bool) }() // Sizes are from InVision design specs. - static let containerSize = CGSize(width: 46, height: 24) - static let knobSize = CGSize(width: 22, height: 22) + static let containerSize = CGSize(width: 51, height: 31) + static let knobSize = CGSize(width: 28, height: 28) private var knobView: View = { let view = View() From 4da8eddd8dc7ba3964935ee4acfa8aac98928de9 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 17:57:42 -0400 Subject: [PATCH 2/3] corner radius --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index ed2a015b..597b50ae 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -50,7 +50,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) private var knobView: View = { let view = View() view.backgroundColor = .white - view.layer.cornerRadius = Toggle.getKnobHeight() / 2.0 + view.layer.cornerRadius = 14 return view }() @@ -205,9 +205,6 @@ public typealias ActionBlockConfirmation = () -> (Bool) knobHeightConstraint?.constant = Self.getKnobHeight() knobWidthConstraint?.constant = Self.getKnobWidth() - layer.cornerRadius = Self.getContainerHeight() / 2.0 - knobView.layer.cornerRadius = Self.getKnobHeight() / 2.0 - changeStateNoAnimation(isOn) } @@ -225,7 +222,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) widthConstraint = widthAnchor.constraint(equalToConstant: Self.containerSize.width) widthConstraint?.isActive = true - layer.cornerRadius = Self.containerSize.height / 2.0 + layer.cornerRadius = 15 backgroundColor = containerTintColor.off addSubview(knobView) From f2f26c60a24da68f16e5be92cdc4aa35e3516968 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 18:08:52 -0400 Subject: [PATCH 3/3] latest dimensions --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index ccf11073..02373958 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -50,7 +50,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) private var knobView: View = { let view = View() view.backgroundColor = .white - view.layer.cornerRadius = 14 + view.layer.cornerRadius = Toggle.getKnobHeight() / 2.0 return view }() @@ -142,14 +142,14 @@ public typealias ActionBlockConfirmation = () -> (Bool) private func constrainKnobOn() { - knobTrailingConstraint = trailingAnchor.constraint(equalTo: knobView.trailingAnchor, constant: 1) + knobTrailingConstraint = trailingAnchor.constraint(equalTo: knobView.trailingAnchor, constant: 2) knobLeadingConstraint = knobView.leadingAnchor.constraint(greaterThanOrEqualTo: leadingAnchor) } private func constrainKnobOff() { knobTrailingConstraint = trailingAnchor.constraint(greaterThanOrEqualTo: knobView.trailingAnchor) - knobLeadingConstraint = knobView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 1) + knobLeadingConstraint = knobView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 2) } //-------------------------------------------------- @@ -203,6 +203,9 @@ public typealias ActionBlockConfirmation = () -> (Bool) knobHeightConstraint?.constant = Self.getKnobHeight() knobWidthConstraint?.constant = Self.getKnobWidth() + layer.cornerRadius = Self.getContainerHeight() / 2.0 + knobView.layer.cornerRadius = Self.getKnobHeight() / 2.0 + changeStateNoAnimation(isOn) } @@ -220,7 +223,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) widthConstraint = widthAnchor.constraint(equalToConstant: Self.containerSize.width) widthConstraint?.isActive = true - layer.cornerRadius = 15 + layer.cornerRadius = Self.getContainerHeight() / 2.0 backgroundColor = containerTintColor.off addSubview(knobView)