[IntervalWidget] adapt to bugui update

This commit is contained in:
thibaud keller 2025-01-04 22:46:27 +00:00
parent 8a9abd5ee9
commit fc93860c6f
2 changed files with 7 additions and 7 deletions

@ -1 +1 @@
Subproject commit 74617670a95ac6cf8bc59c999db89eddc5caed4c Subproject commit 6beac152a93db4887435abdf2712e89ff32f7c35

View file

@ -32,14 +32,14 @@ void IntervalWidget::paint(bugui::painter& painter) const
const auto col = skin.IntervalBase().color(); const auto col = skin.IntervalBase().color();
painter.set_color(col.red(), col.green(), col.blue(), col.alpha()); painter.set_color(col.red(), col.green(), col.blue(), col.alpha());
painter.draw_line({x(), y()}, {x() + width(), y()}); painter.draw_line({0, 0}, {width(), 0});
} }
bool IntervalWidget::contains(int px, int py) const bool IntervalWidget::contains(int px, int py) const
{ {
if (px >= x() && if (px >= 0 &&
px <= (x() + width()) && px <= width() &&
py == y()) py == 0)
return true; return true;
return false; return false;
@ -57,8 +57,8 @@ void IntervalWidget::on_double_press(int x, int y)
void IntervalWidget::on_drag(int from_x, int from_y, int to_x, int to_y) void IntervalWidget::on_drag(int from_x, int from_y, int to_x, int to_y)
{ {
if (from_y != to_y) double increment{to_y / static_cast<double>(parent->height())};
model.requestHeightChange(to_y / static_cast<double>(parent->height())); model.requestHeightChange(model.heightPercentage() + increment);
} }
const Scenario::IntervalModel& IntervalWidget::get_model() const const Scenario::IntervalModel& IntervalWidget::get_model() const