summaryrefslogtreecommitdiffstats
path: root/src/clip.js
diff options
context:
space:
mode:
authorSaivan <savian@me.com>2018-02-27 00:48:11 +1100
committerSaivan <savian@me.com>2018-02-27 00:48:11 +1100
commitbec7881979149425a9c1b894f4741413b28c8141 (patch)
tree3a496f834520925686af3a8059766b61b65be390 /src/clip.js
parentec0a8aee0e21a93b22c255dae6768a9ff7b09e73 (diff)
downloadsvg.js-bec7881979149425a9c1b894f4741413b28c8141.tar.gz
svg.js-bec7881979149425a9c1b894f4741413b28c8141.zip
The first half of the library complies with Standard linting
This commit reformats the code so that it complies with the standard linting style. Its currently a work in progress, but it is meant to pave the way for linting in the build process
Diffstat (limited to 'src/clip.js')
-rw-r--r--src/clip.js38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/clip.js b/src/clip.js
index b43712e..63fff74 100644
--- a/src/clip.js
+++ b/src/clip.js
@@ -1,33 +1,33 @@
SVG.ClipPath = SVG.invent({
// Initialize node
- create: 'clipPath'
+ create: 'clipPath',
// Inherit from
-, inherit: SVG.Container
+ inherit: SVG.Container,
// Add class methods
-, extend: {
+ extend: {
// Unclip all clipped elements and remove itself
- remove: function() {
+ remove: function () {
// unclip all targets
- this.targets().forEach(function(el) {
+ this.targets().forEach(function (el) {
el.unclip()
})
// remove clipPath from parent
return SVG.Element.prototype.remove.call(this)
+ },
+
+ targets: function () {
+ return SVG.select('svg [clip-path*="' + this.id() + '"]')
}
-
- , targets: function() {
- return SVG.select('svg [clip-path*="' +this.id() +'"]')
- }
- }
+ },
// Add parent method
-, construct: {
+ construct: {
// Create clipping element
- clip: function() {
- return this.defs().put(new SVG.ClipPath)
+ clip: function () {
+ return this.defs().put(new SVG.ClipPath())
}
}
})
@@ -35,19 +35,19 @@ SVG.ClipPath = SVG.invent({
//
SVG.extend(SVG.Element, {
// Distribute clipPath to svg element
- clipWith: function(element) {
+ clipWith: function (element) {
// use given clip or create a new one
var clipper = element instanceof SVG.ClipPath ? element : this.parent().clip().add(element)
// apply mask
return this.attr('clip-path', 'url("#' + clipper.id() + '")')
- }
+ },
// Unclip element
-, unclip: function() {
+ unclip: function () {
return this.attr('clip-path', null)
- }
-, clipper: function() {
+ },
+ clipper: function () {
return this.reference('clip-path')
}
-}) \ No newline at end of file
+})