зеркало из https://github.com/mozilla/gecko-dev.git
+ Removed the margin from the tabs; we need to handle buffers more explicitly
+ You can no longer launch into a tab by right clicking it + A group's close box now works + A group's title bar now works again (silly css misunderstanding) + Added a basic Rect object to utils.js, and a getBounds routine for retrieving the bounds of a DOM element + The Utils logging routines no longer expand functions (instead just saying that it's a function)
This commit is contained in:
Родитель
42c71cfed7
Коммит
25674dab26
|
@ -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(){
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче