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.53 to 0.1.54

2

layer/addons/marker.js

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

'use strict';function f(a,b,c){return typeof a==='function'?a(b,c):a}function b(a){a=this.options=c.deepMerge(b.options,a)}var a=require('three'),c=require('bcore/utils'),d=require('bcore/event'),e=require('lodash');b.options={isVisible:!0,width:200,height:100,style:{offsetLeft:30,fontSize:25,color:'#fff',background:'rgba(240,0,0,0)',opacity:function(){return 1}},scaleSize:1e6},b=d.extend(b,{addTo:function(a){if(!a)return;this._map=a,this.three3D=a.three3D,this.init()},init:function(){var b=this.options,c=this.canvas=document.createElement('canvas'),h=this.ctx=c.getContext('2d');c.width=b.width,c.height=b.height;var f=this.texture=new a.Texture(c),g=this.material=new a.SpriteMaterial({map:f,opacity:1,transparent:!0,depthTest:!0,fog:!1}),d=b.scaleSize,e=this.object=new a.Sprite(g);e.scale.set(d,d*b.height/b.width),this.three3D.add(e)},updatePos:function(a){this.position=a,this.object.position.set(a.x,a.y,a.z)},clear:function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},updateTexture:function(d){if(this.clear(),!d)return;var d=this.content=d,l=this,b=this.ctx,c=this.options,i=c.type,g=c.style;b.canvas.height=c.height,b.canvas.width=c.width;var n=b.canvas.width,o=b.canvas.height;if(c.updateCtx)return c.updateCtx(b);if(i==='text'){b.fillStyle=g.background,b.font=g.fontSize+'px Arial';var m=b.measureText(d);b.textBaseline='middle';var k=m.width,h=(n-k)/2;c.offsetLeft&&(h-=g.offsetLeft),b.fillRect(0,0,k+2*h,c.height),b.fillStyle=f(g.color),b.fillText(d,h,c.height/2,k),b.fill(),l.texture.needsUpdate=!0}else if(i==='image'){if(typeof d!=='string'){console.log('need urls of images');return}var j=new a.ImageLoader;j.setCrossOrigin('*'),j.crossOrigin='*',j.load(d,function(a){b.drawImage(a,0,0),l.texture.needsUpdate=!0})}else if(i==='dom'){if(!e.isPlainObject(d)){console.log('content must be object');return}this.drawHTML(b,d)}this.updateVisible()},drawHTML:function(c,b){var g=this,w=b.title||'标题',d=b.content||'这是正文',v=b.titleColor||'#FF0000',u=b.contentColor||'#000',n=b.width||400,s=b.height||300,j=b.titleFontSize||100,e=b.contentFontSize||80,l=b.fontFamily||'serif',p=b.bgImgUrl||'',o=b.paddingLeft||0,q=b.paddingRight||0,r=b.paddingTop||0,k=j,t=s-k,m,i,h,x,f=new a.ImageLoader;f.setCrossOrigin('*'),f.crossOrigin='*',f.load(p,function(s){c.drawImage(s,0,k,n,t),c.font=j+'px '+l,c.fillStyle=v,c.fillText(w,0,j),c.font=e+'px '+l,c.fillStyle=u,m=+(n-o-q),d=d,h=d.split(''),x=h.length*e,i=Math.floor(m/e);for(var a=0;a<Math.ceil(x/m);a++){var b=a*i,f=(a+1)*i>=h.length?h.length:(a+1)*i,p=d.slice(b,f);c.fillText(p,o,r+e*(a+1))}g.texture.image=g.canvas,g.texture.needsUpdate=!0})},updateOptions:function(a){this.options=a,this.update()},updateScale:function(){var a=this.options,c=this.object,b=a.scaleSize;c.scale.set(b,b*a.height/a.width)},update:function(){this.updateVisible(),this.updateScale(),this.updateMaterial()},updateVisible:function(){var a=this.options,b=a.isVisible;b?this.show():this.hide()},show:function(){this.object.visible=!0},hide:function(){this.object.visible=!1},updateMaterial:function(){this.texture.needsUpdate=!0,this.material.needsUpdate=!0,this.material.map.needsUpdate=!0},updateOpacity:function(){var a=this._map.three3D.camera,b=a.position,c=b.distanceTo(this.position),d=this._map.projection.radius,e=this.options,f=e.style.opacity(c/d);this.material.opacity=f},remove:function(){this.three3D.remove(this.object),this.object&&this.object.dispose&&this.object.dispose(),this.material&&this.material.dispose(),this.texture&&this.texture.dispose(),this.object=null,this.material=null,this.texture=null}}),module.exports=b
'use strict';function f(a,b,c){return typeof a==='function'?a(b,c):a}function b(a){a=this.options=c.deepMerge(b.options,a)}var a=require('three'),c=require('bcore/utils'),d=require('bcore/event'),e=require('lodash');b.options={isVisible:!0,width:200,height:100,style:{offsetLeft:30,fontSize:25,color:'#fff',background:'rgba(240,0,0,0)',opacity:function(){return 1}},scaleSize:1e6},b=d.extend(b,{addTo:function(a){if(!a)return;this._map=a,this.three3D=a.three3D,this.init()},init:function(){var b=this.options,c=this.canvas=document.createElement('canvas'),h=this.ctx=c.getContext('2d');c.width=b.width,c.height=b.height;var f=this.texture=new a.Texture(c),g=this.material=new a.SpriteMaterial({map:f,opacity:1,transparent:!0,depthTest:!0,fog:!1}),d=b.scaleSize,e=this.object=new a.Sprite(g);e.scale.set(d,d*b.height/b.width),this.three3D.add(e)},updatePos:function(a){this.position=a,this.object.position.set(a.x,a.y,a.z)},clear:function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},updateTexture:function(d){if(this.clear(),!d)return;var d=this.content=d,l=this,b=this.ctx,c=this.options,i=c.type,g=c.style;b.canvas.height=c.height,b.canvas.width=c.width;var n=b.canvas.width,o=b.canvas.height;if(c.updateCtx)return c.updateCtx(b);if(i==='text'){b.fillStyle=g.background,b.font=g.fontSize+'px Arial';var m=b.measureText(d);b.textBaseline='middle';var k=m.width,h=(n-k)/2;c.offsetLeft&&(h-=g.offsetLeft),b.fillRect(0,0,k+2*h,c.height),b.fillStyle=f(g.color),b.fillText(d,h,c.height/2,k),b.fill(),l.texture.needsUpdate=!0}else if(i==='image'){if(typeof d!=='string'){console.log('need urls of images');return}var j=new a.ImageLoader;j.setCrossOrigin('*'),j.crossOrigin='*',j.load(d,function(a){b.drawImage(a,0,0),l.texture.needsUpdate=!0})}else if(i==='dom'){if(!e.isPlainObject(d)){console.log('content must be object');return}this.drawHTML(b,d)}this.updateVisible()},drawHTML:function(c,b){var g=this,w=b.title||'标题',d=b.content||'这是正文',v=b.titleColor||'#FF0000',u=b.contentColor||'#000',n=b.width||400,s=b.height||300,j=b.titleFontSize||100,e=b.contentFontSize||80,l=b.fontFamily||'serif',p=b.bgImgUrl||'',o=b.paddingLeft||0,q=b.paddingRight||0,r=b.paddingTop||0,k=j,t=s-k,m,i,h,x,f=new a.ImageLoader;f.setCrossOrigin('*'),f.crossOrigin='*',f.load(p,function(s){c.drawImage(s,0,k,n,t),c.font=j+'px '+l,c.fillStyle=v,c.fillText(w,0,j),c.font=e+'px '+l,c.fillStyle=u,m=+(n-o-q)||1,d=d,h=d.split(''),x=h.length*e,i=Math.floor(m/e);for(var a=0;a<Math.ceil(x/m);a++){var b=a*i,f=(a+1)*i>=h.length?h.length:(a+1)*i,p=d.slice(b,f);c.fillText(p,o,r+e*(a+1))}g.texture.image=g.canvas,g.texture.needsUpdate=!0})},updateOptions:function(a){this.options=a,this.update()},updateScale:function(){var a=this.options,c=this.object,b=a.scaleSize;c.scale.set(b,b*a.height/a.width)},update:function(){this.updateVisible(),this.updateScale(),this.updateMaterial()},updateVisible:function(){var a=this.options,b=a.isVisible;b?this.show():this.hide()},show:function(){this.object.visible=!0},hide:function(){this.object.visible=!1},updateMaterial:function(){this.texture.needsUpdate=!0,this.material.needsUpdate=!0,this.material.map.needsUpdate=!0},updateOpacity:function(){var a=this._map.three3D.camera,b=a.position,c=b.distanceTo(this.position),d=this._map.projection.radius,e=this.options,f=e.style.opacity(c/d);this.material.opacity=f},remove:function(){this.three3D.remove(this.object),this.object&&this.object.dispose&&this.object.dispose(),this.material&&this.material.dispose(),this.texture&&this.texture.dispose(),this.object=null,this.material=null,this.texture=null}}),module.exports=b

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

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