Skip to content

Commit 15d2011

Browse files
committed
Merge branch 'pr/ianshade/25' into develop
2 parents 088d426 + bfe6172 commit 15d2011

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

packages/input-gateway/src/inputManagerHandler.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,15 @@ export class InputManagerHandler {
642642
.reverse()
643643

644644
if (previewedAdlibs.length > 0) {
645-
tally = tally | Tally.PRESENT
645+
tally =
646+
tally |
647+
Tally.PRESENT |
648+
previewedAdlibs.reduce(
649+
(acc, adlib) =>
650+
// @ts-expect-error: needs new build of core-integration, but we're on release50, which causes some incompatibilities, even though things just work...
651+
acc | (adlib.isCurrent ? Tally.CURRENT : Tally.NONE) | (adlib.isNext ? Tally.NEXT : Tally.NONE),
652+
Tally.NONE
653+
)
646654
contentLayerLongName = previewedAdlibs[0].sourceLayerName?.name
647655
contentLayerShortName = previewedAdlibs[0].sourceLayerName?.abbreviation
648656
contentLabel = previewedAdlibs.map((adlib) => InputManagerHandler.getStringLabel(adlib.label)).join(', ')

packages/input-manager/src/feedback/bitmap/typeRenderers/adlib/base.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ClassNames, BitmapFeedback } from '../../../feedback'
1+
import { ClassNames, BitmapFeedback, Tally } from '../../../feedback'
22
import { BaseRenderer } from '../base'
33

44
/**
@@ -54,6 +54,11 @@ const COLORS: Record<string, string> = {
5454
[ClassNames.UNKNOWN]: '#4b4b4b',
5555
}
5656

57+
const TALLY_COLORS: Record<string, string> = {
58+
[Tally.CURRENT]: '#ff0000',
59+
[Tally.NEXT]: '#00ff00',
60+
}
61+
5762
export class BaseAdLibRenderer extends BaseRenderer {
5863
private getAdLibColor(classNames: string[] | undefined): string {
5964
if (classNames === undefined) return COLORS[ClassNames.UNKNOWN]
@@ -62,6 +67,13 @@ export class BaseAdLibRenderer extends BaseRenderer {
6267
return COLORS[ClassNames.UNKNOWN]
6368
}
6469

70+
private getTallyColor(tally: Tally | undefined): string | undefined {
71+
if (tally === undefined) return undefined
72+
if (Tally.CURRENT & tally) return TALLY_COLORS[Tally.CURRENT]
73+
if (Tally.NEXT & tally) return TALLY_COLORS[Tally.NEXT]
74+
return undefined
75+
}
76+
6577
private getFontSize(label: string): number {
6678
if (label.length <= 3) {
6779
return 2.5
@@ -86,7 +98,7 @@ export class BaseAdLibRenderer extends BaseRenderer {
8698
spring: true,
8799
fontSize: this.percentToPixels(this.getFontSize(label)),
88100
lineHeight: this.percentToPixels(this.getFontSize(label)),
89-
background: this.getAdLibColor(feedback.classNames),
101+
background: this.getTallyColor(feedback.tally) ?? this.getAdLibColor(feedback.classNames),
90102
textShadowOffset: 1,
91103
lineClamp: 4,
92104
})

0 commit comments

Comments
 (0)