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

ldmap

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ldmap - npm Package Compare versions

Comparing version 0.0.91 to 0.0.92

2

layer/flyingLine.js

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

function a(b){b=this.options=d.deepMerge(a.options,b),b.interactiveLine.kHeight=b.kHeight,b.displayLine.kHeight=b.kHeight,this.initialize(b)}var b=require('./../leaflet'),c=require('./flyingLinePath'),d=require('./../core/utils'),e=b.dmap=b.dmap||{},f=require('./../core/anim_view');a.options={isAutoStart:!1,lifeMin:0,lifeMax:1,isPopupHover:0,lifeEnd:'destroy',range:.8,lifeSpeed:.08,kHeight:.5,interactiveLine:{weight:5,color:'rgba(250,150,50,0.0)',colorHover:'rgba(250,150,50,0.1)'},displayLine:{weight:1}},a.options=d.deepMerge(f.options,a.options),a=f.extend(a,{isInit:!1,life:0,initialize:function(a){this._map&&this.addTo(this._map),this.id=this.options.id||d.getId('flyingLine'),this.isLive=!1,this.isLooping=!0},checkIfEnd:function(){this.life>=this.options.lifeMax+this.options.range&&this._onLifeEnd()},addTo:function(a){return this._map=a,this.init(),this.initEvents(),this},init:function(){if(this.isInit||!this._map)return;this.initInteractiveLine(),this.initDisplayLine(),this.isInit=!0},initDisplayLine:function(){throw'必须实现initDisplayLine方法'},initInteractiveLine:function(){var f=this.options,g=this._map,a=this,b=f.interactiveLine;if(b.kHeight=f.kHeight,!b)return;var e=this.interactivePath=new c(b);e.addTo(g);var d=e._path;d.setAttribute('fill','none'),d.setAttribute('stroke',b.color),d.setAttribute('stroke-width',b.weight),d.setAttribute('stroke-linecap','round'),d.setAttribute('stroke-linejoin','round'),e.on('mouseover',function(c){d.setAttribute('stroke',b.colorHover),a.emit('mouseover',a.record),f.isPopupHover&&e.openPopup()}).on('mouseout',function(c){d.setAttribute('stroke',b.color),f.isPopupHover&&e.closePopup(),a.emit('mouseout',a.record)}).on('mousedown',function(b){a.resume(),a.fireEvent('mouseout',e),a.emit('mousedown',a.record)}).on('click',function(b){a.emit('click',a.record)})},setPopupContent:function(a){this.interactivePath&&this.interactivePath.setPopupContent(a)},data:function(a){if(!(a&&a.from&&a.to))return console.log('无数据/数据格式有问题');this._data=a,this.updateData(a),this.bindPopup(),this.reset(),this.options.isAutoStart&&this.resume(),this.record={data:a,layer:this}},render:function(a){a&&this.data(a),this.draw()},draw:function(){this.fireEvent('lifestart',{latlng:this.displayPath.from,data:this._data}),this.startAnim()},initEvents:function(){this.on('update',this.updateLife.bind(this)).on('lifeEnd',function(b){var a=this.options.lifeEnd;return a==='loop'?this.restart():a==='hide'?this.hide():a==='destroy'?this.destroy():void 0})},updateOptions:function(a){a=this.options=d.deepMerge(this.options,a),this.updateOptionsInteractiveLine&&this.updateOptionsInteractiveLine(),this.updateOptionsDisplayLine&&this.updateOptionsDisplayLine(),a.interactiveLine.kHeight=a.kHeight,this.interactivePath&&this.interactivePath.updateOptions(a.interactiveLine),a.displayLine.kHeight=a.kHeight,this.displayPath&&this.displayPath.updateOptions(a.displayLine)},updateLife:function(a){if(!this.isLive)return;this.updateInteractiveLine&&this.updateInteractiveLine(a),this.updateDisplayLine&&this.updateDisplayLine(a)},updateData:function(a){this.interactivePath&&this.interactivePath.data(a),this.displayPath&&this.displayPath.data(a)},bindPopup:function(a,b){if(a=a||this.bindHTML,!a)return;if(!this._data)return this.bindHTML=a;b=d.deepMerge({maxWidth:800,autoPan:!1},b),typeof a==='function'&&(a=a(this._data||{})),this.interactivePath.bindPopup(a,b),this.bindHTML=null},hide:function(){this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.hide(),this.displayPath&&this.displayPath.hide(),this.fire('hide')},pause:function(){this.isLooping=!1,this.isLive=!1,cancelAnimationFrame(this.loopid),this.loopid=null,this.fire('pause')},resume:function(){if(this.isLive)return;var a=this.options;setTimeout(function(){}.bind(this)),this.isLive=!0,this.loop(),this.fire('resume')},loop:function(){if(!this.isLooping)return;this._updateLife(),this.loopid=requestAnimationFrame(this.loop.bind(this))},isEnd:function(){return this.life>this.options.lifeMax},reset:function(){var a=this.options;this.life=a.lifeMin},destroy:function(){this.pause(),this.off(),this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.destroy(),this.displayPath&&this.displayPath.destroy()}}),e.FlyingLine=a,e.flyingLine=function(b){return new a(b)},module.exports=a
function a(b){b=this.options=e.deepMerge(a.options,b),b.interactiveLine.kHeight=b.kHeight,b.displayLine.kHeight=b.kHeight,this.initialize(b)}function b(a){if(typeof a==='string'&&a.indexOf(',')!==-1){a=a.split(',');var b=a[0]||0,c=a[1]||0;return{lat:parseFloat(b,10),lng:parseFloat(c,10)}}return a}var c=require('./../leaflet'),d=require('./flyingLinePath'),e=require('./../core/utils'),f=c.dmap=c.dmap||{},g=require('./../core/anim_view');a.options={isAutoStart:!1,lifeMin:0,lifeMax:1,isPopupHover:0,lifeEnd:'destroy',range:.8,lifeSpeed:.08,kHeight:.5,interactiveLine:{weight:5,color:'rgba(250,150,50,0.0)',colorHover:'rgba(250,150,50,0.1)'},displayLine:{weight:1}},a.options=e.deepMerge(g.options,a.options),a=g.extend(a,{isInit:!1,life:0,initialize:function(a){this._map&&this.addTo(this._map),this.id=this.options.id||e.getId('flyingLine'),this.isLive=!1,this.isLooping=!0},checkIfEnd:function(){this.life>=this.options.lifeMax+this.options.range&&this._onLifeEnd()},addTo:function(a){return this._map=a,this.init(),this.initEvents(),this},init:function(){if(this.isInit||!this._map)return;this.initInteractiveLine(),this.initDisplayLine(),this.isInit=!0},initDisplayLine:function(){throw'必须实现initDisplayLine方法'},initInteractiveLine:function(){var f=this.options,g=this._map,a=this,b=f.interactiveLine;if(b.kHeight=f.kHeight,!b)return;var e=this.interactivePath=new d(b);e.addTo(g);var c=e._path;c.setAttribute('fill','none'),c.setAttribute('stroke',b.color),c.setAttribute('stroke-width',b.weight),c.setAttribute('stroke-linecap','round'),c.setAttribute('stroke-linejoin','round'),e.on('mouseover',function(d){c.setAttribute('stroke',b.colorHover),a.emit('mouseover',a.record),f.isPopupHover&&e.openPopup()}).on('mouseout',function(d){c.setAttribute('stroke',b.color),f.isPopupHover&&e.closePopup(),a.emit('mouseout',a.record)}).on('mousedown',function(b){a.resume(),a.fireEvent('mouseout',e),a.emit('mousedown',a.record)}).on('click',function(b){a.emit('click',a.record)})},setPopupContent:function(a){this.interactivePath&&this.interactivePath.setPopupContent(a)},data:function(a){if(!(a&&a.from&&a.to))return console.log('无数据/数据格式有问题');a.from=b(a.from),a.to=b(a.to),this._data=a,this.updateData(a),this.bindPopup(),this.reset(),this.options.isAutoStart&&this.resume(),this.record={data:a,layer:this}},render:function(a){a&&this.data(a),this.draw()},draw:function(){this.fireEvent('lifestart',{latlng:this.displayPath.from,data:this._data}),this.startAnim()},initEvents:function(){this.on('update',this.updateLife.bind(this)).on('lifeEnd',function(b){var a=this.options.lifeEnd;return a==='loop'?this.restart():a==='hide'?this.hide():a==='destroy'?this.destroy():void 0})},updateOptions:function(a){a=this.options=e.deepMerge(this.options,a),this.updateOptionsInteractiveLine&&this.updateOptionsInteractiveLine(),this.updateOptionsDisplayLine&&this.updateOptionsDisplayLine(),a.interactiveLine.kHeight=a.kHeight,this.interactivePath&&this.interactivePath.updateOptions(a.interactiveLine),a.displayLine.kHeight=a.kHeight,this.displayPath&&this.displayPath.updateOptions(a.displayLine)},updateLife:function(a){if(!this.isLive)return;this.updateInteractiveLine&&this.updateInteractiveLine(a),this.updateDisplayLine&&this.updateDisplayLine(a)},updateData:function(a){this.interactivePath&&this.interactivePath.data(a),this.displayPath&&this.displayPath.data(a)},bindPopup:function(a,b){if(a=a||this.bindHTML,!a)return;if(!this._data)return this.bindHTML=a;b=e.deepMerge({maxWidth:800,autoPan:!1},b),typeof a==='function'&&(a=a(this._data||{})),this.interactivePath.bindPopup(a,b),this.bindHTML=null},hide:function(){this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.hide(),this.displayPath&&this.displayPath.hide(),this.fire('hide')},pause:function(){this.isLooping=!1,this.isLive=!1,cancelAnimationFrame(this.loopid),this.loopid=null,this.fire('pause')},resume:function(){if(this.isLive)return;var a=this.options;setTimeout(function(){}.bind(this)),this.isLive=!0,this.loop(),this.fire('resume')},loop:function(){if(!this.isLooping)return;this._updateLife(),this.loopid=requestAnimationFrame(this.loop.bind(this))},isEnd:function(){return this.life>this.options.lifeMax},reset:function(){var a=this.options;this.life=a.lifeMin},destroy:function(){this.pause(),this.off(),this.life=0,this.isLive=!1,this.interactivePath&&this.interactivePath.destroy(),this.displayPath&&this.displayPath.destroy()}}),f.FlyingLine=a,f.flyingLine=function(b){return new a(b)},module.exports=a

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

"description": "2d map visualization lib",
"version": "0.0.91",
"version": "0.0.92",
"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