diff options
Diffstat (limited to 'src/Mask.js')
-rw-r--r-- | src/Mask.js | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/Mask.js b/src/Mask.js index ed85552..8edf4ec 100644 --- a/src/Mask.js +++ b/src/Mask.js @@ -1,7 +1,9 @@ import Base from './Base.js' import {nodeOrNew} 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 Mask extends Base { // Initialize node @@ -9,25 +11,25 @@ export default class Mask extends Base { super(nodeOrNew('mask', node)) } - // // Unmask all masked elements and remove itself - // remove () { - // // unmask all targets - // this.targets().forEach(function (el) { - // el.unmask() - // }) - // - // // remove mask from parent - // return remove.call(this) - // } - // - // targets () { - // return find('svg [mask*="' + this.id() + '"]') - // } + // Unmask all masked elements and remove itself + remove () { + // unmask all targets + this.targets().forEach(function (el) { + el.unmask() + }) + + // remove mask from parent + return remove.call(this) + } + + targets () { + return find('svg [mask*="' + this.id() + '"]') + } } -Mask.constructors = { +registerMethods({ Container: { mask () { return this.defs().put(new Mask()) @@ -54,4 +56,6 @@ Mask.constructors = { return this.reference('mask') } } -} +}) + +register(Mask) |