+ Groups now track their last-focused tab. When you click on the group, it brings you back to the group with the appropriate tab focused.

This commit is contained in:
Aza Raskin 2010-05-25 19:18:25 -07:00
parent 525ab6e9ab
commit 3c66e85d7a
2 changed files with 24 additions and 1 deletions

View File

@ -65,6 +65,7 @@ window.Group = function(listOfEls, options) {
this.expanded = null;
this.locked = (options.locked ? Utils.copy(options.locked) : {});
this.topChild = null;
this._activeTab = null;
if(isPoint(options.userSize))
this.userSize = new Point(options.userSize);
@ -265,6 +266,20 @@ window.Group = function(listOfEls, options) {
window.Group.prototype = $.extend(new Item(), new Subscribable(), {
// ----------
defaultName: "name this group...",
// -----------
// TODO: This currently accepts only the DOM element of a tab.
// It should also take a TabItem...
setActiveTab: function(tab){
this._activeTab = tab;
},
// -----------
// TODO: This currently returns a DOM element of the selected tab.
// It should probably actually be a TabItem...
getActiveTab: function(tab){
return this._activeTab;
},
// ----------
getStorageData: function() {
@ -971,6 +986,13 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
});
}
$(container).click(function(){
var activeTab = self.getActiveTab();
if( activeTab ) TabItems.zoomTo(activeTab)
// TODO: This should also accept TabItems
else TabItems.zoomTo(self.getChild(0).tab.mirror.el);
});
$(container).droppable({
tolerance: "intersect",
over: function(){

View File

@ -419,7 +419,8 @@ window.TabItems = {
if( self.getItemByTab(tabEl).parent ){
var gID = self.getItemByTab(tabEl).parent.id;
var group = Groups.group(gID);
Groups.setActiveGroup( group );
Groups.setActiveGroup( group );
group.setActiveTab( tabEl );
}
else
Groups.setActiveGroup( null );