mirror of
https://github.com/stagehacks/Cue-View.git
synced 2026-08-09 15:53:38 +00:00
be smarter about changing the type of a device
This commit is contained in:
@@ -232,9 +232,18 @@ module.exports.deleteActive = function deleteActive() {
|
||||
module.exports.changeActiveType = function changeActiveType(newType) {
|
||||
const device = VIEW.getActiveDevice();
|
||||
device.type = newType;
|
||||
device.fields = {};
|
||||
device.plugin = PLUGINS.all[newType];
|
||||
|
||||
if (PLUGINS.all[device.type].config.fields) {
|
||||
PLUGINS.all[newType].config.fields.forEach((field) => {
|
||||
device.fields[field.key] = field.value;
|
||||
});
|
||||
}
|
||||
|
||||
initDeviceConnection(device.id);
|
||||
VIEW.draw(device);
|
||||
VIEW.updateFields();
|
||||
// SAVESLOTS.saveAll();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user