Comparing version 0.0.78 to 0.0.79
@@ -1,1 +0,1 @@ | ||
function a(b){b=this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('leaflet'),c=require('./../core/utils'),d=require('bcore/event'),e=require('./scatter_marker'),f=b.dmap=b.dmap||{};a.options={lat:c.getLat,lng:c.getLng,filter:function(a,b){return!0},range:[0,1],id:function(a,b){return a.id||b},text:function(a){return a.text},value:function(a){return a.value||a.num||a[0]},zoom:{max:15,min:3},child:{size:function(a,b,c){return 15},shape:{normal:{}}}},a=d.extend(a,{initialize:function(a){this.cache={},this.isable=!0},addTo:function(a){if(!a)return;this._map=a,this.initEventsMap()},data:function(a){this._data=a},clean:function(){var a=this.cache,c,b;if(!a)return;for(var d in a)c=a[d],b=c.visual,b&&b.destroy&&(b.destroy(),delete c.visual)},updateData:function(a){this.processing(a),this.cleanOld()},updateFilter:function(a){if(typeof a!=='function')return;this.options.filter=a,this.updateMap()},cleanOld:function(){var c=this.versionID,b=this.cache,d,a,f;if(!(c&&b))return;for(var e in b)d=b[e],f=d.versionID,f!==c&&(a=d.visual,a&&(a.off&&a.off(),a.destroy&&a.destroy()),delete b[e])},processing:function(y){var t=this.versionID=Math.random(),j=this._map;if(!j)return;var c=this.options,w=this.getChildOptions(),a,i,u,v,d,b,n=this.isInZoom(),o=this._map.getZoom(),p=c.id,q=c.lat,r=c.lng,s=c.filter,g=c.groups,k,h,l=this.cache,m=this.isable;for(var f in y){if(a=y[f],c.processing&&c.processing(a),i=p(a,f),u=q(a),v=r(a),d=l[i],k=!0,k=s(a,o),h=!0,g){h=!1;for(var f in g){var x=g[f];if(x.filter(a)){h=!0;break}}}if(d?d.data=a:d=l[i]={data:a},d.versionID=t,n&&k&&h&&this.isInView(u,v)&&m){var b=d.visual;b?b.updateData(a):m&&(b=d.visual=new e(w),b.addTo(j),b.render(a),this.initEventsScatter(b))}}this.updateRange()},render:function(a){a&&this.data(a),a=this._data,this.updateData(a)},enable:function(){this.isable=!0},disable:function(){this.isable=!1},isInZoom:function(){var a=this.options.zoom;if(!a)return!0;var c=this._map,d=a.max,e=a.min,b=c.getZoom();return b>d||b<e?!1:!0},isInView:function(b,c,a){a=a||this._map.getBounds();var d=a._northEast.lng,e=a._northEast.lat,f=a._southWest.lng,g=a._southWest.lat;return b<e&&b>g&&c<d&&c>f},each:function(c){var a=this.cache;for(var b in a)c(a[b])},getChildOptions:function(){var a=this.options;return{id:a.child.id||a.id,text:a.child.text||a.text,lat:a.child.lat||a.lat,lng:a.child.lng||a.lng,range:a.child.range||a.range,value:a.child.value||a.value,css:a.child.css||a.css,popup:a.child.popup||a.popup}},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a);var b=this.getChildOptions();this.each(function(a){a.visual&&a.visual.updateOptions(b)}),this.draw()},draw:function(){var f=this.options,g=this.cache,d,a,l,h,b,j=f.lng,k=f.lat,c,m,n=f.filter,o=this._map.getZoom(),p,q=this.isInZoom(),t=f.groups;if(!q)return this.clean();if(!g)return;if(!this.isable)return;var s=this.getChildOptions(),r=this._map;for(var i in g)d=g[i],b=d.data,l=k(b),h=j(b),p=this.isInView(l,h),c=!0,c=n(b,o),m=!0,c=c&&m,a=d.visual,p&&c?a?(a.updateData(b),a.updateZIndex()):(a=d.visual=new e(s),a.addTo(r),a.render(b),this.initEventsScatter(a)):a&&(a.off&&a.off(),a.destroy&&a.destroy(),delete d.visual)},updateMap:function(){this.draw()},updateRange:function(){var c=this.cache,d=this.ranges=this.ranges||{},e=this.options.value,a=d.value=[];for(var f in c){var g=c[f].data,b=e(g);a[0]||(a=[b,b]),b<a[0]&&(a[0]=b),b>a[1]&&(a[1]=b)}},initEventsMap:function(){this._map.on('moveend',this.updateMap.bind(this))},initEventsScatter:function(b){var a=this;b.on('click',function(b){console.log(b),a.emit('click-scatter',b)})},initEvents:function(){},destroy:function(){this.clean(),this.cache={}}}),f.ScatterMarkers=a,f.scatterMarkers=function(b){return new a(b)},module.exports=a | ||
function a(b){b=this.options=c.deepMerge(a.options,b),this.initialize(b)}var b=require('leaflet'),c=require('./../core/utils'),d=require('bcore/event'),e=require('./scatter_marker'),f=b.dmap=b.dmap||{};a.options={lat:c.getLat,lng:c.getLng,filter:function(a,b){return!0},range:[0,1],id:function(a,b){return a.id||b},text:function(a){return a.text},value:function(a){return a.value||a.num||a[0]},zoom:{max:15,min:3},child:{size:function(a,b,c){return 15},shape:{normal:{}}}},a=d.extend(a,{initialize:function(a){this.cache={},this.isable=!0},addTo:function(a){if(!a)return;this._map=a,this.initEventsMap()},initPopUp:function(){var a=this._map},data:function(a){this._data=a},clean:function(){var a=this.cache,c,b;if(!a)return;for(var d in a)c=a[d],b=c.visual,b&&b.destroy&&(b.destroy(),delete c.visual)},updateData:function(a){this.processing(a),this.cleanOld()},updateFilter:function(a){if(typeof a!=='function')return;this.options.filter=a,this.updateMap()},cleanOld:function(){var c=this.versionID,b=this.cache,d,a,f;if(!(c&&b))return;for(var e in b)d=b[e],f=d.versionID,f!==c&&(a=d.visual,a&&(a.off&&a.off(),a.destroy&&a.destroy()),delete b[e])},processing:function(y){var t=this.versionID=Math.random(),j=this._map;if(!j)return;var c=this.options,w=this.getChildOptions(),a,i,u,v,d,b,n=this.isInZoom(),o=this._map.getZoom(),p=c.id,q=c.lat,r=c.lng,s=c.filter,g=c.groups,k,h,l=this.cache,m=this.isable;for(var f in y){if(a=y[f],c.processing&&c.processing(a),i=p(a,f),u=q(a),v=r(a),d=l[i],k=!0,k=s(a,o),h=!0,g){h=!1;for(var f in g){var x=g[f];if(x.filter(a)){h=!0;break}}}if(d?d.data=a:d=l[i]={data:a},d.versionID=t,n&&k&&h&&this.isInView(u,v)&&m){var b=d.visual;b?b.updateData(a):m&&(b=d.visual=new e(w),b.addTo(j),b.render(a),this.initEventsScatter(b))}}this.updateRange()},render:function(a){a&&this.data(a),a=this._data,this.updateData(a)},enable:function(){this.isable=!0},disable:function(){this.isable=!1},isInZoom:function(){var a=this.options.zoom;if(!a)return!0;var c=this._map,d=a.max,e=a.min,b=c.getZoom();return b>d||b<e?!1:!0},isInView:function(b,c,a){a=a||this._map.getBounds();var d=a._northEast.lng,e=a._northEast.lat,f=a._southWest.lng,g=a._southWest.lat;return b<e&&b>g&&c<d&&c>f},each:function(c){var a=this.cache;for(var b in a)c(a[b])},getChildOptions:function(){var a=this.options;return{id:a.child.id||a.id,text:a.child.text||a.text,lat:a.child.lat||a.lat,lng:a.child.lng||a.lng,range:a.child.range||a.range,value:a.child.value||a.value,css:a.child.css||a.css,popup:a.child.popup||a.popup}},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a);var b=this.getChildOptions();this.each(function(a){a.visual&&a.visual.updateOptions(b)}),this.draw()},draw:function(){var f=this.options,g=this.cache,d,a,l,h,b,j=f.lng,k=f.lat,c,m,n=f.filter,o=this._map.getZoom(),p,q=this.isInZoom(),t=f.groups;if(!q)return this.clean();if(!g)return;if(!this.isable)return;var s=this.getChildOptions(),r=this._map;for(var i in g)d=g[i],b=d.data,l=k(b),h=j(b),p=this.isInView(l,h),c=!0,c=n(b,o),m=!0,c=c&&m,a=d.visual,p&&c?a?(a.updateData(b),a.updateZIndex()):(a=d.visual=new e(s),a.addTo(r),a.render(b),this.initEventsScatter(a)):a&&(a.off&&a.off(),a.destroy&&a.destroy(),delete d.visual)},updateMap:function(){this.draw()},updateRange:function(){var c=this.cache,d=this.ranges=this.ranges||{},e=this.options.value,a=d.value=[];for(var f in c){var g=c[f].data,b=e(g);a[0]||(a=[b,b]),b<a[0]&&(a[0]=b),b>a[1]&&(a[1]=b)}},initEventsMap:function(){this._map.on('moveend',this.updateMap.bind(this))},initEventsScatter:function(b){var a=this;b.on('click',function(b){console.log(b),a.emit('click-scatter',b)})},initEvents:function(){},destroy:function(){this.clean(),this.cache={}}}),f.ScatterMarkers=a,f.scatterMarkers=function(b){return new a(b)},module.exports=a |
@@ -5,3 +5,3 @@ { | ||
"description": "2d map visualization lib", | ||
"version": "0.0.78", | ||
"version": "0.0.79", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "test": "mocha -r jscoverage test" |
@@ -1,1 +0,1 @@ | ||
function a(b,d){this.tilelayer=b,this.container=e(b._container),this._map=b._map;var f=this;b._filter=f,d=this.options=c.deepMerge(a.options,d),this.initEvents(b),this.updateStyle()}var b=require('bcore/event'),c=require('bcore/utils'),d=require('leaflet'),e=require('jquery');d.dmap=d.dmap||{},a.options={hueRotate:0,saturate:100,contrast:100,brightness:100,grayscale:0,opacity:1,anim:0,blur:0,sepia:0,invert:0},a=b.extend(a,{initEvents:function(a){a.on('tileload',this.updateStyle.bind(this))},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.updateStyle()},updateStyle:function(){var a=this.options,b='';a.saturate!=100&&(b+='saturate('+a.saturate+'%)'+' '),a.grayscale!=0&&(b+='grayscale('+a.grayscale+'%)'+' '),a.hueRotate!=0&&(b+='hue-rotate('+a.hueRotate+'deg)'+' '),a.contrast!=0&&(b+='contrast('+a.contrast+'%)'+' '),a.brightness!=0&&(b+='brightness('+a.brightness+'%)'+' '),a.blur!=0&&(b+='blur('+a.blur+'px)'+' '),a.sepia!=0&&(b+='sepia('+a.sepia+'%)'+' '),a.invert!=0&&(b+='invert('+a.invert+'%)'+' ');var c=a.opacity,d=a.anim,e=this._map.getPanes().tilePane;this.container.css({'-webkit-filter':b,filter:b,transition:d+'s',opacity:c})},cleanStyle:function(){var b=a.options,d=this.options;for(var c in b)d[c]=b[c];this.updateStyle()}}),d.dmap.Filter=a,d.dmap.filter=function(b,c){return new a(b,c)},module.exports=a | ||
function a(b,d){this.tilelayer=b,this.container=e(b._container),this._map=b._map;var f=this;b._filter=f,d=this.options=c.deepMerge(a.options,d),this.initEvents(b),this.updateStyle()}var b=require('bcore/event'),c=require('bcore/utils'),d=require('leaflet'),e=require('jquery');d.dmap=d.dmap||{},a.options={hueRotate:0,saturate:100,contrast:100,brightness:100,grayscale:0,opacity:1,anim:0,blur:0,sepia:0,invert:0},a=b.extend(a,{initEvents:function(a){a.on('tileload',this.updateStyle.bind(this))},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.updateStyle()},updateStyle:function(){var a=this.options,b='';a.sepia!=0&&(b+='sepia('+a.sepia+'%)'+' '),a.saturate!=100&&(b+='saturate('+a.saturate+'%)'+' '),a.grayscale!=0&&(b+='grayscale('+a.grayscale+'%)'+' '),a.hueRotate!=0&&(b+='hue-rotate('+a.hueRotate+'deg)'+' '),a.contrast!=0&&(b+='contrast('+a.contrast+'%)'+' '),a.brightness!=0&&(b+='brightness('+a.brightness+'%)'+' '),a.blur!=0&&(b+='blur('+a.blur+'px)'+' '),a.invert!=0&&(b+='invert('+a.invert+'%)'+' ');var c=a.opacity,d=a.anim,e=this._map.getPanes().tilePane;this.container.css({'-webkit-filter':b,filter:b,transition:d+'s',opacity:c})},cleanStyle:function(){var b=a.options,d=this.options;for(var c in b)d[c]=b[c];this.updateStyle()}}),d.dmap.Filter=a,d.dmap.filter=function(b,c){return new a(b,c)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
'use strict';function a(d,b){b=arguments[arguments.length-1],this.options=c.deepMerge(a.options,b)}var b=require('leaflet'),c=require('./../core/utils'),d=require('bcore/event');a.options={},a=d.extend(a,{});var e=b.dmap=b.dmap||{};e.PopupContents=a,e.popupContents=function(b){return a(b)},module.exports=a | ||
'use strict';function a(d,b){b=arguments[arguments.length-1],this.options=c.deepMerge(a.options,b)}var b=require('./../leaflet'),c=require('./../core/utils'),d=require('bcore/event');a.options={},a=d.extend(a,{});var e=b.dmap=b.dmap||{};e.PopupContents=a,e.popupContents=function(b){return a(b)},module.exports=a |
@@ -1,1 +0,1 @@ | ||
function b(c,a){a=this.options=d.deepMerge(b.options,a),this.initialize(c,a)}var a=require('jquery'),c=require('leaflet'),d=require('./../core/utils'),e=require('bcore/event'),a=require('keyanim');require('./ui_animate.css'),require('./tile_selector.css');var f=require('dat-gui'),g=d.switchValue;b.options={style:{left:'5%',top:'5%'}},b=e.extend(b,{initialize:function(a,b){this.container=a,this.initDom()},initDom:function(){var c=this.options,d=this.container,b=this.button=a('<div class="tile-selector">瓦片层 <div class="tile-selector-sub-wrapper"> <div class="tile-selector-sub-panel tile-selector-hide"> <div class=main></div> <div class=detail></div> </div> <div> <div> ').css(c.style).appendTo(d);this.subPanelNode=b.find('.tile-selector-sub-panel'),this.detailNode=b.find('.detail'),this.initEvents()},initEvents:function(){this.button.on('touchstart mousedown',this.switch.bind(this)),this.subPanelNode.on('touchstart mousedown',function(a){a.stopPropagation()})},bindTo:function(a){this.tilelayer=a,this._data=a.tData,this._map=a._map,this.initEventMap()},render:function(d){d&&this.bindTo(d);var e=this.tilelayer.tileName,h=this.subPanelNode,b=this._data,c,f,g;for(var a in b){if(c=b[a],c.disable)continue;f=a===e,g=this.renderGrid(c,a,f),this.initEventsGrid(g)}this.initInitFilter()},renderGrid:function(d,e,f){var c=this.subPanelNode.find('.main'),b=a('<div class="grid" id="'+e+'">'+d.options.name+'</div>').appendTo(c);return f&&this.selectGrid(b),this.initEventGrid(b),b},initEventMap:function(){this._map.on('click',this.hide.bind(this))},initEventGrid:function(d){var b=this.tilelayer,c=this._data;d.on('touchstart mousedown',function(h){var e=a(this).attr('id'),d=c[e];if(!d)return;var f=g(d.url,d.options);return b.update(e)})},initEventsGrid:function(a){a.on('click',function(){this.selectGrid(a)}.bind(this))},selectGrid:function(a){this.curGird&&this.curGird.removeClass('grid-selected'),this.curGird=a.addClass('grid-selected')},switch:function(){if(this.isShow)return this.hide();this.show()},hide:function(){if(!this.isShow)return;this.subPanelNode.keyAnim('toolsOutLeft',{time:.3}),this.isShow=!1},show:function(){if(this.isShow)return;this.subPanelNode.css('display','block').keyAnim('toolsInLeft',{time:.3}),this.isShow=!0},initInitFilter:function(){var j=this.tilelayer,b=j._filter;if(!b)return;var h=this.detailNode,l=b.options,e=new f.gui.GUI({width:h.width(),autoPlace:!1});h.append(a(e.domElement));var c=e.addFolder('滤镜');c.open();var g=e.addFolder('其他');g.open();var d=b.updateStyle.bind(b),i={saturate:c.add(b.options,'saturate',0,200).name('饱和度(%)').onChange(d),grayscale:c.add(b.options,'grayscale',0,100).name('灰度(%)').onChange(d),brightness:c.add(b.options,'brightness',0,200).name('亮度(%)').onChange(d),contrast:c.add(b.options,'contrast',0,200).name('对比(%)').onChange(d),opacity:c.add(b.options,'opacity',0,1).name('透明(0-1)').onChange(d),hueRotate:c.add(b.options,'hueRotate',0,360).name('色相(deg)').onChange(d),blur:c.add(b.options,'blur',0,20).name('模糊(px)').onChange(d),invert:c.add(b.options,'invert',0,100).name('反向(%)').onChange(d),anim:g.add(b.options,'anim',0,3).name('缓动(秒)').onChange(d)},k={clear:!1};g.add(k,'clear').name('清除样式').onChange(function(c){c&&b.cleanStyle();for(var a in i)i[a].updateDisplay()})}}),module.exports=b | ||
function b(c,a){a=this.options=d.deepMerge(b.options,a),this.initialize(c,a)}var a=require('jquery'),c=require('leaflet'),d=require('./../core/utils'),e=require('bcore/event'),a=require('keyanim');require('./ui_animate.css'),require('./tile_selector.css');var f=require('dat-gui'),g=d.switchValue;b.options={style:{left:'5%',top:'5%'}},b=e.extend(b,{initialize:function(a,b){this.container=a,this.initDom()},initDom:function(){var c=this.options,d=this.container,b=this.button=a('<div class="tile-selector">瓦片层 <div class="tile-selector-sub-wrapper"> <div class="tile-selector-sub-panel tile-selector-hide"> <div class=main></div> <div class=detail></div> </div> <div> <div> ').css(c.style).appendTo(d);this.subPanelNode=b.find('.tile-selector-sub-panel'),this.detailNode=b.find('.detail'),this.initEvents()},initEvents:function(){this.button.on('touchstart mousedown',this.switch.bind(this)),this.subPanelNode.on('touchstart mousedown',function(a){a.stopPropagation()})},bindTo:function(a){this.tilelayer=a,this._data=a.tData,this._map=a._map,this.initEventMap()},render:function(d){d&&this.bindTo(d);var e=this.tilelayer.tileName,h=this.subPanelNode,b=this._data,c,f,g;for(var a in b){if(c=b[a],c.disable)continue;f=a===e,g=this.renderGrid(c,a,f),this.initEventsGrid(g)}this.initInitFilter()},renderGrid:function(d,e,f){var c=this.subPanelNode.find('.main'),b=a('<div class="grid" id="'+e+'">'+d.options.name+'</div>').appendTo(c);return f&&this.selectGrid(b),this.initEventGrid(b),b},initEventMap:function(){this._map.on('click',this.hide.bind(this))},initEventGrid:function(d){var b=this.tilelayer,c=this._data;d.on('touchstart mousedown',function(h){var e=a(this).attr('id'),d=c[e];if(!d)return;var f=g(d.url,d.options);return b.update(e)})},initEventsGrid:function(a){a.on('click',function(){this.selectGrid(a)}.bind(this))},selectGrid:function(a){this.curGird&&this.curGird.removeClass('grid-selected'),this.curGird=a.addClass('grid-selected')},switch:function(){if(this.isShow)return this.hide();this.show()},hide:function(){if(!this.isShow)return;this.subPanelNode.keyAnim('toolsOutLeft',{time:.3}),this.isShow=!1},show:function(){if(this.isShow)return;this.subPanelNode.css('display','block').keyAnim('toolsInLeft',{time:.3}),this.isShow=!0},initInitFilter:function(){var j=this.tilelayer,b=j._filter;if(!b)return;var h=this.detailNode,l=b.options,e=new f.gui.GUI({width:h.width(),autoPlace:!1});h.append(a(e.domElement));var c=e.addFolder('滤镜');c.open();var g=e.addFolder('其他');g.open();var d=b.updateStyle.bind(b),i={saturate:c.add(b.options,'saturate',0,200).name('饱和度(%)').onChange(d),grayscale:c.add(b.options,'grayscale',0,100).name('灰度(%)').onChange(d),brightness:c.add(b.options,'brightness',0,200).name('亮度(%)').onChange(d),contrast:c.add(b.options,'contrast',0,200).name('对比(%)').onChange(d),opacity:c.add(b.options,'opacity',0,1).name('透明(0-1)').onChange(d),hueRotate:c.add(b.options,'hueRotate',0,360).name('色相(deg)').onChange(d),blur:c.add(b.options,'blur',0,20).name('模糊(px)').onChange(d),invert:c.add(b.options,'invert',0,100).name('反向(%)').onChange(d),sepia:c.add(b.options,'sepia',0,100).name('加色(%)').onChange(d),anim:g.add(b.options,'anim',0,3).name('缓动(秒)').onChange(d)},k={clear:!1};g.add(k,'clear').name('清除样式').onChange(function(c){c&&b.cleanStyle();for(var a in i)i[a].updateDisplay()})}}),module.exports=b |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
315319
0