summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-03-05 09:52:39 +0100
committerGitHub <noreply@github.com>2018-03-05 09:52:39 +0100
commit55874e6dd16cb85181e879b8c35b4e65bb310e11 (patch)
treefade9fb53991736c908fe3be06d03bfdb6b1b6d5 /src
parent31e94c28d85f676a0f4ec073a06435bc86b1dc73 (diff)
parent14585d5e4f8ce51829f4da6759c2fe04dde37b5c (diff)
downloadsvg.js-55874e6dd16cb85181e879b8c35b4e65bb310e11.tar.gz
svg.js-55874e6dd16cb85181e879b8c35b4e65bb310e11.zip
Merge pull request #828 from svgdotjs/797-throw-error-in-at
make `at()` method of morphable objects throw when no destination is set (#797)
Diffstat (limited to 'src')
-rw-r--r--src/array.js2
-rw-r--r--src/boxes.js2
-rw-r--r--src/color.js2
-rw-r--r--src/matrix.js2
-rw-r--r--src/number.js2
-rw-r--r--src/patharray.js2
-rw-r--r--src/point.js2
-rw-r--r--src/pointarray.js2
8 files changed, 8 insertions, 8 deletions
diff --git a/src/array.js b/src/array.js
index ca51d8e..5ce0160 100644
--- a/src/array.js
+++ b/src/array.js
@@ -49,7 +49,7 @@ SVG.extend(SVG.Array, {
// Get morphed array at given position
at: function (pos) {
// make sure a destination is defined
- if (!this.destination) return this
+ if (!this.destination) throw new Error('No destination set')
// generate morphed array
for (var i = 0, il = this.value.length, array = []; i < il; i++) {
diff --git a/src/boxes.js b/src/boxes.js
index f0154bd..de96081 100644
--- a/src/boxes.js
+++ b/src/boxes.js
@@ -74,7 +74,7 @@ SVG.Box = SVG.invent({
},
at: function (pos) {
- if (!this.destination) return this
+ if (!this.destination) throw new Error('No destination set')
return new SVG.Box(
this.x + (this.destination.x - this.x) * pos
diff --git a/src/color.js b/src/color.js
index 8f47f70..22b8506 100644
--- a/src/color.js
+++ b/src/color.js
@@ -68,7 +68,7 @@ SVG.extend(SVG.Color, {
// Get morphed color at given position
at: function (pos) {
// make sure a destination is defined
- if (!this.destination) return this
+ if (!this.destination) throw new Error('No destination set')
// normalise pos
pos = pos < 0 ? 0 : pos > 1 ? 1 : pos
diff --git a/src/matrix.js b/src/matrix.js
index e823a81..8028b15 100644
--- a/src/matrix.js
+++ b/src/matrix.js
@@ -68,7 +68,7 @@ SVG.Matrix = SVG.invent({
// Get morphed matrix at a given position
at: function (pos) {
// make sure a destination is defined
- if (!this.destination) return this
+ if (!this.destination) throw new Error('No destination set')
// calculate morphed matrix at a given position
var matrix = new SVG.Matrix({
diff --git a/src/number.js b/src/number.js
index 6413f94..ba95151 100644
--- a/src/number.js
+++ b/src/number.js
@@ -91,7 +91,7 @@ SVG.Number = SVG.invent({
// Get morphed number at given position
at: function (pos) {
// Make sure a destination is defined
- if (!this.destination) return this
+ if (!this.destination) throw new Error('No destination set')
// Generate new morphed number
return new SVG.Number(this.destination)
diff --git a/src/patharray.js b/src/patharray.js
index d9ffecd..ca58513 100644
--- a/src/patharray.js
+++ b/src/patharray.js
@@ -195,7 +195,7 @@ SVG.extend(SVG.PathArray, {
// Get morphed path array at given position
at: function (pos) {
// make sure a destination is defined
- if (!this.destination) return this
+ if (!this.destination) throw new Error('No destination set')
var sourceArray = this.value
var destinationArray = this.destination.value
diff --git a/src/point.js b/src/point.js
index 682092e..72a9572 100644
--- a/src/point.js
+++ b/src/point.js
@@ -32,7 +32,7 @@ SVG.Point = SVG.invent({
// Get morphed point at a given position
at: function (pos) {
// make sure a destination is defined
- if (!this.destination) return this
+ if (!this.destination) throw new Error('No destination set')
// calculate morphed matrix at a given position
var point = new SVG.Point({
diff --git a/src/pointarray.js b/src/pointarray.js
index ecf5c40..6229e2e 100644
--- a/src/pointarray.js
+++ b/src/pointarray.js
@@ -32,7 +32,7 @@ SVG.extend(SVG.PointArray, {
// Get morphed array at given position
at: function (pos) {
// make sure a destination is defined
- if (!this.destination) return this
+ if (!this.destination) throw new Error('No destination set')
// generate morphed point string
for (var i = 0, il = this.value.length, array = []; i < il; i++) {