Browse Source

Fixed Ctrl + PG_DOWN bug

Fixes #705
v0.5.8
Ramiro Saenz 8 years ago
parent
commit
3e1f59ebf0
  1. 13
      app/Application.js

13
app/Application.js

@ -82,9 +82,14 @@ Ext.define('Rambox.Application', {
var tabPanel = Ext.cq1('app-main'); var tabPanel = Ext.cq1('app-main');
var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab()); var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab());
var i = activeIndex + 1; var i = activeIndex + 1;
if ( i >= tabPanel.items.items.length - 1 ) i = 0;
while ( tabPanel.items.items[i].id === 'tbfill' ) i++; // "cycle" (go to the start) when the end is reached or the end is the spacer "tbfill"
tabPanel.setActiveTab( i ); if (i === tabPanel.items.items.length || i === tabPanel.items.items.length - 1 && tabPanel.items.items[i].id === 'tbfill') i = 0;
// skip spacer
while (tabPanel.items.items[i].id === 'tbfill') i++;
tabPanel.setActiveTab(i);
} }
} }
,{ ,{
@ -97,7 +102,7 @@ Ext.define('Rambox.Application', {
var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab()); var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab());
var i = activeIndex - 1; var i = activeIndex - 1;
if ( i < 0 ) i = tabPanel.items.items.length - 1; if ( i < 0 ) i = tabPanel.items.items.length - 1;
while ( tabPanel.items.items[i].id === 'tbfill' ) i--; while ( tabPanel.items.items[i].id === 'tbfill' || i < 0 ) i--;
tabPanel.setActiveTab( i ); tabPanel.setActiveTab( i );
} }
} }

Loading…
Cancel
Save