+ Added reverse-syncing of tab ordering: from tab bar order to group order.

- Before this commit, changing the order of tabs in a group would change
   the order of tabs in the tab bar on zoom-in.
 - After this commit, that continues to be the case. In addition, if you
   change the order of tabs in the tab bar, those changes will be reflected
   in the order of tabs in the group.
This commit is contained in:
Aza Raskin 2010-05-03 18:05:43 -07:00
parent d4491b6071
commit 358d271ca0
2 changed files with 28 additions and 0 deletions

View File

@ -812,6 +812,24 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
this.$resizer.fadeOut();
$(this.container).resizable('disable');
}
},
reorderBasedOnTabOrder: function(){
// Reorderes the tabs in a group based on the arrangment of the tabs
// shown in the tab bar. It doesn't it by sorting the children
// of the group by the positions of their respective tabs in the
// tab bar.
var groupTabs = [];
for( var i=0; i<UI.tabBar.el.children.length; i++ ){
var tab = UI.tabBar.el.children[i];
if( tab.collapsed == false )
groupTabs.push(tab);
}
this._children.sort(function(a,b){
return groupTabs.indexOf(a.tab.raw) - groupTabs.indexOf(b.tab.raw)
})
}
});

View File

@ -130,6 +130,14 @@ window.Page = {
Utils.homeTab.raw.maxWidth = 60;
Utils.homeTab.raw.minWidth = 60;
/*try{
Tabs.onMove(function(){
Utils.log('mooooori');
})
}catch(e){
Utils.log(e)
}*/
Tabs.onClose(function(){
// Only go back to the TabCandy tab when there you close the last
// tab of a group.
@ -144,6 +152,8 @@ window.Page = {
Tabs.onFocus(function(){
// If we switched to TabCandy window...
if( this.contentWindow == window && lastTab != null && lastTab.mirror != null){
Groups.getActiveGroup().reorderBasedOnTabOrder();
UI.tabBar.hide(false);
// If there was a lastTab we want to animate
// its mirror for the zoom out.