gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-ios] 33/69: bars relative to fontSize


From: gnunet
Subject: [taler-taler-ios] 33/69: bars relative to fontSize
Date: Fri, 19 Jan 2024 09:02:06 +0100

This is an automated email from the git hooks/post-receive script.

marc-stibane pushed a commit to branch master
in repository taler-ios.

commit c8adbe5082fdda1e210a75976da05ef4e35e2178
Author: Marc Stibane <marc@taler.net>
AuthorDate: Thu Jan 4 17:53:16 2024 +0100

    bars relative to fontSize
---
 TalerWallet1/Views/HelperViews/BarGraph.swift | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/TalerWallet1/Views/HelperViews/BarGraph.swift 
b/TalerWallet1/Views/HelperViews/BarGraph.swift
index 92c6e69..e7b60ef 100644
--- a/TalerWallet1/Views/HelperViews/BarGraph.swift
+++ b/TalerWallet1/Views/HelperViews/BarGraph.swift
@@ -16,6 +16,7 @@ struct BarGraphHeader: View {
     @Environment(\.colorSchemeContrast) private var colorSchemeContrast
 
     @State private var completedTransactions: [Transaction] = []
+    @ScaledMetric var barHeight = 9       // relative to fontSize
 
     var body: some View {
         HStack (alignment: .center, spacing: 10) {
@@ -23,7 +24,7 @@ struct BarGraphHeader: View {
                 .accessibilityFont(.title2)
 //                .foregroundColor(colorSchemeContrast == .increased ? 
.primary : .secondary)
             BarGraph(transactions: $completedTransactions,
-                     maxBars: MAXBARS, barHeight: 10)       // TODO: barHeight 
relative to fontSize
+                     maxBars: MAXBARS, barHeight: barHeight)
         }
         .task {
             symLog.log(".task for BarGraphHeader(\(currency)) - reload 
Transactions")
@@ -38,7 +39,7 @@ struct BarGraphHeader: View {
 struct BarGraph: View {
     @Binding var transactions: [Transaction]
     let maxBars: Int
-    let barHeight : Double
+    let barHeight: Double
 
     func maxValue(_ someTransactions: [Transaction]) -> Double {
         var maxValue = 0.0
@@ -67,15 +68,16 @@ struct BarGraph: View {
                     let valueTransparent = barHeight - valueColored
 //                    let _ = print("max: \(maxValue), ", incoming ? "+" : 
"-", netto)
                     VStack(spacing: 0) {
+                        let width = barHeight / 3
                         Rectangle()
                             .opacity(0.001)
-                            .frame (width: 3, height: incoming ? 
valueTransparent : barHeight )
+                            .frame (width: width, height: incoming ? 
valueTransparent : barHeight )
                         Rectangle()
                             .foregroundColor(incoming ? .green : .red)
-                            .frame (width: 3, height: valueColored )
+                            .frame (width: width, height: valueColored )
                         Rectangle()
                             .opacity(0.001)
-                            .frame (width: 3, height: incoming ? barHeight : 
valueTransparent)
+                            .frame (width: width, height: incoming ? barHeight 
: valueTransparent)
                     }
                 }
             }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]