% Thanks to <a href="http://www.mathworks.com/matlabcentral/profile/authors/3354683-yaroslav">Yaroslav Don</a> for his assistance in updating cursorbar for
% MATLAB Graphics and for his contribution of new functionality.
% Copyright 2003-2016 The MathWorks, Inc.
hAxes = get(hThis,'Parent');
cp = get(hAxes,'CurrentPoint');
pos = [cp(1,1) cp(1,2) 0];
hTarget = hThis.Target;
if isTargetAxes(hThis)
% axes: ignore interpolation, just use the axes' CurrentPoint
hNewDataCursor.DataSource.XData = pos(1);
hNewDataCursor.DataSource.YData = pos(2);
else
% put the DataCursor in a correct place
[x,y,n] = closestvertex(hThis,pos);
if ~isscalar(hTarget)
if isa(hTarget,'matlab.graphics.chart.interaction.DataAnnotatable')