Using $SD.setFeedbackLayout with custom layouts #88
-
Hi there, I'm having an issue with dynamically changing the layout of an encoder display. I'm trying to have a screen saver display on timeout like so: async function setScreenSaver(context, coordinates) {
const layout = "../assets/layouts/screensaver.json"
$SD.setFeedbackLayout(context, layout)
const screenSaverIcon = await getScreenSaverIconAsBase64String(coordinates)
feedbackPayload = {
screenSaverIcon: {value: screenSaverIcon},
}
$SD.setFeedback(context, feedbackPayload)
} When I try to trigger the $SD.setFeedbackLayout(), it defaults to a generic layout with the name of action and the action icon. If I add a screenSaverIcon param to all of the custom layouts and call setFeedback without changing the layout it works. I would prefer not to have to override the other settings in my other custom layouts to achieve this though. Thanks for your help! EDIT: Adding JSON files SCREENSAVER LAYOUT{
"id": "com.example.plugin.screensaver.layout",
"items": [
{
"key": "screenSaverIcon",
"type": "pixmap",
"background": "transparent",
"zOrder": 2,
"rect": [0, 0, 200, 100]
}
]
} GENERAL LAYOUT{
"id": "com.example.plugin.channels.layout",
"items": [
{
"key": "channelNumber",
"type": "text",
"rect": [10, 10, 190, 24],
"zOrder": 1,
"font": { "size": 18, "weight": 600 },
"alignment": "center"
},
{
"key": "channelName",
"type": "text",
"rect": [10, 40, 190, 48],
"font": { "size": 24, "weight": 600 },
"alignment": "center"
},
{
"key": "screenSaverIcon",
"type": "pixmap",
"zOrder": 10,
"rect": [0, 0, 200, 100]
}
]
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey @erikjmurray, could you share the layout defined in screensaver.json - I suspect this might be the root of the issue. |
Beta Was this translation helpful? Give feedback.
I notice the path to the layout file starts with
../
which implies the layout file is outside the root of the plugin; is this correct?For example, should it instead be this: