konva/dist/kinetic-Ellipse-current.min.js

2 lines
930 B
JavaScript

Kinetic.Ellipse=function(a){this._initEllipse(a)},Kinetic.Ellipse.prototype={_initEllipse:function(a){this.setDefaultAttrs({radius:{x:0,y:0}}),this.shapeType="Ellipse",a.drawFunc=this.drawFunc,Kinetic.Shape.call(this,a)},drawFunc:function(a){var b=this.getRadius();a.beginPath(),a.save(),b.x!==b.y&&a.scale(1,b.y/b.x),a.arc(0,0,b.x,0,Math.PI*2,!0),a.restore(),a.closePath(),this.fill(a),this.stroke(a)},setRadius:function(){var a=Kinetic.Type._getXY([].slice.call(arguments));this.setAttr("radius",Kinetic.Type._merge(a,this.getRadius()))},getWidth:function(){return this.getRadius().x*2},getHeight:function(){return this.getRadius().y*2},setWidth:function(a){Kinetic.Node.prototype.setWidth.call(this,a),this.setRadius({x:a/2})},setHeight:function(a){Kinetic.Node.prototype.setHeight.call(this,a),this.setRadius({y:a/2})}},Kinetic.Global.extend(Kinetic.Ellipse,Kinetic.Shape),Kinetic.Node.addGetters(Kinetic.Ellipse,["radius"]);