Skip to content

Commit

Permalink
removed unused comments and files
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuzzyma committed Nov 5, 2018
1 parent 306b167 commit 9f2696e
Show file tree
Hide file tree
Showing 21 changed files with 3,471 additions and 4,498 deletions.
7,355 changes: 3,441 additions & 3,914 deletions dist/svg.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/svg.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/ClipPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default class ClipPath extends Container {

// remove clipPath from parent
return super.remove()
// return remove.call(this)
}

targets () {
Expand Down
15 changes: 0 additions & 15 deletions src/Doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default class Doc extends Container {
doc () {
if (this.isRoot()) return this
return super.doc()
// return doc.call(this)
}

// Add namespaces
Expand Down Expand Up @@ -51,22 +50,8 @@ export default class Doc extends Container {
}

return super.parent(type)
// return parent.call(this, type)
}

// Removes the doc from the DOM
// remove() {
// if (!this.isRoot()) {
// return super.remove()
// }
//
// if (this.parent()) {
// this.parent().remove(this)
// }
//
// return this
// }

clear () {
// remove children
while (this.node.hasChildNodes()) {
Expand Down
3 changes: 2 additions & 1 deletion src/Dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default class Dom extends EventTarget {

// Replace element
replace (element) {
// FIXME: after might not be available here
// FIXME: after() might not be available here
this.after(element).remove()

return element
Expand Down Expand Up @@ -234,4 +234,5 @@ export default class Dom extends EventTarget {
return this
}
}

extend(Dom, { attr })
9 changes: 0 additions & 9 deletions src/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,3 @@ export default class Element extends Dom {
return this.attr('y', y)
}
}

// registerMethods('Element', {
// x, y, cx, cy, move, center, width, height, size, clone, remove, replace,
// addTo, putIn, id, inside, toString, classes, hasClass, addClass, removeClass,
// toggleClass, reference, doc, defs, parent, parents, matches, native, svg,
// writeDataToDom, setData, getEventTarget
// })
//
// registerConstructor('Element', setup)
10 changes: 2 additions & 8 deletions src/EventTarget.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Base from './Base.js'
import { on, off, dispatch } from './event.js'
import { extend } from './tools.js'
import { registerMethods } from './methods.js'

export default class EventTarget extends Base {
constructor ({ events = {} } = {}) {
Expand Down Expand Up @@ -87,10 +87,4 @@ const methods = [ 'click',
return last
}, {})

extend(EventTarget, methods)

// registerMethods('EventTarget', {
// on, off, dispatch, fire
// })
//
// registerConstructor('EventTarget', setup)
registerMethods('Element', methods)
1 change: 0 additions & 1 deletion src/Gradient.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default class Gradient extends Container {
attr (a, b, c) {
if (a === 'transform') a = 'gradientTransform'
return super.attr(a, b, c)
// return attr.call(this, a, b, c)
}

targets () {
Expand Down
1 change: 0 additions & 1 deletion src/Mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default class Mask extends Container {

// remove mask from parent
return super.remove()
// return remove.call(this)
}

targets () {
Expand Down
217 changes: 0 additions & 217 deletions src/PathArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,220 +289,3 @@ extend(PathArray, {
return parser.nodes.path.getBBox()
}
})

// export default class PathArray extends SVGArray {
// constructor (array, fallback = [['M', 0, 0]]) {
// super(array, fallback)
// }
//
// // Convert array to string
// toString () {
// return arrayToString(this)
// }
//
// toArray () {
// return this.reduce(function (prev, curr) {
// return [].concat.call(prev, curr)
// }, [])
// }
//
// // Move path string
// move (x, y) {
// // get bounding box of current situation
// var box = this.bbox()
//
// // get relative offset
// x -= box.x
// y -= box.y
//
// if (!isNaN(x) && !isNaN(y)) {
// // move every point
// for (var l, i = this.length - 1; i >= 0; i--) {
// l = this[i][0]
//
// if (l === 'M' || l === 'L' || l === 'T') {
// this[i][1] += x
// this[i][2] += y
// } else if (l === 'H') {
// this[i][1] += x
// } else if (l === 'V') {
// this[i][1] += y
// } else if (l === 'C' || l === 'S' || l === 'Q') {
// this[i][1] += x
// this[i][2] += y
// this[i][3] += x
// this[i][4] += y
//
// if (l === 'C') {
// this[i][5] += x
// this[i][6] += y
// }
// } else if (l === 'A') {
// this[i][6] += x
// this[i][7] += y
// }
// }
// }
//
// return this
// }
//
// // Resize path string
// size (width, height) {
// // get bounding box of current situation
// var box = this.bbox()
// var i, l
//
// // recalculate position of all points according to new size
// for (i = this.length - 1; i >= 0; i--) {
// l = this[i][0]
//
// if (l === 'M' || l === 'L' || l === 'T') {
// this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x
// this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y
// } else if (l === 'H') {
// this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x
// } else if (l === 'V') {
// this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y
// } else if (l === 'C' || l === 'S' || l === 'Q') {
// this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x
// this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y
// this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x
// this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y
//
// if (l === 'C') {
// this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x
// this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y
// }
// } else if (l === 'A') {
// // resize radii
// this[i][1] = (this[i][1] * width) / box.width
// this[i][2] = (this[i][2] * height) / box.height
//
// // move position values
// this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x
// this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y
// }
// }
//
// return this
// }
//
// // Test if the passed path array use the same path data commands as this path array
// equalCommands (pathArray) {
// var i, il, equalCommands
//
// pathArray = new PathArray(pathArray)
//
// equalCommands = this.length === pathArray.value.length
// for (i = 0, il = this.length; equalCommands && i < il; i++) {
// equalCommands = this[i][0] === pathArray.value[i][0]
// }
//
// return equalCommands
// }
//
// // Make path array morphable
// morph (pathArray) {
// pathArray = new PathArray(pathArray)
//
// if (this.equalCommands(pathArray)) {
// this.destination = pathArray
// } else {
// this.destination = null
// }
//
// return this
// }
//
// // Get morphed path array at given position
// at (pos) {
// // make sure a destination is defined
// if (!this.destination) return this
//
// var sourceArray = this
// var destinationArray = this.destination.value
// var array = []
// var pathArray = new PathArray()
// var i, il, j, jl
//
// // Animate has specified in the SVG spec
// // See: https://www.w3.org/TR/SVG11/paths.html#PathElement
// for (i = 0, il = sourceArray.length; i < il; i++) {
// array[i] = [sourceArray[i][0]]
// for (j = 1, jl = sourceArray[i].length; j < jl; j++) {
// array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos
// }
// // For the two flags of the elliptical arc command, the SVG spec say:
// // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true
// // Elliptical arc command as an array followed by corresponding indexes:
// // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y]
// // 0 1 2 3 4 5 6 7
// if (array[i][0] === 'A') {
// array[i][4] = +(array[i][4] !== 0)
// array[i][5] = +(array[i][5] !== 0)
// }
// }
//
// // Directly modify the value of a path array, this is done this way for performance
// pathArray.value = array
// return pathArray
// }
//
// // Absolutize and parse path to array
// parse (array) {
// // if it's already a patharray, no need to parse it
// if (array instanceof PathArray) return array.valueOf()
//
// // prepare for parsing
// var s
// var paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 }
//
// if (typeof array === 'string') {
// array = array
// .replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123
// .replace(pathLetters, ' $& ') // put some room between letters and numbers
// .replace(hyphen, '$1 -') // add space before hyphen
// .trim() // trim
// .split(delimiter) // split into array
// } else {
// array = array.reduce(function (prev, curr) {
// return [].concat.call(prev, curr)
// }, [])
// }
//
// // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...]
// var result = []
// var p = new Point()
// var p0 = new Point()
// var index = 0
// var len = array.length
//
// do {
// // Test if we have a path letter
// if (isPathLetter.test(array[index])) {
// s = array[index]
// ++index
// // If last letter was a move command and we got no new, it defaults to [L]ine
// } else if (s === 'M') {
// s = 'L'
// } else if (s === 'm') {
// s = 'l'
// }
//
// result.push(pathHandlers[s].call(null,
// array.slice(index, (index = index + paramCnt[s.toUpperCase()])).map(parseFloat),
// p, p0
// )
// )
// } while (len > index)
//
// return result
// }
//
// // Get bounding box of path
// bbox () {
// parser().path.setAttribute('d', this.toString())
// return parser.nodes.path.getBBox()
// }
// }
1 change: 0 additions & 1 deletion src/Pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export default class Pattern extends Container {
attr (a, b, c) {
if (a === 'transform') a = 'patternTransform'
return super.attr(a, b, c)
// return attr.call(this, a, b, c)
}

targets () {
Expand Down

0 comments on commit 9f2696e

Please sign in to comment.