diff --git a/src/frontend/gui/GUI.cpp b/src/frontend/gui/GUI.cpp index 30161f24..2173eb45 100644 --- a/src/frontend/gui/GUI.cpp +++ b/src/frontend/gui/GUI.cpp @@ -40,7 +40,6 @@ PagesControl* GUI::getMenu() { } void GUI::actMouse(float delta) { - auto hover = container->getAt(Events::cursor, nullptr); if (this->hover && this->hover != hover) { this->hover->hover(false); @@ -53,7 +52,7 @@ void GUI::actMouse(float delta) { } this->hover = hover; - if (Events::jclicked(0)) { + if (Events::jclicked(mousecode::BUTTON_1)) { if (pressed == nullptr && this->hover) { pressed = hover; pressed->click(this, Events::cursor.x, Events::cursor.y); @@ -73,6 +72,14 @@ void GUI::actMouse(float delta) { pressed->mouseRelease(this, Events::cursor.x, Events::cursor.y); pressed = nullptr; } + + if (hover) { + for (int i = mousecode::BUTTON_1; i < mousecode::BUTTON_1+12; i++) { + if (Events::jclicked(i)) { + hover->clicked(this, i); + } + } + } } void GUI::act(float delta) { @@ -100,13 +107,6 @@ void GUI::act(float delta) { if (Events::clicked(mousecode::BUTTON_1)) { focus->mouseMove(this, Events::cursor.x, Events::cursor.y); } - if (prevfocus == focus){ - for (int i = mousecode::BUTTON_1; i < mousecode::BUTTON_1+12; i++) { - if (Events::jclicked(i)) { - focus->clicked(this, i); - } - } - } } } } diff --git a/src/frontend/gui/panels.cpp b/src/frontend/gui/panels.cpp index 97a211cf..2c838aa7 100644 --- a/src/frontend/gui/panels.cpp +++ b/src/frontend/gui/panels.cpp @@ -278,4 +278,4 @@ void PagesControl::reset() { Container::remove(current_.panel); current_ = Page{nullptr}; } -} \ No newline at end of file +} diff --git a/src/logic/ChunksController.cpp b/src/logic/ChunksController.cpp index 49f94823..c666c0fd 100644 --- a/src/logic/ChunksController.cpp +++ b/src/logic/ChunksController.cpp @@ -74,8 +74,8 @@ bool ChunksController::loadVisible(){ if (surrounding == MIN_SURROUNDING && !chunk->isLighted()) { if (!chunk->isLoadedLights()) { lighting->buildSkyLight(chunk->x, chunk->z); - lighting->onChunkLoaded(chunk->x, chunk->z); } + lighting->onChunkLoaded(chunk->x, chunk->z); chunk->setLighted(true); return true; }