From 571c109260fb8455594173f1ed6739f7351f53e1 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 22 Nov 2013 13:37:03 +0100 Subject: Make splitters more responsive (using timing events) --- skins/classic/splitter.js | 13 +++++++++++-- skins/larry/ui.js | 13 ++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'skins') diff --git a/skins/classic/splitter.js b/skins/classic/splitter.js index 72ada5719..b94f0bd6f 100644 --- a/skins/classic/splitter.js +++ b/skins/classic/splitter.js @@ -124,6 +124,17 @@ function rcube_splitter(attrib) if (!this.drag_active) return false; + ref = this; + + // with timing events dragging action is more responsive + window.clearTimeout(this.ts); + this.ts = window.setTimeout(function() { ref.onDragAction(e); }, 1); + + return false; + }; + + this.onDragAction = function(e) + { var pos = rcube_event.get_mouse_pos(e); if (this.relative) { @@ -147,8 +158,6 @@ function rcube_splitter(attrib) this.p1pos = this.relative ? $(this.p1).position() : $(this.p1).offset(); this.p2pos = this.relative ? $(this.p2).position() : $(this.p2).offset(); - - return false; }; /** diff --git a/skins/larry/ui.js b/skins/larry/ui.js index 7cc795432..ae8ae5c55 100644 --- a/skins/larry/ui.js +++ b/skins/larry/ui.js @@ -1292,6 +1292,18 @@ function rcube_splitter(p) if (!me.drag_active) return false; + // with timing events dragging action is more responsive + window.clearTimeout(me.ts); + me.ts = window.setTimeout(function() { onDragAction(e); }, 1); + + return false; + }; + + /** + * Dragging action (see onDrag()) + */ + function onDragAction(e) + { var pos = rcube_event.get_mouse_pos(e); if (me.relative) { @@ -1315,7 +1327,6 @@ function rcube_splitter(p) me.p1pos = me.relative ? me.p1.position() : me.p1.offset(); me.p2pos = me.relative ? me.p2.position() : me.p2.offset(); - return false; }; /** -- cgit v1.2.3