aboutsummaryrefslogtreecommitdiffstats
path: root/src/elements/Marker.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/Marker.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/Marker.js')
-rw-r--r--src/elements/Marker.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/elements/Marker.js b/src/elements/Marker.js
index 7e78e7f..d40d13b 100644
--- a/src/elements/Marker.js
+++ b/src/elements/Marker.js
@@ -1,4 +1,4 @@
-import { nodeOrNew, register } from '../utils/adopter.js'
+import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'
import { registerMethods } from '../utils/methods.js'
import Container from './Container.js'
@@ -42,14 +42,14 @@ export default class Marker extends Container {
registerMethods({
Container: {
- marker (width, height, block) {
+ marker (...args) {
// Create marker element in defs
- return this.defs().marker(width, height, block)
+ return this.defs().marker(...args)
}
},
Defs: {
// Create marker
- marker (width, height, block) {
+ marker: wrapWithAttrCheck(function (width, height, block) {
// Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto
return this.put(new Marker())
.size(width, height)
@@ -57,7 +57,7 @@ registerMethods({
.viewbox(0, 0, width, height)
.attr('orient', 'auto')
.update(block)
- }
+ })
},
marker: {
// Create and attach markers