summaryrefslogtreecommitdiffstats
path: root/src/elements/Circle.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-08 19:49:49 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-08 19:49:49 +0100
commit09e7d0b595da5a2e86e375ea4bd9bd7aba02c588 (patch)
treeae4d2df2887187bed13756c0cc79657cca680cf2 /src/elements/Circle.js
parent8c81fb7c2e6e9842570d27a84b1a1c600c82c16b (diff)
downloadsvg.js-09e7d0b595da5a2e86e375ea4bd9bd7aba02c588.tar.gz
svg.js-09e7d0b595da5a2e86e375ea4bd9bd7aba02c588.zip
added possibility to pass in additional attribues to element creators (#796)
e.g. - `canvas.rect({x:100})` or - `canvas.rect(100, 100, {x:100})`
Diffstat (limited to 'src/elements/Circle.js')
-rw-r--r--src/elements/Circle.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/elements/Circle.js b/src/elements/Circle.js
index 2f0d7f2..3135ada 100644
--- a/src/elements/Circle.js
+++ b/src/elements/Circle.js
@@ -1,5 +1,10 @@
import { cx, cy, height, width, x, y } from '../modules/core/circled.js'
-import { extend, nodeOrNew, register } from '../utils/adopter.js'
+import {
+ extend,
+ nodeOrNew,
+ register,
+ wrapWithAttrCheck
+} from '../utils/adopter.js'
import { registerMethods } from '../utils/methods.js'
import SVGNumber from '../types/SVGNumber.js'
import Shape from './Shape.js'
@@ -33,11 +38,11 @@ extend(Circle, { x, y, cx, cy, width, height })
registerMethods({
Element: {
// Create circle element
- circle (size) {
+ circle: wrapWithAttrCheck(function (size) {
return this.put(new Circle())
.size(size)
.move(0, 0)
- }
+ })
}
})