From 19025077030d1c56085c9344f48bdb0670302597 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 19 Oct 2020 21:32:50 -0400 Subject: [PATCH] Change scroll "center" to rightmost bar on screen --- piker/ui/_interaction.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/piker/ui/_interaction.py b/piker/ui/_interaction.py index bde6a4c6..6b0dcf1d 100644 --- a/piker/ui/_interaction.py +++ b/piker/ui/_interaction.py @@ -49,10 +49,10 @@ class ChartView(pg.ViewBox): vl = r - l if ev.delta() > 0 and vl <= _min_points_to_show: - log.trace("Max zoom bruh...") + log.debug("Max zoom bruh...") return if ev.delta() < 0 and vl >= len(self.linked_charts._array): - log.trace("Min zoom bruh...") + log.debug("Min zoom bruh...") return # actual scaling factor @@ -64,14 +64,21 @@ class ChartView(pg.ViewBox): # ) # XXX: scroll "around" the right most element in the view - furthest_right_coord = self.boundingRect().topRight() - center = pg.Point( - fn.invertQTransform( - self.childGroup.transform() - ).map(furthest_right_coord) - ) + # which stays "pinned" in place. + + # furthest_right_coord = self.boundingRect().topRight() + + # yaxis = pg.Point( + # fn.invertQTransform( + # self.childGroup.transform() + # ).map(furthest_right_coord) + # ) + + # This seems like the most "intuitive option, a hybrdid of + # tws and tv styles + last_bar = pg.Point(rbar) self._resetTarget() - self.scaleBy(s, center) + self.scaleBy(s, last_bar) ev.accept() self.sigRangeChangedManually.emit(mask)