bug: Fixes basic mode mouse hitboxes being broken (#458)
Fixes basic mode having broken click hitboxes (they were 1 unit too long in both directions). I'm pretty sure normal mode does too, but it's less noticeable due to bounding boxes.
This commit is contained in:
parent
280bcbead2
commit
fcc478a1eb
|
@ -65,6 +65,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- [#425](https://github.com/ClementTsang/bottom/pull/425): Fixed a bug allowing grouped mode in tree mode if already in grouped mode.
|
||||
|
||||
- [#458](https://github.com/ClementTsang/bottom/pull/458): Fix basic mode having really broken click bounding boxes.
|
||||
|
||||
## [0.5.7] - 2021-01-30
|
||||
|
||||
## Bug Fixes
|
||||
|
|
|
@ -136,19 +136,18 @@ impl BasicTableArrows for Painter {
|
|||
);
|
||||
|
||||
if app_state.should_get_widget_bounds() {
|
||||
// The y is +1 as for some reason the height is 2... but we only want a height of 1.
|
||||
if let Some(basic_table) = &mut app_state.basic_table_widget_state {
|
||||
basic_table.left_tlc =
|
||||
Some((margined_draw_loc[0].x, margined_draw_loc[0].y + 1));
|
||||
Some((margined_draw_loc[0].x - 1, margined_draw_loc[0].y + 1));
|
||||
basic_table.left_brc = Some((
|
||||
margined_draw_loc[0].x + margined_draw_loc[0].width,
|
||||
margined_draw_loc[0].y + 1 + margined_draw_loc[0].height,
|
||||
margined_draw_loc[0].x + margined_draw_loc[0].width - 1,
|
||||
margined_draw_loc[0].y + 1,
|
||||
));
|
||||
basic_table.right_tlc =
|
||||
Some((margined_draw_loc[2].x, margined_draw_loc[2].y + 1));
|
||||
Some((margined_draw_loc[2].x - 1, margined_draw_loc[2].y + 1));
|
||||
basic_table.right_brc = Some((
|
||||
margined_draw_loc[2].x + margined_draw_loc[2].width,
|
||||
margined_draw_loc[2].y + 1 + margined_draw_loc[2].height,
|
||||
margined_draw_loc[2].x + margined_draw_loc[2].width - 1,
|
||||
margined_draw_loc[2].y + 1,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,8 +198,10 @@ impl CpuBasicWidget for Painter {
|
|||
// Update draw loc in widget map
|
||||
if let Some(widget) = app_state.widget_map.get_mut(&widget_id) {
|
||||
widget.top_left_corner = Some((draw_loc.x, draw_loc.y));
|
||||
widget.bottom_right_corner =
|
||||
Some((draw_loc.x + draw_loc.width, draw_loc.y + draw_loc.height));
|
||||
widget.bottom_right_corner = Some((
|
||||
draw_loc.x + draw_loc.width - 1,
|
||||
draw_loc.y + draw_loc.height - 1,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,8 +122,10 @@ impl MemBasicWidget for Painter {
|
|||
if app_state.should_get_widget_bounds() {
|
||||
if let Some(widget) = app_state.widget_map.get_mut(&widget_id) {
|
||||
widget.top_left_corner = Some((draw_loc.x, draw_loc.y));
|
||||
widget.bottom_right_corner =
|
||||
Some((draw_loc.x + draw_loc.width, draw_loc.y + draw_loc.height));
|
||||
widget.bottom_right_corner = Some((
|
||||
draw_loc.x + draw_loc.width - 1,
|
||||
draw_loc.y + draw_loc.height - 1,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,8 +70,10 @@ impl NetworkBasicWidget for Painter {
|
|||
if app_state.should_get_widget_bounds() {
|
||||
if let Some(widget) = app_state.widget_map.get_mut(&widget_id) {
|
||||
widget.top_left_corner = Some((draw_loc.x, draw_loc.y));
|
||||
widget.bottom_right_corner =
|
||||
Some((draw_loc.x + draw_loc.width, draw_loc.y + draw_loc.height));
|
||||
widget.bottom_right_corner = Some((
|
||||
draw_loc.x + draw_loc.width - 1,
|
||||
draw_loc.y + draw_loc.height - 1,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue