ujs/src/js/objects.js

26 lines
511 B
JavaScript
Raw Normal View History

2023-04-06 18:46:01 +03:00
class Object {
2023-04-06 16:52:57 +03:00
constructor(x, y, w, h) {
this.x = x;
this.y = y;
this.width = w;
this.height = h;
}
}
2023-04-06 18:46:01 +03:00
export class Rect extends Object {
2023-04-06 16:52:57 +03:00
constructor(x, y, w, h, fillColor = 'white') {
super(x, y, w, h);
this.fillColor = fillColor;
}
}
2023-04-06 18:46:01 +03:00
export class StrokeRect extends Rect {
2023-04-06 16:52:57 +03:00
constructor(x, y, w, h, fillColor = 'white', strokeColor = 'black', strokeWidth = 1) {
super(x, y, w, h, fillColor);
this.strokeWidth = strokeWidth;
this.strokeColor = strokeColor;
}
}