Skip to content

Commit

Permalink
Fix rounding error in calculating index
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Jul 28, 2021
1 parent dc63626 commit fd2f284
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions astrowidgets/bqplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ def _mouse_move(self, event_data):
yc = event_data['domain']['y']

# get the array indices into the data so that we can get data values
x_index = int(np.trunc(xc + 0.5))
y_index = int(np.trunc(yc + 0.5))
x_index = int(np.floor(xc + 0.5))
y_index = int(np.floor(yc + 0.5))

# Check that the index is in the array.
in_image = (self._data.shape[1] > x_index >= 0) and (self._data.shape[0] > y_index >= 0)
Expand Down

0 comments on commit fd2f284

Please sign in to comment.