API Docs for: 3.8.0
Show:

File: graphics/js/VMLEllipse.js

  1. /**
  2.  * <a href="http://www.w3.org/TR/NOTE-VML">VML</a> implementation of the <a href="Ellipse.html">`Ellipse`</a> class.
  3.  * `VMLEllipse` is not intended to be used directly. Instead, use the <a href="Ellipse.html">`Ellipse`</a> class.
  4.  * If the browser lacks <a href="http://www.w3.org/TR/SVG/">SVG</a> and <a href="http://www.w3.org/TR/html5/the-canvas-element.html">Canvas</a>
  5.  * capabilities, the <a href="Ellipse.html">`Ellipse`</a> class will point to the `VMLEllipse` class.
  6.  *
  7.  * @module graphics
  8.  * @class VMLEllipse
  9.  * @constructor
  10.  */
  11. VMLEllipse = function()
  12. {
  13.         VMLEllipse.superclass.constructor.apply(this, arguments);
  14. };

  15. VMLEllipse.NAME = "ellipse";

  16. Y.extend(VMLEllipse, Y.VMLShape, {
  17.         /**
  18.          * Indicates the type of shape
  19.          *
  20.          * @property _type
  21.          * @type String
  22.      * @private
  23.          */
  24.         _type: "oval"
  25. });
  26. VMLEllipse.ATTRS = Y.merge(Y.VMLShape.ATTRS, {
  27.         /**
  28.          * Horizontal radius for the ellipse.
  29.          *
  30.          * @config xRadius
  31.          * @type Number
  32.          */
  33.         xRadius: {
  34.                 lazyAdd: false,

  35.                 getter: function()
  36.                 {
  37.                         var val = this.get("width");
  38.                         val = Math.round((val/2) * 100)/100;
  39.                         return val;
  40.                 },

  41.                 setter: function(val)
  42.                 {
  43.                         var w = val * 2;
  44.                         this.set("width", w);
  45.                         return val;
  46.                 }
  47.         },

  48.         /**
  49.          * Vertical radius for the ellipse.
  50.          *
  51.          * @config yRadius
  52.          * @type Number
  53.          * @readOnly
  54.          */
  55.         yRadius: {
  56.                 lazyAdd: false,

  57.                 getter: function()
  58.                 {
  59.                         var val = this.get("height");
  60.                         val = Math.round((val/2) * 100)/100;
  61.                         return val;
  62.                 },

  63.                 setter: function(val)
  64.                 {
  65.                         var h = val * 2;
  66.                         this.set("height", h);
  67.                         return val;
  68.                 }
  69.         }
  70. });
  71. Y.VMLEllipse = VMLEllipse;

  72.