Skip to content

Commit

Permalink
Improve select start position
Browse files Browse the repository at this point in the history
  • Loading branch information
highfestiva committed Jul 12, 2024
1 parent 5f63c77 commit c7a3144
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion finplot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,8 +923,10 @@ def mouseLeftDrag(self, ev, axis):
p = self.mapToView(ev.pos())
p = _clamp_point(self.parent(), p)
if self.vband is None:
p0 = self.mapToView(ev.buttonDownPos())
p0 = _clamp_point(self.parent(), p0)
x = self.datasrc.x
x0, x1 = x[int(p.x())], x[min(len(x)-1, int(p.x())+1)]
x0, x1 = x[int(p0.x())], x[min(len(x)-1, int(p.x())+1)]
self.vband = add_vertical_band(x0, x1, color=draw_band_color, ax=self.parent())
self.vband.setMovable(True)
_set_clamp_pos(self.vband.lines[0])
Expand Down

0 comments on commit c7a3144

Please sign in to comment.