Skip to content

Commit 274c2e4

Browse files
committed
Scoreboard refactoring.
1 parent 5b9142b commit 274c2e4

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

Moblin/VideoEffects/Scoreboard/ScoreboardEffect.swift

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,7 @@ private struct ModularScoreboardView: View {
264264
.padding(.leading, 6)
265265
.padding(.trailing, 2)
266266
.frame(maxWidth: .infinity, alignment: .leading)
267-
.frame(height: height)
268267
renderPossession(show: team.possession, size: fontSize)
269-
.frame(height: height)
270268
if histCount > 0 {
271269
ForEach(1 ... histCount, id: \.self) { i in
272270
let val = getHistoricScore(team: team, indexPlusOne: i) ?? ""
@@ -282,7 +280,6 @@ private struct ModularScoreboardView: View {
282280
label: nil,
283281
size: fontSize * 0.9,
284282
width: histW,
285-
height: height,
286283
gray: true,
287284
weight: weight
288285
)
@@ -292,12 +289,11 @@ private struct ModularScoreboardView: View {
292289
label: nil,
293290
size: fontSize * 0.9,
294291
width: histW,
295-
height: height,
296292
gray: true,
297293
weight: .medium
298294
)
299295
} else {
300-
Color.clear.frame(width: histW, height: height)
296+
Color.clear.frame(width: histW)
301297
}
302298
}
303299
}
@@ -306,10 +302,10 @@ private struct ModularScoreboardView: View {
306302
label: nil,
307303
size: fontSize,
308304
width: width,
309-
height: height,
310305
gray: false
311306
)
312307
}
308+
.frame(height: height)
313309
.background(backgroundColor)
314310
if modular.showMoreStats {
315311
renderMoreStats(team: team,
@@ -438,7 +434,6 @@ private struct ModularScoreboardView: View {
438434
label: team.secondaryScoreLabel,
439435
size: fontSize,
440436
width: width,
441-
height: height,
442437
gray: true
443438
)
444439
}
@@ -448,16 +443,13 @@ private struct ModularScoreboardView: View {
448443
.lineLimit(1)
449444
.padding(.leading, 3)
450445
.frame(maxWidth: .infinity, alignment: .leading)
451-
.frame(height: height)
452446
renderPossession(show: team.possession, size: fontSize)
453-
.frame(height: height)
454447
if modular.layout == .stackedInline {
455448
renderStat(
456449
team.secondaryScore,
457450
label: team.secondaryScoreLabel,
458451
size: fontSize,
459452
width: width,
460-
height: height,
461453
gray: true
462454
)
463455
}
@@ -466,10 +458,10 @@ private struct ModularScoreboardView: View {
466458
label: nil,
467459
size: fontSize,
468460
width: width,
469-
height: height,
470461
gray: false
471462
)
472463
}
464+
.frame(height: height)
473465
.background(backgroundColor)
474466
if modular.showMoreStats {
475467
renderMoreStats(team: team,
@@ -496,28 +488,24 @@ private struct ModularScoreboardView: View {
496488
HStack(spacing: 0) {
497489
if !mirrored {
498490
renderPossession(show: team.possession, size: fontSize)
499-
.frame(height: height)
500491
Text(team.name)
501492
.font(.system(size: fontSize))
502493
.bold(modular.isBold)
503494
.lineLimit(1)
504495
.padding(.trailing, 4)
505496
.frame(maxWidth: .infinity, alignment: .trailing)
506-
.frame(height: height)
507497
renderStat(
508498
team.secondaryScore,
509499
label: team.secondaryScoreLabel,
510500
size: fontSize,
511501
width: width,
512-
height: height,
513502
gray: true
514503
)
515504
renderStat(
516505
team.primaryScore,
517506
label: nil,
518507
size: fontSize,
519508
width: width,
520-
height: height,
521509
gray: false
522510
)
523511
} else {
@@ -526,15 +514,13 @@ private struct ModularScoreboardView: View {
526514
label: nil,
527515
size: fontSize,
528516
width: width,
529-
height: height,
530517
gray: false
531518
)
532519
renderStat(
533520
team.secondaryScore,
534521
label: team.secondaryScoreLabel,
535522
size: fontSize,
536523
width: width,
537-
height: height,
538524
gray: true
539525
)
540526
Text(team.name)
@@ -543,11 +529,10 @@ private struct ModularScoreboardView: View {
543529
.lineLimit(1)
544530
.padding(.leading, 4)
545531
.frame(maxWidth: .infinity, alignment: .leading)
546-
.frame(height: height)
547532
renderPossession(show: team.possession, size: fontSize)
548-
.frame(height: height)
549533
}
550534
}
535+
.frame(height: height)
551536
.background(backgroundColor)
552537
if modular.showMoreStats {
553538
renderMoreStats(team: team,
@@ -566,16 +551,13 @@ private struct ModularScoreboardView: View {
566551
label: String?,
567552
size: CGFloat,
568553
width: CGFloat,
569-
height: CGFloat,
570554
gray: Bool,
571555
weight: Font.Weight = .black
572556
) -> some View {
573557
if !val.isEmpty {
574558
ZStack {
575559
if gray {
576-
Color.black
577-
.opacity(0.25)
578-
.frame(width: width, height: height)
560+
Color.black.opacity(0.25)
579561
}
580562
if let label, !label.isEmpty {
581563
VStack(spacing: -2) {
@@ -590,7 +572,7 @@ private struct ModularScoreboardView: View {
590572
.font(.system(size: size, weight: weight))
591573
}
592574
}
593-
.frame(width: width, height: height)
575+
.frame(width: width)
594576
}
595577
}
596578

0 commit comments

Comments
 (0)