<commit_before>import { Component, ViewChild, ElementRef } from '@angular/core';
import { Platform, NavController, App} from 'ionic-angular';
import { Geolocation } from '@ionic-native/geolocation';

import {StoresData} from '../../providers/stores';
import {MenuPage} from '../menu/menu';

declare var google: any;


@Component({
  selector: 'page-map',
  templateUrl: 'map.html'
})
export class MapPage {

  @ViewChild('mapCanvas') mapElement: ElementRef;
  constructor(
     public platform: Platform,
     public storesData: StoresData,
     public navCtrl: NavController,
     public app:App,
     public geolocation: Geolocation
  ) {}

  private currentLocationCircle: any = {};

  ionViewDidLoad() {
    this.app.setTitle('Map');
    this.storesData.getMapData().subscribe((data: any) => {
      // console.log(data);

      let map = new google.maps.Map(this.mapElement.nativeElement, {
        center: {lat: 43.074640, lng: -89.384103},
        zoom: 13,
        styles: [
          {
            "featureType": "poi",
            "elementType": "labels.icon",
            "stylers": [
              {
                "visibility": "off"
              }
            ]
          },
          {
            "featureType": "poi.park",
            "elementType": "labels",
            "stylers": [
              {
                "visibility": "off"
              }
            ]
          },
          {
            "featureType": "transit",
            "stylers": [
              {
                "visibility": "off"
              }
            ]
          }
        ]
      });
      let infoWindow = new google.maps.InfoWindow();
      let infoWindowListener = {};
      let thisNavCtrl = this.navCtrl;

      data.forEach((markerData: any) => {

        let marker = new google.maps.Marker({
          position: {lat: markerData.lat, lng: markerData.lng},
          map: map,
          title: markerData.name,
          html: `<div class='dp-infowindow'><img src="${markerData.imgUrl}" />
            <h5>${markerData.name}</h5>
            <p>${markerData.address}</p>
            <p>Bottles? ${markerData.bottles ? "Yes" : "No"}, Taps? ${markerData.taps ? "Yes" : "No"}</p>
            <button class="map-button">See Menu</button></div>`
        });

        marker.addListener('click', () => {
          infoWindow.close();
          // google.maps.event.removeListener(infoWindowListener);
          google.maps.event.clearListeners(infoWindow);
          infoWindow.setContent(marker.html);
          infoWindow.open(map, marker);
          infoWindowListener = google.maps.event.addListener(infoWindow, 'domready', function() {
            let domObj: any = document.querySelector('.map-button');
            if (domObj) {
              domObj.addEventListener("click", function(e: Event) {
                e.stopPropagation();
                e.preventDefault();
                // console.log(markerData.id);
                thisNavCtrl.push(MenuPage, { storeId: markerData.id, name: markerData.name });
              });
            }
          });
        });
      });

      google.maps.event.addListenerOnce(map, 'idle', () => {
        this.mapElement.nativeElement.classList.add('show-map');
      });
      this.geolocation.getCurrentPosition().then((resp) => {
        map.setCenter({lat: resp.coords.latitude, lng: resp.coords.longitude});
        this.currentLocationCircle = new google.maps.Marker({
          map: map,
          position: map.getCenter(),
          title: "circle",
          icon: {
            strokeColor: '#FFFFFF',
            strokeOpacity: 1.0,
            strokeWeight: 2,
            fillColor: '#689df6',
            fillOpacity: 1.0,
            path: google.maps.SymbolPath.CIRCLE,
            scale: 7,
            anchor: new google.maps.Point(0, 0)
          }
        });
      }, (err) => {
        console.error(err);
      });
    });
    this.geolocation.watchPosition({timeout: 30000}).subscribe((resp) => {
      this.currentLocationCircle.setPosition({lat: resp.coords.latitude, lng: resp.coords.longitude});
    });
  }
}<commit_msg>fix null current circle issue; change to private naming convention<commit_after>import { Component, ViewChild, ElementRef } from '@angular/core';
import { Platform, NavController, App} from 'ionic-angular';
import { Geolocation } from '@ionic-native/geolocation';

import {StoresData} from '../../providers/stores';
import {MenuPage} from '../menu/menu';

declare var google: any;


@Component({
  selector: 'page-map',
  templateUrl: 'map.html'
})
export class MapPage {

  @ViewChild('mapCanvas') mapElement: ElementRef;
  constructor(
     public platform: Platform,
     public storesData: StoresData,
     public navCtrl: NavController,
     public app:App,
     public geolocation: Geolocation
  ) {}

  private _currentLocationCircle: any = {};

  ionViewDidLoad() {
    this.app.setTitle('Map');
    this.storesData.getMapData().subscribe((data: any) => {
      // console.log(data);

      let map = new google.maps.Map(this.mapElement.nativeElement, {
        center: {lat: 43.074640, lng: -89.384103},
        zoom: 13,
        styles: [
          {
            "featureType": "poi",
            "elementType": "labels.icon",
            "stylers": [
              {
                "visibility": "off"
              }
            ]
          },
          {
            "featureType": "poi.park",
            "elementType": "labels",
            "stylers": [
              {
                "visibility": "off"
              }
            ]
          },
          {
            "featureType": "transit",
            "stylers": [
              {
                "visibility": "off"
              }
            ]
          }
        ]
      });
      let infoWindow = new google.maps.InfoWindow();
      let infoWindowListener = {};
      let thisNavCtrl = this.navCtrl;

      data.forEach((markerData: any) => {

        let marker = new google.maps.Marker({
          position: {lat: markerData.lat, lng: markerData.lng},
          map: map,
          title: markerData.name,
          html: `<div class='dp-infowindow'><img src="${markerData.imgUrl}" />
            <h5>${markerData.name}</h5>
            <p>${markerData.address}</p>
            <p>Bottles? ${markerData.bottles ? "Yes" : "No"}, Taps? ${markerData.taps ? "Yes" : "No"}</p>
            <button class="map-button">See Menu</button></div>`
        });

        marker.addListener('click', () => {
          infoWindow.close();
          // google.maps.event.removeListener(infoWindowListener);
          google.maps.event.clearListeners(infoWindow);
          infoWindow.setContent(marker.html);
          infoWindow.open(map, marker);
          infoWindowListener = google.maps.event.addListener(infoWindow, 'domready', function() {
            let domObj: any = document.querySelector('.map-button');
            if (domObj) {
              domObj.addEventListener("click", function(e: Event) {
                e.stopPropagation();
                e.preventDefault();
                // console.log(markerData.id);
                thisNavCtrl.push(MenuPage, { storeId: markerData.id, name: markerData.name });
              });
            }
          });
        });
      });

      google.maps.event.addListenerOnce(map, 'idle', () => {
        this.mapElement.nativeElement.classList.add('show-map');
      });
      this.geolocation.getCurrentPosition().then((resp) => {
        map.setCenter({lat: resp.coords.latitude, lng: resp.coords.longitude});
        this._currentLocationCircle = new google.maps.Marker({
          map: map,
          position: map.getCenter(),
          title: "circle",
          icon: {
            strokeColor: '#FFFFFF',
            strokeOpacity: 1.0,
            strokeWeight: 2,
            fillColor: '#689df6',
            fillOpacity: 1.0,
            path: google.maps.SymbolPath.CIRCLE,
            scale: 7,
            anchor: new google.maps.Point(0, 0)
          }
        });
      }, (err) => {
        console.error(err);
      });
    });
    this.geolocation.watchPosition({timeout: 30000}).subscribe((resp) => {
      if (this._currentLocationCircle) {
        this._currentLocationCircle.setPosition({lat: resp.coords.latitude, lng: resp.coords.longitude});
      }
    });
  }
}
{'fraction_non_alphanumeric': 0.1466169931498618, 'fraction_numerical': 0.00889316187958178, 'mean_word_length': 1.876598686484618, 'pattern_counts': {'":': 22, '<': 25, '<?xml version=': 0, '>': 39, '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': '3058870', 'n_tokens_mistral': 2472, 'n_tokens_neox': 2389, 'n_words': 423}