how to I increase the IsPointInStroke hitbox?

I have a have a line’s that are drawn in a varias directions. I save the path and then check if I hover over the point:

How the line is made:

        let path = new Path2D();            
        ctx.lineWidth = 20; // this doesn't seem to affect the hitbox of the liine
        ctx.globalAlpha = 1;
        ctx.beginPath();
        path.moveTo(start.x + (width / 2), start.y);
        path.lineTo(start.x + (width / 2) + linePadding, start.y);
        path.lineTo(mid, start.y);
        path.lineTo(mid, end.y);
        path.lineTo(end.x - (width / 2) - linePadding, end.y);
        ctx.stroke(path);
        ctx.closePath();

when I check to see if I hit the path:

                path_Arrows.some(element => {
                    if (ctx.isPointInStroke(element.path, mouseLocation.x, mouseLocation.y)) {

it doesn’t seem to detect the whole stroke, just the tiny little stroke. Changing the lineWidth does change the line visually, but not the isPointInStroke. Adjusting the mouseLocation.x, mouseLocation.y to adjust for a hitbox range is technically possible, but because these lines are so dynamic and procedural it would be incredibly difficult to account for each potential location (unless I’m thinking of this wrong).

I’ve also considered changing mainting a line the way I do with the desired lineWidth (like 5) and then just draw rectangles with 0 alphas from the points they move and check isPointInPath.

178 thoughts on “how to I increase the IsPointInStroke hitbox?”

  1. I am really enjoying the theme/design of your weblog. Do you
    ever run into any web browser compatibility problems?
    A small number of my blog audience have complained about my site not working correctly in Explorer but looks great in Safari.
    Do you have any recommendations to help fix this problem?

    Reply
  2. Yesterday, while I was at work, my sister stole my iphone and tested
    to see if it can survive a thirty foot drop, just so she can be a youtube sensation. My iPad
    is now destroyed and she has 83 views. I know this is entirely
    off topic but I had to share it with someone!

    Reply
  3. hi!,I love your writing so so much! percentage we communicate more approximately your post
    on AOL? I require a specialist in this house to unravel my problem.

    Maybe that is you! Having a look ahead to peer you.

    Reply
  4. I like the helpful information you provide in your articles.
    I’ll bookmark your weblog and take a look at once
    more here frequently. I am reasonably sure I’ll be informed
    plenty of new stuff proper right here! Best of luck for the next!

    Reply
  5. Hi there! This is kind of off topic but I need
    some guidance from an established blog. Is it difficult to set up your own blog?
    I’m not very techincal but I can figure things out pretty fast.
    I’m thinking about making my own but I’m not sure where to
    begin. Do you have any points or suggestions? Appreciate it

    Reply
  6. Pingback: ivermectin 100mg
  7. Pingback: tinder gay dating
  8. Pingback: ivermectin 200mg
  9. I really like your blog.. very nice colors & theme.
    Did you design this website yourself or did you hire someone to do it for you?
    Plz answer back as I’m looking to construct my own blog and would like to find out
    where u got this from. appreciate it

    Reply
  10. Pingback: molnupiravir india
  11. Pingback: baricitinib moa
  12. Pingback: nolvadex buy uk
  13. Pingback: buy nolvadex uk
  14. obviously like your web-site but you need to test the spelling on quite a
    few of your posts. A number of them are rife with spelling problems and I
    find it very troublesome to tell the truth on the other hand I’ll surely come back
    again.

    Reply
  15. Excellent post. I was checking constantly this blog and I am impressed!

    Extremely helpful info particularly the last part 🙂 I care for such info a lot.
    I was looking for this particular info for a long time.
    Thank you and best of luck.

    Reply

Leave a Comment