+ Cleaned up various close and remove routines (the close group feature wasn't working properly)

+ Improved Tabs.tab() (though it's still kind of a hack); new tabs weren't being hooked up properly
This commit is contained in:
Ian Gilman 2010-03-30 11:05:53 -07:00
parent 7abb15a948
commit 34935fdee3
3 changed files with 20 additions and 19 deletions

View File

@ -201,7 +201,8 @@ window.Group.prototype = $.extend(new Item(), {
// ----------
close: function() {
$.each(this._children, function(index, child) {
var toClose = $.merge([], this._children);
$.each(toClose, function(index, child) {
child.close();
});
},
@ -316,8 +317,11 @@ window.Group.prototype = $.extend(new Item(), {
// ----------
removeAll: function() {
while(this._children.length)
this.remove(this._children[0], {dontArrange: true});
var self = this;
var toRemove = $.merge([], this._children);
$.each(toRemove, function(index, child) {
self.remove(child, {dontArrange: true});
});
},
// ----------
@ -551,8 +555,10 @@ window.Groups = {
// ----------
removeAll: function() {
while(this.groups.length)
this.groups[0].removeAll();
var toRemove = $.merge([], this.groups);
$.each(toRemove, function(index, group) {
group.removeAll();
});
}
};

View File

@ -129,19 +129,10 @@ window.TabItems = {
$div.css({left: p.x, top: p.y});
}
/*
Utils.log('each');
if($div.length > 1) {
*/
$div.each(function() {
var tab = Tabs.tab(this);
/* Utils.log('adding', tab.url); */
$(this).data('tabItem', new TabItem(this, tab));
});
/*
} else
$div.data('tabItem', new TabItem($div.get(0), Tabs.tab($div.get(0))));
*/
$div.each(function() {
var tab = Tabs.tab(this);
$(this).data('tabItem', new TabItem(this, tab));
});
// TODO: Figure out this really weird bug?
// Why is that:

View File

@ -359,7 +359,11 @@ function Tabs() {
},
tab: function tab(value) {
// assuming value is a DOM element for the time being
return $(value).find("canvas").data("link").tab;
var result = $(value).data('tab');
if(!result)
result = $(value).find("canvas").data("link").tab;
return result;
},
toString: function toString() {
return "[Tabs]";