18 lines
278 B
JavaScript
18 lines
278 B
JavaScript
|
export default class Polygon {
|
||
|
constructor() {
|
||
|
this._ = [];
|
||
|
}
|
||
|
moveTo(x, y) {
|
||
|
this._.push([x, y]);
|
||
|
}
|
||
|
closePath() {
|
||
|
this._.push(this._[0].slice());
|
||
|
}
|
||
|
lineTo(x, y) {
|
||
|
this._.push([x, y]);
|
||
|
}
|
||
|
value() {
|
||
|
return this._.length ? this._ : null;
|
||
|
}
|
||
|
}
|