From a76fb75200040168c29226cd0c6346913f8a319a Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Mon, 20 Jan 2020 11:53:22 +0530 Subject: [PATCH 1/6] crash fix --- MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift b/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift index 130536e4..51532228 100644 --- a/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift +++ b/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift @@ -176,7 +176,7 @@ open class DoughnutChart: View { labelContainer.layoutIfNeeded() let radius = sizeObject.getValueBasedOnApplicationWidth()/2 - lineWidth() let labelheight = labelContainer.frame.height/2 - let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(pow(radius, 2) - pow(labelheight, 2)) + let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(abs(pow(radius, 2) - pow(labelheight, 2))) labelContainerLeftConstraint?.constant = padding labelContainerRightConstraint?.constant = padding From d3c644805352a92933719b41ddd20bc1b1fcc681 Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Mon, 20 Jan 2020 14:50:53 +0530 Subject: [PATCH 2/6] fix for separator --- MVMCoreUI/Models/Molecules/HeaderModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Models/Molecules/HeaderModel.swift b/MVMCoreUI/Models/Molecules/HeaderModel.swift index 4499d313..0277e9fe 100644 --- a/MVMCoreUI/Models/Molecules/HeaderModel.swift +++ b/MVMCoreUI/Models/Molecules/HeaderModel.swift @@ -44,8 +44,8 @@ import Foundation required public init(from decoder: Decoder) throws { try super.init(from: decoder) let typeContainer = try decoder.container(keyedBy: HeaderCodingKeys.self) - line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) setDefaults() + line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) } public override func encode(to encoder: Encoder) throws { From 8c373ebfa41ec923fd341a8b9f4712b85ea8132f Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Tue, 21 Jan 2020 16:56:30 +0530 Subject: [PATCH 3/6] index update --- .../VerticalCombinationViews/Lists/NumberedListModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift index 728ae3a8..943dfd11 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift @@ -26,7 +26,7 @@ import Foundation let list = try typeContainer.decodeMolecules(codingKey: .list) var models: [MoleculeStackItemModel] = [] for (index, molecule) in list.enumerated() { - models.append(MoleculeStackItemModel(with: StringAndMoleculeModel(string: "\(index).", molecule: molecule))) + models.append(MoleculeStackItemModel(with: StringAndMoleculeModel(string: "\(index+1).", molecule: molecule))) } super.init(molecules: models) spacing = 0 From 13cc6bf2090e05b45213421376c4431758e26d19 Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Tue, 21 Jan 2020 17:11:00 +0530 Subject: [PATCH 4/6] removed padding --- MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift b/MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift index 72aceab7..e33601ad 100644 --- a/MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift +++ b/MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift @@ -26,7 +26,7 @@ import Foundation addSubview(colorLablesStack) doughnutChart.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true - doughnutChart.topAnchor.constraint(equalTo: topAnchor, constant: PaddingFour).isActive = true + doughnutChart.topAnchor.constraint(equalTo: topAnchor).isActive = true bottomAnchor.constraint(greaterThanOrEqualTo: doughnutChart.bottomAnchor).isActive = true let doughnutBottomAnchor = bottomAnchor.constraint(equalTo: doughnutChart.bottomAnchor) From fffb04e5e15380bbd4dc2ac01610dc64034f4260 Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Tue, 21 Jan 2020 20:31:02 +0530 Subject: [PATCH 5/6] avoid negative value --- MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift b/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift index 51532228..03d87ec9 100644 --- a/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift +++ b/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift @@ -176,7 +176,7 @@ open class DoughnutChart: View { labelContainer.layoutIfNeeded() let radius = sizeObject.getValueBasedOnApplicationWidth()/2 - lineWidth() let labelheight = labelContainer.frame.height/2 - let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(abs(pow(radius, 2) - pow(labelheight, 2))) + let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(max(0, pow(radius, 2) - pow(labelheight, 2))) labelContainerLeftConstraint?.constant = padding labelContainerRightConstraint?.constant = padding From 4760c10c8db7d58ea05aadcb645e9080f65b1241 Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Tue, 21 Jan 2020 21:51:22 +0530 Subject: [PATCH 6/6] removed comment --- MVMCoreUI/Models/Molecules/HeaderModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Models/Molecules/HeaderModel.swift b/MVMCoreUI/Models/Molecules/HeaderModel.swift index 0277e9fe..4499d313 100644 --- a/MVMCoreUI/Models/Molecules/HeaderModel.swift +++ b/MVMCoreUI/Models/Molecules/HeaderModel.swift @@ -44,8 +44,8 @@ import Foundation required public init(from decoder: Decoder) throws { try super.init(from: decoder) let typeContainer = try decoder.container(keyedBy: HeaderCodingKeys.self) - setDefaults() line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) + setDefaults() } public override func encode(to encoder: Encoder) throws {