(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pvm_MbMeasureTool"],{"1bfa":function(e,t,n){"use strict";n.r(t);n("4de4"),n("d81d");var r,o,a=n("e747"),i={name:"MbMeasureTool",mounted:function(){console.log("MbMeasureTool.vue mounted is running");this.$mapboxElement=this.createMapboxElement(),this.$store.state.map.map},methods:{createMapboxElement:function(){var e={id:"labels",type:"raster",source:"labels"};return e},parentMounted:function(e){var t=this.$store.map;console.log("MbMeasureTool.vue parentMounted is running, parent:",e,"map:",t);var n=document.getElementById("distance"),r={type:"FeatureCollection",features:[]},o={type:"Feature",geometry:{type:"LineString",coordinates:[]}};t.addSource("geojson",{type:"geojson",data:r}),t.addLayer({id:"measure-points",type:"circle",source:"geojson",paint:{"circle-radius":5,"circle-color":"#000"},filter:["in","$type","Point"]}),t.addLayer({id:"measure-lines",type:"line",source:"geojson",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#000","line-width":2.5},filter:["in","$type","LineString"]}),t.on("click",(function(e){var i=t.queryRenderedFeatures(e.point,{layers:["measure-points"]});if(r.features.length>1&&r.features.pop(),n.innerHTML="",i.length){var s=i[0].properties.id;r.features=r.features.filter((function(e){return e.properties.id!==s}))}else{var u={type:"Feature",geometry:{type:"Point",coordinates:[e.lngLat.lng,e.lngLat.lat]},properties:{id:String((new Date).getTime())}};r.features.push(u)}if(r.features.length>1){o.geometry.coordinates=r.features.map((function(e){return e.geometry.coordinates})),r.features.push(o);var l=document.createElement("pre");l.textContent="Total distance: "+Object(a["default"])(o).toLocaleString()+"km",n.appendChild(l)}t.getSource("geojson").setData(r)})),t.on("mousemove",(function(e){var n=t.queryRenderedFeatures(e.point,{layers:["measure-points"]});t.getCanvas().style.cursor=n.length?"pointer":"crosshair"}))}},render:function(e){}},s=i,u=n("2877"),l=Object(u["a"])(s,r,o,!1,null,null,null);t["default"]=l.exports}}]);
//# sourceMappingURL=pvm_MbMeasureTool.1431a357.js.map