<commit_before>(function() {
  slMapClickHandler = function(infobox, settings) {
    // Private attributes

    var map_click_handler = this;

    /**
     * The OpenLayers.Geometry object of the circle.
     * @type {Object}
     */
    var circle = null;

    /**
     * Stores the state if the infobox.
     * @type {Bool}
     */
    var visible = false;

    // Public attributes and functions

    /**
     * @expose
     * Click handler which shows a info box at the click location.
     */
    map_click_handler.trigger = function(e) {
      // do nothing if this is visible, let the event handler close the box.
      if (visible) return;

      // create bounding box in map coordinates around mouse cursor
      var pixel = new OpenLayers.Pixel(e.layerX, e.layerY);
      var clickTolerance = 15;
      var llPx = pixel.add(-clickTolerance / 2, clickTolerance / 2);
      var urPx = pixel.add(clickTolerance / 2, -clickTolerance / 2);
      var ll = map.getLonLatFromPixel(llPx);
      var ur = map.getLonLatFromPixel(urPx);
      var loc = map.getLonLatFromPixel(pixel);

      var loc_wgs84 = loc.clone()
          .transform(map.getProjectionObject(), WGS84_PROJ);
      var lon = loc_wgs84.lon,
          lat = loc_wgs84.lat;

      infobox.stop(true, true); // remove any running delays or animations
      infobox.empty();

      if (settings.flight_info) {
        // search for a aircraft position within the bounding box
        var nearest = searchForPlane(
            new OpenLayers.Bounds(ll.lon, ll.lat, ur.lon, ur.lat),
            loc,
            clickTolerance);

        if (nearest !== null) {
          var index = nearest.from;
          var flight = flights[nearest.fid];
          var dx = nearest.along;
<commit_msg>map-click-handler.js: Calculate bounding box only when needed<commit_after>(function() {
  slMapClickHandler = function(infobox, settings) {
    // Private attributes

    var map_click_handler = this;

    /**
     * The OpenLayers.Geometry object of the circle.
     * @type {Object}
     */
    var circle = null;

    /**
     * Stores the state if the infobox.
     * @type {Bool}
     */
    var visible = false;

    // Public attributes and functions

    /**
     * @expose
     * Click handler which shows a info box at the click location.
     */
    map_click_handler.trigger = function(e) {
      // do nothing if this is visible, let the event handler close the box.
      if (visible) return;

      var pixel = new OpenLayers.Pixel(e.layerX, e.layerY);
      var loc = map.getLonLatFromPixel(pixel);

      var loc_wgs84 = loc.clone()
          .transform(map.getProjectionObject(), WGS84_PROJ);
      var lon = loc_wgs84.lon,
          lat = loc_wgs84.lat;

      infobox.stop(true, true); // remove any running delays or animations
      infobox.empty();

      if (settings.flight_info) {
        // create bounding box in map coordinates around mouse cursor
        var clickTolerance = 15;
        var llPx = pixel.add(-clickTolerance / 2, clickTolerance / 2);
        var urPx = pixel.add(clickTolerance / 2, -clickTolerance / 2);
        var ll = map.getLonLatFromPixel(llPx);
        var ur = map.getLonLatFromPixel(urPx);

        var bounds = new OpenLayers.Bounds(ll.lon, ll.lat, ur.lon, ur.lat);

        // search for a aircraft position within the bounding box
        var nearest = searchForPlane(bounds, loc, clickTolerance);

        if (nearest !== null) {
          var index = nearest.from;
          var flight = flights[nearest.fid];
          var dx = nearest.along;

{'fraction_non_alphanumeric': 0.10230466554243957, 'fraction_numerical': 0.007869589657110737, 'mean_word_length': 2.244302643573382, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2219996', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1050, 'n_words': 318}