diff --git a/browser/base/content/tabcandy/app/groups.js b/browser/base/content/tabcandy/app/groups.js index a321d69071e5..65145735490e 100644 --- a/browser/base/content/tabcandy/app/groups.js +++ b/browser/base/content/tabcandy/app/groups.js @@ -60,6 +60,7 @@ Group.prototype = { }, create: function(listOfEls){ + var self = this; this._children = $(listOfEls).toArray(); var boundingBox = this._getBoundingBox(); @@ -93,7 +94,14 @@ Group.prototype = { position: "relative", top: -(titlebar.height()+2), left: -1, - }) + }); + + $('.close', titlebar).click(function() { + $.each(self._children, function(index, child) { + var tab = Tabs.tab(child); + tab.close(); + }); + }); // On delay, show the title bar. var shouldShow = false; @@ -122,6 +130,24 @@ Group.prototype = { for(var i in els){ this.add( els[i] ); } + + // ___ Push other objects away +/* + var bb = Utils.getBounds(this._container); + $('.tab').each(function() { + $el = $(this); + if($el.data('group') != self) { + var box = Utils.getBounds(this); + if(box.intersects(bb)) { + if(box.right < bb.right) { + $el.animate({ + left: box.left - (box.right - bb.left), + }); + } + } + } + }); +*/ }, add: function($el){ @@ -253,7 +279,9 @@ Group.prototype = { $dragged.addClass("willGroup"); }, out: function(){ - $dragged.data("group").remove($dragged); + var $group = $dragged.data("group"); + if($group) + $group.remove($dragged); $dragged.removeClass("willGroup"); }, drop: function(){ diff --git a/browser/base/content/tabcandy/app/ui.js b/browser/base/content/tabcandy/app/ui.js index cce34488f1bf..8eeee5456c90 100644 --- a/browser/base/content/tabcandy/app/ui.js +++ b/browser/base/content/tabcandy/app/ui.js @@ -31,7 +31,8 @@ var Page = { } $div.mousedown(function(e) { - self.lastMouseDownTarget = e.target; + if(!Utils.isRightClick(e)) + self.lastMouseDownTarget = e.target; }); $div.mouseup(function(e) { diff --git a/browser/base/content/tabcandy/core/utils.js b/browser/base/content/tabcandy/core/utils.js index 00178f46dfe9..6571b5b29666 100644 --- a/browser/base/content/tabcandy/core/utils.js +++ b/browser/base/content/tabcandy/core/utils.js @@ -17,6 +17,40 @@ var consoleService = Cc["@mozilla.org/consoleservice;1"] var extensionManager = Cc["@mozilla.org/extensions/manager;1"] .getService(Ci.nsIExtensionManager); +// ---------- +function Rect(left, top, width, height) { + this.left = left; + this.top = top; + this.width = width; + this.height = height; +} + +Rect.prototype = { + get right() { + return this.left + this.width; + }, + + set right(value) { + this.width = value - this.left; + }, + + get bottom() { + return this.top + this.height; + }, + + set bottom(value) { + this.height = value - this.top; + }, + + intersects: function(rect) { + return (rect.right > this.left + && rect.left < this.right + && rect.bottom > this.top + && rect.top < this.bottom); + } +}; + +// ---------- var Utils = { // ___ Windows and Tabs get activeWindow(){ @@ -147,11 +181,15 @@ var Utils = { var s = obj + ' = {'; for(prop in obj) { var value = obj[prop]; - s += prop + ": " - + (typeof(value) == 'string' ? '\'' : '') - + value - + (typeof(value) == 'string' ? '\'' : '') - + ", "; + s += prop + ': '; + if(typeof(value) == 'string') + s += '\'' + value + '\''; + else if(typeof(value) == 'function') + s += 'function'; + else + s += value; + + s += ", "; } return s + '}'; }, @@ -197,6 +235,17 @@ var Utils = { return date.getTime(); }, + // ___ Geometry + getBounds: function(el) { + var $el = $(el); + return new Rect( + parseInt($el.css('left')), + parseInt($el.css('top')), + $el.width(), + $el.height() + ); + }, + // ___ Misc isJQuery: function(object) { // TODO: need more robust way diff --git a/browser/themes/pinstripe/browser/tabcandy/tabcandy.css b/browser/themes/pinstripe/browser/tabcandy/tabcandy.css index a6dfae54ec59..5b8db4180518 100644 --- a/browser/themes/pinstripe/browser/tabcandy/tabcandy.css +++ b/browser/themes/pinstripe/browser/tabcandy/tabcandy.css @@ -11,7 +11,7 @@ background-color: white; cursor: move; -moz-box-shadow: inset 2px 2px 12px rgba(0,0,0,.15); - overflow: hidden; +/* overflow: hidden; */ } .titlebar{ diff --git a/content/candies/revision-a/index.html b/content/candies/revision-a/index.html index bc9a24c51af7..975fc53eef01 100644 --- a/content/candies/revision-a/index.html +++ b/content/candies/revision-a/index.html @@ -18,7 +18,7 @@ position: absolute; display: block; float:left; - margin: 10px; +/* margin: 10px; */ padding: 0; background-color: rgba(255,255,255,.8); z-index: 0;