summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2019-01-12 20:32:39 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2019-01-12 20:32:39 +0100
commit60792807eee29f1b748c9b12d308c477f7c1227d (patch)
tree27f5c46c02ea0acbec71668935ef72cf2749698e /src/utils
parentf5eff8745af43fcfcc2e837d89d549cb66220d99 (diff)
downloadsvg.js-60792807eee29f1b748c9b12d308c477f7c1227d.tar.gz
svg.js-60792807eee29f1b748c9b12d308c477f7c1227d.zip
Fix move and size of groups, removed setting of a default font so we dont act against user intention, fixed bug in `font()`
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/adopter.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/utils/adopter.js b/src/utils/adopter.js
index f091c96..45e9bd3 100644
--- a/src/utils/adopter.js
+++ b/src/utils/adopter.js
@@ -138,3 +138,27 @@ export function wrapWithAttrCheck (fn) {
}
}
}
+
+export function invent (config) {
+ // Create element initializer
+ var initializer = typeof config.create === 'function'
+ ? config.create
+ : function (node) {
+ this.constructor(node || create(config.create))
+ }
+
+ // Inherit prototype
+ if (config.inherit) {
+ /* eslint new-cap: off */
+ initializer.prototype = new config.inherit()
+ initializer.prototype.constructor = initializer
+ }
+
+ // Extend with methods
+ if (config.extend) { extend(initializer, config.extend) }
+
+ // Attach construct method to parent
+ if (config.construct) { extend(config.parent || elements['Container'], config.construct) }
+
+ return initializer
+}