--- /dev/null
+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
+ }
+}
--- /dev/null
+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)
+ }
+})
+++ /dev/null
-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
- }
-}
+++ /dev/null
-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)
- }
-})