import ButtonTile from "./ButtonTile.js";
import TilorswiftButtonBackgroundTileClickedEvent from "./events/TilorswiftButtonBackgroundTileClickedEvent.js";
import Tileset from "./Tileset.js";

export default class ButtonBackgroundTile extends ButtonTile
{
    /**
     * @param {Tileset} tileset 
     * @param {number} index 
     */
    constructor(tileset, index = 0)
    {
        super(tileset, index);
    }

    initHtml() {
        this.htmlElement = document.createElement('div');
        this.className = 'field';
        this.setupElement();
    }

    initEventListeners() {
        this.htmlElement.addEventListener(
            'mousedown',
            () => {
                window.dispatchEvent(new TilorswiftButtonBackgroundTileClickedEvent(this));
            }
        )
    }
}
