19 lines
420 B
JavaScript
19 lines
420 B
JavaScript
|
import {Graphics} from '@pixi/graphics';
|
||
|
|
||
|
export default class Aabb extends Graphics {
|
||
|
constructor({color, width = 0.5}) {
|
||
|
super();
|
||
|
this.$$color = color;
|
||
|
this.$$width = width;
|
||
|
}
|
||
|
redraw({x0, y0, x1, y1}) {
|
||
|
this.clear();
|
||
|
this.lineStyle(this.$$width, this.$$color);
|
||
|
this.moveTo(x0, y0);
|
||
|
this.lineTo(x1, y0);
|
||
|
this.lineTo(x1, y1);
|
||
|
this.lineTo(x0, y1);
|
||
|
this.lineTo(x0, y0);
|
||
|
}
|
||
|
}
|