From: Ulrich-Matthias Schäfer Date: Fri, 26 Oct 2018 10:01:39 +0000 (+0200) Subject: rename files X-Git-Tag: 3.0.0~56^2~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b1b776a710d0ce0a6259043b8ce0665e205195fa;p=svg.js.git rename files --- diff --git a/src/Stop.js b/src/Stop.js new file mode 100644 index 0000000..6bce999 --- /dev/null +++ b/src/Stop.js @@ -0,0 +1,27 @@ +import Element from './Element.js' +import SVGNumber from './SVGNumber.js' +import {nodeOrNew} from './tools.js' + +export default class Stop extends Element { + constructor (node) { + super(nodeOrNew('stop', node)) + } + + // add color stops + update (o) { + if (typeof o === 'number' || o instanceof SVGNumber) { + o = { + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + } + } + + // set attributes + if (o.opacity != null) this.attr('stop-opacity', o.opacity) + if (o.color != null) this.attr('stop-color', o.color) + if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)) + + return this + } +} diff --git a/src/Use.js b/src/Use.js new file mode 100644 index 0000000..9cf1711 --- /dev/null +++ b/src/Use.js @@ -0,0 +1,21 @@ +import {Shape, Container} from './classes.js' +import {xlink} from './namespaces.js' + +export default class Use extends Shape { + constructor (node) { + super(nodeOrNew('use', node)) + } + + // Use element as a reference + element (element, file) { + // Set lined element + return this.attr('href', (file || '') + '#' + element, xlink) + } +} + +addFactory(Container, { + // Create a use element + use: function (element, file) { + return this.put(new Use()).element(element, file) + } +}) diff --git a/src/stop.js b/src/stop.js deleted file mode 100644 index 6bce999..0000000 --- a/src/stop.js +++ /dev/null @@ -1,27 +0,0 @@ -import Element from './Element.js' -import SVGNumber from './SVGNumber.js' -import {nodeOrNew} from './tools.js' - -export default class Stop extends Element { - constructor (node) { - super(nodeOrNew('stop', node)) - } - - // add color stops - update (o) { - if (typeof o === 'number' || o instanceof SVGNumber) { - o = { - offset: arguments[0], - color: arguments[1], - opacity: arguments[2] - } - } - - // set attributes - if (o.opacity != null) this.attr('stop-opacity', o.opacity) - if (o.color != null) this.attr('stop-color', o.color) - if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)) - - return this - } -} diff --git a/src/use.js b/src/use.js deleted file mode 100644 index 9cf1711..0000000 --- a/src/use.js +++ /dev/null @@ -1,21 +0,0 @@ -import {Shape, Container} from './classes.js' -import {xlink} from './namespaces.js' - -export default class Use extends Shape { - constructor (node) { - super(nodeOrNew('use', node)) - } - - // Use element as a reference - element (element, file) { - // Set lined element - return this.attr('href', (file || '') + '#' + element, xlink) - } -} - -addFactory(Container, { - // Create a use element - use: function (element, file) { - return this.put(new Use()).element(element, file) - } -})