Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfHielscher committed Oct 17, 2014
1 parent dd3e2a8 commit 0b894f8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions plotting/@mtexFigure/getDataCursorPos.m
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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

0 comments on commit 0b894f8

Please sign in to comment.