1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

initial stab on preventing tab switch chaining

This commit is contained in:
cTn 2014-07-09 16:10:02 +02:00
parent 795502a585
commit 3f063f6654
3 changed files with 7 additions and 1 deletions

View file

@ -3,6 +3,7 @@ var GUI_control = function() {
this.connecting_to = false; this.connecting_to = false;
this.connected_to = false; this.connected_to = false;
this.active_tab; this.active_tab;
this.tab_switch_in_progress = false;
this.operating_system; this.operating_system;
this.optional_usb_permissions = false; // controlled by usb permissions code this.optional_usb_permissions = false; // controlled by usb permissions code
this.interval_array = []; this.interval_array = [];

View file

@ -22,6 +22,7 @@ $(document).ready(function() {
GUI.timeout_kill_all(); GUI.timeout_kill_all();
GUI.interval_kill_all(); GUI.interval_kill_all();
GUI.tab_switch_cleanup(); GUI.tab_switch_cleanup();
GUI.tab_switch_in_progress = false;
serial.disconnect(onClosed); serial.disconnect(onClosed);

View file

@ -49,7 +49,7 @@ $(document).ready(function() {
// Tabs // Tabs
var tabs = $('#tabs > ul'); var tabs = $('#tabs > ul');
$('a', tabs).click(function() { $('a', tabs).click(function() {
if ($(this).parent().hasClass('active') == false) { // only initialize when the tab isn't already active if ($(this).parent().hasClass('active') == false && !GUI.tab_switch_in_progress) { // only initialize when the tab isn't already active
var self = this; var self = this;
var index = $(self).parent().index(); var index = $(self).parent().index();
var tab = $(self).parent().prop('class'); var tab = $(self).parent().prop('class');
@ -60,6 +60,8 @@ $(document).ready(function() {
return; return;
} }
GUI.tab_switch_in_progress = true;
GUI.tab_switch_cleanup(function() { GUI.tab_switch_cleanup(function() {
// disable previously active tab highlight // disable previously active tab highlight
$('li', tabs).removeClass('active'); $('li', tabs).removeClass('active');
@ -102,6 +104,8 @@ $(document).ready(function() {
tab_initialize_logging(); tab_initialize_logging();
break; break;
} }
GUI.tab_switch_in_progress = false;
}); });
} }
}); });