aboutsummaryrefslogtreecommitdiffstats
path: root/src/ClipPath.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-01 15:04:55 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-01 15:04:55 +0100
commitac84c9be8051567cfcb28ccd7ea2652524bb8a6f (patch)
tree26c4e1d5a21e5c9a7ed492291bee26a2ecc4f9b0 /src/ClipPath.js
parent4eba4508e4b9fd3a808e2d52f5c4d26af73becdd (diff)
downloadsvg.js-ac84c9be8051567cfcb28ccd7ea2652524bb8a6f.tar.gz
svg.js-ac84c9be8051567cfcb28ccd7ea2652524bb8a6f.zip
introduce register and registerMethod method to get rid of dependency problems
Diffstat (limited to 'src/ClipPath.js')
-rw-r--r--src/ClipPath.js40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/ClipPath.js b/src/ClipPath.js
index aeb129f..4989d6d 100644
--- a/src/ClipPath.js
+++ b/src/ClipPath.js
@@ -1,31 +1,33 @@
import Base from './Base.js'
import {nodeOrNew, extend} from './tools.js'
-//import find from './selector.js'
-//import {remove} from './Element.js'
+import find from './selector.js'
+import {remove} from './Element.js'
+import {register} from './adopter.js'
+import {registerMethods} from './methods.js'
export default class ClipPath extends Base {
constructor (node) {
super(nodeOrNew('clipPath', node), ClipPath)
}
- // // Unclip all clipped elements and remove itself
- // remove () {
- // // unclip all targets
- // this.targets().forEach(function (el) {
- // el.unclip()
- // })
- //
- // // remove clipPath from parent
- // return remove.call(this)
- // }
- //
- // targets () {
- // return find('svg [clip-path*="' + this.id() + '"]')
- // }
+ // Unclip all clipped elements and remove itself
+ remove () {
+ // unclip all targets
+ this.targets().forEach(function (el) {
+ el.unclip()
+ })
+
+ // remove clipPath from parent
+ return remove.call(this)
+ }
+
+ targets () {
+ return find('svg [clip-path*="' + this.id() + '"]')
+ }
}
-ClipPath.constructors = {
+registerMethods({
Container: {
// Create clipping element
clip: function() {
@@ -53,4 +55,6 @@ ClipPath.constructors = {
return this.reference('clip-path')
}
}
-}
+})
+
+register(ClipPath)