Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dmap

Package Overview
Dependencies
Maintainers
4
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dmap - npm Package Compare versions

Comparing version 0.1.39 to 0.1.40

2

layer/scatter.js

@@ -1,1 +0,1 @@

'use strict';function a(c){this.options=b.deepMerge(a.options,c)}var b=require('./../core/utils'),g=require('lodash'),h=b.isNone,d=require('./../render/particleMaterial3D'),e=require('./scatter.anim'),c=require('./../three'),f=b.getSprite,i=b.getRange;a.options={blending:c.AdditiveBlending,ratio:1,lat:b.getLat,lng:b.getLng,id:function(a,b){return a.id||a.adcode||b},scatterN:1e3,maxPtSize:5,minPtSize:2,maxOpacity:1,color:'#0ff',sprite:{drawN:1.15,width:128,height:128,color:{from:'hsla(20,100%,75%,0.8)',to:'hsla(120,100%,50%,0.1)',easing:'Linear.None.1.7',space:'rgb'}},offset:{x:0,y:2e5,z:0},value:function(a){return a.value},size:function(c,a,d){var b=(c.value-a)/(d-a);return b*(this.maxPtSize-this.minPtSize)+this.minPtSize},anim:{easing:'Bounce.In',time:3e3}},a.prototype.addTo=function(a){this._map=a,this.three3D=a.three3D,this.initParticles(),this.initAnim(),this.projection=a.projection},a.prototype.data=function(g){var f={},e,j,a,d=this.options,h=d.value.bind(d),i=d.id.bind(d),b,c;for(var k in g)e=g[k],j=i(e),f[j]=e,a=h(e),(b===null||b===undefined)&&(b=a),(c===null||c===undefined)&&(c=a),b>a&&(b=a),c<a&&(c=a);this._data=f,this.range=[b,c]},a.prototype.addAttributes=function(f){var i=this.options,b=i.scatterN,g=new Float32Array(b),d=new Float32Array(b*4),e=new Float32Array(b*3),h=new Float32Array(b);for(var a=0;a<b;a++)g[a*1]=0,d[a*4+0]=1,d[a*4+1]=1,d[a*4+2]=1,d[a*4+3]=1,h[a*1]=1,e[a*3+0]=0,e[a*3+1]=0,e[a*3+2]=0;f.addAttribute('sizes',new c.BufferAttribute(g,1,1).setDynamic(!0)),f.addAttribute('colors',new c.BufferAttribute(d,4,1).setDynamic(!0)),f.addAttribute('scales',new c.BufferAttribute(h,1,1).setDynamic(!0)),f.addAttribute('position',new c.BufferAttribute(e,3,1).setDynamic(!0))},a.prototype.clean=function(d){var b=this.particleGeometry,a=b.getAttribute('sizes').array;for(var c in a)a[c]=0;d&&this.updateSize()},a.prototype.draw=function(){var l=this._data;this.clean();var r=this.particles=this.particles||{},s=this.projection.project.bind(this.projection),y=this.material,x=this.particleGeometry.vertices,n=this.particleGeometry.getAttribute('sizes').array,f=this.particleGeometry.getAttribute('position').array,a=this.options,i=this.range,g=a.ratio,w=i[0],m=i[1],t=a.lng,o=a.lat,p=a.size.bind(a),q=a.id.bind(a),c,d,j,k,v,e=a.offset,u,b=0;for(var h in l){if(c=l[h],u=q(c,h),j=o(c),k=t(c),!(j&&k))continue;if(d=s({lat:j,lng:k},e.x,e.y,e.z),!d)continue;v=p(c,w,m),n[b]=v,f[3*b+0]=d.x*g,f[3*b+1]=d.y*g,f[3*b+2]=d.z*g,r[u]={attributesIndex:b},b++}this.updatePosition(),this.updateSize()},a.prototype.render=function(a){a&&this.data(a),this.draw()},a.prototype.initParticles=function(){var e=this.three3D,f=this.particleMaterial=new d(this.getMatOptions()),g=this.material=f.getMaterial(),a=this.particleGeometry=new c.BufferGeometry;this.addAttributes(a);var b=this.pointCloud=new c.Points(a,g);b.frustumCulled=!1,e.add(b),this.updateSize()},a.prototype.getMatOptions=function(){var a=this.options;return{sprite:f(a.sprite),scatterN:a.scatterN,maxPtSize:a.maxPtSize,maxOpacity:a.maxOpacity,reverseSpriteColor:a.reverseSpriteColor,blending:a.blending}},a.prototype.hide=function(){this.pointCloud.visible=!1},a.prototype.show=function(){this.pointCloud.visible=!0},a.prototype.updateOptions=function(a){this.options=b.deepMerge(this.options,a),this.particleMaterial.updateOptions(this.getMatOptions()),this.draw()},a.prototype.loop=function(){this.updateSize()},a.prototype.updateSize=function(){this.particleGeometry.getAttribute('sizes').needsUpdate=!0,this.material.needsUpdate=!0},a.prototype.updatePosition=function(){this.particleGeometry.verticesNeedUpdate=!0,this.particleGeometry.getAttribute('position').needsUpdate=!0},a.prototype.updateSprite=function(a){},a.prototype.remove=function(){this.three3D.remove(this.pointCloud)},a.prototype=b.extend(a.prototype,e),module.exports=a
'use strict';function a(c){this.options=b.deepMerge(a.options,c)}var b=require('./../core/utils'),g=require('lodash'),h=b.isNone,d=require('./../render/particleMaterial3D'),e=require('./scatter.anim'),c=require('./../three'),f=b.getSprite,i=b.getRange;a.options={blending:c.AdditiveBlending,ratio:1,lat:b.getLat,lng:b.getLng,id:function(a,b){return a.id||a.adcode||b},scatterN:1e3,maxPtSize:5,minPtSize:2,maxOpacity:1,color:'#0ff',sprite:{drawN:1.15,width:128,height:128,color:{from:'hsla(20,100%,75%,0.8)',to:'hsla(120,100%,50%,0.1)',easing:'Linear.None.1.7',space:'rgb'}},offset:{x:0,y:2e5,z:0},value:function(a){return a.value},size:function(c,a,d){var b=(c.value-a)/(d-a);return b*(this.maxPtSize-this.minPtSize)+this.minPtSize},anim:{easing:'Bounce.In',time:3e3}},a.prototype.addTo=function(a){this._map=a,this.three3D=a.three3D,this.initParticles(),this.initAnim(),this.projection=a.projection},a.prototype.data=function(g){var f={},e,j,a,d=this.options,h=d.value.bind(d),i=d.id.bind(d),b,c;for(var k in g)e=g[k],j=i(e),f[j]=e,a=h(e),(b===null||b===undefined)&&(b=a),(c===null||c===undefined)&&(c=a),b>a&&(b=a),c<a&&(c=a);this._data=f,this.range=[b,c]},a.prototype.addAttributes=function(f){var i=this.options,b=i.scatterN,g=new Float32Array(b),d=new Float32Array(b*4),e=new Float32Array(b*3),h=new Float32Array(b);for(var a=0;a<b;a++)g[a*1]=0,d[a*4+0]=1,d[a*4+1]=1,d[a*4+2]=1,d[a*4+3]=1,h[a*1]=1,e[a*3+0]=0,e[a*3+1]=0,e[a*3+2]=0;f.addAttribute('sizes',new c.BufferAttribute(g,1,1).setDynamic(!0)),f.addAttribute('colors',new c.BufferAttribute(d,4,1).setDynamic(!0)),f.addAttribute('scales',new c.BufferAttribute(h,1,1).setDynamic(!0)),f.addAttribute('position',new c.BufferAttribute(e,3,1).setDynamic(!0))},a.prototype.clean=function(f){var c=this.options,d=c.scatterN,e=this.particleGeometry.getAttribute('sizes').array,b=this.particleGeometry.getAttribute('position').array;for(var a=0;a<d;a++)e[a*1]=0,b[a*3+0]=0,b[a*3+1]=0,b[a*3+2]=0;f&&this.updateSize()},a.prototype.draw=function(){var l=this._data;this.clean();var r=this.particles=this.particles||{},s=this.projection.project.bind(this.projection),y=this.material,x=this.particleGeometry.vertices,n=this.particleGeometry.getAttribute('sizes').array,f=this.particleGeometry.getAttribute('position').array,a=this.options,i=this.range,g=a.ratio,w=i[0],m=i[1],t=a.lng,o=a.lat,p=a.size.bind(a),q=a.id.bind(a),c,d,j,k,v,e=a.offset,u,b=0;for(var h in l){if(c=l[h],u=q(c,h),j=o(c),k=t(c),!(j&&k))continue;if(d=s({lat:j,lng:k},e.x,e.y,e.z),!d)continue;v=p(c,w,m),n[b]=v,f[3*b+0]=d.x*g,f[3*b+1]=d.y*g,f[3*b+2]=d.z*g,r[u]={attributesIndex:b},b++}this.updatePosition(),this.updateSize()},a.prototype.render=function(a){a&&this.data(a),this.draw()},a.prototype.initParticles=function(){var e=this.three3D,f=this.particleMaterial=new d(this.getMatOptions()),g=this.material=f.getMaterial(),a=this.particleGeometry=new c.BufferGeometry;this.addAttributes(a);var b=this.pointCloud=new c.Points(a,g);b.frustumCulled=!1,e.add(b),this.updateSize()},a.prototype.getMatOptions=function(){var a=this.options;return{sprite:f(a.sprite),scatterN:a.scatterN,maxPtSize:a.maxPtSize,maxOpacity:a.maxOpacity,reverseSpriteColor:a.reverseSpriteColor,blending:a.blending}},a.prototype.hide=function(){this.pointCloud.visible=!1},a.prototype.show=function(){this.pointCloud.visible=!0},a.prototype.updateOptions=function(a){this.options=b.deepMerge(this.options,a),this.particleMaterial.updateOptions(this.getMatOptions()),this.draw()},a.prototype.loop=function(){this.updateSize()},a.prototype.updateSize=function(){this.particleGeometry.getAttribute('sizes').needsUpdate=!0,this.material.needsUpdate=!0},a.prototype.updatePosition=function(){this.particleGeometry.verticesNeedUpdate=!0,this.particleGeometry.getAttribute('position').needsUpdate=!0},a.prototype.updateSprite=function(a){},a.prototype.remove=function(){this.three3D.remove(this.pointCloud)},a.prototype=b.extend(a.prototype,e),module.exports=a

@@ -5,3 +5,3 @@ {

"description": "3d map visualization lib",
"version": "0.1.39",
"version": "0.1.40",
"scripts": {

@@ -8,0 +8,0 @@ "test": "mocha -r jscoverage test"

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc