changeset 27718:39ac47fdcda2

legend.m: handle "edgecolor" passed at legend creation (bug #56968) * legend.m (update_edgecolor_cb): New subfunction to handle edgecolor property. Call it in property listener but also at legend creation.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 19 Nov 2019 16:40:11 +0100
parents 842d4221ac6c
children 88350aacd800
files scripts/plot/appearance/legend.m
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/legend.m	Tue Nov 19 16:21:16 2019 +0100
+++ b/scripts/plot/appearance/legend.m	Tue Nov 19 16:40:11 2019 +0100
@@ -1,4 +1,4 @@
-## Copyright (C) 2010-2019 David Bateman
+# Copyright (C) 2010-2019 David Bateman
 ##
 ## This file is part of Octave.
 ##
@@ -214,8 +214,9 @@
                     "__next_label_index__", opts.next_idx,
                     "__peer_objects__", opts.obj_handles);
     update_location_cb (hl, [], false);
+    update_edgecolor_cb (hl);
+    update_numchild_cb (hl);
     update_layout_cb (hl, [], true);
-    update_numchild_cb (hl);
 
     ## Dummy invisible object that deletes the legend when "newplot" is called
     ht = __go_text__ (opts.axes_handles(1), "tag", "__legend_watcher__",
@@ -257,9 +258,7 @@
 
     addlistener (hl, "box", @update_box_cb);
 
-    addlistener (hl, "edgecolor", ...
-                 @(h) set (hl, "xcolor", get (hl, "edgecolor"), ...
-                               "ycolor", get (hl, "edgecolor")));
+    addlistener (hl, "edgecolor", @update_edgecolor_cb);
 
     addlistener (hl, "location", @update_location_cb);
 
@@ -321,6 +320,13 @@
 
 endfunction
 
+function update_edgecolor_cb (hl)
+
+  set (hl, "xcolor", get (hl, "edgecolor"), ...
+           "ycolor", get (hl, "edgecolor"))
+
+endfunction
+
 function update_position_cb (hl)
 
   updating = getappdata (hl, "__updating_layout__");