# HG changeset patch # User Markus Mützel # Date 1589805850 -7200 # Node ID f9b5357f4a7e790fd682d66e0aa95ac8b03c39b4 # Parent 1379ebcb00c3e92f8e9d1b4f7f3b55d425f9424e struct2hdl.m: Allowing loading old figure files (bug #58336). * struct2hdl.m: Fall back to using "activepositionproperty" when loading an figure file that was saved before the axes property "positionconstraint" existed. diff -r 1379ebcb00c3 -r f9b5357f4a7e scripts/plot/util/struct2hdl.m --- a/scripts/plot/util/struct2hdl.m Mon May 18 13:02:20 2020 +0200 +++ b/scripts/plot/util/struct2hdl.m Mon May 18 14:44:10 2020 +0200 @@ -112,12 +112,18 @@ names = [names(! n); names(n)]; n_pos = find (strcmp (names, "position") | strcmp (names, "outerposition")); if (strcmp (s.type, "axes") && numel (n_pos) == 2) - if (strcmp (s.properties.positionconstraint, "innerposition")) + if (isfield (s.properties, "positionconstraint")) + positionconstraint = s.properties.positionconstraint; + else + ## loading old figure file before "positionconstraint" property was added + positionconstraint = s.properties.activepositionproperty; + endif + if (strcmp (positionconstraint, "outerposition")) + names{n_pos(1)} = "position"; + names{n_pos(2)} = "outerposition"; + else names{n_pos(1)} = "outerposition"; names{n_pos(2)} = "position"; - else - names{n_pos(1)} = "position"; - names{n_pos(2)} = "outerposition"; endif endif ## Reorder the properties with the mode properties coming last