From fc93860c6ffadc22b288292ca120b91fe62f8622 Mon Sep 17 00:00:00 2001 From: thibaudk Date: Sat, 4 Jan 2025 22:46:27 +0000 Subject: [PATCH] [IntervalWidget] adapt to bugui update --- Hardware/3rdparty/bugui | 2 +- Hardware/Widgets/IntervalWidget.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Hardware/3rdparty/bugui b/Hardware/3rdparty/bugui index 7461767..6beac15 160000 --- a/Hardware/3rdparty/bugui +++ b/Hardware/3rdparty/bugui @@ -1 +1 @@ -Subproject commit 74617670a95ac6cf8bc59c999db89eddc5caed4c +Subproject commit 6beac152a93db4887435abdf2712e89ff32f7c35 diff --git a/Hardware/Widgets/IntervalWidget.cpp b/Hardware/Widgets/IntervalWidget.cpp index 5940fbf..1051067 100644 --- a/Hardware/Widgets/IntervalWidget.cpp +++ b/Hardware/Widgets/IntervalWidget.cpp @@ -32,14 +32,14 @@ void IntervalWidget::paint(bugui::painter& painter) const const auto col = skin.IntervalBase().color(); 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 { - if (px >= x() && - px <= (x() + width()) && - py == y()) + if (px >= 0 && + px <= width() && + py == 0) return true; 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) { - if (from_y != to_y) - model.requestHeightChange(to_y / static_cast(parent->height())); + double increment{to_y / static_cast(parent->height())}; + model.requestHeightChange(model.heightPercentage() + increment); } const Scenario::IntervalModel& IntervalWidget::get_model() const