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

@BTMorton
Copy link
Contributor

Reset subgroup heights in resetSubgroups method.

Reset subgroup heights in resetSubgroups method.
Copy link
Member

@yotamberk yotamberk left a comment

Choose a reason for hiding this comment

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

Seems good. Needs a small revision

lib/util.js Outdated
classes.splice(index, 1); // remove the class from the array
elem.className = classes.join(' ');
var oldClasses = classNames.split(' ');
for (var i = 0; i < oldClasses.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

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

I think you could do this better:

classes = classes.concat(oldClasses.filter(function (className) {
    return classes.indexOf(className) < 0;
}));

Copy link
Member

@yotamberk yotamberk left a comment

Choose a reason for hiding this comment

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

I have a problem with this PR.
You've added 2 changes that are unrelated and do not reference any issue.
I can understand the this.subgroups[subgroup].height = 0; But not the rest.
Where do you use addition od multi classNames? Why is this in the same PR? I would implement it by allowing an array of classes and not a string of classes. It seems dirty to me...

@BTMorton
Copy link
Contributor Author

You make fair points.

These are issues that I came across while trying to add dynamic heights to the Timeline for our use case. Each group/item has a class that adds various CSS properties to them based on the type of event, and I was trying to add a second class that changes things based upon the height. I could have done it using more complex single classes or with partial class selectors, but that seemed wrong. I could have changed it to allow for an array of class names, but that would change the timeline options and affect larger parts of the code base, whereas this adds support for it without breaking any existing functionality.

The reason they're together was because I encountered them while working on the same thing, and I was being lazy and trying to sneak them in before the release :P

@yotamberk
Copy link
Member

Look, I'll approve them for now because the release is tomorrow and I think this PR is important enough to go in. Please don't let this happen again. I don;t like lazy PRs =P
You could write it better by allowing an array or a string in the second parameter.
But for now this will do.

@yotamberk yotamberk merged commit 421e361 into visjs:develop May 20, 2017
@BTMorton
Copy link
Contributor Author

Fair enough, apologies for that. And thanks for accepting it anyway. :)

@mojoaxel mojoaxel added this to the Minor Release v4.20 milestone May 21, 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