aboutsummaryrefslogtreecommitdiffstats
path: root/src/Polyline.js
blob: 7d1664ebc96eb8d2d5acbb6f9e4805ceda53d90b (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 Shape from './Shape.js'
import { nodeOrNew, extend } from './tools.js'
import PointArray from './PointArray.js'
import * as pointed from './pointed.js'
import * as poly from './poly.js'
import { register } from './adopter.js'
import { registerMethods } from './methods.js'

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

registerMethods({
  Container: {
    // Create a wrapped polygon element
    polyline (p) {
      // make sure plot is called as a setter
      return this.put(new Polyline()).plot(p || new PointArray())
    }
  }
})

extend(Polyline, pointed)
extend(Polyline, poly)
register(Polyline)