<commit_before>maphub.AnnotationView = function(parameters) {
  
  /* Callbacks for added / removed features */
  function featureSelected(evt) {
    var class_name = evt.feature.geometry.CLASS_NAME;
    if (!evt.feature.tooltip) {
      if (class_name == "OpenLayers.Geometry.Point") {
        evt.feature.tooltip = new maphub.ControlPointTooltip(evt.feature.control_point, self.user_id);
      } else {
        evt.feature.tooltip = new maphub.AnnotationTooltip(evt.feature.annotation, self.user_id);
      }
      self.tooltips.push(evt.feature.tooltip);
    }
    // get the screen coordinates
    var lonlat = evt.feature.geometry.getBounds().getCenterLonLat();
    var coords = this.map.getPixelFromLonLat(lonlat);
    evt.feature.tooltip.show(coords.x - 50, coords.y);
  }
  
  function featureUnselected(evt) {
    evt.feature.tooltip.hide();
  }
  
  // This function is called when a feature was added to the Edit layer
  function featureAdded(evt) {
    
    // deactivate keyboard shortcuts
    self.keyboard_shortcuts.deactivate();
    
    // hide all tooltips
    for (var i in self.tooltips) {
      self.tooltips[i].hide();
    }
    
    // is this a Control Point or an Annotation?
    var class_name = evt.feature.geometry.CLASS_NAME;
    if (class_name == "OpenLayers.Geometry.Point") {
      controlPointAdded(evt);
    } else {
      annotationAdded(evt);
    }
  }
  
  // This function is called when an annotation was drawn
  function annotationAdded(evt) {    
    var wkt_data = evt.feature.geometry.toString();
    
    // reinitialize title and body, and copy WKT data as well as bounds
    $("#annotation_body").attr("value", "Add your annotation here!");
    $("#annotation_wkt_data").attr("value", wkt_data);
    
    $("#annotation_boundary_attributes_ne_x").attr("value", evt.feature.geometry.bounds.right);
    $("#annotation_boundary_attributes_ne_y").attr("value", evt.feature.geometry.bounds.top);
    $("#annotation_boundary_attributes_sw_x").attr("value", evt.feature.geometry.bounds.left);
    $("#annotation_boundary_attributes_sw_y").attr("value", evt.feature.geometry.bounds.bottom);
    
    // clear the existing tags
    $("#modal-annotation-tags").empty();
    $("#tagging-help").hide();
    $("#no-tags").show();
    
    // show the popup
    $("#modal-annotation").modal({
      'backdrop': 'static'
    });
    $("#annotation_body").focus();
    $("#annotation_body").select();
  }
  
  function controlPointAdded(evt) {
    var wkt_data = evt.feature.geometry.toString();
    
    // set x/y in form
    $("#control_point_wkt_data").attr("value", wkt_data);
    $("#control_point_x").attr("value", evt.feature.geometry.x);
    $("#control_point_y").attr("value", evt.feature.geometry.y);
    
    // reset the place search box and slide up panel
    $("#place-search").attr("value", "");
    $("#modal-control-point").modal({
      'backdrop': 'static'
    });
    $("#place-search").focus();
  }
  
  /* ============================================================================== */
  
  this.zoomify_width  = parameters.width;        // pixel width ...
  this.zoomify_height = parameters.height;       // ... and height of map
  this.zoomify_url    = parameters.zoomify_url;  // remote zoomify tileset<commit_msg>Don't make Escape close an open annotation / control point window<commit_after>maphub.AnnotationView = function(parameters) {
  
  /* Callbacks for added / removed features */
  function featureSelected(evt) {
    var class_name = evt.feature.geometry.CLASS_NAME;
    if (!evt.feature.tooltip) {
      if (class_name == "OpenLayers.Geometry.Point") {
        evt.feature.tooltip = new maphub.ControlPointTooltip(evt.feature.control_point, self.user_id);
      } else {
        evt.feature.tooltip = new maphub.AnnotationTooltip(evt.feature.annotation, self.user_id);
      }
      self.tooltips.push(evt.feature.tooltip);
    }
    // get the screen coordinates
    var lonlat = evt.feature.geometry.getBounds().getCenterLonLat();
    var coords = this.map.getPixelFromLonLat(lonlat);
    evt.feature.tooltip.show(coords.x - 50, coords.y);
  }
  
  function featureUnselected(evt) {
    evt.feature.tooltip.hide();
  }
  
  // This function is called when a feature was added to the Edit layer
  function featureAdded(evt) {
    
    // deactivate keyboard shortcuts
    self.keyboard_shortcuts.deactivate();
    
    // hide all tooltips
    for (var i in self.tooltips) {
      self.tooltips[i].hide();
    }
    
    // is this a Control Point or an Annotation?
    var class_name = evt.feature.geometry.CLASS_NAME;
    if (class_name == "OpenLayers.Geometry.Point") {
      controlPointAdded(evt);
    } else {
      annotationAdded(evt);
    }
  }
  
  // This function is called when an annotation was drawn
  function annotationAdded(evt) {    
    var wkt_data = evt.feature.geometry.toString();
    
    // reinitialize title and body, and copy WKT data as well as bounds
    $("#annotation_body").attr("value", "Add your annotation here!");
    $("#annotation_wkt_data").attr("value", wkt_data);
    
    $("#annotation_boundary_attributes_ne_x").attr("value", evt.feature.geometry.bounds.right);
    $("#annotation_boundary_attributes_ne_y").attr("value", evt.feature.geometry.bounds.top);
    $("#annotation_boundary_attributes_sw_x").attr("value", evt.feature.geometry.bounds.left);
    $("#annotation_boundary_attributes_sw_y").attr("value", evt.feature.geometry.bounds.bottom);
    
    // clear the existing tags
    $("#modal-annotation-tags").empty();
    $("#tagging-help").hide();
    $("#no-tags").show();
    
    // show the popup
    $("#modal-annotation").modal({
      'backdrop': 'static',
      keyboard: false
    });
    $("#annotation_body").focus();
    $("#annotation_body").select();
  }
  
  function controlPointAdded(evt) {
    var wkt_data = evt.feature.geometry.toString();
    
    // set x/y in form
    $("#control_point_wkt_data").attr("value", wkt_data);
    $("#control_point_x").attr("value", evt.feature.geometry.x);
    $("#control_point_y").attr("value", evt.feature.geometry.y);
    
    // reset the place search box and slide up panel
    $("#place-search").attr("value", "");
    $("#modal-control-point").modal({
      'backdrop': 'static',
      keyboard: false
    });
    $("#place-search").focus();
  }
  
  /* ============================================================================== */
  
  this.zoomify_width  = parameters.width;        // pixel width ...
  this.zoomify_height = parameters.height;       // ... and height of map
  this.zoomify_url    = parameters.zoomify_url;  // remote zoomify tileset
{'fraction_non_alphanumeric': 0.17043059319482085, 'fraction_numerical': 0.0006022282445046673, 'mean_word_length': 3.225826972010178, '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': '6879817', 'n_tokens_mistral': 2001, 'n_tokens_neox': 2042, 'n_words': 388}