Browse Source

Fixed #107: allow repeating select event

css_transitions
jos 10 years ago
parent
commit
fc6d7ab82f
2 changed files with 4 additions and 2 deletions
  1. +1
    -0
      docs/timeline.html
  2. +3
    -2
      src/timeline/Timeline.js

+ 1
- 0
docs/timeline.html View File

@ -820,6 +820,7 @@ timeline.off('select', onSelect);
<tr> <tr>
<td>select</td> <td>select</td>
<td>Fired after the user selects or deselects items by tapping or holding them. <td>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 <code>setSelection</code>is executed. Not fired when the method <code>setSelection</code>is executed.
</td> </td>
<td> <td>

+ 3
- 2
src/timeline/Timeline.js View File

@ -633,8 +633,9 @@ Timeline.prototype._onSelectItem = function (event) {
var newSelection = this.getSelection(); 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', { this.emit('select', {
items: this.getSelection() items: this.getSelection()
}); });

Loading…
Cancel
Save