-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added @available checks for new canvas keyboard and removed #Preview macro #25
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,15 @@ | |
import SwiftUI | ||
import Tonic | ||
|
||
@available(iOS 15, macOS 12.0, *) | ||
extension GraphicsContext { | ||
func fill(rect: CGRect, with color: Color) { | ||
fill(Path(roundedRect: rect, cornerRadius: 0), with: GraphicsContext.Shading.color(color)) | ||
} | ||
} | ||
|
||
@available(iOS 15, macOS 12.0, *) | ||
struct MIDIMonitorKeyboard: View { | ||
|
||
var layout: KeyboardLayout | ||
var activatedPitches: PitchSet | ||
var colorFunction: (Pitch)->Color | ||
|
@@ -87,9 +88,11 @@ struct MIDIMonitorKeyboard: View { | |
} | ||
|
||
var p = PitchSet(pitches: [Pitch(65), Pitch(68), Pitch(71), Pitch(74)]) | ||
#Preview { | ||
MIDIMonitorKeyboard(layout: .piano(pitchRange: Pitch(61)...Pitch(88)), | ||
activatedPitches: p, | ||
colorFunction: { x in Color(cgColor: PitchColor.helmholtz[Int(x.pitchClass)])} | ||
).frame(width: 600, height: 100) | ||
} | ||
|
||
//MARK: - we can have preview macro after Xcode 15 is released | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment Spacing Violation: Prefer at least one space after slashes for comments. (comment_spacing) |
||
//#Preview { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment Spacing Violation: Prefer at least one space after slashes for comments. (comment_spacing) |
||
// MIDIMonitorKeyboard(layout: .piano(pitchRange: Pitch(61)...Pitch(88)), | ||
// activatedPitches: p, | ||
// colorFunction: { x in Color(cgColor: PitchColor.helmholtz[Int(x.pitchClass)])} | ||
// ).frame(width: 600, height: 100) | ||
//} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment Spacing Violation: Prefer at least one space after slashes for comments. (comment_spacing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)