# HG changeset patch
# User Pantxo Diribarne <pantxo.diribarne@gmail.com>
# Date 1710188576 -3600
#      Mon Mar 11 21:22:56 2024 +0100
# Branch stable
# Node ID 87238c567605ce5d7e7266f77c63d4c27d14be65
# Parent  430eccf64677f127eb24aa7914cf2997d8c74e26
legend.m: fix error with showhiddenhandles on (bug #65442)

* legend.m (update_layout_cb): Make sure the root "showhiddenhandles" property
  is off so that labels are not visible in children list. 
                                                 

diff -r 430eccf64677 -r 87238c567605 scripts/plot/appearance/legend.m
--- a/scripts/plot/appearance/legend.m	Mon Mar 11 17:44:16 2024 +0100
+++ b/scripts/plot/appearance/legend.m	Mon Mar 11 21:22:56 2024 +0100
@@ -913,6 +913,10 @@
 
   unwind_protect
 
+    ## Make sure legend title and labels are invisible
+    hvisibility = get (groot, "showhiddenhandles");
+    set (groot, "showhiddenhandles", "off");
+
     pos = get (hl, "position");
 
     if (update_item)
@@ -959,6 +963,7 @@
 
   unwind_protect_cleanup
     set (hl, "units", units);
+    set (groot, "showhiddenhandles", hvisibility);
     setappdata (hl, "__updating_layout__", false);
   end_unwind_protect
 
