Android Canvas: Draw line with padding for extended touch/click area -


well i`m trying find solution small problem.

i have multiple points on canvas , have connect them straight line. 1 incoming or outgoing connection per point. have 2 points line.

it works canvas.drawline(...) method. want able detect if there click/touch event on particular line within line + padding area.

as line drawn inside rectangular bounding box size varies based on length , overlaps other bounding boxes. considering touch within bounding box dumb guess.

can please give me input in direction? lot!

you can calculate perpendicular distance of touch line.if distance within range(in case padding size) consider touch event on line.

to calculate perpendicular distance use formula refer-shortest distance between point , line segment


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -