Skip to content

Commit

Permalink
prevent picking when select is locked
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Feb 6, 2025
1 parent f742960 commit b1eb253
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 9 additions & 0 deletions js/DevicePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,14 @@ export default class DevicePanel extends Panel {
deviceTypeSelected.classList.remove('locked');
}
}

isSelectionLocked() {
const deviceTypeSelected = document.getElementById('deviceTypeSelected');
if (!deviceTypeSelected) {
return false;
}
// Prevent dropdown from opening if it's locked
return deviceTypeSelected.classList.contains('locked');
}
}

8 changes: 5 additions & 3 deletions js/ModesPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,14 @@ export default class ModesPanel extends Panel {
const selectedDevice = this.editor.devicePanel.selectedDevice;

// If the imported mode has a different device, ask the user to choose
if (initialDevice && selectedDevice !== initialDevice && selectedDevice !== 'None') {
if (initialDevice && selectedDevice !== initialDevice && selectedDevice !== 'None' && !this.editor.devicePanel.isSelectionLocked()) {
this.showImportModeModal(initialDevice, selectedDevice, modeData, addNew);
return;
}
this.lightshow.setLedCount(modeData.num_leds);
this.editor.devicePanel.updateSelectedDevice(initialDevice, true);
if (!this.editor.devicePanel.isSelectionLocked()) {
this.lightshow.setLedCount(modeData.num_leds);
this.editor.devicePanel.updateSelectedDevice(initialDevice, true);
}
const modeCount = this.lightshow.vortex.numModes();
let curSel;
if (addNew) {
Expand Down

0 comments on commit b1eb253

Please sign in to comment.