Merge pull request 'Style changes' (#27) from Dram27-fix-settings-scrolling into main

Reviewed-on: #27
This commit was merged in pull request #27.
This commit is contained in:
2026-07-20 21:14:57 +02:00
3 changed files with 34 additions and 45 deletions

View File

@@ -36,7 +36,7 @@ void GuiElementContainer::removeChild( GuiElement* element ) {
} }
bool GuiElementContainer::containsPointInChildren(int x, int y) const { bool GuiElementContainer::containsPointInChildren(int x, int y) const {
for (std::vector<GuiElement*>::const_iterator it = children.begin(); it != children.end(); ++it) { for (auto it = children.begin(); it != children.end(); ++it) {
GuiElement* child = *it; GuiElement* child = *it;
if (child == NULL || !child->visible) continue; if (child == NULL || !child->visible) continue;
if (child->pointInside(x, y)) return true; if (child->pointInside(x, y)) return true;

View File

@@ -12,18 +12,7 @@
#include "../../../platform/input/Mouse.h" #include "../../../platform/input/Mouse.h"
#include "../../../util/Mth.h" #include "../../../util/Mth.h"
OptionsGroup::OptionsGroup( std::string labelID ) OptionsGroup::OptionsGroup( std::string labelID ) {
: contentHeight(0),
scrollOffsetY(0.0f),
maxScrollOffsetY(0.0f),
trackingScrollGesture(false),
scrollingGesture(false),
touchDispatched(false),
dragStartX(0),
dragStartY(0),
lastDragY(0),
touchStartX(0),
touchStartY(0) {
label = I18n::get(labelID); label = I18n::get(labelID);
} }
@@ -36,7 +25,7 @@ void OptionsGroup::setupPositions() {
const int contentStartY = y + labelHeight; const int contentStartY = y + labelHeight;
// First we write the header and then we add the items // First we write the header and then we add the items
for(std::vector<GuiElement*>::iterator it = children.begin(); it != children.end(); ++it) { for(auto it = children.begin(); it != children.end(); ++it) {
(*it)->width = width - 5; (*it)->width = width - 5;
(*it)->y = curY; (*it)->y = curY;

View File

@@ -32,17 +32,17 @@ protected:
void createKey(OptionId optId, Minecraft* minecraft); void createKey(OptionId optId, Minecraft* minecraft);
std::string label; std::string label;
int contentHeight; int contentHeight = 0;
float scrollOffsetY; float scrollOffsetY = 0.f;
float maxScrollOffsetY; float maxScrollOffsetY = 0.f;
bool trackingScrollGesture; bool trackingScrollGesture = false;
bool scrollingGesture; bool scrollingGesture = false;
bool touchDispatched; bool touchDispatched = false;
int dragStartX; int dragStartX = 0;
int dragStartY; int dragStartY = 0;
int lastDragY; int lastDragY = 0;
int touchStartX; int touchStartX = 0;
int touchStartY; int touchStartY = 0;
static const int ScrollStartThreshold = 5; static const int ScrollStartThreshold = 5;
}; };