Changeset fa1cbee in sasview


Ignore:
Timestamp:
Aug 15, 2016 9:21:17 AM (8 years ago)
Author:
lewis
Branches:
master, 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
e767897, 18a1f2b
Parents:
70308f6c
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

    r2f12acc rfa1cbee  
    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.