From e0c5916427a8ed5a3f24a49b81672af789f71962 Mon Sep 17 00:00:00 2001 From: talksik Date: Thu, 16 Dec 2021 21:13:44 -0800 Subject: [PATCH] attempting to debug the distance calculation problem --- nirvana-ios/v2/InnerCircle/InnerCircleView.swift | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/nirvana-ios/v2/InnerCircle/InnerCircleView.swift b/nirvana-ios/v2/InnerCircle/InnerCircleView.swift index 2873386..2e2558e 100644 --- a/nirvana-ios/v2/InnerCircle/InnerCircleView.swift +++ b/nirvana-ios/v2/InnerCircle/InnerCircleView.swift @@ -9,6 +9,7 @@ import SwiftUI struct InnerCircleView: View { let universalSize = UIScreen.main.bounds + // y position of where waves should start let baseLineY = UIScreen.main.bounds.height * 0.95 @State var animateWaves = false @@ -83,7 +84,7 @@ struct InnerCircleView: View { // magic variables for grid // TODO: change the number of columns based on the number of items - private static var numberOfItems: Int = 50 + private static var numberOfItems: Int = 10 private static let size: CGFloat = 80 private static let spacingBetweenColumns: CGFloat = 10 private static let spacingBetweenRows: CGFloat = 10 @@ -109,6 +110,14 @@ struct InnerCircleView: View { GeometryReader {gridProxy in let posRelToGrid = gridProxy.frame(in: .global) // relative to the entire lazygrid + // TESTING + let positionOfCurrentItem = CGPoint(x: gridProxy.frame(in: .global).midX, y: gridProxy.frame(in: .global).midY) + let currItemDistFromCenter = Self.distanceBetweenPoints(p1: positionOfCurrentItem, p2: center) + + Text("dist: \(currItemDistFromCenter)") + .font(.caption) + .foregroundColor(Color.black) + Image("Artboards_Diversity_Avatars_by_Netguru-\(value)") .resizable() .scaledToFit() @@ -145,7 +154,8 @@ struct InnerCircleView: View { private let small:CGFloat = 0.8 private let supersmall:CGFloat = 0.7 - private let center: CGPoint = CGPoint(x: UIScreen.main.bounds.size.width*0.5,y: UIScreen.main.bounds.size.height*0.5) + private let center: CGPoint = CGPoint(x: UIScreen.main.bounds.width*0.5,y: UIScreen.main.bounds.height*0.5) + private let oldCenter: CGPoint = CGPoint(x: UIScreen.main.bounds.size.width*0.5,y: UIScreen.main.bounds.size.height*0.5) // getting the proxy of an individual item // and decoding into a scale that the item should take @@ -272,7 +282,7 @@ struct InnerCircleView_Previews: PreviewProvider { } } - +// //struct Axes : View { // var body: some View { // GeometryReader { geometry in