Skip to content

Commit

Permalink
make sure to have a visible region
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhrisca committed Sep 11, 2024
1 parent 9eac948 commit b1a35d4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/asammdf/gui/widgets/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4692,15 +4692,17 @@ def keyPressEvent(self, event):
self.region.sigRegionChanged.connect(self.range_modified_handler)
self.region.sigRegionChangeFinished.connect(self.range_modified_finished_handler)
start, stop = self.viewbox.viewRange()[0]
view_range = abs(stop - start)
start, stop = (
start + 0.1 * (stop - start),
stop - 0.1 * (stop - start),
)
self.region.setRegion((start, stop))

if self.cursor1 is not None:
if self.cursor1 is not None and abs(self.cursor1.value() - stop) >= 0.1 * view_range:
self.cursor1.hide()
self.region.setRegion(tuple(sorted((self.cursor1.value(), stop))))
else:
self.region.setRegion((start, stop))

else:
self.region_lock = None
Expand Down

0 comments on commit b1a35d4

Please sign in to comment.