%% Drag on UI Component with Specified Selection Type
% Create an axes within a UI figure and then plot a line into the axes.

f = uifigure;
ax = axes(f);
plot(ax,1:10)

% Create an interactive test case and drag on the figure from the point (100, 200) to the point (200, 300) using a right-click. A blue dot representing the programmatic drag gesture appears at the start value and then disappears when it reaches the stop value.

tc = matlab.uitest.TestCase.forInteractiveUse;
tc.drag(f,[100 200],[200 300],'SelectionType','alt')

% Now, drag on the axes from the point (3, 2) to the point (4, 2) using a left-click. The axis limits are updated based on the difference between the start and stop values.

tc.drag(ax,[3 2],[4 2],'SelectionType','normal')

% Copyright 2020 The MathWorks, Inc.