Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid labels are still being considered visible & draw happens unnecessarily for invalid labels #44

Closed
channeladam opened this issue Jan 18, 2019 · 1 comment · Fixed by visjs/vis-network#26

Comments

@channeladam
Copy link
Collaborator

When Label is initialised with an invalid label (such as an empty string), the visible() function still says that it is visible.

Similarly, the draw() function does not short-circuit when the label is invalid.

The root cause is Label.js line 42 which sets options.label to an empty string.
Both the visible and draw functions are checking for undefined, not empty string - so that is why they don't work as expected.

Label.js:
if (ComponentUtil.isValidLabel(options.label)) {
this.labelDirty = true
} else {
// Bad label! Change the option value to prevent bad stuff happening
options.label = '' **************** THIS IS THE PROBLEM - SHOULD BE undefined **************
}

PR coming.

@mojoaxel
Copy link

💌 Thanks @channeladam for your contribution!
This pull-request has been merge into visjs/vis-network#26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants