fantasy/ui/ui.js

24 lines
557 B
JavaScript
Raw Normal View History

2018-11-19 15:03:05 +00:00
class UI {
constructor(el, width, height) {
this.element = el;
this.setSize(width, height);
}
destructor() {
delete this.element;
}
setPosition(x, y) {
this.element.style.position = "absolute";
this.element.style.top = y + "px";
this.element.style.left = x + "px";
}
setSize(width, height) {
this._width = width;
this._height = height;
this.element.style.width = width + "px";
this.element.style.height = height + "px";
}
}
export default UI;