leaflet.measurecontrol
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -1,5 +0,3 @@ | ||
L.Polyline.Measure=L.Draw.Polyline.extend({addHooks:function(){L.Draw.Polyline.prototype.addHooks.call(this),this._map&&(this._markerGroup=new L.LayerGroup,this._map.addLayer(this._markerGroup),this._markers=[],this._map.on("click",this._onClick,this),this._startShape())},removeHooks:function(){L.Draw.Polyline.prototype.removeHooks.call(this),this._clearHideErrorTimeout(),this._map.off("pointermove",this._onMouseMove,this).off("mousemove",this._onMouseMove,this).off("click",this._onClick,this),this._clearGuides(),this._container.style.cursor="",this._removeShape()},_startShape:function(){this._drawing=!0,this._poly=new L.Polyline([],this.options.shapeOptions),this._poly._onClick=function(){},this._container.style.cursor="crosshair",this._updateTooltip(),this._map.on("pointermove",this._onMouseMove,this).on("mousemove",this._onMouseMove,this)},_finishShape:function(){this._drawing=!1,this._cleanUpShape(),this._clearGuides(),this._updateTooltip(),this._map.off("pointermove",this._onMouseMove,this).off("mousemove",this._onMouseMove,this),this._container.style.cursor=""},_removeShape:function(){this._poly&&(this._map.removeLayer(this._poly),delete this._poly,this._markers.splice(0),this._markerGroup.clearLayers())},_onClick:function(e){if(!this._drawing)return this._removeShape(),void this._startShape()},_getTooltipText:function(){var e=L.Draw.Polyline.prototype._getTooltipText.call(this) | ||
return this._drawing||(e.text=""),e}}),L.Control.MeasureControl=L.Control.extend({statics:{TITLE:"Measure distances"},options:{position:"topleft",handler:{}},toggle:function(){this.handler.enabled()?this.handler.disable.call(this.handler):this.handler.enable.call(this.handler)},onAdd:function(e){var t="leaflet-control-draw" | ||
this._container=L.DomUtil.create("div","leaflet-bar"),this.handler=new L.Polyline.Measure(e,this.options.handler),this.handler.on("enabled",function(){this.enabled=!0,L.DomUtil.addClass(this._container,"enabled")},this),this.handler.on("disabled",function(){delete this.enabled,L.DomUtil.removeClass(this._container,"enabled")},this) | ||
var o=L.DomUtil.create("a",t+"-measure",this._container) | ||
return o.href="#",o.title=L.Control.MeasureControl.TITLE,L.DomEvent.addListener(o,"click",L.DomEvent.stopPropagation).addListener(o,"click",L.DomEvent.preventDefault).addListener(o,"click",this.toggle,this),this._container}}),L.Map.mergeOptions({measureControl:!1}),L.Map.addInitHook(function(){this.options.measureControl&&(this.measureControl=L.Control.measureControl().addTo(this))}),L.Control.measureControl=function(e){return new L.Control.MeasureControl(e)} | ||
!function(e,t){"function"==typeof define&&define.amd?define(["leaflet"],function(o){e(o,t.toGeoJSON)}):"object"==typeof exports?module.exports=function(o){return void 0===o&&"undefined"!=typeof t&&(o=require("leaflet")),e(o),o}:"undefined"!=typeof t&&t.L&&e(t.L)}(function(e){e.Polyline.Measure=e.Draw.Polyline.extend({addHooks:function(){e.Draw.Polyline.prototype.addHooks.call(this),this._map&&(this._markerGroup=new e.LayerGroup,this._map.addLayer(this._markerGroup),this._markers=[],this._map.on("click",this._onClick,this),this._startShape())},removeHooks:function(){e.Draw.Polyline.prototype.removeHooks.call(this),this._clearHideErrorTimeout(),this._map.off("pointermove",this._onMouseMove,this).off("mousemove",this._onMouseMove,this).off("click",this._onClick,this),this._clearGuides(),this._container.style.cursor="",this._removeShape()},_startShape:function(){this._drawing=!0,this._poly=new e.Polyline([],this.options.shapeOptions),this._poly._onClick=function(){},this._container.style.cursor="crosshair",this._updateTooltip(),this._map.on("pointermove",this._onMouseMove,this).on("mousemove",this._onMouseMove,this)},_finishShape:function(){this._drawing=!1,this._cleanUpShape(),this._clearGuides(),this._updateTooltip(),this._map.off("pointermove",this._onMouseMove,this).off("mousemove",this._onMouseMove,this),this._container.style.cursor=""},_removeShape:function(){this._poly&&(this._map.removeLayer(this._poly),delete this._poly,this._markers.splice(0),this._markerGroup.clearLayers())},_onClick:function(){if(!this._drawing)return this._removeShape(),void this._startShape()},_getTooltipText:function(){var t=e.Draw.Polyline.prototype._getTooltipText.call(this) | ||
return this._drawing||(t.text=""),t}}),e.Control.MeasureControl=e.Control.extend({statics:{TITLE:"Measure distances"},options:{position:"topleft",handler:{}},toggle:function(){this.handler.enabled()?this.handler.disable.call(this.handler):this.handler.enable.call(this.handler)},onAdd:function(t){var o=null,i="leaflet-control-draw" | ||
return this._container=e.DomUtil.create("div","leaflet-bar"),this.handler=new e.Polyline.Measure(t,this.options.handler),this.handler.on("enabled",function(){this.enabled=!0,e.DomUtil.addClass(this._container,"enabled")},this),this.handler.on("disabled",function(){delete this.enabled,e.DomUtil.removeClass(this._container,"enabled")},this),o=e.DomUtil.create("a",i+"-measure",this._container),o.href="#",o.title=e.Control.MeasureControl.TITLE,e.DomEvent.addListener(o,"click",e.DomEvent.stopPropagation).addListener(o,"click",e.DomEvent.preventDefault).addListener(o,"click",this.toggle,this),this._container}}),e.Map.mergeOptions({measureControl:!1}),e.Map.addInitHook(function(){this.options.measureControl&&(this.measureControl=e.Control.measureControl().addTo(this))}),e.Control.measureControl=function(t){return new e.Control.MeasureControl(t)}},window) |
{ | ||
"name": "leaflet.measurecontrol", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Leaflet control to mesure distances on the map.", | ||
@@ -8,5 +8,4 @@ "main": "leaflet.measurecontrol.js", | ||
"build": "minify --output leaflet.measurecontrol.min.js leaflet.measurecontrol.js", | ||
"copy": "copy leaflet.measurecontrol.min.js example && copy leaflet.measurecontrol.css example", | ||
"release": "npm run build && npm run copy", | ||
"deploy": "gh-pages -d example" | ||
"copy": "copy leaflet.measurecontrol.min.js docs && copy leaflet.measurecontrol.css docs", | ||
"release": "npm run build && npm run copy" | ||
}, | ||
@@ -31,7 +30,5 @@ "repository": { | ||
"devDependencies": { | ||
"copy": "^0.3.0", | ||
"eslint": "^3.4.0", | ||
"eslint-config-airbnb-base": "^5.0.3", | ||
"eslint-plugin-import": "^1.14.0", | ||
"gh-pages": "^0.11.0", | ||
"minifier": "^0.8.0" | ||
@@ -38,0 +35,0 @@ }, |
@@ -14,3 +14,3 @@ Leaflet.MeasureControl | ||
``` | ||
npm install | ||
npm install leaflet.measurecontrol | ||
``` | ||
@@ -40,2 +40,22 @@ | ||
Développement | ||
----- | ||
``` | ||
npm install # install dependancies | ||
npm run release # minify js and copy sources in docs (example) | ||
``` | ||
Changelog | ||
------- | ||
### 1.1.0 | ||
* Add npm support | ||
* Add support for AMD and CommonJS loading | ||
* Set example in docs folder | ||
### 1.0.0 | ||
* Initial version | ||
Authors | ||
@@ -42,0 +62,0 @@ ------- |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
4
22001
66
869245
1
3