JS function to make polygons in a canvas selectable