-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix click and doubleclick events on items #2988
Changes from 30 commits
dcb2d58
582fc64
f96e6bf
ffa8e0e
2f04345
3cfa8d0
aee0fb3
4681ace
e9d1ebf
cd37b2d
9a27aa7
4982679
b9144d3
001fd9f
e504dc7
ada1c90
3124d8e
4870ad2
fae21a0
91c2c31
ea1d8c1
af16ffc
099a8e7
0362af6
608c4da
914937b
9973b6e
91eba11
5ea07e1
8fefd5a
2d99aca
2bf3f43
fe000da
eaaa9dc
527512a
96029f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,16 +145,26 @@ Item.prototype.repositionY = function() { | |
*/ | ||
Item.prototype._repaintDragCenter = function () { | ||
if (this.selected && this.options.editable.updateTime && !this.dom.dragCenter) { | ||
var me = this; | ||
|
||
var me = this | ||
// create and show drag area | ||
var dragCenter = document.createElement('div'); | ||
dragCenter.className = 'vis-drag-center'; | ||
dragCenter.dragCenterItem = this; | ||
this.hammer = new Hammer(dragCenter) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. semicolon There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So hammer is now a member var; but it will be overwritten on every redraw. Is this what is supposed to happen? Doesn't look right to me. I would expect it to be either a local var, or a more permanent member var. |
||
|
||
new Hammer(dragCenter).on('doubletap', function (event) { | ||
this.hammer.on('tap', function (event) { | ||
me.parent.itemSet.body.emitter.emit('click', { | ||
event: event, | ||
item: me.id | ||
}); | ||
}); | ||
this.hammer.on('doubletap', function (event) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They don't fire consecutively. It's one or the other. There is no need for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
event.stopPropagation(); | ||
me.parent.itemSet._onUpdateItem(me); | ||
me.parent.itemSet.body.emitter.emit('doubleClick', { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am trusting that this block is correct; it is congruent to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
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; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semicolon