[IntervalWidget] adapt to bugui update
This commit is contained in:
parent
8a9abd5ee9
commit
fc93860c6f
2 changed files with 7 additions and 7 deletions
2
Hardware/3rdparty/bugui
vendored
2
Hardware/3rdparty/bugui
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 74617670a95ac6cf8bc59c999db89eddc5caed4c
|
Subproject commit 6beac152a93db4887435abdf2712e89ff32f7c35
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue