summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-08 11:12:26 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-08 11:12:26 +0100
commit834c05b0a251f38043a7961dab920f20720c1144 (patch)
tree36b610ca049952079468f03f1902f376124ddaa8 /src
parent4702522137dac17a6312c521f3c1974eb839c5eb (diff)
downloadsvg.js-834c05b0a251f38043a7961dab920f20720c1144.tar.gz
svg.js-834c05b0a251f38043a7961dab920f20720c1144.zip
get rid of the fixmes and todos
Diffstat (limited to 'src')
-rw-r--r--src/animation/Runner.js15
-rw-r--r--src/animation/Timeline.js1
-rw-r--r--src/elements/Rect.js16
-rw-r--r--src/elements/Text.js1
-rw-r--r--src/modules/core/circled.js1
-rw-r--r--src/modules/core/gradiented.js1
-rw-r--r--src/modules/optional/class.js10
-rw-r--r--src/modules/optional/css.js1
-rw-r--r--src/modules/optional/memory.js5
-rw-r--r--src/types/Morphable.js5
10 files changed, 20 insertions, 36 deletions
diff --git a/src/animation/Runner.js b/src/animation/Runner.js
index f752185..4de127a 100644
--- a/src/animation/Runner.js
+++ b/src/animation/Runner.js
@@ -1,8 +1,10 @@
import { Controller, Ease, Stepper } from './Controller.js'
import { extend } from '../utils/adopter.js'
+import { from, to } from '../modules/core/gradiented.js'
import { getOrigin } from '../utils/utils.js'
import { noop, timeline } from '../modules/core/defaults.js'
import { registerMethods } from '../utils/methods.js'
+import { rx, ry } from '../modules/core/circled.js'
import Animator from './Animator.js'
import Box from '../types/Box.js'
import EventTarget from '../types/EventTarget.js'
@@ -668,9 +670,8 @@ extend(Runner, {
: (affine != null ? affine : !isMatrix)
// Create a morepher and set its type
- const morpher = new Morphable()
+ const morpher = new Morphable(this._stepper)
.type(affine ? TransformBag : Matrix)
- .stepper(this._stepper)
let origin
let element
@@ -883,12 +884,7 @@ extend(Runner, {
return this.plot([a, b, c, d])
}
- // FIXME: this needs to be rewritten such that the element is only accesed
- // in the init function
- return this._queueObject('plot', new this._element.MorphArray(a))
-
- /*
- var morpher = this._element.morphArray().to(a)
+ var morpher = this._element.MorphArray().to(a)
this.queue(function () {
morpher.from(this._element.array())
@@ -897,7 +893,6 @@ extend(Runner, {
})
return this
- */
},
// Add leading method
@@ -926,3 +921,5 @@ extend(Runner, {
return this
}
})
+
+extend(Runner, { rx, ry, from, to })
diff --git a/src/animation/Timeline.js b/src/animation/Timeline.js
index 3a731cb..790033a 100644
--- a/src/animation/Timeline.js
+++ b/src/animation/Timeline.js
@@ -225,7 +225,6 @@ export default class Timeline {
} else if (runnerInfo.persist !== true) {
// runner is finished. And runner might get removed
- // TODO: Figure out end time of runner
var endTime = runner.duration() - runner.time() + this._time
if (endTime + this._persist < this._time) {
diff --git a/src/elements/Rect.js b/src/elements/Rect.js
index 9d6163c..fa66fc3 100644
--- a/src/elements/Rect.js
+++ b/src/elements/Rect.js
@@ -1,5 +1,6 @@
-import { nodeOrNew, register } from '../utils/adopter.js'
+import { extend, nodeOrNew, register } from '../utils/adopter.js'
import { registerMethods } from '../utils/methods.js'
+import { rx, ry } from '../modules/core/circled.js'
import Shape from './Shape.js'
export default class Rect extends Shape {
@@ -7,19 +8,10 @@ export default class Rect extends Shape {
constructor (node) {
super(nodeOrNew('rect', node), Rect)
}
-
- // FIXME: unify with circle
- // Radius x value
- rx (rx) {
- return this.attr('rx', rx)
- }
-
- // Radius y value
- ry (ry) {
- return this.attr('ry', ry)
- }
}
+extend(Rect, { rx, ry })
+
registerMethods({
Container: {
// Create a rect element
diff --git a/src/elements/Text.js b/src/elements/Text.js
index 58d50a3..f1aa402 100644
--- a/src/elements/Text.js
+++ b/src/elements/Text.js
@@ -55,7 +55,6 @@ export default class Text extends Shape {
text (text) {
// act as getter
if (text === undefined) {
- // FIXME use children() or each()
var children = this.node.childNodes
var firstLine = 0
text = ''
diff --git a/src/modules/core/circled.js b/src/modules/core/circled.js
index 9a3b1ad..b94d237 100644
--- a/src/modules/core/circled.js
+++ b/src/modules/core/circled.js
@@ -1,4 +1,3 @@
-// FIXME: import this to runner
import { proportionalSize } from '../../utils/utils.js'
import SVGNumber from '../../types/SVGNumber.js'
diff --git a/src/modules/core/gradiented.js b/src/modules/core/gradiented.js
index d34a9fe..6c744e4 100644
--- a/src/modules/core/gradiented.js
+++ b/src/modules/core/gradiented.js
@@ -1,4 +1,3 @@
-// FIXME: add to runner
import SVGNumber from '../../types/SVGNumber.js'
export function from (x, y) {
diff --git a/src/modules/optional/class.js b/src/modules/optional/class.js
index 1d28fd5..b08c82b 100644
--- a/src/modules/optional/class.js
+++ b/src/modules/optional/class.js
@@ -2,18 +2,18 @@ import { delimiter } from '../core/regex.js'
import { registerMethods } from '../../utils/methods.js'
// Return array of classes on the node
-function classes () {
+export function classes () {
var attr = this.attr('class')
return attr == null ? [] : attr.trim().split(delimiter)
}
// Return true if class exists on the node, false otherwise
-function hasClass (name) {
+export function hasClass (name) {
return this.classes().indexOf(name) !== -1
}
// Add class to the node
-function addClass (name) {
+export function addClass (name) {
if (!this.hasClass(name)) {
var array = this.classes()
array.push(name)
@@ -24,7 +24,7 @@ function addClass (name) {
}
// Remove class from the node
-function removeClass (name) {
+export function removeClass (name) {
if (this.hasClass(name)) {
this.attr('class', this.classes().filter(function (c) {
return c !== name
@@ -35,7 +35,7 @@ function removeClass (name) {
}
// Toggle the presence of a class on the node
-function toggleClass (name) {
+export function toggleClass (name) {
return this.hasClass(name) ? this.removeClass(name) : this.addClass(name)
}
diff --git a/src/modules/optional/css.js b/src/modules/optional/css.js
index 924b13d..babee7a 100644
--- a/src/modules/optional/css.js
+++ b/src/modules/optional/css.js
@@ -1,4 +1,3 @@
-// FIXME: We dont need exports
import { camelCase } from '../../utils/utils.js'
import { isBlank } from '../core/regex.js'
import { registerMethods } from '../../utils/methods.js'
diff --git a/src/modules/optional/memory.js b/src/modules/optional/memory.js
index d1bf7cf..6478367 100644
--- a/src/modules/optional/memory.js
+++ b/src/modules/optional/memory.js
@@ -1,5 +1,4 @@
import { registerMethods } from '../../utils/methods.js'
-// FIXME: We need a constructor to set this up
// Remember arbitrary data
export function remember (k, v) {
@@ -31,7 +30,9 @@ export function forget () {
return this
}
-// return local memory object
+// This triggers creation of a new hidden class which is not performant
+// However, this function is not rarely used so it will not happen frequently
+// Return local memory object
export function memory () {
return (this._memory = this._memory || {})
}
diff --git a/src/types/Morphable.js b/src/types/Morphable.js
index 2b12375..021c5f4 100644
--- a/src/types/Morphable.js
+++ b/src/types/Morphable.js
@@ -12,7 +12,6 @@ import SVGNumber from './SVGNumber.js'
export default class Morphable {
constructor (stepper) {
- // FIXME: the default stepper does not know about easing
this._stepper = stepper || new Ease('-')
this._from = null
@@ -230,11 +229,11 @@ export function registerMorphableType (type = []) {
export function makeMorphable () {
extend(morphableTypes, {
- to (val, args) {
+ to (val) {
return new Morphable()
.type(this.constructor)
.from(this.valueOf())
- .to(val, args)
+ .to(val)
},
fromArray (arr) {
this.init(arr)