Browse Source

Neatly using hammer2 for the delete button

flowchartTest
jos 10 years ago
parent
commit
6818d68ba1
1 changed files with 3 additions and 7 deletions
  1. +3
    -7
      lib/timeline/component/item/Item.js

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

@ -137,16 +137,12 @@ Item.prototype._repaintDeleteButton = function (anchor) {
deleteButton.className = 'delete'; deleteButton.className = 'delete';
deleteButton.title = 'Delete this item'; 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) { new Hammer(deleteButton).on('tap', function (event) {
me.parent.removeFromDataSet(me); 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); anchor.appendChild(deleteButton);
this.dom.deleteButton = deleteButton; this.dom.deleteButton = deleteButton;

Loading…
Cancel
Save