import Dialog from "./Dialog.js";
import TilorswiftGravityUpdatedEvent from "../events/TilorswiftGravityUpdatedEvent.js";

export default class DialogGravity extends Dialog
{
    constructor(gravity)
    {
        super();
        this.setMessage('Gravitation einstellen');
        this.inputGravity = this.createInputNumber('Stärke', gravity, 0, 10, 0.001);
        this.createButton('Abbrechen');
        this.buttonOk = this.createButton('OK');
        this.buttonOk.addEventListener(
            'click',
            () => {
                window.dispatchEvent(
                    new TilorswiftGravityUpdatedEvent(parseFloat(this.inputGravity.value))
                );
            }
        )
    }
}
