mr-crocs-adventures/tilorswift/js/menu/InsertRowsWidget.js

46 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-02-09 00:29:46 +01:00
import Widget from "./Widget.js";
import BrushMode from "../BrushMode.js";
export default class InsertRowsWidget extends Widget
{
constructor(widgetBar, brush)
{
super('+Zeile');
this.elementRowsInput = document.createElement('input');
this.elementButton = document.createElement('img');
this.htmlElement = this.createElement();
this.widgetBar = widgetBar;
this.brush = brush;
this.elementButton.addEventListener(
'click',
() => {
this.widgetBar.disableWidgets();
this.enable();
this.brush.mode = BrushMode.ADD_ROWS;
}
);
}
createElement()
{
let htmlElement = document.createElement('div');
htmlElement.id = 'widget-insert-rows';
this.elementButton.src = 'graphics/button-add-row.svg';
this.elementButton.id = 'widget-insert-rows-button';
htmlElement.appendChild(this.elementButton);
this.elementRowsInput.type = 'number';
this.elementRowsInput.id = 'widget-insert-rows-input';
this.elementRowsInput.value = 1;
htmlElement.appendChild(this.elementRowsInput);
return htmlElement;
}
getElement()
{
return this.htmlElement;
}
}