Check if Path is Closed

Discussion in 'Javascript/Plugin Support' started by wrigty12, Oct 8, 2016.

  1. wrigty12

    wrigty12 Veteran Veteran

    Messages:
    533
    Likes Received:
    76
    First Language:
    English
    I am looking for a way to check if a drawn path becomes closed, when the path is being drawn by lines created when a cursor is moved with the arrow keys (Imagine drawing lines to make a circle using the arrow keys). I can get the lines to draw, but I can't figure out how to check when the path makes a closed "shape"/area.


    If anyone has a good idea of how I can check when a path becomes closed, please let me know!
     
    #1
  2. taarna23

    taarna23 Marshmallow Princess Global Mod

    Messages:
    2,349
    Likes Received:
    4,629
    Location:
    Saskatoon, SK, Canada
    First Language:
    English
    Do you have a way to record the start and end locations of the shape? If so, check that they are at the same location.
     
    #2
  3. wrigty12

    wrigty12 Veteran Veteran

    Messages:
    533
    Likes Received:
    76
    First Language:
    English
    I don't think I can make that comparison, since the "end point" of the shape can be any part of the line, not just the start point. Imagine drawing a "6", where the end of the tail is the start point, the cursor draws the rest, then closes in the middle, making a closed circle. I need to detect when that circle becomes closed.
     
    #3

Share This Page