guy 8 years ago
parent
commit
adf4dec387
  1. 29
      bi/base.js
  2. 29
      docs/base.js
  3. 27
      src/base/single/button/button.basic.js

29
bi/base.js

@ -713,7 +713,6 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
mouseDown = false; mouseDown = false;
$(document).unbind("mouseup." + self.getName()); $(document).unbind("mouseup." + self.getName());
self.fireEvent(BI.BasicButton.EVENT_MOUSE_UP);
// } // }
}); });
if (mouseDown === true) { if (mouseDown === true) {
@ -726,7 +725,6 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
mouseDown = true; mouseDown = true;
ev(e); ev(e);
self.fireEvent(BI.BasicButton.EVENT_MOUSE_DOWN);
// } // }
}); });
hand.mouseup(function (e) { hand.mouseup(function (e) {
@ -743,6 +741,29 @@ BI.BasicButton = BI.inherit(BI.Single, {
case "dblclick": case "dblclick":
hand.dblclick(clk); hand.dblclick(clk);
break; break;
case "lclick":
var mouseDown = false;
var interval;
hand.mousedown(function (e) {
$(document).bind("mouseup." + self.getName(), function (e) {
interval && clearInterval(interval);
interval = null;
mouseDown = false;
$(document).unbind("mouseup." + self.getName());
});
if (mouseDown === true) {
return;
}
if (!self.isEnabled() || (self.isOnce() && self.isSelected())) {
return;
}
interval = setInterval(function () {
self.doClick();
}, 100);
mouseDown = true;
ev(e);
});
break;
default: default:
hand.mousedown(function (e) { hand.mousedown(function (e) {
ev(e); ev(e);
@ -872,9 +893,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
BI.BasicButton.superclass.destroy.apply(this, arguments); BI.BasicButton.superclass.destroy.apply(this, arguments);
} }
}); });
BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE"; BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/**
BI.BasicButton.EVENT_MOUSE_DOWN = "BasicButton.EVENT_MOUSE_DOWN";
BI.BasicButton.EVENT_MOUSE_UP = "BasicButton.EVENT_MOUSE_UP";/**
* 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 * 表示一个可以展开的节点, 不仅有选中状态而且有展开状态
* *
* Created by GUY on 2015/9/9. * Created by GUY on 2015/9/9.

29
docs/base.js

@ -713,7 +713,6 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
mouseDown = false; mouseDown = false;
$(document).unbind("mouseup." + self.getName()); $(document).unbind("mouseup." + self.getName());
self.fireEvent(BI.BasicButton.EVENT_MOUSE_UP);
// } // }
}); });
if (mouseDown === true) { if (mouseDown === true) {
@ -726,7 +725,6 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
mouseDown = true; mouseDown = true;
ev(e); ev(e);
self.fireEvent(BI.BasicButton.EVENT_MOUSE_DOWN);
// } // }
}); });
hand.mouseup(function (e) { hand.mouseup(function (e) {
@ -743,6 +741,29 @@ BI.BasicButton = BI.inherit(BI.Single, {
case "dblclick": case "dblclick":
hand.dblclick(clk); hand.dblclick(clk);
break; break;
case "lclick":
var mouseDown = false;
var interval;
hand.mousedown(function (e) {
$(document).bind("mouseup." + self.getName(), function (e) {
interval && clearInterval(interval);
interval = null;
mouseDown = false;
$(document).unbind("mouseup." + self.getName());
});
if (mouseDown === true) {
return;
}
if (!self.isEnabled() || (self.isOnce() && self.isSelected())) {
return;
}
interval = setInterval(function () {
self.doClick();
}, 100);
mouseDown = true;
ev(e);
});
break;
default: default:
hand.mousedown(function (e) { hand.mousedown(function (e) {
ev(e); ev(e);
@ -872,9 +893,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
BI.BasicButton.superclass.destroy.apply(this, arguments); BI.BasicButton.superclass.destroy.apply(this, arguments);
} }
}); });
BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE"; BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/**
BI.BasicButton.EVENT_MOUSE_DOWN = "BasicButton.EVENT_MOUSE_DOWN";
BI.BasicButton.EVENT_MOUSE_UP = "BasicButton.EVENT_MOUSE_UP";/**
* 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 * 表示一个可以展开的节点, 不仅有选中状态而且有展开状态
* *
* Created by GUY on 2015/9/9. * Created by GUY on 2015/9/9.

27
src/base/single/button/button.basic.js

@ -130,7 +130,6 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
mouseDown = false; mouseDown = false;
$(document).unbind("mouseup." + self.getName()); $(document).unbind("mouseup." + self.getName());
self.fireEvent(BI.BasicButton.EVENT_MOUSE_UP);
// } // }
}); });
if (mouseDown === true) { if (mouseDown === true) {
@ -143,7 +142,6 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
mouseDown = true; mouseDown = true;
ev(e); ev(e);
self.fireEvent(BI.BasicButton.EVENT_MOUSE_DOWN);
// } // }
}); });
hand.mouseup(function (e) { hand.mouseup(function (e) {
@ -160,6 +158,29 @@ BI.BasicButton = BI.inherit(BI.Single, {
case "dblclick": case "dblclick":
hand.dblclick(clk); hand.dblclick(clk);
break; break;
case "lclick":
var mouseDown = false;
var interval;
hand.mousedown(function (e) {
$(document).bind("mouseup." + self.getName(), function (e) {
interval && clearInterval(interval);
interval = null;
mouseDown = false;
$(document).unbind("mouseup." + self.getName());
});
if (mouseDown === true) {
return;
}
if (!self.isEnabled() || (self.isOnce() && self.isSelected())) {
return;
}
interval = setInterval(function () {
self.doClick();
}, 100);
mouseDown = true;
ev(e);
});
break;
default: default:
hand.mousedown(function (e) { hand.mousedown(function (e) {
ev(e); ev(e);
@ -290,5 +311,3 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
}); });
BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE"; BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";
BI.BasicButton.EVENT_MOUSE_DOWN = "BasicButton.EVENT_MOUSE_DOWN";
BI.BasicButton.EVENT_MOUSE_UP = "BasicButton.EVENT_MOUSE_UP";
Loading…
Cancel
Save