Skip to content

Commit 0580ba2

Browse files
committed
Fix drawing with correct non deprecated methods for both 13 and 14+
1 parent 8c649af commit 0580ba2

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

OpenTimelineIO-Sample/OpenTimelineIO-Reader/Views/TimeRulerView.swift

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,36 @@ struct TimeRulerView: View
117117
let playheadRect = CGRect(x: playheadPositionX, y: 20, width: 1, height: size.height-20)
118118
// context.fill(Path(playheadRect), with: .color(.orange))
119119

120-
context.draw(Text("\(Image(systemName: "arrowtriangle.down.fill"))").font(.system(size: 13)), at: CGPoint(x: playheadPositionX + 0.5, y: 15))
121-
120+
if #available(macOS 14.0, *)
121+
{
122+
context.draw(
123+
Text("\(Image(systemName: "arrowtriangle.down.fill"))")
124+
.font(.system(size: 13))
125+
.foregroundStyle(.orange),
126+
at: CGPoint(x: playheadPositionX + 0.5, y: 15))
127+
128+
context.draw(
129+
Text(currentTimeLabel)
130+
.font(.system(size: 10))
131+
.foregroundStyle(.orange),
132+
at: CGPoint(x: playheadPositionX, y: 5))
133+
}
134+
else
135+
{
136+
context.draw(
137+
Text("\(Image(systemName: "arrowtriangle.down.fill"))")
138+
.font(.system(size: 13))
139+
.foregroundColor(.orange),
140+
at: CGPoint(x: playheadPositionX + 0.5, y: 15))
141+
142+
context.draw(
143+
Text(currentTimeLabel)
144+
.font(.system(size: 10))
145+
.foregroundColor(.orange),
146+
at: CGPoint(x: playheadPositionX, y: 5))
147+
}
148+
122149
context.fill(Path(playheadRect), with: .color(.orange))
123-
124-
context.draw( Text(currentTimeLabel).font(.system(size: 10)), at: CGPoint(x: playheadPositionX, y: 5))
125-
126150
}
127151

128152
// New function to get frame rate of the timeline

0 commit comments

Comments
 (0)