diff libgui/graphics/Canvas.cc @ 23185:0032c2f7ee4e stable

Don't display legend, colorbar, and annotation axes coordinates (bug #50272). * Canvas.h, Canvas.cc (Canvas::select_object): new argument to specify that axes with a given tag property should not be selected. * Canvas.cc (Canvas::canvasMouseMoveEvent): specify that select_object should omit legends, colorbars and annotation axes.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sun, 12 Feb 2017 22:20:40 +0100
parents e9a0469dedd9
children 94f04d8172eb 3ac9f9ecfae5
line wrap: on
line diff
--- a/libgui/graphics/Canvas.cc	Tue Feb 14 11:21:53 2017 -0800
+++ b/libgui/graphics/Canvas.cc	Sun Feb 12 22:20:40 2017 +0100
@@ -374,7 +374,7 @@
   void
   Canvas::select_object (graphics_object obj, QMouseEvent* event,
                          graphics_object &currentObj, graphics_object &axesObj,
-                         bool axes_only)
+                         bool axes_only, std::vector<std::string> omit)
   {
     QList<graphics_object> axesList;
     Matrix children = obj.get_properties ().get_all_children ();
@@ -385,7 +385,17 @@
         graphics_object childObj (gh_manager::get_object (children(i)));
 
         if (childObj.isa ("axes"))
-          axesList.append (childObj);
+          {
+            auto p = omit.begin ();
+            bool omitfound = false;
+            while (p != omit.end () && ! omitfound)
+              {
+                omitfound = (childObj.get ("tag").string_value () == *p);
+                p++;
+              }
+            if (! omitfound)
+              axesList.append (childObj);
+          }
         else if (childObj.isa ("uicontrol") || childObj.isa ("uipanel")
                  || childObj.isa ("uibuttongroup"))
           {
@@ -545,7 +555,8 @@
     if (figObj.valid_object () && obj.valid_object ())
       {
         graphics_object currentObj, axesObj;
-        select_object (obj, event, currentObj, axesObj, true);
+        std::vector<std::string> omit = {"legend", "colorbar", "scribeoverlay"};
+        select_object (obj, event, currentObj, axesObj, true, omit);
 
         if (axesObj.valid_object ())
           {