Commit 6e0f5c29 authored by Kendrick, Coleman's avatar Kendrick, Coleman
Browse files

Update widget start and add release notes

parent 6bdd35ba
......@@ -13,4 +13,6 @@ New and Improved
Bugfixes
--------
- Fix cursor tracking from getting stuck and displaying incorrect signals when viewing MDHistogram workspaces in :ref:`sliceviewer`.
:ref:`Release 6.2.0 <v6.2.0>`
......@@ -26,12 +26,15 @@ ImageInfoWidget = import_qt('.._common', 'mantidqt.widgets', 'ImageInfoWidget')
class ImageInfoTracker(CursorTracker):
def __init__(self, image: Union[AxesImage, QuadMesh], transform: NonOrthogonalTransform,
do_transform: bool, widget: ImageInfoWidget, cursor_transform):
do_transform: bool, widget: ImageInfoWidget, cursor_transform: tuple = None):
"""
Update the image that the widget refers too.
:param: An AxesImage or Mesh instance to track
:param: transpose_xy: If true the cursor position should be transposed
before sending to the table update
:param do_transform: Flag to perform transform for QuadMesh images
:param widget: ImageInfoWidget instance
:param cursor_transform: Full axes limits to use for mouse coord transform to use instead of image extents
"""
super().__init__(image_axes=image.axes, autoconnect=False)
self._image = image
......
......@@ -397,12 +397,13 @@ CursorInfo = namedtuple("CursorInfo", ("array", "extent", "point"))
@lru_cache(maxsize=32)
def cursor_info(image: AxesImage, xdata: float, ydata: float, full_bbox=None) -> Optional[CursorInfo]:
def cursor_info(image: AxesImage, xdata: float, ydata: float, full_bbox: Bbox = None) -> Optional[CursorInfo]:
"""Return information on the image for the given position in
data coordinates.
:param image: An instance of an image type
:param xdata: X data coordinate of cursor
:param xdata: Y data coordinate of cursor
:param full_bbox: Bbox of full workspace dimension to use for transforming mouse position
:return: None if point is not valid on the image else return CursorInfo type
"""
extent = image.get_extent()
......@@ -413,6 +414,10 @@ def cursor_info(image: AxesImage, xdata: float, ydata: float, full_bbox=None) ->
if full_bbox is None:
trans = BboxTransform(boxin=data_extent, boxout=array_extent)
else:
# If the view is zoomed in and the slice is changed, then the image extents
# and data extents change. This causes the cursor to be transformed to the
# wrong point for certain MDH workspaces (since it cannot be dynamically rebinned).
# This will use the full WS data dimensions to do the transformation
trans = BboxTransform(boxin=full_bbox, boxout=array_extent)
point = trans.transform_point([ydata, xdata])
if any(np.isnan(point)):
......
......@@ -254,8 +254,6 @@ class SliceViewerDataView(QWidget):
transpose=self.dimensions.transpose,
norm=self.colorbar.get_norm(),
**kwargs)
self.on_track_cursor_state_change(self.track_cursor_checked())
# ensure the axes data limits are updated to match the
# image. For example if the axes were zoomed and the
# swap dimensions was clicked we need to restore the
......@@ -263,8 +261,12 @@ class SliceViewerDataView(QWidget):
extent = self.image.get_extent()
self.ax.set_xlim(extent[0], extent[1])
self.ax.set_ylim(extent[2], extent[3])
# Set the original data limits which get passed to the ImageInfoWidget so that
# the mouse projection to data space is correct for MDH workspaces when zoomed/changing slices
self._orig_lims = self.get_axes_limits()
self.on_track_cursor_state_change(self.track_cursor_checked())
self.draw_plot()
def plot_MDH_nonorthogonal(self, ws, **kwargs):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment