From 0b894f812e55d622150dd74a8b8e513bfd960e30 Mon Sep 17 00:00:00 2001 From: "Ralf.Hielscher" Date: Fri, 17 Oct 2014 14:51:38 +0200 Subject: [PATCH] bug fix --- plotting/@mtexFigure/getDataCursorPos.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plotting/@mtexFigure/getDataCursorPos.m b/plotting/@mtexFigure/getDataCursorPos.m index e08c88b8e..fc6f80472 100644 --- a/plotting/@mtexFigure/getDataCursorPos.m +++ b/plotting/@mtexFigure/getDataCursorPos.m @@ -21,12 +21,6 @@ % convert pos to vector3d for spherical plots ax = get(target,'Parent'); -% for spherical plots convert to polar coordinates -sP = getappdata(ax,'sphericalPlot'); -if ~isempty(sP) - pos = sP.proj.iproject(pos(1),pos(2)); -end - % get value value = []; zd = get(target,'zdata'); @@ -40,9 +34,15 @@ yd = mean(yd); end -[~,value] = min((xd-pos(1)).^2 + (yd-pos(2)).^2); +[~,value] = min((xd(:)-pos(1)).^2 + (yd(:)-pos(2)).^2); if numel(zd) == numel(xd), value = zd(value); end +% for spherical plots convert to polar coordinates +sP = getappdata(ax,'sphericalPlot'); +if ~isempty(sP) + pos = sP.proj.iproject(pos(1),pos(2)); +end + end