Socket
Socket
Sign inDemoInstall

leaflet-webgl-heatmap

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.6 to 0.2.7

2

dist/leaflet-webgl-heatmap.min.js

@@ -6,2 +6,2 @@ /*

*/
L.WebGLHeatMap=L.Renderer.extend({version:"0.2.2",options:{size:3e4,units:"m",opacity:1,gradientTexture:!1,alphaRange:1,padding:0},_initContainer:function(){var t=this._container=L.DomUtil.create("canvas","leaflet-zoom-animated"),i=this.options;t.id="webgl-leaflet-"+L.Util.stamp(this),t.style.opacity=i.opacity,t.style.position="absolute";try{this.gl=window.createWebGLHeatmap({canvas:t,gradientTexture:i.gradientTexture,alphaRange:[0,i.alphaRange]})}catch(t){console.error(t),this.gl={clear:function(){},update:function(){},multiply:function(){},addPoint:function(){},display:function(){},adjustSize:function(){}}}this._container=t},onAdd:function(){this.size=this.options.size,L.Renderer.prototype.onAdd.call(this),this.resize()},getEvents:function(){var t=L.Renderer.prototype.getEvents.call(this);return L.Util.extend(t,{resize:this.resize,move:L.Util.throttle(this._update,49,this)}),t},resize:function(){var t=this._container,i=this._map.getSize();t.width=i.x,t.height=i.y,this.gl.adjustSize(),this.draw()},reposition:function(){var t=this._map._getMapPanePos().multiplyBy(-1);L.DomUtil.setPosition(this._container,t)},_update:function(){L.Renderer.prototype._update.call(this),this.draw()},draw:function(){var t=this._map,i=this.gl,e=this.data,a=e.length,n=Math.floor,s=this["_scale"+this.options.units].bind(this),o=this._multiply;if(t){if(i.clear(),this.reposition(),a){for(var r=0;r<a;r++){var l=e[r],h=L.latLng(l),u=t.latLngToContainerPoint(h);i.addPoint(n(u.x),n(u.y),s(h),l[2])}i.update(),o&&(i.multiply(o),i.update())}i.display()}},_scalem:function(t){var i=this._map,e=this.size/40075017*360/Math.cos(Math.PI/180*t.lat),a=new L.LatLng(t.lat,t.lng-e),n=i.latLngToLayerPoint(t),s=i.latLngToLayerPoint(a);return Math.max(Math.round(n.x-s.x),1)},_scalepx:function(){return this.size},data:[],addDataPoint:function(t,i,e){this.data.push([t,i,e/100])},setData:function(t){this.data=t,this._multiply=null,this.draw()},clear:function(){this.setData([])},multiply:function(t){this._multiply=t,this.draw()}}),L.webGLHeatmap=function(t){return new L.WebGLHeatMap(t)};
L.WebGLHeatMap=L.Renderer.extend({version:"0.2.7",options:{size:3e4,units:"m",opacity:1,gradientTexture:!1,alphaRange:1,padding:0},_initContainer:function(){var t=this._container=L.DomUtil.create("canvas","leaflet-zoom-animated"),i=this.options;t.id="webgl-leaflet-"+L.Util.stamp(this),t.style.opacity=i.opacity,t.style.position="absolute";try{this.gl=window.createWebGLHeatmap({canvas:t,gradientTexture:i.gradientTexture,alphaRange:[0,i.alphaRange]})}catch(t){console.error(t),this.gl={clear:function(){},update:function(){},multiply:function(){},addPoint:function(){},display:function(){},adjustSize:function(){}}}this._container=t},onAdd:function(){this.size=this.options.size,L.Renderer.prototype.onAdd.call(this),this.resize()},_destroyContainer:function(){delete this.gl,L.DomUtil.remove(this._container),L.DomEvent.off(this._container),delete this._container},getEvents:function(){var t=L.Renderer.prototype.getEvents.call(this);return L.Util.extend(t,{resize:this.resize,move:L.Util.throttle(this._update,49,this)}),t},resize:function(){var t=this._container,i=this._map.getSize();t.width=i.x,t.height=i.y,this.gl.adjustSize(),this.draw()},reposition:function(){var t=this._map._getMapPanePos().multiplyBy(-1);L.DomUtil.setPosition(this._container,t)},_update:function(){L.Renderer.prototype._update.call(this),this.draw()},draw:function(){var t=this._map,i=this.gl,e=this.data,n=e.length,a=Math.floor,o=this["_scale"+this.options.units].bind(this),s=this._multiply;if(t){if(i.clear(),this.reposition(),n){for(var r=0;r<n;r++){var l=e[r],h=L.latLng(l),d=t.latLngToContainerPoint(h);i.addPoint(a(d.x),a(d.y),o(h),l[2])}i.update(),s&&(i.multiply(s),i.update())}i.display()}},_scalem:function(t){var i=this._map,e=this.size/40075017*360/Math.cos(Math.PI/180*t.lat),n=new L.LatLng(t.lat,t.lng-e),a=i.latLngToLayerPoint(t),o=i.latLngToLayerPoint(n);return Math.max(Math.round(a.x-o.x),1)},_scalepx:function(){return this.size},data:[],addDataPoint:function(t,i,e){this.data.push([t,i,e/100])},setData:function(t){this.data=t,this._multiply=null,this.draw()},clear:function(){this.setData([])},multiply:function(t){this._multiply=t,this.draw()}}),L.webGLHeatmap=function(t){return new L.WebGLHeatMap(t)};
{
"name": "leaflet-webgl-heatmap",
"version": "0.2.6",
"version": "0.2.7",
"description": "A Leaflet plugin for a popular WebGL Heatmap library.",

@@ -18,3 +18,3 @@ "main": "dist/leaflet-webgl-heatmap.min.js",

"jshint": "^2.9.4",
"leaflet": "^1.0.3"
"leaflet": "^1.1.0"
},

@@ -27,3 +27,3 @@ "preinstall": "npm i -g casperjs jshint gulp",

"test-example": "jshint ./example/js/script.js",
"test-casper": "casperjs test ./caspertest.js",
"test-casper": "casperjs test ./tests/ --includes=casper-helpers.js",
"build": "gulp build",

@@ -43,2 +43,8 @@ "release": "./publish.sh || true"

"author": "Ursudio",
"contributors": [
{
"name": "Chris Willey",
"url": "https://github.com/chriswilley"
}
],
"license": "MIT",

@@ -45,0 +51,0 @@ "bugs": {

@@ -6,3 +6,3 @@ WebGL Heatmap Leaflet Plugin

&nbsp;
![Leaflet](http://img.shields.io/badge/leaflet-1.0.1-green.svg?style=flat)
![Leaflet](http://img.shields.io/badge/leaflet-1.1.0-green.svg?style=flat)
&nbsp;

@@ -93,2 +93,2 @@ [![Build Status](https://travis-ci.org/ursudio/leaflet-webgl-heatmap.svg?branch=master)](https://travis-ci.org/ursudio/leaflet-webgl-heatmap)

* MIT: see mit-license
* MIT: see mit-license

@@ -10,3 +10,3 @@ /*

// tested on Leaflet 1.0.3
version: '0.2.2',
version: '0.2.7',

@@ -68,2 +68,10 @@ options: {

// onRemove-ish
_destroyContainer: function () {
delete this.gl;
L.DomUtil.remove(this._container);
L.DomEvent.off(this._container);
delete this._container;
},
// events

@@ -70,0 +78,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc