mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
UI for adding rows and columns.
This commit is contained in:
46
tilorswift/js/menu/InsertRowsWidget.js
Normal file
46
tilorswift/js/menu/InsertRowsWidget.js
Normal file
@@ -0,0 +1,46 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user