Changeset 6d4cf68 in sasview


Ignore:
Timestamp:
Sep 15, 2016 8:33:57 AM (4 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
d6e36e44
Parents:
813220f
git-author:
Lewis O'Driscoll <lewis.o'driscoll@…> (08/15/16 11:21:17)
git-committer:
Piotr Rozyczko <rozyczko@…> (09/15/16 08:33:57)
Message:

Allow repositioning of PlotPanel? text (fixes #445)

Text can be moved by clicking on it and dragging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/plottools/PlotPanel.py

    r0d0aa40 r6d4cf68  
    150150        #List of texts currently on the plot 
    151151        self.textList = [] 
     152        self.selectedText = None 
    152153        #User scale 
    153154        if xtransform != None: 
     
    352353            self.leftdown = True 
    353354            ax = event.inaxes 
     355            for text in self.textList: 
     356                if text.contains(event)[0]: # If user has clicked on text 
     357                    self.selectedText = text 
     358                    return 
     359 
    354360            if ax != None: 
    355361                self.xInit, self.yInit = event.xdata, event.ydata 
     
    373379            self.mousemotion = False 
    374380            self.leftup = True 
     381            self.selectedText = None 
    375382 
    376383        #release the legend 
     
    448455            self._on_legend_motion(event) 
    449456            return 
     457 
     458        if self.leftdown and self.selectedText is not None: 
     459            # User has clicked on text and is dragging 
     460            ax = event.inaxes 
     461            if ax != None: 
     462                # Only move text if mouse is within axes 
     463                self.selectedText.set_position((event.xdata, event.ydata)) 
     464                self._dragHelper(0, 0) 
     465            else: 
     466                # User has dragged outside of axes 
     467                self.selectedText = None 
     468            return 
     469 
    450470        if self.enable_toolbar: 
    451471            #Disable dragging without the toolbar to allow zooming with toolbar 
Note: See TracChangeset for help on using the changeset viewer.