how to force Draggable points to move along a line?
1 view (last 30 days)
Show older comments
Answered: Roman Willi on 2 Jul 2018
Hi All. I would like to use impoint to generate a draggable point. But I want to force it to move along a line. I try to do so by setPosition, but it does not work properly. Any help?
h1 = impoint(gca,[5, 5])
addNewPositionCallback(h1,@(h1) CallThis(1,[1 2],[ 2 ]));
axis([0 10 0 10])
pos = h1.getPosition()
Roman Willi on 2 Jul 2018
move along a line:
obj.dragPoint = impoint();
hp = addNewPositionCallback(obj.dragPoint,@(pos) point_move(obj,pos));
function point_move(obj, pos)
pos = [.....] % Calc Y Point of line
axilim = [.....] % X axi limit
fcn = makeConstrainToRectFcn('impoint',axilim, [pos pos]);
Find more on Specifying Target for Graphics Output in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!