{"version":3,"file":"mapbox-BcxenJ-3.js","sources":["../../../app/assets/javascripts/utils/mapbox.js"],"sourcesContent":["// this code more or less is taken directly from\n// https://docs.mapbox.com/mapbox-gl-js/example/add-image-animated/\nconst pulsingDot = (size) => ({\n width: size,\n height: size,\n data: new Uint8Array(size * size * 4),\n\n // get rendering context for the map canvas when layer is added to the map\n onAdd: function () {\n const canvas = document.createElement('canvas');\n canvas.width = this.width;\n canvas.height = this.height;\n this.context = canvas.getContext('2d');\n },\n\n // called once before every frame where the icon will be used\n render: function () {\n const duration = 1500;\n const t = (performance.now() % duration) / duration;\n\n const radius = (size / 2) * 0.3;\n const outerRadius = (size / 2) * 0.7 * t + radius;\n const { context } = this;\n\n // draw outer circle\n context.clearRect(0, 0, this.width, this.height);\n context.beginPath();\n context.arc(this.width / 2, this.height / 2, outerRadius, 0, Math.PI * 2);\n context.fillStyle = `rgba(248, 202, 70, ${1 - t})`;\n context.fill();\n\n // draw inner circle\n context.beginPath();\n context.arc(this.width / 2, this.height / 2, radius, 0, Math.PI * 2);\n context.fillStyle = 'rgba(248, 202, 70, 1)';\n context.strokeStyle = 'white';\n context.lineWidth = 1;\n context.fill();\n context.stroke();\n\n // update this image's data with data from the canvas\n this.data = context.getImageData(0, 0, this.width, this.height).data;\n\n // continuously repaint the map, resulting in the smooth animation of the dot\n map.triggerRepaint();\n\n // return `true` to let the map know that the image was updated\n return true;\n },\n});\n\nexport { pulsingDot };\n"],"names":["pulsingDot","size","canvas","t","radius","outerRadius","context"],"mappings":"AAEK,MAACA,EAAcC,IAAU,CAC5B,MAAOA,EACP,OAAQA,EACR,KAAM,IAAI,WAAWA,EAAOA,EAAO,CAAC,EAGpC,MAAO,UAAY,CACjB,MAAMC,EAAS,SAAS,cAAc,QAAQ,EAC9CA,EAAO,MAAQ,KAAK,MACpBA,EAAO,OAAS,KAAK,OACrB,KAAK,QAAUA,EAAO,WAAW,IAAI,CACtC,EAGD,OAAQ,UAAY,CAElB,MAAMC,EAAK,YAAY,IAAK,EAAG,KAAY,KAErCC,EAAUH,EAAO,EAAK,GACtBI,EAAeJ,EAAO,EAAK,GAAME,EAAIC,EACrC,CAAE,QAAAE,CAAO,EAAK,KAGpB,OAAAA,EAAQ,UAAU,EAAG,EAAG,KAAK,MAAO,KAAK,MAAM,EAC/CA,EAAQ,UAAW,EACnBA,EAAQ,IAAI,KAAK,MAAQ,EAAG,KAAK,OAAS,EAAGD,EAAa,EAAG,KAAK,GAAK,CAAC,EACxEC,EAAQ,UAAY,sBAAsB,EAAIH,CAAC,IAC/CG,EAAQ,KAAM,EAGdA,EAAQ,UAAW,EACnBA,EAAQ,IAAI,KAAK,MAAQ,EAAG,KAAK,OAAS,EAAGF,EAAQ,EAAG,KAAK,GAAK,CAAC,EACnEE,EAAQ,UAAY,wBACpBA,EAAQ,YAAc,QACtBA,EAAQ,UAAY,EACpBA,EAAQ,KAAM,EACdA,EAAQ,OAAQ,EAGhB,KAAK,KAAOA,EAAQ,aAAa,EAAG,EAAG,KAAK,MAAO,KAAK,MAAM,EAAE,KAGhE,IAAI,eAAgB,EAGb,EACR,CACH"}