diff options
Diffstat (limited to 'src/elements/Ellipse.js')
-rw-r--r-- | src/elements/Ellipse.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/elements/Ellipse.js b/src/elements/Ellipse.js index 40b9369..b0ee4bf 100644 --- a/src/elements/Ellipse.js +++ b/src/elements/Ellipse.js @@ -1,5 +1,7 @@ import { extend, nodeOrNew, register } from '../utils/adopter.js' +import { proportionalSize } from '../utils/utils.js' import { registerMethods } from '../utils/methods.js' +import SVGNumber from '../types/SVGNumber.js' import Shape from './Shape.js' import * as circled from '../modules/core/circled.js' @@ -7,6 +9,14 @@ export default class Ellipse extends Shape { constructor (node) { super(nodeOrNew('ellipse', node), Ellipse) } + + size (width, height) { + var p = proportionalSize(this, width, height) + + return this + .rx(new SVGNumber(p.width).divide(2)) + .ry(new SVGNumber(p.height).divide(2)) + } } extend(Ellipse, circled) |