From: Sven on
Hi all,

Is there a property of a plot object that determines its clickable area?

For example, consider the two lines:
figure, p1 = plot([0 1],[0 1],'-b.','linewidth',2,'ButtonDownFcn','disp HIT')
and
figure, p2 = plot([0 1],[0 1],'-b.','linewidth',20,'ButtonDownFcn','disp HIT')

It is much easier to 'hit' p2 with a mouse click than it is p1, because the line is thicker. Is there a way to have thin lines, but have the clickability of a thicker line? Perhaps some plot property somewhere such as "hitAreaMargin" that I'm looking for?

Cheers,
Sven.
From: us on
"Sven" <sven.holcombe(a)gmail.deleteme.com> wrote in message <htpd2h$idm$1(a)fred.mathworks.com>...
> Hi all,
>
> Is there a property of a plot object that determines its clickable area?
>
> For example, consider the two lines:
> figure, p1 = plot([0 1],[0 1],'-b.','linewidth',2,'ButtonDownFcn','disp HIT')
> and
> figure, p2 = plot([0 1],[0 1],'-b.','linewidth',20,'ButtonDownFcn','disp HIT')
>
> It is much easier to 'hit' p2 with a mouse click than it is p1, because the line is thicker. Is there a way to have thin lines, but have the clickability of a thicker line? Perhaps some plot property somewhere such as "hitAreaMargin" that I'm looking for?
>
> Cheers,
> Sven.

no
us
From: Matt Fig on
I can think of instances where it would be useful to let a user have an easier time with clicking on a line. If it is really worth it to you for your particular application, consider plotting an identical yet thicker line under the visible one, and setting its color to white. Then set its buttondownfcn to match the visible line. For example:

figure
plot([0 1],[0 1],'-w.','linewidth',...
10,'ButtonDownFcn','disp HIT',...
'handlevisibility','off')
hold on
plot([0 1],[0 1],'-b.','ButtonDownFcn','disp HIT')
From: Sven on
> no
> us

Ha! Pithy.

Cheers all, and yeah, Matt, I was thinking along those lines too.