adding in some changes to sizing dynamically
This commit is contained in:
@@ -136,7 +136,7 @@ struct InnerCircleView: View {
|
|||||||
.padding(.horizontal, 8)
|
.padding(.horizontal, 8)
|
||||||
.background(
|
.background(
|
||||||
RoundedRectangle(cornerRadius: 20, style: .continuous)
|
RoundedRectangle(cornerRadius: 20, style: .continuous)
|
||||||
.fill(Color.teal.opacity(0.1))
|
.fill(Color.teal.opacity(0.5))
|
||||||
).overlay(
|
).overlay(
|
||||||
RoundedRectangle(cornerRadius: 20, style: .continuous)
|
RoundedRectangle(cornerRadius: 20, style: .continuous)
|
||||||
.strokeBorder(Color.white.opacity(01), lineWidth: 1)
|
.strokeBorder(Color.white.opacity(01), lineWidth: 1)
|
||||||
@@ -177,7 +177,7 @@ struct InnerCircleView: View {
|
|||||||
// magic variables for grid
|
// magic variables for grid
|
||||||
// TODO: change the number of columns based on the number of items
|
// TODO: change the number of columns based on the number of items
|
||||||
private static var numberOfItems: Int = 20
|
private static var numberOfItems: Int = 20
|
||||||
private static let size: CGFloat = 80
|
private static let size: CGFloat = UIScreen.main.bounds.height*0.15
|
||||||
private static let spacingBetweenColumns: CGFloat = 0
|
private static let spacingBetweenColumns: CGFloat = 0
|
||||||
private static let spacingBetweenRows: CGFloat = 0
|
private static let spacingBetweenRows: CGFloat = 0
|
||||||
private static let totalColumns: Int = Int(log2(Double(Self.numberOfItems))) // scaling the circles and calculating column count
|
private static let totalColumns: Int = Int(log2(Double(Self.numberOfItems))) // scaling the circles and calculating column count
|
||||||
@@ -198,6 +198,8 @@ struct InnerCircleView: View {
|
|||||||
|
|
||||||
private var gridContent: some View {
|
private var gridContent: some View {
|
||||||
// main communication hub
|
// main communication hub
|
||||||
|
// TODO: client side, sort the honeycomb from top left to bottom right
|
||||||
|
// based on most close friends to least
|
||||||
ScrollViewReader {scrollReaderValue in
|
ScrollViewReader {scrollReaderValue in
|
||||||
ScrollView([.horizontal, .vertical], showsIndicators: false) {
|
ScrollView([.horizontal, .vertical], showsIndicators: false) {
|
||||||
LazyVGrid(
|
LazyVGrid(
|
||||||
@@ -233,20 +235,19 @@ struct InnerCircleView: View {
|
|||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
self.selectedUserIndex = value
|
self.selectedUserIndex = value
|
||||||
|
|
||||||
withAnimation(Animation.spring()) {
|
|
||||||
scrollReaderValue.scrollTo(value, anchor: .bottomTrailing)
|
|
||||||
}
|
|
||||||
print("the selected item is: \(value)")
|
print("the selected item is: \(value)")
|
||||||
}
|
}
|
||||||
.animation(Animation.easeInOut(duration: 2).repeatForever(autoreverses: true), value: self.usersWithNewMessage)
|
.animation(Animation.easeInOut(duration: 2).repeatForever(autoreverses: true), value: self.usersWithNewMessage)
|
||||||
.animation(Animation.spring(), value: self.selectedUserIndex)
|
.animation(Animation.spring())
|
||||||
}
|
}
|
||||||
} // lazyvgrid
|
} // lazyvgrid
|
||||||
.padding(.trailing, Self.size / 2 + Self.spacingBetweenColumns / 2) // because of the offset of last column
|
.padding(.trailing, Self.size / 2 + Self.spacingBetweenColumns / 2) // because of the offset of last column
|
||||||
.padding(.top, Self.size / 2 + Self.spacingBetweenRows / 2) // because we are going under the nav bar
|
.padding(.top, Self.size / 2 + Self.spacingBetweenRows / 2) // because we are going under the nav bar
|
||||||
}// scrollview
|
}// scrollview
|
||||||
.onAppear {
|
.onAppear {
|
||||||
scrollReaderValue.scrollTo(Self.numberOfItems / 2)
|
//TODO: was causing problems so commenting out
|
||||||
|
//may not need anymore with bottom nav activation
|
||||||
|
// scrollReaderValue.scrollTo(Self.numberOfItems / 2)
|
||||||
}
|
}
|
||||||
} // scrollview reader
|
} // scrollview reader
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user