Skip to content

Commit d4e97d9

Browse files
authored
Merge pull request #232 from TaskarCenterAtUW/fix-quest-option-text-shadow
Add shadow and stroke to quest option text
2 parents 8be3c4f + 82758b9 commit d4e97d9

File tree

3 files changed

+63
-12
lines changed

3 files changed

+63
-12
lines changed
1 Byte
Loading

GoInfoGame/GoInfoGame/quests/LongQuests/Components/LongFormImageView.swift

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,26 @@ struct LongFormImageView: View {
3030
.clipped()
3131

3232
if let label = label {
33-
Text(label)
34-
.font(.system(size: 15, weight: .bold))
35-
.foregroundColor(Color.white)
36-
.padding(.bottom, 8)
33+
let strokeOffsets: [(CGFloat, CGFloat)] = [
34+
(-1, -1), (1, -1),
35+
(-1, 1), (1, 1),
36+
(0, -1), (0, 1),
37+
(-1, 0), (1, 0)
38+
]
39+
40+
ForEach(0..<strokeOffsets.count, id: \.self) { i in
41+
let offset = strokeOffsets[i]
42+
Text(label)
43+
.font(.system(size: 15, weight: .bold))
44+
.foregroundColor(.black)
45+
.offset(x: offset.0, y: offset.1)
46+
}
47+
48+
Text(label)
49+
.font(.system(size: 15, weight: .bold))
50+
.foregroundColor(.white)
51+
.shadow(color: Color.black.opacity(0.7), radius: 4, x: 0, y: 2)
52+
3753
}
3854
}
3955
.frame(width: width, height: height)

GoInfoGame/GoInfoGame/quests/LongQuests/Components/QuestOptions.swift

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,28 @@ struct QuestOptions: View {
5151
width: 300,
5252
height: 300
5353
)
54-
Text(selectedImageText ?? "")
55-
.font(.system(size: 15, weight: .bold))
56-
.foregroundColor(Color.black)
57-
.padding(.bottom, 8)
54+
55+
ZStack {
56+
let strokeOffsets: [(CGFloat, CGFloat)] = [
57+
(-1, -1), (1, -1),
58+
(-1, 1), (1, 1),
59+
(0, -1), (0, 1),
60+
(-1, 0), (1, 0)
61+
]
62+
63+
ForEach(0..<strokeOffsets.count, id: \.self) { i in
64+
let offset = strokeOffsets[i]
65+
Text(selectedImageText ?? "")
66+
.font(.system(size: 15, weight: .bold))
67+
.foregroundColor(.black)
68+
.offset(x: offset.0, y: offset.1)
69+
}
70+
71+
Text(selectedImageText ?? "")
72+
.font(.system(size: 15, weight: .bold))
73+
.foregroundColor(.white)
74+
.shadow(color: Color.black.opacity(0.7), radius: 4, x: 0, y: 2)
75+
}
5876
Spacer()
5977
Button("Close") {
6078
selectedImageURL = nil
@@ -96,10 +114,27 @@ struct QuestOptions: View {
96114
.frame(width: 100, height: 100)
97115
.clipped()
98116

99-
Text(option.choiceText)
100-
.font(.system(size: 15, weight: .bold))
101-
.foregroundColor(Color.white)
102-
.padding(.bottom, 8)
117+
ZStack {
118+
let strokeOffsets: [(CGFloat, CGFloat)] = [
119+
(-1, -1), (1, -1),
120+
(-1, 1), (1, 1),
121+
(0, -1), (0, 1),
122+
(-1, 0), (1, 0)
123+
]
124+
125+
ForEach(0..<strokeOffsets.count, id: \.self) { i in
126+
let offset = strokeOffsets[i]
127+
Text(option.choiceText)
128+
.font(.system(size: 15, weight: .bold))
129+
.foregroundColor(.black)
130+
.offset(x: offset.0, y: offset.1)
131+
}
132+
133+
Text(option.choiceText)
134+
.font(.system(size: 15, weight: .bold))
135+
.foregroundColor(.white)
136+
.shadow(color: Color.black.opacity(0.7), radius: 4, x: 0, y: 2)
137+
}
103138
}
104139

105140
}

0 commit comments

Comments
 (0)