2020-01-30 23:40:42 +01:00
|
|
|
import Field from "./Field.js";
|
|
|
|
import TilorswiftButtonTileClickedEvent from "./events/TilorswiftButtonTileClickedEvent.js";
|
|
|
|
|
|
|
|
export default class ButtonTile extends Field
|
|
|
|
{
|
|
|
|
constructor(tileset, index = 0)
|
|
|
|
{
|
2023-09-24 01:48:01 +02:00
|
|
|
super(tileset, 0, 0, index);
|
2020-01-30 23:40:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
initHtml() {
|
|
|
|
this.htmlElement = document.createElement('div');
|
|
|
|
this.className = 'field';
|
|
|
|
this.setupElement();
|
|
|
|
}
|
|
|
|
|
|
|
|
initEventListeners() {
|
|
|
|
this.htmlElement.addEventListener(
|
|
|
|
'mousedown',
|
|
|
|
() => {
|
|
|
|
window.dispatchEvent(new TilorswiftButtonTileClickedEvent(this));
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
2023-09-24 01:48:01 +02:00
|
|
|
}
|