diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-10-27 20:43:35 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-10-27 20:43:35 +0200 |
commit | 1c75fcaf02ceb144152d59557643c6fdd7264065 (patch) | |
tree | 5184af75f2fd27ca6b81c24a06b1676d17ca2c76 /src/Circle.js | |
parent | b1b776a710d0ce0a6259043b8ce0665e205195fa (diff) | |
download | svg.js-1c75fcaf02ceb144152d59557643c6fdd7264065.tar.gz svg.js-1c75fcaf02ceb144152d59557643c6fdd7264065.zip |
resolve circular references and make example working again
Diffstat (limited to 'src/Circle.js')
-rw-r--r-- | src/Circle.js | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/Circle.js b/src/Circle.js index fc8be72..6d4b12b 100644 --- a/src/Circle.js +++ b/src/Circle.js @@ -1,10 +1,11 @@ -import SVGNumber from './SVGNumber.js' -import Parent from './Parent.js' +import Base from './Base.js' +import {nodeOrNew, extend} from './tools.js' import {x, y, cx, cy, width, height, size} from './circled.js' +import SVGNumber from './SVGNumber.js' -export default class Circle extends Shape { +export default class Circle extends Base { constructor (node) { - super(nodeOrNew('circle', node)) + super(nodeOrNew('circle', node), Circle) } radius (r) { @@ -24,11 +25,13 @@ export default class Circle extends Shape { extend(Circle, {x, y, cx, cy, width, height, size}) -addFactory(Parent, { - // Create circle element - circle (size) { - return this.put(new Circle()) - .radius(new SVGNumber(size).divide(2)) - .move(0, 0) +Circle.constructors = { + Element: { + // Create circle element + circle (size) { + return this.put(new Circle()) + .radius(new SVGNumber(size).divide(2)) + .move(0, 0) + } } -}) +} |