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.48 to 0.1.49

2

layer/solar.js

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

function a(b){this.options=c.deepMerge(a.options,b)}var b=require('three'),c=require('./../core/utils'),d=c.requestAnimationFrame;a.options={ambient:{color:'#fff',intensity:.5},spot:{color:'#333',intensity:10},isSolar:!1,radius:4e8,phi:10},a.prototype.addTo=function(a){this._map=a;var b=this.three3D=a.three3D;this.projection=a.projection,this.init(this.options),this.loop()},a.prototype.init=function(c){var d=this._map;this.lightMax=2;var e=this.three3D,a=this.spot=new b.SpotLight(c.spot.color,c.spot.intensity);a.lookAt(d.options.center||d.center),a.castShadow=!0,a.shadowMapWidth=1024,a.shadowMapHeight=1024,e.add(a);var f=this.ambient=new b.AmbientLight(c.ambient.color,c.ambient.intensity);e.add(f)},a.prototype.updateOptions=function(a){this.options=c.deepMerge(this.options,a),this.updateSolar()},a.prototype.updateSolar=function(){var a=this.options,c=new b.Color(a.ambient.color),d=a.ambient.intensity||1;this.ambient.color.setRGB(c.r*d,c.g*d,c.b*d);var e=new b.Color(a.spot.color);this.spot.color.setRGB(e.r,e.g,e.b),this.spot.intensity=a.spot.intensity},a.prototype.genMaterial=function(c){var a={side:b.BackSide,color:16711680};return new b.MeshBasicMaterial(a)},a.prototype.updateSolarPos=function(){var a=this.options.radius||this.projection.radius*8,b=this.options.phi,c=a*Math.cos(b),d=a*Math.sin(-.044444444444444446*Math.PI),e=a*Math.sin(b);this.spot.position.set(c,d,e)},a.prototype.update=function(){var b=this.three3D.camera,a=b.position,c=a.x,d=a.y,e=a.z;this.spot.position.set(c,d,e)},a.prototype.loop=function(){this.update(),this.loopId=d(this.loop.bind(this))},a.prototype.remove=function(){this.three3D.remove(this.spot),this.three3D.remove(this.ambient),this.spot&&this.spot.dispose&&this.spot.dispose(),this.ambient&&this.ambient.dispose&&this.ambient.dispose(),this.spot=null,this.ambient=null,window.cancelAnimationFrame(this.loopId)},module.exports=a
function a(b){this.options=c.deepMerge(a.options,b)}var b=require('three'),c=require('./../core/utils'),d=c.requestAnimationFrame;a.options={ambient:{color:'#fff',intensity:.5},spot:{color:'#333',intensity:10},isSolar:!1,radius:4e8,phi:10},a.prototype.addTo=function(a){this._map=a;var b=this.three3D=a.three3D;this.projection=a.projection,this.init(this.options),this.loop()},a.prototype.init=function(d){var f=this._map;this.lightMax=2;var g=this.three3D,a=this.spot=new b.SpotLight(d.spot.color,d.spot.intensity);a.lookAt(f.options.center||f.center),a.castShadow=!0,a.shadowMapWidth=1024,a.shadowMapHeight=1024,g.add(a);var c=new b.Color(d.ambient.color),e=d.ambient.intensity||1,h=this.ambient=new b.AmbientLight(c);h.color.setRGB(c.r*e,c.g*e,c.b*e),g.add(h)},a.prototype.updateOptions=function(a){a&&(this.options=c.deepMerge(this.options,a)),this.updateSolar()},a.prototype.updateSolar=function(){var a=this.options,c=new b.Color(a.ambient.color),d=a.ambient.intensity||1;this.ambient.color.setRGB(c.r*d,c.g*d,c.b*d);var e=new b.Color(a.spot.color);this.spot.color.setRGB(e.r,e.g,e.b),this.spot.intensity=a.spot.intensity},a.prototype.genMaterial=function(c){var a={side:b.BackSide,color:16711680};return new b.MeshBasicMaterial(a)},a.prototype.updateSolarPos=function(){var a=this.options.radius||this.projection.radius*8,b=this.options.phi,c=a*Math.cos(b),d=a*Math.sin(-.044444444444444446*Math.PI),e=a*Math.sin(b);this.spot.position.set(c,d,e)},a.prototype.update=function(){var b=this.three3D.camera,a=b.position,c=a.x,d=a.y,e=a.z;this.spot.position.set(c,d,e)},a.prototype.loop=function(){this.update(),this.loopId=d(this.loop.bind(this))},a.prototype.remove=function(){this.three3D.remove(this.spot),this.three3D.remove(this.ambient),this.spot&&this.spot.dispose&&this.spot.dispose(),this.ambient&&this.ambient.dispose&&this.ambient.dispose(),this.spot=null,this.ambient=null,window.cancelAnimationFrame(this.loopId)},module.exports=a

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

function c(b){var a;Array.isArray(b)?a=[]:a={};for(var c in b)a[c]=b[c];return a}function a(c,d){c=this.container=b.getContainer(c),d=this.options=b.deepMerge(a.options,d),this.setProjection(),this.initialize(c,d),this.initEvents()}var l=require('leaflet'),d=require('three'),e=require('bcore/event'),b=require('bcore/utils'),k=require('./../render/three3d'),h=require('./interactions'),i=require('./projection/sphere'),j=require('./projection/mecator'),g=require('./projection/normal'),f=require('./projection/origin');a.options={projection:'plane',rotation:{x:-1.53407346410207,y:Math.PI/4},rotateSpeed:.1,autoRotateSpeed:0,distance:19378137,distanceSpeed:.3,center:null,moveSpeed:.2,globalAlpha:1,clearAlpha:1,angle:50,far:1e7,near:10,clearColor:0,background:'transparent',pointerEvents:'auto'},a=e.extend(a,{init3d:function(a){var d=this.options,b=this.three3D=new k(a,this.getThree3dOptions()),c=this.interaction=new h(a,this.getInteractionOptions());c.linkTo(b.camera)},getInteractionOptions:function(){var a=this.options,b=a.center;return a?b&&(b=this.processingCenter(a.center)):a=this.options,{rotation:{target:a.rotation,speed:a.rotateSpeed,autoRotateSpeed:a.autoRotateSpeed},distance:{target:a.distance,speed:a.distanceSpeed},center:{target:b},lookAt:{target:b,speed:a.moveSpeed}}},getThree3dOptions:function(){var a=this.options;return{alpha:a.globalAlpha,clearAlpha:a.clearAlpha,clearColor:a.clearColor,background:a.background,camera:{angle:a.angle,far:a.far,near:a.near},pointerEvents:a.pointerEvents}},initialize:function(b,c){var a=this.options.center||{lat:40,lng:100};if(!a)return console.log('必须有中心点');this.setCenter(a),this.init3d(b),this.addLight()},setProjection:function(){var b=this.options,a=b.projection;if(typeof a==='object')return;if(typeof a!=='string')return console.log('可能projection格式有误');this.projection={normal:g,sphere:i,plane:j,origin:f}[a]},setCenter:function(a){this.center=a,this.updatePosition(a)},setView:function(){},setRadius:function(){},getCenter:function(){},openDetect:function(){this.interaction.openDetect()},closeDetect:function(){this.interaction.closeDetect()},addLight:function(){},processingCenter:function(a){return a?a.x!==undefined&&a.y!==null?new d.Vector3(a.x,a.y,a.z):this.projection.project(a):null},updatePosition:function(a){var b=this.options,a=this.processingCenter(a);this.interaction&&this.interaction.flying({rotation:b.rotation,center:a,lookAt:a,distance:b.distance}),this.directionalLight&&this.directionalLight.position.set(a.x+1e3,5e3,a.z),this.directionalLight&&this.directionalLight.lookAt(a)},updateCamera:function(){var a=this.options;this.three3D.updateCamera({angle:a.angle,far:a.far,near:a.near})},updateOptions:function(a){typeof a==='object'&&(this.options=b.deepMerge(this.options,a)),a=this.options,this.interaction&&this.interaction.updateOptions(this.getInteractionOptions()),this.three3D.updateOptions(this.getThree3dOptions())},initEvents:function(){var a=this.interaction,b=this.options;a.on('zoom',function(){b.distance=a.options.distance.target}).on('rotate',function(){b.rotation=c(a.options.rotation.target)}).on('move',function(){b.center=c(a.options.lookAt.target),b.lookAt=c(a.options.lookAt.target)})}}),module.exports=a
function c(b){var a;Array.isArray(b)?a=[]:a={};for(var c in b)a[c]=b[c];return a}function a(c,d){c=this.container=b.getContainer(c),d=this.options=b.deepMerge(a.options,d),this.setProjection(),this.initialize(c,d),this.initEvents()}var f=require('three'),d=require('bcore/event'),b=require('bcore/utils'),k=require('./../render/three3d'),g=require('./interactions'),h=require('./projection/sphere'),i=require('./projection/mecator'),j=require('./projection/normal'),e=require('./projection/origin');a.options={projection:'plane',rotation:{x:-1.53407346410207,y:Math.PI/4},rotateSpeed:.1,autoRotateSpeed:0,distance:19378137,distanceSpeed:.3,center:null,moveSpeed:.2,globalAlpha:1,clearAlpha:1,angle:50,far:1e7,near:10,clearColor:0,background:'transparent',pointerEvents:'auto'},a=d.extend(a,{init3d:function(a){var d=this.options,b=this.three3D=new k(a,this.getThree3dOptions()),c=this.interaction=new g(a,this.getInteractionOptions());c.linkTo(b.camera)},getInteractionOptions:function(){var a=this.options,b=a.center;return a?b&&(b=this.processingCenter(a.center)):a=this.options,{rotation:{target:a.rotation,speed:a.rotateSpeed,autoRotateSpeed:a.autoRotateSpeed},distance:{target:a.distance,speed:a.distanceSpeed},center:{target:b},lookAt:{target:b,speed:a.moveSpeed}}},getThree3dOptions:function(){var a=this.options;return{alpha:a.globalAlpha,clearAlpha:a.clearAlpha,clearColor:a.clearColor,background:a.background,camera:{angle:a.angle,far:a.far,near:a.near},pointerEvents:a.pointerEvents}},initialize:function(b,c){var a=this.options.center||{lat:40,lng:100};if(!a)return console.log('必须有中心点');this.setCenter(a),this.init3d(b),this.addLight()},setProjection:function(){var b=this.options,a=b.projection;if(typeof a==='object')return;if(typeof a!=='string')return console.log('可能projection格式有误');this.projection={normal:j,sphere:h,plane:i,origin:e}[a]},setCenter:function(a){this.center=a,this.updatePosition(a)},setView:function(){},setRadius:function(){},getCenter:function(){},openDetect:function(){this.interaction.openDetect()},closeDetect:function(){this.interaction.closeDetect()},addLight:function(){},processingCenter:function(a){return a?a.x!==undefined&&a.y!==null?new f.Vector3(a.x,a.y,a.z):this.projection.project(a):null},updatePosition:function(a){var b=this.options,a=this.processingCenter(a);this.interaction&&this.interaction.flying({rotation:b.rotation,center:a,lookAt:a,distance:b.distance}),this.directionalLight&&this.directionalLight.position.set(a.x+1e3,5e3,a.z),this.directionalLight&&this.directionalLight.lookAt(a)},updateCamera:function(){var a=this.options;this.three3D.updateCamera({angle:a.angle,far:a.far,near:a.near})},updateOptions:function(a){typeof a==='object'&&(this.options=b.deepMerge(this.options,a)),a=this.options,this.interaction&&this.interaction.updateOptions(this.getInteractionOptions()),this.three3D.updateOptions(this.getThree3dOptions())},initEvents:function(){var a=this.interaction,b=this.options;a.on('zoom',function(){b.distance=a.options.distance.target}).on('rotate',function(){b.rotation=c(a.options.rotation.target)}).on('move',function(){b.center=c(a.options.lookAt.target),b.lookAt=c(a.options.lookAt.target)})}}),module.exports=a

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

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