re-do the way a custom icon is generated / stored
fix small roll up header text going outside of circle view
This commit is contained in:
@@ -12,16 +12,15 @@ struct CreateIconView: View {
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
static var iconViewBGs: [(Image, UUID)] = {
|
||||
var blah = [(Image, UUID)]()
|
||||
static var iconViewBGs: [(BackGroundOptions, UUID)] = {
|
||||
var blah = [(BackGroundOptions, UUID)]()
|
||||
for _ in 0...99 {
|
||||
let image = Image(BackGroundOptions.selectable.randomElement()!.rawValue, bundle: .main)
|
||||
blah.append((image, UUID()))
|
||||
blah.append((BackGroundOptions.selectable.randomElement()!, UUID()))
|
||||
}
|
||||
return blah
|
||||
}()
|
||||
|
||||
@State private var mouth: Image = MouthOptions.defaultOption
|
||||
@State private var mouth: MouthOptions = MouthOptions.defaultOption
|
||||
@StateObject private var customIcon = CustomIcon(leftEye: EyeOptions.defaultOption,
|
||||
rightEye: EyeOptions.defaultOption,
|
||||
mouth: MouthOptions.defaultOption,
|
||||
@@ -49,12 +48,11 @@ struct CreateIconView: View {
|
||||
]
|
||||
|
||||
func update(eye: Eyes, eyeOption: EyeOptions) {
|
||||
let image = Image(eyeOption.rawValue, bundle: .main)
|
||||
switch eye {
|
||||
case .left:
|
||||
customIcon.leftEye = image
|
||||
customIcon.leftEye = eyeOption
|
||||
case .right:
|
||||
customIcon.rightEye = image
|
||||
customIcon.rightEye = eyeOption
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +73,7 @@ struct CreateIconView: View {
|
||||
}
|
||||
|
||||
func update(mouthOption: MouthOptions) {
|
||||
let image = Image(mouthOption.rawValue, bundle: .main)
|
||||
customIcon.mouth = image
|
||||
customIcon.mouth = mouthOption
|
||||
}
|
||||
|
||||
func update(background: BackGroundOptions) {
|
||||
@@ -84,14 +81,12 @@ struct CreateIconView: View {
|
||||
|
||||
if background == .random {
|
||||
for _ in 0...CustomIcon.numberOfBGItems {
|
||||
let image = Image(BackGroundOptions.selectable.randomElement()!.rawValue, bundle: .main)
|
||||
customIcon.background.append((image, UUID()))
|
||||
customIcon.background.append((BackGroundOptions.selectable.randomElement()!, UUID()))
|
||||
}
|
||||
return
|
||||
}
|
||||
let image = Image(background.rawValue, bundle: .main)
|
||||
for _ in 0...CustomIcon.numberOfBGItems {
|
||||
customIcon.background.append((image, UUID()))
|
||||
customIcon.background.append((background, UUID()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user