Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
visibleRegion() in GenomeView.js sometimes returning end with float values #491
I sometimes get a floating point value for the end attribute of genomeView.visibleRegion(). I believe a fractional pxToBp() result for the scrollbar width in the maxVisible() method on line 1207 of GenomeView.js leads to this situation. Return values set up in lines 1210 - 1213 only apply Math.round() to the mv variable, but I think this should be rounding the entire return value after subtracting the scrollbar width.
Is anyone aware of any usage of visibleRegion() or MaxVisible where anything other than an integer representing the rightmost bp is expected?
In contrast, GenomeView.visibleRegionLocString(), via Util.assembleLocString(), always rounds the start and end attributes that are returned.
I could always just apply Math.round() in the function callback where I am using the visibleRegion() object, and maybe that's better procedure, but this feels like a bug.
I haven't seen this in a while. GenomeView.js maxVisible() has var scrollbar set to the results of a pxToBp() call, which can be fractional and looks to be the source of the behavior that prompted this.
Enclosing the right side of line 1253 with Math.round() looks like it'll solve things.