Skip to content

Commit

Permalink
getWords and scroll motion fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
karwler committed Sep 14, 2018
1 parent 8322932 commit cc8fbaa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/engine/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void Scene::selectFirst() {
lay = lay->getParent();
} else if (Layout* next = dynamic_cast<Layout*>(lay->getWidget(id)))
lay = next;
else if (dynamic_cast<Button*>(lay->getWidget(id))) {
else if (lay->getWidget(id)->navSelectable()) {
select = lay->getWidget(0);
break;
} else
Expand Down
1 change: 1 addition & 0 deletions src/utils/layouts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ void ScrollArea::onUndrag(uint8 mBut) {

void ScrollArea::onScroll(const vec2i& wMov) {
moveListPos(wMov.swap(direction.horizontal()));
motion = 0.f;
}

void ScrollArea::moveListPos(const vec2i& mov) {
Expand Down
14 changes: 7 additions & 7 deletions src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ static int natCompareRight(const char* a, const char* b) {
else if (!isDigit(*a))
return -1;
else if (!isDigit(*b))
return +1;
return 1;
else if (*a < *b) {
if (!bias)
bias = -1;
} else if (*a > *b) {
if (!bias)
bias = +1;
bias = 1;
} else if (!*a && !*b)
return bias;
}
Expand All @@ -27,11 +27,11 @@ static int natCompareLeft(const char* a, const char* b) {
else if (!isDigit(*a))
return -1;
else if (!isDigit(*b))
return +1;
return 1;
else if (*a < *b)
return -1;
else if (*a > *b)
return +1;
return 1;
}
return 0;
}
Expand Down Expand Up @@ -60,7 +60,7 @@ int strnatcmp(const char* a, const char* b) {
if (ca < cb)
return -1;
if (ca > cb)
return +1;
return 1;
}
}

Expand Down Expand Up @@ -221,11 +221,11 @@ vector<string> getWords(const string& line) {
vector<string> words;
while (i < line.length()) {
sizt pos = i;
while (!isSpace(line[i]))
while (!isSpace(line[i]) && i < line.length())
i++;
words.push_back(line.substr(pos, i - pos));

while (isSpace(line[i]) && i < line.length())
while (isSpace(line[i]))
i++;
}
return words;
Expand Down
3 changes: 2 additions & 1 deletion src/utils/widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ Slider::Slider(const Size& relSize, int value, int minimum, int maximum, PCall l
Button(relSize, leftCall, rightCall, doubleCall, background, showBackground, backgroundMargin, parent, id),
val(value),
vmin(minimum),
vmax(maximum)
vmax(maximum),
diffSliderMouse(0)
{}

void Slider::drawSelf() {
Expand Down

0 comments on commit cc8fbaa

Please sign in to comment.