mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
+ merged from Aza
--HG-- rename : browser/base/content/tabcandy/app/jquery.lasso.js => browser/base/content/tabcandy/shared/jquery.lasso.js rename : content/ian1/ui.js => content/candies/ian1/js/ui.js rename : content/tab.html => content/candies/original/index.html
This commit is contained in:
commit
94c745dd0d
@ -11,11 +11,15 @@ Lasso.prototype = {
|
||||
this._container = options.container || "body";
|
||||
this._fillColor = options.fillColor || "rgba(0,0,255,.1)";
|
||||
this._strokeColor = options.strokeColor || "rgba(0,0,255,.4)";
|
||||
this._strokeWidth = options.strokeWidth || 1;
|
||||
this._onSelect = options.onSelect || function(){};
|
||||
this._onStart = options.onStart || function(){};
|
||||
this._onMove = options.onMove;
|
||||
this._acceptMouseDown = options.acceptMouseDown || function(){ return true; };
|
||||
|
||||
if( options.fill != false ) this._fill = true;
|
||||
else this._fill = false;
|
||||
|
||||
this._lastPos = null;
|
||||
this._isSelecting = false;
|
||||
|
||||
@ -57,7 +61,7 @@ Lasso.prototype = {
|
||||
this.ctx.beginPath();
|
||||
this.ctx.fillStyle = this._fillColor;
|
||||
this.ctx.strokeStyle = this._strokeColor;
|
||||
this.ctx.lineWidth = 1;
|
||||
this.ctx.lineWidth = this._strokeWidth;
|
||||
$(this.canvas).mousemove(this._draw);
|
||||
$(this.canvas).show();
|
||||
|
||||
@ -88,7 +92,7 @@ Lasso.prototype = {
|
||||
clearRect(0,0,this.canvas.width,this.canvas.height)
|
||||
lineTo(pos.x, pos.y);
|
||||
stroke();
|
||||
fill();
|
||||
if( self._fill ) fill();
|
||||
}
|
||||
|
||||
self._lastPos = pos;
|
||||
|
@ -44,5 +44,7 @@ $(function(){
|
||||
var select = new Selector({
|
||||
targets: ".tab",
|
||||
container: "html",
|
||||
fill: false,
|
||||
strokeWidth: 3
|
||||
});
|
||||
});
|
@ -26,6 +26,8 @@ var Page = {
|
||||
|
||||
var zIndex = 100;
|
||||
function mod($div){
|
||||
Utils.log("hi!")
|
||||
|
||||
$div.draggable({
|
||||
start:function(){ isDragging = true; },
|
||||
stop: function(){
|
||||
|
50
content/select/js/jquery.select.js
Normal file
50
content/select/js/jquery.select.js
Normal file
@ -0,0 +1,50 @@
|
||||
function Selector(options){ this.init(options) }
|
||||
Selector.prototype = {
|
||||
init: function(options){
|
||||
var self = this;
|
||||
options.onSelect = function(a,b){ self.showMenu(a,b); };
|
||||
options.onStart = function(){ self.hideMenu() };
|
||||
this.lasso = new Lasso(options);
|
||||
},
|
||||
|
||||
hideMenu: function(){
|
||||
if( this.menu ) this.menu.remove();
|
||||
},
|
||||
|
||||
showMenu: function( selectedEls, pos ){
|
||||
if( pos == null || selectedEls.length == 0 ) return;
|
||||
var self = this;
|
||||
|
||||
this.menu = $("<div class='lasso-menu'>").appendTo("body");
|
||||
this.menu.css({
|
||||
position:"fixed",
|
||||
zIndex: 9999,
|
||||
top:pos.y-this.menu.height()/2,
|
||||
left:pos.x-this.menu.width()/2
|
||||
})
|
||||
.text("Group")
|
||||
.mouseout( function(){self.hideMenu()} )
|
||||
.mousedown( function(){group(selectedEls)} )
|
||||
}
|
||||
}
|
||||
|
||||
function group(els){
|
||||
var startEl = $(els[0]);
|
||||
startEl.css("z-index", 0);
|
||||
for( var i=1; i<els.length; i++){
|
||||
var el = els[i];
|
||||
var pos = startEl.position()
|
||||
$(el).css("z-index", i*10)
|
||||
$(el).animate({top: pos.top+i*15, left: pos.left+i*15, position: "absolute"}, 250);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(function(){
|
||||
var select = new Selector({
|
||||
targets: ".tab",
|
||||
container: "html",
|
||||
fill: false,
|
||||
strokeWidth: 3
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user