summaryrefslogtreecommitdiffstats
path: root/src/elements/Rect.js
blob: fa66fc35019daf01504ecc313d5bf02d7f571331 (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
import { extend, nodeOrNew, register } from '../utils/adopter.js'
import { registerMethods } from '../utils/methods.js'
import { rx, ry } from '../modules/core/circled.js'
import Shape from './Shape.js'

export default class Rect extends Shape {
  // Initialize node
  constructor (node) {
    super(nodeOrNew('rect', node), Rect)
  }
}

extend(Rect, { rx, ry })

registerMethods({
  Container: {
    // Create a rect element
    rect (width, height) {
      return this.put(new Rect()).size(width, height)
    }
  }
})

register(Rect)