<commit_before>

var utils = require('cordova/utils'),
  cordova_exec = require('cordova/exec'),
  common = require('./Common'),
  Overlay = require('./Overlay'),
  BaseClass = require('./BaseClass'),
  BaseArrayClass = require('./BaseArrayClass'),
  LatLng = require('./LatLng'),
  MapTypeId = require('./MapTypeId'),
  event = require('./event'),
  VisibleRegion = require('./VisibleRegion'),
  Marker = require('./Marker'),
  Circle = require('./Circle'),
  Polyline = require('./Polyline'),
  Polygon = require('./Polygon'),
  TileOverlay = require('./TileOverlay'),
  GroundOverlay = require('./GroundOverlay'),
  KmlOverlay = require('./KmlOverlay'),
  KmlLoader = require('./KmlLoader'),
  MarkerCluster = require('./MarkerCluster');

/**
 * Google Maps model.
 */
var exec;
var Map = function(__pgmId, _exec) {
  var self = this;
  exec = _exec;
  Overlay.call(self, self, {}, 'Map', _exec, {
    __pgmId: __pgmId
  });
  delete self.map;


  self.set('myLocation', false);
  self.set('myLocationButton', false);

  self.MARKERS = {};
  self.OVERLAYS = {};

  var infoWindowLayer = document.createElement('div');
  infoWindowLayer.style.position = 'absolute';
  infoWindowLayer.style.left = 0;
  infoWindowLayer.style.top = 0;
  infoWindowLayer.style.width = 0;
  infoWindowLayer.style.height = 0;
  infoWindowLayer.style.overflow = 'visible';
  infoWindowLayer.style['z-index'] = 1;

  Object.defineProperty(self, '_layers', {
    value: {
      info: infoWindowLayer
    },
    enumerable: false,
    writable: false
  });

  self.on(event.MAP_CLICK, function() {
    self.set('active_marker', undefined);
  });

  self.on('active_marker_changed', function(prevMarker, newMarker) {
    var newMarkerId = newMarker ? newMarker.getId() : null;
    if (prevMarker) {
      prevMarker.hideInfoWindow.call(prevMarker);
    }
    self.exec.call(self, null, null, self.__pgmId, 'setActiveMarkerId', [newMarkerId]);
  });
};

utils.extend(Map, Overlay);

/**
 * @desc Recalculate the position of HTML elements
 */
Map.prototype.refreshLayout = function() {
  // Webkit redraw mandatory
  // http://stackoverflow.com/a/3485654/697856
  document.body.style.display = 'none';
  document.body.offsetHeight;
  document.body.style.display = '';

  this.exec.call(this, null, null, this.__pgmId, 'resizeMap', []);
};

Map.prototype.getMap = function(meta, div, options) {
  var self = this,
    args = [meta];
  options = options || {};

  self.set('clickable', options.clickable === false ? false : true);
  self.set('visible', options.visible === false ? false : true);

  if (options.controls) {
    this.set('myLocation', options.controls.myLocation === true);
    this.set('myLocationButton', options.controls.myLocationButton === true);
  }

  if (options.preferences && options.preferences.gestureBounds) {<commit_msg>changed 'display: none' to 'display: inline-block' within the refreshLayout function<commit_after>

var utils = require('cordova/utils'),
  cordova_exec = require('cordova/exec'),
  common = require('./Common'),
  Overlay = require('./Overlay'),
  BaseClass = require('./BaseClass'),
  BaseArrayClass = require('./BaseArrayClass'),
  LatLng = require('./LatLng'),
  MapTypeId = require('./MapTypeId'),
  event = require('./event'),
  VisibleRegion = require('./VisibleRegion'),
  Marker = require('./Marker'),
  Circle = require('./Circle'),
  Polyline = require('./Polyline'),
  Polygon = require('./Polygon'),
  TileOverlay = require('./TileOverlay'),
  GroundOverlay = require('./GroundOverlay'),
  KmlOverlay = require('./KmlOverlay'),
  KmlLoader = require('./KmlLoader'),
  MarkerCluster = require('./MarkerCluster');

/**
 * Google Maps model.
 */
var exec;
var Map = function(__pgmId, _exec) {
  var self = this;
  exec = _exec;
  Overlay.call(self, self, {}, 'Map', _exec, {
    __pgmId: __pgmId
  });
  delete self.map;


  self.set('myLocation', false);
  self.set('myLocationButton', false);

  self.MARKERS = {};
  self.OVERLAYS = {};

  var infoWindowLayer = document.createElement('div');
  infoWindowLayer.style.position = 'absolute';
  infoWindowLayer.style.left = 0;
  infoWindowLayer.style.top = 0;
  infoWindowLayer.style.width = 0;
  infoWindowLayer.style.height = 0;
  infoWindowLayer.style.overflow = 'visible';
  infoWindowLayer.style['z-index'] = 1;

  Object.defineProperty(self, '_layers', {
    value: {
      info: infoWindowLayer
    },
    enumerable: false,
    writable: false
  });

  self.on(event.MAP_CLICK, function() {
    self.set('active_marker', undefined);
  });

  self.on('active_marker_changed', function(prevMarker, newMarker) {
    var newMarkerId = newMarker ? newMarker.getId() : null;
    if (prevMarker) {
      prevMarker.hideInfoWindow.call(prevMarker);
    }
    self.exec.call(self, null, null, self.__pgmId, 'setActiveMarkerId', [newMarkerId]);
  });
};

utils.extend(Map, Overlay);

/**
 * @desc Recalculate the position of HTML elements
 */
Map.prototype.refreshLayout = function() {
  // Webkit redraw mandatory
  // http://stackoverflow.com/a/3485654/697856
  document.body.style.display = 'inline-block';
  document.body.offsetHeight;
  document.body.style.display = '';

  this.exec.call(this, null, null, this.__pgmId, 'resizeMap', []);
};

Map.prototype.getMap = function(meta, div, options) {
  var self = this,
    args = [meta];
  options = options || {};

  self.set('clickable', options.clickable === false ? false : true);
  self.set('visible', options.visible === false ? false : true);

  if (options.controls) {
    this.set('myLocation', options.controls.myLocation === true);
    this.set('myLocationButton', options.controls.myLocationButton === true);
  }

  if (options.preferences && options.preferences.gestureBounds) {
{'fraction_non_alphanumeric': 0.16961007169085504, 'fraction_numerical': 0.006294806784402867, 'mean_word_length': 4.044091710758377, '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': '5466644', 'n_tokens_mistral': 1839, 'n_tokens_neox': 1800, 'n_words': 351}