{"size": 2181, "ext": "js", "max_stars_repo_path": "dist/registry/components/geolocation.js", "max_stars_repo_name": "probins/map-make", "max_stars_repo_stars_event_min_datetime": "2016-05-02T17:39:27.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-18T21:39:57.000Z", "max_issues_repo_path": "dist/registry/components/geolocation.js", "max_issues_repo_name": "probins/map-make", "max_issues_repo_issues_event_min_datetime": "2015-12-28T17:53:31.000Z", "max_issues_repo_issues_event_max_datetime": "2021-02-18T10:03:39.000Z", "max_forks_repo_path": "dist/registry/components/geolocation.js", "max_forks_repo_name": "probins/map-make", "max_forks_repo_forks_event_min_datetime": "2016-05-02T17:38:58.000Z", "max_forks_repo_forks_event_max_datetime": "2018-12-07T18:13:54.000Z"}
{"max_stars_count": 7, "max_issues_count": 21, "max_forks_count": 2, "avg_line_length": 1090.5, "max_line_length": 2180, "alphanum_fraction": 0.6950939936}
import{o as e,C as t}from"../../olMap-8ffb7ea3.js";import{O as o}from"../../Overlay-e6570afb.js";import{aE as n}from"../../size-aa14a1dc.js";import{$ as i}from"../../mapDef-32126832.js";import"./toolbar.js";const a=e.get(),l=new t('\n<template id="geolocationtemplate">\n  <style>\n    #geolocationContainer {\n      position: absolute;\n      top: 15px;\n      left: 100px;\n      font-size: 1em;\n    }\n  </style>\n  <div id="geolocationContainer">\n    <button id="geolocationbutton" title="Geolocation"><i class="fa fa-map-marker fa-lg"></i></button>\n  </div>\n</template>\n\n<template id="geomarkertemplate">\n  <div id="geomarker"><i class="fa fa-location-arrow"></i></div>\n</template>\n\n<template id="geolocationhelptemplate">\n  <section>\n    <div id="geolocation-title" class="helptitle">Geolocation</div>\n    <div id="geolocation-content" class="helpcontent">\n      <div id="geolocation-text">\n        <p>Click on the marker button to fetch the current position from the device. This can take several seconds.</p>\n      </div>\n    </div>\n  </section>\n</template>\n',"geolocation");let s=l.getTemplate("geolocation");e.addControl(s);const r="Unable to retrieve your location",c="Position outside map extent",d="Geolocation is not supported by your browser";s=l.getTemplate("geomarker");const p=s.getElementById("geomarker"),g=new o({positioning:"center-center",element:p});a.addOverlay(g),i("#geolocationbutton").addEventListener("click",()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition((function(e){let t=[parseFloat(e.coords.longitude),parseFloat(e.coords.latitude)];t=n(t,"EPSG:4326",a.get("view").getProjection());const o=a.get("view").extent;if(o[0]<=t[0]&&t[0]<=o[2]&&o[1]<=t[1]&&t[1]<=o[3]){a.get("view").setCenter(t),a.get("view").setZoom(a.get("view").zoomIn);const o=e.heading?e.heading-45:-45;p.firstChild.style.transform="rotate("+o+"deg)",g.set("position",t)}else alert(c)}),(function(){alert(r)})):alert(d)}),i("#help-content").appendChild(l.getTemplate("geolocationhelp")),i("#geolocation-title").addEventListener("click",(function(){const e=this.nextElementSibling;e.style.display="block"==e.style.display?"none":"block"}));
