L.SVG.include({_updateEllipse:function(t){t._point;var i=t._radiusX,s=t._radiusY,n=t._tiltDeg,a=t._endPointParams,e="M"+a.x0+","+a.y0+"A"+i+","+s+","+n+","+a.largeArc+","+a.sweep+","+a.x1+","+a.y1+" z";this._setPath(t,e)}}),L.Canvas.include({_updateEllipse:function(t){if(t._empty())return;let i=t._point,s=this._ctx,n=t._radiusX;t._radiusY;if(this.hasOwnProperty("_drawnLayers"))this._drawnlayers[t._leaflet_id]=t;else{if(!this.hasOwnProperty("_layers"))throw new Error("Cannot find property _drawnLayers or _layers");this._layers[t._leaflet_id]=t}s.save(),s.beginPath(),console.log(i.x,i.y,t._tilt,t._tiltDeg),s.ellipse(i.x,i.y,t._radiusX,t._radiusY,t._tilt,0,2*Math.PI,!0),s.restore(),this._fillStroke(s,t)}}),L.Ellipse=L.Path.extend({options:{fill:!0,startAngle:0,endAngle:359.9},initialize:function(t,i,s,n){console.log(t,s),L.setOptions(this,n),this._latlng=L.latLng(t),s?(this._tiltDeg=-1*s+180,this._tilt=Math.PI*this._tiltDeg/180):(this._tiltDeg=0,this._tilt=0),i&&(this._mRadiusX=i[0],this._mRadiusY=i[1])},setRadius:function(t){return this._mRadiusX=t[0],this._mRadiusY=t[1],this.redraw()},getRadius:function(){return new L.point(this._mRadiusX,this._mRadiusY)},setTilt:function(t){return this._tiltDeg=t,this.redraw()},getBounds:function(){var t=this._getLngRadius(),i=this._getLatRadius(),s=this._latlng;return new L.LatLngBounds([s.lat-i,s.lng-t],[s.lat+i,s.lng+t])},setLatLng:function(t){return this._latlng=L.latLng(t),this.redraw(),this.fire("move",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setStyle:L.Path.prototype.setStyle,_project:function(){var t=this._getLngRadius(),i=this._getLatRadius(),s=this._latlng,n=this._map.latLngToLayerPoint([s.lat,s.lng-t]),a=this._map.latLngToLayerPoint([s.lat-i,s.lng]);this._point=this._map.latLngToLayerPoint(s),this._radiusX=Math.max(this._point.x-n.x,1),this._radiusY=Math.max(a.y-this._point.y,1),this._tilt=Math.PI*this._tiltDeg/180,this._endPointParams=this._centerPointToEndPoint(),this._updateBounds()},_updateBounds:function(){var t=Math.sin(this._tilt),i=Math.cos(this._tilt),s=t*t,n=i*i,a=this._radiusX*this._radiusX,e=this._radiusY*this._radiusY,h=Math.sqrt(a*n+e*s),r=Math.sqrt(a*s+e*n),_=this._clickTolerance(),o=[h+_,r+_];this._pxBounds=new L.Bounds(this._point.subtract(o),this._point.add(o))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateEllipse(this)},_getLatRadius:function(){return!!this._map.options.crs.infinite?this._mRadiusY:this._mRadiusY/40075017*360},_getLngRadius:function(){return!!this._map.options.crs.infinite?this._mRadiusX:this._mRadiusX/40075017*360/Math.cos(Math.PI/180*this._latlng.lat)},_centerPointToEndPoint:function(){var t=this._point,i=this._radiusX,s=this._radiusY,n=(this.options.startAngle+this.options.endAngle)*(Math.PI/180),a=this.options.startAngle*(Math.PI/180),e=this.options.endAngle,h=this._tiltDeg*(Math.PI/180);return{x0:t.x+Math.cos(h)*i*Math.cos(a)+Math.sin(-h)*s*Math.sin(a),y0:t.y+Math.sin(h)*i*Math.cos(a)+Math.cos(h)*s*Math.sin(a),tilt:h,largeArc:e>180?1:0,sweep:e>0?1:0,x1:t.x+Math.cos(h)*i*Math.cos(n)+Math.sin(-h)*s*Math.sin(n),y1:t.y+Math.sin(h)*i*Math.cos(n)+Math.cos(h)*s*Math.sin(n)}},_empty:function(){return this._radiusX&&this._radiusY&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){var i=Math.sin(this._tilt),s=Math.cos(this._tilt),n=t.x-this._point.x,a=t.y-this._point.y,e=s*n+i*a,h=i*n-s*a;return e*e/(this._radiusX*this._radiusX)+h*h/(this._radiusY*this._radiusY)<=1}}),L.ellipse=function(t,i,s,n){return new L.Ellipse(t,i,s,n)};