From fc6d7ab82fc56933867d580b532f0da84eb47dce Mon Sep 17 00:00:00 2001 From: jos Date: Fri, 6 Jun 2014 11:56:30 +0200 Subject: [PATCH] Fixed #107: allow repeating select event --- docs/timeline.html | 1 + src/timeline/Timeline.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/timeline.html b/docs/timeline.html index ee22e962..74445571 100644 --- a/docs/timeline.html +++ b/docs/timeline.html @@ -820,6 +820,7 @@ timeline.off('select', onSelect); select Fired after the user selects or deselects items by tapping or holding them. + When a use taps an already selected item, the select event is fired again. Not fired when the method setSelectionis executed. diff --git a/src/timeline/Timeline.js b/src/timeline/Timeline.js index a5738870..961484dd 100644 --- a/src/timeline/Timeline.js +++ b/src/timeline/Timeline.js @@ -633,8 +633,9 @@ Timeline.prototype._onSelectItem = function (event) { var newSelection = this.getSelection(); - // if selection is changed, emit a select event - if (!util.equalArray(oldSelection, newSelection)) { + // emit a select event, + // except when old selection is empty and new selection is still empty + if (newSelection.length > 0 || oldSelection.length > 0) { this.emit('select', { items: this.getSelection() });