Browse Source

Fix click and doubleclick events on items (#2988)

* Fix redraw order

* Fix error when option is not defined

* Allow template labels

* Add .travis.yml file

* Add experiment travis code

* Fix react example

* Fix item click and doubleclick

* Remove new empty line

* Return id of item tapped

* Fix comments from Review

* Add missing semicolon
gemini
yotamberk 7 years ago
committed by GitHub
parent
commit
10927b5931
1 changed files with 12 additions and 3 deletions
  1. +12
    -3
      lib/timeline/component/item/Item.js

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

@ -146,15 +146,25 @@ Item.prototype.repositionY = function() {
Item.prototype._repaintDragCenter = function () {
if (this.selected && this.options.editable.updateTime && !this.dom.dragCenter) {
var me = this;
// create and show drag area
var dragCenter = document.createElement('div');
dragCenter.className = 'vis-drag-center';
dragCenter.dragCenterItem = this;
var hammer = new Hammer(dragCenter);
new Hammer(dragCenter).on('doubletap', function (event) {
hammer.on('tap', function (event) {
me.parent.itemSet.body.emitter.emit('click', {
event: event,
item: me.id
});
});
hammer.on('doubletap', function (event) {
event.stopPropagation();
me.parent.itemSet._onUpdateItem(me);
me.parent.itemSet.body.emitter.emit('doubleClick', {
event: event,
item: me.id
});
});
if (this.dom.box) {
@ -370,7 +380,6 @@ Item.prototype._updateContents = function (element) {
throw new Error('Property "content" missing in item ' + this.id);
}
}
this.content = content;
}
}

Loading…
Cancel
Save