silphius/app/react/components/pixi/aabb.js
2024-07-31 21:25:11 -05:00

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);
}
}