From adf4dec3873a1af72a8ee921f5587006d10f9381 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 25 Apr 2017 10:38:36 +0800 Subject: [PATCH] add --- bi/base.js | 29 +++++++++++++++++++++----- docs/base.js | 29 +++++++++++++++++++++----- src/base/single/button/button.basic.js | 29 +++++++++++++++++++++----- 3 files changed, 72 insertions(+), 15 deletions(-) diff --git a/bi/base.js b/bi/base.js index f6241ad7ea..82e71967ee 100644 --- a/bi/base.js +++ b/bi/base.js @@ -713,7 +713,6 @@ BI.BasicButton = BI.inherit(BI.Single, { } mouseDown = false; $(document).unbind("mouseup." + self.getName()); - self.fireEvent(BI.BasicButton.EVENT_MOUSE_UP); // } }); if (mouseDown === true) { @@ -726,7 +725,6 @@ BI.BasicButton = BI.inherit(BI.Single, { } mouseDown = true; ev(e); - self.fireEvent(BI.BasicButton.EVENT_MOUSE_DOWN); // } }); hand.mouseup(function (e) { @@ -743,6 +741,29 @@ BI.BasicButton = BI.inherit(BI.Single, { case "dblclick": hand.dblclick(clk); 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: hand.mousedown(function (e) { ev(e); @@ -872,9 +893,7 @@ BI.BasicButton = BI.inherit(BI.Single, { BI.BasicButton.superclass.destroy.apply(this, arguments); } }); -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";/** +BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/** * 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 * * Created by GUY on 2015/9/9. diff --git a/docs/base.js b/docs/base.js index f6241ad7ea..82e71967ee 100644 --- a/docs/base.js +++ b/docs/base.js @@ -713,7 +713,6 @@ BI.BasicButton = BI.inherit(BI.Single, { } mouseDown = false; $(document).unbind("mouseup." + self.getName()); - self.fireEvent(BI.BasicButton.EVENT_MOUSE_UP); // } }); if (mouseDown === true) { @@ -726,7 +725,6 @@ BI.BasicButton = BI.inherit(BI.Single, { } mouseDown = true; ev(e); - self.fireEvent(BI.BasicButton.EVENT_MOUSE_DOWN); // } }); hand.mouseup(function (e) { @@ -743,6 +741,29 @@ BI.BasicButton = BI.inherit(BI.Single, { case "dblclick": hand.dblclick(clk); 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: hand.mousedown(function (e) { ev(e); @@ -872,9 +893,7 @@ BI.BasicButton = BI.inherit(BI.Single, { BI.BasicButton.superclass.destroy.apply(this, arguments); } }); -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";/** +BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/** * 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 * * Created by GUY on 2015/9/9. diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index ce8b283dda..1882bd2dea 100644 --- a/src/base/single/button/button.basic.js +++ b/src/base/single/button/button.basic.js @@ -130,7 +130,6 @@ BI.BasicButton = BI.inherit(BI.Single, { } mouseDown = false; $(document).unbind("mouseup." + self.getName()); - self.fireEvent(BI.BasicButton.EVENT_MOUSE_UP); // } }); if (mouseDown === true) { @@ -143,7 +142,6 @@ BI.BasicButton = BI.inherit(BI.Single, { } mouseDown = true; ev(e); - self.fireEvent(BI.BasicButton.EVENT_MOUSE_DOWN); // } }); hand.mouseup(function (e) { @@ -160,6 +158,29 @@ BI.BasicButton = BI.inherit(BI.Single, { case "dblclick": hand.dblclick(clk); 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: hand.mousedown(function (e) { ev(e); @@ -289,6 +310,4 @@ BI.BasicButton = BI.inherit(BI.Single, { BI.BasicButton.superclass.destroy.apply(this, arguments); } }); -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"; \ No newline at end of file +BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE"; \ No newline at end of file