Improve edit screen

This commit is contained in:
asraelite 2018-03-05 22:29:35 +00:00
parent 52770d7eb2
commit 826986cdbf
12 changed files with 235 additions and 40 deletions

View file

@ -38,8 +38,8 @@ export default class GuiEdit extends GuiElement {
for (let x = 0; x < this.tileWidth; x++)
for (let y = 0; y < this.tileHeight; y++) {
let tile = edit.getTile(x, y);
let ex = x * tileSize + spacing / 2 + ox + this.x;
let ey = y * tileSize + spacing / 2 + oy + this.y;
let ex = x * tileSize + spacing / 2 + ox;
let ey = y * tileSize + spacing / 2 + oy;
let [ew, eh] = [tileSize - spacing, tileSize - spacing];
let onclick = (button) => {
@ -54,9 +54,11 @@ export default class GuiEdit extends GuiElement {
tick() {
if (state.editing && !this.active) this.updateTiles();
this.active = state.editing;
this.options.draw = this.options.drawChildren = this.active;
this.parent.options.drawChildren = this.active;
if (!this.active) return;
this.textElements.info.text = edit.message;
[this.tileWidth, this.tileHeight] = [edit.width, edit.height];
}