changeset 28284:a41095478d9b

struct2hdl.m: Restore loading axes objects from .fig files (bug #58336). * struct2hdl.m: Remove read-only properties that have been added in changeset 044cea7947db.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 10 May 2020 18:01:51 +0200
parents 044cea7947db
children fdaec2feeed3
files scripts/plot/util/struct2hdl.m
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/struct2hdl.m	Fri May 08 22:37:01 2020 +0200
+++ b/scripts/plot/util/struct2hdl.m	Sun May 10 18:01:51 2020 +0200
@@ -157,8 +157,16 @@
         par = gcf;
       endif
     endif
-    if (isfield (s.properties, "tightinset"))
-      s.properties = rmfield (s.properties, {"tightinset"});
+    ## remove read only properties
+    ## FIXME: Remove "contextmenu", "interactions", "layout", "legend",
+    ## "toolbar", "xaxis", "yaxis", and "zaxis" from this list once they are
+    ## implemented.
+    ro_props = {"contextmenu", "interactions", "layout", "legend", ...
+                "nextseriesindex", "tightinset", "toolbar", "xaxis", ...
+                "yaxis", "zaxis"};
+    has_ro_props = cellfun (@(x) isfield (s.properties, x), ro_props);
+    if (any (has_ro_props))
+      s.properties = rmfield (s.properties, ro_props(has_ro_props));
     endif
     [h, s] = createaxes (s, p, par);
   elseif (strcmp (s.type, "line"))