aboutsummaryrefslogtreecommitdiffstats
path: root/src/elements/G.js
blob: 4d3b03c2991e91af9303448b507e4494d5967bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import {
  nodeOrNew,
  register,
  wrapWithAttrCheck,
  extend
} from '../utils/adopter.js'
import { registerMethods } from '../utils/methods.js'
import Container from './Container.js'
import * as containerGeometry from '../modules/core/containerGeometry.js'

export default class G extends Container {
  constructor(node, attrs = node) {
    super(nodeOrNew('g', node), attrs)
  }
}

extend(G, containerGeometry)

registerMethods({
  Container: {
    // Create a group element
    group: wrapWithAttrCheck(function () {
      return this.put(new G())
    })
  }
})

register(G, 'G')