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

Style properties not read correctly if value is zero #674

Closed
hasanbalci opened this issue Jun 16, 2021 · 10 comments
Closed

Style properties not read correctly if value is zero #674

hasanbalci opened this issue Jun 16, 2021 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@hasanbalci
Copy link
Contributor

hasanbalci commented Jun 16, 2021

While reading style properties of the graph elements, if the property value is zero it is ignored because of the buggy code here. That if statement should differentiate "0" value from "undefined". As a result, those properties are not written to the file during save operation.

@hasanbalci hasanbalci added the bug Something isn't working label Jun 16, 2021
@hasanbalci
Copy link
Contributor Author

I encountered with a similar issue in infobox values. Apparently, if there is an infobox with value 0, it's saved in the file, but while loading, those values are lost somewhere and infoboxes seem as empty. Probably, there is a similar bug during load operation.

@ugurdogrusoz
Copy link
Contributor

@msalihaltun See if this straightforward to fix for this release. @hasanbalci should know.

@msalihaltun
Copy link
Contributor

Nodes with label "0" are saved but can't be reloaded either.

In javascript, if we use the value 0 as a predicate inside an if statement (or anything similar) the value is evaluated as false. This is likely the reason for these problems. When we are reading value fields from files, we can't do truth checks with those values. We just need to make sure we don't get undefined.

msalihaltun added a commit to iVis-at-Bilkent/sbgnviz.js that referenced this issue Jun 18, 2021
msalihaltun added a commit that referenced this issue Jun 18, 2021
@msalihaltun
Copy link
Contributor

msalihaltun commented Jun 18, 2021

"0" style values should be fixed now but labels are not fixed. We take the nwt file as an xml file while loading and call libsbgnjs.Sbgn.fromXML() function on this file (the xml as string). This function returns label text value as undefined when we use "0" as label.

msalihaltun added a commit to iVis-at-Bilkent/sbgnviz.js that referenced this issue Jun 18, 2021
msalihaltun added a commit that referenced this issue Jun 18, 2021
This reverts commit f987a1a.
@msalihaltun
Copy link
Contributor

Nevermind, apperantly my changes had many unexpected side affects. Reverted for now. It is my mistake, I didn't run the tests locally.

msalihaltun added a commit to iVis-at-Bilkent/sbgnviz.js that referenced this issue Jun 18, 2021
msalihaltun added a commit that referenced this issue Jun 18, 2021
@msalihaltun
Copy link
Contributor

It should be fine now. @hasanbalci please test and confirm.

@msalihaltun
Copy link
Contributor

Also I created an issue about label values here.

@hasanbalci
Copy link
Contributor Author

  • I assume that the problem with label values includes both node labels and infobox labels, so they will be fixed in libsbgn.js.
  • I noticed that when we set "Border Width" to 0 for a node, after save/load, that field in inspector becomes empty for that node instead of 0. I think we should show 0 again.

@msalihaltun
Copy link
Contributor

  • I believe so yes, it should be solved in libsbgn.js.
  • We had the same problem with border width value as all others where 0's truth value is evaluated as false, fixed now.

@ugurdogrusoz ugurdogrusoz removed their assignment Jun 21, 2021
@hasanbalci
Copy link
Contributor Author

Labels will be fixed in libsbgn.js. The rest seems fixed, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants