Decompile fn_11553 (UIListBoxEx::SendMsg)
Batch #17502 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_11553 UIListBoxEx::SendMsg: logic confirmed by peer review Peer-reviewed-by: eAthena, bibinir Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
3b003c3089
commit
b75e65ced8
1 changed files with 9 additions and 8 deletions
|
|
@ -237,18 +237,19 @@ int UIListBoxEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
|
|||
case UM_SCROLLVERTPAGEUP:
|
||||
case UM_SCROLLVERTPAGEDOWN: {
|
||||
const int previous = this->topLine;
|
||||
const int visible = this->geometry.height / this->lineHeight;
|
||||
const int delta = message == UM_SCROLLVERTPAGEUP ? (1 - visible) : message == UM_SCROLLVERTPAGEDOWN ? (visible - 1) : value;
|
||||
this->topLine = previous + delta;
|
||||
if (message == UM_SCROLLVERTPAGEUP) {
|
||||
this->topLine = previous - this->geometry.height / this->lineHeight + 1;
|
||||
} else if (message == UM_SCROLLVERTPAGEDOWN) {
|
||||
this->topLine = previous - 1 + this->geometry.height / this->lineHeight;
|
||||
} else {
|
||||
this->topLine = previous + value;
|
||||
}
|
||||
|
||||
if (this->topLine < 0) {
|
||||
this->topLine = 0;
|
||||
}
|
||||
|
||||
const int maximum = ((static_cast<int>(this->lines.size()) - visible) + this->bottomMargin);
|
||||
|
||||
if (static_cast<unsigned>(this->topLine) > static_cast<unsigned>(maximum)) {
|
||||
this->topLine = maximum;
|
||||
if (this->topLine > this->lines.size() - this->geometry.height / this->lineHeight + this->bottomMargin) {
|
||||
this->topLine = this->lines.size() - this->geometry.height / this->lineHeight + this->bottomMargin;
|
||||
}
|
||||
|
||||
this->verticalBar->position = this->topLine;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue