src/pyams_gis/resources/js/Edit.Circle.min.js
changeset 0 c73bb834ccbe
equal deleted inserted replaced
-1:000000000000 0:c73bb834ccbe
       
     1 L.Edit=L.Edit||{};L.Edit.Circle=L.Edit.SimpleShape.extend({_createMoveMarker:function(){var a=this._shape.getLatLng();this._moveMarker=this._createMarker(a,this.options.moveIcon)},_createResizeMarker:function(){var a=this._shape.getLatLng(),b=this._getResizeMarkerPoint(a);this._resizeMarkers=[];this._resizeMarkers.push(this._createMarker(b,this.options.resizeIcon))},_getResizeMarkerPoint:function(c){var b=this._shape._radius*Math.cos(Math.PI/4),a=this._map.project(c);return this._map.unproject([a.x+b,a.y-b])},_move:function(b){var a=this._getResizeMarkerPoint(b);this._resizeMarkers[0].setLatLng(a);this._shape.setLatLng(b);this._map.fire(L.Draw.Event.EDITMOVE,{layer:this._shape})},_resize:function(c){var b=this._moveMarker.getLatLng(),a=b.distanceTo(c);this._shape.setRadius(a);this._map.fire(L.Draw.Event.EDITRESIZE,{layer:this._shape})}});L.Circle.addInitHook(function(){if(L.Edit.Circle){this.editing=new L.Edit.Circle(this);if(this.options.editable){this.editing.enable()}}this.on("add",function(){if(this.editing&&this.editing.enabled()){this.editing.addHooks()}});this.on("remove",function(){if(this.editing&&this.editing.enabled()){this.editing.removeHooks()}})});