Browse Source

Call event.stopPropagation() before adding or removing items (see #577)

flowchartTest
jos 9 years ago
parent
commit
09bc7d0993
2 changed files with 6 additions and 4 deletions
  1. +5
    -3
      lib/timeline/component/ItemSet.js
  2. +1
    -1
      lib/timeline/component/item/Item.js

+ 5
- 3
lib/timeline/component/ItemSet.js View File

@ -1419,9 +1419,11 @@ ItemSet.prototype._onAddItem = function (event) {
if (!this.options.selectable) return; if (!this.options.selectable) return;
if (!this.options.editable.add) return; if (!this.options.editable.add) return;
var me = this,
snap = this.options.snap || null,
item = this.itemFromTarget(event);
var me = this;
var snap = this.options.snap || null;
var item = this.itemFromTarget(event);
event.stopPropagation();
if (item) { if (item) {
// update item // update item

+ 1
- 1
lib/timeline/component/item/Item.js View File

@ -144,8 +144,8 @@ Item.prototype._repaintDeleteButton = function (anchor) {
// TODO: be able to destroy the delete button // TODO: be able to destroy the delete button
new Hammer(deleteButton).on('tap', function (event) { new Hammer(deleteButton).on('tap', function (event) {
me.parent.removeFromDataSet(me);
event.stopPropagation(); event.stopPropagation();
me.parent.removeFromDataSet(me);
}); });
anchor.appendChild(deleteButton); anchor.appendChild(deleteButton);

Loading…
Cancel
Save