diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-12-03 22:59:58 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-12-03 22:59:58 +0100 |
commit | f089db0c1990d75bbd34713f97f547045ae92fca (patch) | |
tree | a0aa8346394aae92fff16ff4f1f452b30909cb5a /src/types | |
parent | c336bd4a1c8e129efffed63424b724a148f053b3 (diff) | |
download | svg.js-f089db0c1990d75bbd34713f97f547045ae92fca.tar.gz svg.js-f089db0c1990d75bbd34713f97f547045ae92fca.zip |
Release 3.0.23.0.2
Diffstat (limited to 'src/types')
-rw-r--r-- | src/types/Box.js | 5 | ||||
-rw-r--r-- | src/types/Color.js | 3 | ||||
-rw-r--r-- | src/types/EventTarget.js | 3 | ||||
-rw-r--r-- | src/types/List.js | 6 | ||||
-rw-r--r-- | src/types/Matrix.js | 3 |
5 files changed, 15 insertions, 5 deletions
diff --git a/src/types/Box.js b/src/types/Box.js index d2ddcdd..3df1367 100644 --- a/src/types/Box.js +++ b/src/types/Box.js @@ -1,6 +1,7 @@ import { delimiter } from '../modules/core/regex.js' -import { registerMethods } from '../utils/methods.js' import { globals } from '../utils/window.js' +import { register } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' import Point from './Point.js' import parser from '../modules/core/parser.js' @@ -152,3 +153,5 @@ registerMethods({ } } }) + +register(Box) diff --git a/src/types/Color.js b/src/types/Color.js index a1329aa..93ca570 100644 --- a/src/types/Color.js +++ b/src/types/Color.js @@ -63,6 +63,9 @@ export default class Color { } init (a = 0, b = 0, c = 0, d = 0, space = 'rgb') { + // This catches the case when a falsy value is passed like '' + a = !a ? 0 : a + // Reset all values in case the init function is rerun with new color space if (this.space) { for (let component in this.space) { diff --git a/src/types/EventTarget.js b/src/types/EventTarget.js index 5a005fd..d414dd8 100644 --- a/src/types/EventTarget.js +++ b/src/types/EventTarget.js @@ -1,4 +1,5 @@ import { dispatch, off, on } from '../modules/core/event.js' +import { register } from '../utils/adopter.js' import Base from './Base.js' export default class EventTarget extends Base { @@ -56,3 +57,5 @@ export default class EventTarget extends Base { removeEventListener () {} } + +register(EventTarget) diff --git a/src/types/List.js b/src/types/List.js index 44f0fed..f66e3cd 100644 --- a/src/types/List.js +++ b/src/types/List.js @@ -13,16 +13,14 @@ export default List extend(List, { each (fnOrMethodName, ...args) { if (typeof fnOrMethodName === 'function') { - this.forEach((el) => { - fnOrMethodName.call(el, el) + return this.map((el) => { + return fnOrMethodName.call(el, el) }) } else { return this.map(el => { return el[fnOrMethodName](...args) }) } - - return this }, toArray () { diff --git a/src/types/Matrix.js b/src/types/Matrix.js index 102192b..ef90ca3 100644 --- a/src/types/Matrix.js +++ b/src/types/Matrix.js @@ -1,5 +1,6 @@ import { delimiter } from '../modules/core/regex.js' import { radians } from '../utils/utils.js' +import { register } from '../utils/adopter.js' import Element from '../elements/Element.js' import Point from './Point.js' @@ -498,3 +499,5 @@ export function screenCTM () { } return new Matrix(this.node.getScreenCTM()) } + +register(Matrix) |