diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2019-02-18 09:44:27 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2019-02-18 09:44:27 +0100 |
commit | 9e75004466f251d765f72fd80fad846e71fae107 (patch) | |
tree | 6f1610a7bc384e86c43ff1afd43c4042485896f1 /src/elements | |
parent | a118f5e8ea4c596d9f9e39f8cc7a388136f958c9 (diff) | |
download | svg.js-9e75004466f251d765f72fd80fad846e71fae107.tar.gz svg.js-9e75004466f251d765f72fd80fad846e71fae107.zip |
added foreignObject to the core
Diffstat (limited to 'src/elements')
-rw-r--r-- | src/elements/Circle.js | 2 | ||||
-rw-r--r-- | src/elements/ForeignObject.js | 19 | ||||
-rw-r--r-- | src/elements/G.js | 2 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/elements/Circle.js b/src/elements/Circle.js index 3135ada..e3bfacc 100644 --- a/src/elements/Circle.js +++ b/src/elements/Circle.js @@ -36,7 +36,7 @@ export default class Circle extends Shape { extend(Circle, { x, y, cx, cy, width, height }) registerMethods({ - Element: { + Container: { // Create circle element circle: wrapWithAttrCheck(function (size) { return this.put(new Circle()) diff --git a/src/elements/ForeignObject.js b/src/elements/ForeignObject.js new file mode 100644 index 0000000..e6f9e2b --- /dev/null +++ b/src/elements/ForeignObject.js @@ -0,0 +1,19 @@ +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' +import { registerMethods } from '../utils/methods.js' +import Element from './Element.js' + +export default class ForeignObject extends Element { + constructor (node) { + super(nodeOrNew('foreignObject', node), node) + } +} + +registerMethods({ + Container: { + foreignObject: wrapWithAttrCheck(function (width, height) { + return this.put(new ForeignObject()).size(width, height) + }) + } +}) + +register(ForeignObject) diff --git a/src/elements/G.js b/src/elements/G.js index a9e8b55..da4af77 100644 --- a/src/elements/G.js +++ b/src/elements/G.js @@ -78,7 +78,7 @@ export default class G extends Container { } registerMethods({ - Element: { + Container: { // Create a group element group: wrapWithAttrCheck(function () { return this.put(new G()) |