mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-09 04:38:45 +00:00
fix gui1 sliders
this fixes issued with gui1 sliders beeing unable to handle negative min values.
This commit is contained in:
parent
8ee34c39b2
commit
f507418655
@ -25,6 +25,9 @@
|
|||||||
#include "video.hpp"
|
#include "video.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
#include <boost/math/special_functions/sign.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const std::string slider_image = ".png";
|
const std::string slider_image = ".png";
|
||||||
const std::string disabled_image = ".png~GS()";
|
const std::string disabled_image = ".png~GS()";
|
||||||
@ -89,7 +92,7 @@ void slider::set_value(int value)
|
|||||||
value = min_;
|
value = min_;
|
||||||
|
|
||||||
if (increment_ > 1) {
|
if (increment_ > 1) {
|
||||||
int hi = increment_ / 2;
|
int hi = boost::math::sign(value) * increment_ / 2;
|
||||||
value = ((value + hi) / increment_) * increment_;
|
value = ((value + hi) / increment_) * increment_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user