changeset 10569:4f2e46473153

Fix the order of calling setdata and setvertexdata for patches (bug #29549)
author David Bateman <dbateman@free.fr>
date Sun, 25 Apr 2010 20:04:02 +0200
parents 046b713d21dc
children a61d7248627c
files scripts/ChangeLog scripts/plot/private/__patch__.m
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Sun Apr 25 10:04:52 2010 -0400
+++ b/scripts/ChangeLog	Sun Apr 25 20:04:02 2010 +0200
@@ -1,3 +1,8 @@
+2010-04-24  David Bateman  <dbateman@free.fr>
+
+	* plot/private/__patch__.m: Correct order of calling setdata and
+	setvertexdata.
+
 2010-04-25  Ben Abbott <bpabbot@mac.com>
 
 	* plot/__go_draw_figure__.m: Hidden axes may have visible children.
--- a/scripts/plot/private/__patch__.m	Sun Apr 25 10:04:52 2010 -0400
+++ b/scripts/plot/private/__patch__.m	Sun Apr 25 20:04:02 2010 +0200
@@ -158,12 +158,18 @@
 
 function args = delfields(args, flds)
   idx = cellfun (@(x) any (strcmpi (x, flds)), args);
-  idx = idx | [false, idx(1:end-1)];
+  if (rows (idx) == 1)
+    idx = idx | [false, idx(1:end-1)];
+  else
+    idx = idx | [false; idx(1:end-1)];
+  endif
   args (idx) = [];
 endfunction
 
 function args = setdata (args)
   args = delfields (args, {"xdata", "ydata", "zdata", "cdata"});
+  ## Remove the readonly fields as well
+  args = delfields (args, {"type", "uicontextmenu"});
   nargs = length (args);
   idx = find (cellfun (@(x) strcmpi (x, "faces"), args)) + 1;
   if (idx > nargs)
@@ -233,6 +239,8 @@
 
 function args = setvertexdata (args)
   args = delfields (args, {"vertices", "faces", "facevertexcdata"});
+  ## Remove the readonly fields as well
+  args = delfields (args, {"type", "uicontextmenu"});
   nargs = length (args);
   idx = find (cellfun (@(x) strcmpi (x, "xdata"), args)) + 1;
   if (idx > nargs)
@@ -307,9 +315,9 @@
     recursive = true;
     f = get (h);
     if (isfv)
-      set (h, setvertexdata ([fieldnames(f), struct2cell(f)].'(:)){:});
+      set (h, setdata ([fieldnames(f), struct2cell(f)].'(:)){:});
     else
-      set (h, setdata ([fieldnames(f), struct2cell(f)].'(:)){:});
+      set (h, setvertexdata ([fieldnames(f), struct2cell(f)].'(:)){:});
     endif
     recursive = false;
   endif