Skip to content
Snippets Groups Projects
Commit ae8fd580 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Holding shift down and dragging the mouse on an ortho canvas allows the

brightness/contrast of the current overlay to be adjusted.
parent 9477aeca
No related branches found
No related tags found
No related merge requests found
...@@ -24,24 +24,27 @@ class OrthoViewProfile(profiles.Profile): ...@@ -24,24 +24,27 @@ class OrthoViewProfile(profiles.Profile):
allow the user to navigate through the ``OrthoPanel`` display of the allow the user to navigate through the ``OrthoPanel`` display of the
overlays in the :class:`.OverlayList`. overlays in the :class:`.OverlayList`.
``OrthoViewProfile`` defines three *modes* (see the :class:`.Profile` ``OrthoViewProfile`` defines the following *modes* (see the
class documentation): :class:`.Profile` class documentation):
======== ============================================================== ========== ==============================================================
``nav`` The user can change the currently displayed location. This is ``nav`` The user can change the currently displayed location. This is
accomplished by updating the :attr:`.DisplayContext.location` accomplished by updating the :attr:`.DisplayContext.location`
property on left mouse drags. property on left mouse drags.
``zoom`` The user can zoom in/out of a canvas with the mouse wheel, and ``zoom`` The user can zoom in/out of a canvas with the mouse wheel, and
draw a rectangle on a canvas in which to zoom. This is draw a rectangle on a canvas in which to zoom. This is
accomplished by updating the :attr:`.SliceCanvasOpts.zoom` accomplished by updating the :attr:`.SliceCanvasOpts.zoom`
property on mouse wheel changes, and displaying a property on mouse wheel changes, and displaying a
:class:`~.annotations.Rect` annotation on left mouse drags. :class:`~.annotations.Rect` annotation on left mouse drags.
``pan`` The user can pan around a canvas (if the canvas is zoomed in). ``pan`` The user can pan around a canvas (if the canvas is zoomed in).
This is accomplished by calling the This is accomplished by calling the
:meth:`.SliceCanvas.panDisplayBy` on left mouse drags. :meth:`.SliceCanvas.panDisplayBy` on left mouse drags.
======== ==============================================================
``bricon`` The user can drag the mouse along a canvas to change the
brightness/contrast of the currently selected overlay.
========== ==============================================================
The ``OrthoViewProfile`` class also defines a few actions: The ``OrthoViewProfile`` class also defines a few actions:
...@@ -86,7 +89,7 @@ class OrthoViewProfile(profiles.Profile): ...@@ -86,7 +89,7 @@ class OrthoViewProfile(profiles.Profile):
if extraModes is None: extraModes = [] if extraModes is None: extraModes = []
if extraActions is None: extraActions = {} if extraActions is None: extraActions = {}
modes = ['nav', 'pan', 'zoom'] modes = ['nav', 'pan', 'zoom', 'bricon']
actionz = { actionz = {
'resetZoom' : self.resetZoom, 'resetZoom' : self.resetZoom,
'centreCursor' : self.centreCursor, 'centreCursor' : self.centreCursor,
...@@ -424,3 +427,33 @@ class OrthoViewProfile(profiles.Profile): ...@@ -424,3 +427,33 @@ class OrthoViewProfile(profiles.Profile):
else: return else: return
canvas.panDisplayBy(xoff, yoff) canvas.panDisplayBy(xoff, yoff)
def _briconModeLeftMouseDrag(self, ev, canvas, mousePos, canvasPos):
"""Handles left mouse drags in ``bricon`` mode.
The brightness and contrast of the currently selected overlay are
adjusted according to the location of the mouse, relative to the
canvas.
"""
overlay = self._displayCtx.getSelectedOverlay()
if overlay is None:
return
display = self._displayCtx.getDisplay(overlay)
w, h = canvas.GetSize().Get()
x, y = mousePos
brightness = float(x) / w
contrast = float(y) / h
log.debug('Adjusting bricon for {} '
'(brightness: {}, contrast: {})'.format(
overlay.name,
brightness,
contrast))
display.brightness = 100 * brightness
display.contrast = 100 * contrast
...@@ -68,7 +68,8 @@ tempModeMap = { ...@@ -68,7 +68,8 @@ tempModeMap = {
(('nav', wx.WXK_CONTROL), 'zoom'), (('nav', wx.WXK_CONTROL), 'zoom'),
(('pan', wx.WXK_CONTROL), 'zoom'), (('pan', wx.WXK_CONTROL), 'zoom'),
(('nav', wx.WXK_ALT), 'pan'), (('nav', wx.WXK_ALT), 'pan'),
(('zoom', wx.WXK_ALT), 'pan'))), (('zoom', wx.WXK_ALT), 'pan'),
(('nav', wx.WXK_SHIFT), 'bricon'))),
# OrthoEditProfile inherits all of the # OrthoEditProfile inherits all of the
# settings for OrthoViewProfile above, # settings for OrthoViewProfile above,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment