Skip to content

Commit 575b78e

Browse files
authored
Merge pull request #1 from NickCulbertson/main
Add border to keys
2 parents 92895f2 + 236ef56 commit 575b78e

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

Demo/KeyboardDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/Keyboard/Keyboard.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public struct Keyboard<Content>: View where Content: View {
5555
}
5656

5757
var isomorphicBody: some View {
58-
HStack(spacing: 1) {
58+
HStack(spacing: 0) {
5959
ForEach(pitchRange, id: \.self) { pitch in
6060
KeyContainer(model: model,
6161
pitch: pitch,
@@ -66,12 +66,12 @@ public struct Keyboard<Content>: View where Content: View {
6666
content: content)
6767
}
6868
}
69-
.frame(minWidth: 600, minHeight: 100)
69+
.frame(minWidth: 100, minHeight: 100)
7070
.clipShape(Rectangle())
7171
}
7272

7373
var pianoRollBody: some View {
74-
VStack(spacing: 1) {
74+
VStack(spacing: 0) {
7575
ForEach(pitchRange, id: \.self) { pitch in
7676
KeyContainer(model: model,
7777
pitch: pitch,
@@ -82,15 +82,15 @@ public struct Keyboard<Content>: View where Content: View {
8282
content: content)
8383
}
8484
}
85-
.frame(minWidth: 100, minHeight: 600)
85+
.frame(minWidth: 100, minHeight: 100)
8686
.clipShape(Rectangle())
8787
}
8888

8989

9090
var pianoBody: some View {
9191

9292
ZStack {
93-
HStack(spacing: 1) {
93+
HStack(spacing: 0) {
9494
ForEach(whiteKeys, id: \.self) { pitch in
9595
KeyContainer(model: model,
9696
pitch: pitch,
@@ -101,7 +101,7 @@ public struct Keyboard<Content>: View where Content: View {
101101
}
102102
}
103103
VStack {
104-
HStack(spacing: 1) {
104+
HStack(spacing: 0) {
105105
ForEach(whiteKeys, id: \.self) { pitch in
106106
KeyContainer(model: model,
107107
pitch: Pitch(intValue: pitch.intValue + 1),
@@ -115,7 +115,7 @@ public struct Keyboard<Content>: View where Content: View {
115115
Spacer()
116116
}
117117
}
118-
.frame(minWidth: 600, minHeight: 100)
118+
.frame(minWidth: 100, minHeight: 100)
119119
.clipShape(Rectangle())
120120
}
121121
}

Sources/Keyboard/KeyboardKey.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public struct KeyboardKey: View {
4949
RoundedRectangle(cornerSize: CGSize(width: minDimension(proxy.size) / 8.0,
5050
height: minDimension(proxy.size) / 8.0))
5151
.foregroundColor(keyColor)
52+
.overlay(RoundedRectangle(cornerRadius: minDimension(proxy.size) / 8.0)
53+
.strokeBorder(Color.black, lineWidth: 0.5))
5254
Text(text)
5355
.font(Font(.init(.system, size: minDimension(proxy.size) / 3)))
5456
.foregroundColor(textColor)

0 commit comments

Comments
 (0)