From 6818d68ba1b196d5f5f1fd98f6be7bb949ddc6e1 Mon Sep 17 00:00:00 2001 From: jos Date: Mon, 5 Jan 2015 12:30:41 +0100 Subject: [PATCH] Neatly using hammer2 for the delete button --- lib/timeline/component/item/Item.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/timeline/component/item/Item.js b/lib/timeline/component/item/Item.js index b7bf7941..d1819498 100644 --- a/lib/timeline/component/item/Item.js +++ b/lib/timeline/component/item/Item.js @@ -137,16 +137,12 @@ Item.prototype._repaintDeleteButton = function (anchor) { deleteButton.className = 'delete'; deleteButton.title = 'Delete this item'; - // TODO: neatly handle button click + // TODO: be able to destroy the delete button new Hammer(deleteButton).on('tap', function (event) { me.parent.removeFromDataSet(me); - event.srcEvent.stopPropagation(); // TODO: stopPropagation seems not to work + event.stopPropagation(); + event.preventDefault(); }); - //deleteButton.addEventListener('click', function (event) { - // me.parent.removeFromDataSet(me); - // event.stopPropagation(); - // event.preventDefault(); - //}); anchor.appendChild(deleteButton); this.dom.deleteButton = deleteButton;