This commit is contained in:
Ian Gilman 2010-05-04 16:44:20 -07:00
commit 4f56dba221
3 changed files with 21 additions and 39 deletions

View File

@ -451,12 +451,7 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
}
if(!options.dontArrange)
// If this is a brand new tab don't animate it in from
// nowhere in particular (i.e., from [0,0])
if( item.bounds.left == 0 && item.bounds.top == 0 )
this.arrange({animate:false});
else
this.arrange();
this.arrange();
if( this._nextNewTabCallback ){
this._nextNewTabCallback.apply(this, [item])
@ -791,9 +786,8 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
// ----------
newTab: function() {
Groups.setActiveGroup(this);
Utils.log("Name", this.getTitle())
Utils.log("Active", Groups.getActiveGroup().getTitle())
var newTab = Tabs.open("about:blank");
UI.navBar.hide();
var self = this;
var doNextTab = function(tab){
@ -801,28 +795,27 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
$(tab.container).css({opacity: 0});
anim = $("<div class='newTabAnimatee'/>").css({
top: group.$ntb.offset().top,
left: group.$ntb.offset().left,
width: group.$ntb.width(),
height: group.$ntb.height()
})
top: tab.bounds.top+5,
left: tab.bounds.left+5,
width: tab.bounds.width-10,
height: tab.bounds.height-10,
zIndex: 999,
opacity: 0
})
.appendTo("body")
.animate({
top: tab.bounds.top,
left: tab.bounds.left,
width: tab.bounds.width,
height: tab.bounds.height,
zIndex: 999
},200)
opacity: 1.0
},500)
.animate({
top: 0,
left: 0,
width: window.innerWidth,
height: window.innerHeight
}, 250, function(){
}, 270, function(){
$(tab.container).css({opacity: 1});
newTab.focus();
UI.tabBar.show(false);
UI.navBar.show();
UI.navBar.urlBar.focus();
anim.remove();
// We need a timeout here so that there is a chance for the
@ -841,10 +834,7 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
// We need to fix this--immediate response to a users
// actions is necessary for a good user experience.
// Should be doNextTab being passed in. Putting "..." for debugging.
self.onNextNewTab(function(){
Utils.log('...')
});
self.onNextNewTab(doNextTab);
},
// ----------
@ -1161,20 +1151,12 @@ window.Groups = {
// ----------
newTab: function(tabItem) {
try{
//var group = this.getActiveGroup() ? this.getActiveGroup() : this.getNewTabGroup();
var group = this.getActiveGroup();
if( group == null )
group = this.getNewTabGroup();
Utils.log("new tab in: ", group.getTitle())
var $el = $(tabItem.container);
if(group)
group.add($el);
}catch(e){
Utils.log(e)
}
if(group) group.add($el);
},
// ----------

View File

@ -2,6 +2,7 @@
window.TabItem = function(container, tab) {
this.defaultSize = new Point(TabItems.tabWidth, TabItems.tabHeight);
this._init(container);
this._hasBeenDrawn = false;
this.tab = tab;
this.setResizable(true);
};
@ -93,8 +94,10 @@ window.TabItem.prototype = $.extend(new Item(), {
return;
this.bounds.copy(rect);
if(immediately) {
// If this is a brand new tab don't animate it in from
// a random location (i.e., from [0,0]). Instead, just
// have it appear where it should be.
if(immediately || (!this._hasBeenDrawn) ) {
$container.css(css);
} else {
TabMirror.pausePainting();
@ -123,6 +126,7 @@ window.TabItem.prototype = $.extend(new Item(), {
}
this._updateDebugBounds();
this._hasBeenDrawn = true;
},
// ----------

View File

@ -136,10 +136,6 @@ window.Page = {
var group = Groups.getActiveGroup();
if( group && group._children.length == 0 )
Page.show();
else {
Utils.homeTab.focus();
UI.tabBar.hide(false);
}
return false;
});