Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Conversation

@yotamberk
Copy link
Member

@yotamberk yotamberk commented Apr 16, 2017

There was a major bug I encountered trying to catch click and doubleclick events on selected items.
This PR solves this bug. (continues #2473 to fully solve: #2421, )
checkout the vis/examples/timeline/interaction/eventListeners.html example in this PR to see the click\doubleclick event getting fired when an item is already selected.

Copy link

@wimrijnders wimrijnders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the best review I can do without testing the changes - I don't see how I can do that now.

Also, extra: in the timeline basicUsage example, I get this.groupsData === null in the first test of ItemSet.prototype.groupFromTarget(). Is that supposed to happen?

if (this.selected && this.options.editable.updateTime && !this.dom.dragCenter) {
var me = this;

var me = this

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semicolon

var dragCenter = document.createElement('div');
dragCenter.className = 'vis-drag-center';
dragCenter.dragCenterItem = this;
this.hammer = new Hammer(dragCenter)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semicolon

Choose a reason for hiding this comment

The 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.

item: me.id
});
});
this.hammer.on('doubletap', function (event) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do tap and doubletap always fire consecutively? Or is it either one or the other?
In the latter case, please consider usage of requireFailure().

Copy link
Member Author

Choose a reason for hiding this comment

The 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 requireFailure() here because it hasn't been used anywhere else. I can add it in another PR.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

this.hammer.on('doubletap', function (event) {
event.stopPropagation();
me.parent.itemSet._onUpdateItem(me);
me.parent.itemSet.body.emitter.emit('doubleClick', {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trusting that this block is correct; it is congruent to click above, so it looks OK.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@yotamberk
Copy link
Member Author

yotamberk commented May 3, 2017

@wimrijnders

Also, extra: in the timeline basicUsage example, I get this.groupsData === null in the first test of ItemSet.prototype.groupFromTarget(). Is that supposed to happen?

not sure when this was introduced.
I'll take a look and fix in another PR

dragCenter.className = 'vis-drag-center';
dragCenter.dragCenterItem = this;
this.hammer = new Hammer(dragCenter)
var hammer = new Hammer(dragCenter)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semicolon

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link

@wimrijnders wimrijnders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, now it is perfect.

@yotamberk yotamberk merged commit 10927b5 into visjs:develop May 3, 2017
@mojoaxel mojoaxel added this to the Minor Release v4.20 milestone May 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants