aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-04-10 15:55:22 +1000
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-04-10 15:55:22 +1000
commita61525e02014062d09f0ce65495d6144636389ef (patch)
treededf42da33afc127f340f4bffde121885c98e630 /src
parent707098f081c5821af6173508a966a158d84bc741 (diff)
downloadsvg.js-a61525e02014062d09f0ce65495d6144636389ef.tar.gz
svg.js-a61525e02014062d09f0ce65495d6144636389ef.zip
added tests for Pattern
Diffstat (limited to 'src')
-rw-r--r--src/elements/Pattern.js39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/elements/Pattern.js b/src/elements/Pattern.js
index 72b7c59..be03423 100644
--- a/src/elements/Pattern.js
+++ b/src/elements/Pattern.js
@@ -10,9 +10,23 @@ export default class Pattern extends Container {
super(nodeOrNew('pattern', node), attrs)
}
- // Return the fill id
- url () {
- return 'url(#' + this.id() + ')'
+ // custom attr to handle transform
+ attr (a, b, c) {
+ if (a === 'transform') a = 'patternTransform'
+ return super.attr(a, b, c)
+ }
+
+ bbox () {
+ return new Box()
+ }
+
+ targets () {
+ return baseFind('svg [fill*="' + this.id() + '"]')
+ }
+
+ // Alias string convertion to fill
+ toString () {
+ return this.url()
}
// Update pattern by rebuilding
@@ -28,24 +42,11 @@ export default class Pattern extends Container {
return this
}
- // Alias string convertion to fill
- toString () {
- return this.url()
- }
-
- // custom attr to handle transform
- attr (a, b, c) {
- if (a === 'transform') a = 'patternTransform'
- return super.attr(a, b, c)
- }
-
- targets () {
- return baseFind('svg [fill*="' + this.id() + '"]')
+ // Return the fill id
+ url () {
+ return 'url("#' + this.id() + '")'
}
- bbox () {
- return new Box()
- }
}
registerMethods({