function fish_click(handle) {
  return function(ev) {
    var x = event.pageX - c.offsetLeft;
    var y = event.pageY - c.offsetTop;

    for (let f of fish) {
      if (!f.ot || !f.ar) {
        continue; // fish hasn't been drawn yet, also missing critical info
      }

      const [centerx, centery] = fish_center(f);

      if (((centerx - x)**2 + (centery - y)**2)**0.5 < 24) {
        handle(f);
        f.delete = true;
      }
    }
  }
}
// find the fish you clicked on and call the handle function
find the fish you clicked on and call the handle function
find the fish you clicked on and call the handle function
function fish_click(handle) {
  return function(ev) {
    var x = event.pageX - c.offsetLeft;
    var y = event.pageY - c.offsetTop;
    for (let f of fish) {
      if (!f.ot || !f.ar) {
        continue; 
      }
      const [centerx, centery] = fish_center(f);
      if (((centerx - x)**2 + (centery - y)**2)**0.5 < 24) {
        handle(f);
        f.delete = true;
      }
    }
  }
}
function fish_click ( handle ) { return function ( ev ) { var x = event . pageX - c . offsetLeft ; var y = event . pageY - c . offsetTop ; for ( let f of fish ) { if ( ! f . ot || ! f . ar ) { continue ; } const [ centerx , centery ] = fish_center ( f ) ; if ( ( ( centerx - x ) ** 2 + ( centery - y ) ** 2 ) ** 0.5 < 24 ) { handle ( f ) ; f . delete = true ; } } } }
find the fish you clicked on and call the handle function
find the fish you clicked on and call the handle function
// fish hasn't been drawn yet, also missing critical info