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

dmap

Package Overview
Dependencies
Maintainers
5
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.69 to 0.2.1

2

layer/globe_canvas.js

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

'use strict';const a=require('three');const c=require('bcore/event');const b=require('./../core/utils');const d={maxOpacity:.8,ratio:.98,color:16777215,xN:30,yN:30,width:2048,height:1024,material:{}};class e extends c{constructor(a){super(),this.options=b.deepMerge(d,a||{})}addTo(b){if(!b)return;this.three3D=b.three3D;let a=this.projection=b.projection;if(a.type==='plane'||a.type==='mecator'||a.type==='origin')return;this.initGlobe()}initGlobe(){let b=this.options;let d=this.projection;let e=(d.radius||1)*b.ratio;let f=this.globeGeometry=new a.SphereBufferGeometry(e,b.xN,b.yN);let g=this.material=this.createMaterial();let c=this.globeMesh=new a.Mesh(f,g);c.scale.set(b.ratio,b.ratio,b.ratio),this.three3D.add(c)}createMaterial(){let b=this.options;let c=new a.Color(b.color);let d=b.maxOpacity;let e=this.createTexture();return new a.MeshBasicMaterial({map:e,color:c,opacity:d,transparent:!0})}createTexture(){let c=this.createCanvas();let b=this.texture=new a.Texture(c);return b.needsUpdate=!0,b}createCanvas(){let b=this.options;let a=this.canvas=document.createElement('canvas');return a.width=b.width,a.height=b.height,a}getCanvas(){return this.canvas}update(){this.texture.needsUpdate=!0,this.material.needsUpdate=!0,this.material.map.needsUpdate=!0}updateOptions(a){this.options=b.deepMerge(this.options,a),this.updateGlobe()}updateGlobe(){let b=this.options;let c=b.ratio;let e=b.maxOpacity;let d=new a.Color(b.color);this.material&&this.material.color.setRGB(d.r,d.g,d.b),this.material&&(this.material.opacity=e),this.globeMesh&&this.globeMesh.scale.set(c,c,c)}remove(){this.three3D.remove(this.globeMesh),this.globeMesh&&this.globeMesh.dispose&&this.globeMesh.dispose(),this.globeMesh.material&&this.globeMesh.material.dispose(),this.globeMesh.geometry&&this.globeMesh.geometry.dispose(),this.material=null,this.globeMesh=null,this.globeGeometry=null,this.canvas=null,loopId&&window.cancelAnimationFrame(this.loopId)}loop(){this.update(),this.loopId=window.requestAnimationFrame(this.loop.bind(this))}}module.exports=e
'use strict';const a=require('three');const c=require('bcore/event');const b=require('./../core/utils');const d={maxOpacity:.8,ratio:.98,color:16777215,xN:30,yN:30,width:2048,height:1024,material:{}};class e extends c{constructor(a){super(),this.options=b.deepMerge(d,a||{})}addTo(b){if(!b)return;this.three3D=b.three3D;let a=this.projection=b.projection;if(a.type==='plane'||a.type==='mecator'||a.type==='origin')return;this.initGlobe()}initGlobe(){let b=this.options;let d=this.projection;let e=(d.radius||1)*b.ratio;let f=this.globeGeometry=new a.SphereBufferGeometry(e,b.xN,b.yN);let g=this.material=this.createMaterial();let c=this.globeMesh=new a.Mesh(f,g);c.scale.set(b.ratio,b.ratio,b.ratio),this.three3D.add(c)}createMaterial(){let b=this.options;let c=new a.Color(b.color);let d=b.maxOpacity;let e=this.createTexture();return new a.MeshBasicMaterial({map:e,color:c,opacity:d,transparent:!0})}createTexture(){let c=this.createCanvas();let b=this.texture=new a.Texture(c);return b.needsUpdate=!0,b}createCanvas(){let b=this.options;let a=this.canvas=document.createElement('canvas');return a.width=b.width,a.height=b.height,a}getCanvas(){return this.canvas}update(){this.texture.needsUpdate=!0,this.material.needsUpdate=!0,this.material.map.needsUpdate=!0}updateOptions(a){this.options=b.deepMerge(this.options,a),this.updateGlobe()}updateGlobe(){let b=this.options;let c=b.ratio;let e=b.maxOpacity;let d=new a.Color(b.color);this.material&&this.material.color.setRGB(d.r,d.g,d.b),this.material&&(this.material.opacity=e),this.globeMesh&&this.globeMesh.scale.set(c,c,c)}remove(){this.three3D.remove(this.globeMesh),this.globeMesh&&this.globeMesh.dispose&&this.globeMesh.dispose(),this.globeMesh.material&&this.globeMesh.material.dispose(),this.globeMesh.geometry&&this.globeMesh.geometry.dispose(),this.material=null,this.globeMesh=null,this.globeGeometry=null,this.canvas=null,this.loopId&&window.cancelAnimationFrame(this.loopId)}loop(){this.update(),this.loopId=window.requestAnimationFrame(this.loop.bind(this))}}module.exports=e

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

"description": "3d map visualization lib",
"version": "0.1.69",
"version": "0.2.1",
"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