Skip to content

Commit

Permalink
wip: update property name
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed May 24, 2024
1 parent 3336847 commit 3361f66
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
7 changes: 4 additions & 3 deletions packages/input-gateway/src/inputManagerHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ export class InputManagerHandler {
let contentLayerLongName: string | undefined
let contentLayerShortName: string | undefined
let tally: Tally = Tally.NONE
let stylePreset: string | undefined
let styleClassNames: string | undefined

if (actionId) {
const previewedAdlibs = this.#coreHandler.core
Expand All @@ -643,7 +643,8 @@ export class InputManagerHandler {
contentTypes = previewedAdlibs
.map((adlib) => adlib.sourceLayerType)
.filter((a) => a !== undefined) as SourceLayerType[]
stylePreset = previewedAdlibs[0].stylePreset
// @ts-expect-error lazy
styleClassNames = previewedAdlibs[0].styleClassNames
}
}

Expand All @@ -660,7 +661,7 @@ export class InputManagerHandler {
content: contentLabel ? { long: contentLabel } : undefined,
classNames: InputManagerHandler.buildFeedbackClassNames(mountedTrigger, contentTypes),
tally,
stylePreset,
styleClassNames,
})
}
}
8 changes: 2 additions & 6 deletions packages/input-manager/src/feedback/feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,12 @@ export interface Feedback {
content?: Label
/** The label for the type of content attached to this Action */
contentClass?: Label
// /** The duration of the content attached to this Action */
// duration?: string
/** The tally state bitmap */
tally?: Tally
/** Various classes attached to this Action - including the ones defined in `ClassNames` */
classNames?: string[]
// /** A PNG image of the content attached to this Action */
// thumbnail?: Blob
/** The id of the style preset to use when drawing the button */
stylePreset?: string
/** Space separated list of class names to use when drawing the button */
styleClassNames?: string
}

export type SomeFeedback = Feedback | null
Expand Down
28 changes: 18 additions & 10 deletions packages/input-manager/src/integrations/streamdeck/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,27 @@ export class StreamDeckDevice extends Device {
}

private convertFeedbackToBitmapFeedback(feedback: Feedback): BitmapFeedback | Feedback {
const stylePresetId = feedback.stylePreset
if (!stylePresetId || !this.config.stylePresets) return feedback
const styleClassNames = feedback.styleClassNames
if (!styleClassNames || !this.config.stylePresets) return feedback

const stylePreset = Object.values<StreamdeckStylePreset>(this.config.stylePresets).find(
(preset) => preset.id === stylePresetId
)
if (!stylePreset) return feedback
console.log('test', styleClassNames)

// Find the first match
for (const name of styleClassNames.split(' ')) {
const stylePreset = Object.values<StreamdeckStylePreset>(this.config.stylePresets).find(
(preset) => preset.id === name
)

return {
...feedback,
backgroundImage: stylePreset.backgroundImage,
hideText: !stylePreset.drawText,
if (stylePreset) {
return {
...feedback,
backgroundImage: stylePreset.backgroundImage,
hideText: !stylePreset.drawText,
}
}
}

return feedback
}

private quietUpdateFeedbackWithDownState = (trigger: string): void => {
Expand Down

0 comments on commit 3361f66

Please sign in to comment.