mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 20:45:08 +00:00
GTableView: Make column resizing work when view is scrolled horizontally.
This commit is contained in:
parent
26110f7753
commit
e66f88ed60
1 changed files with 2 additions and 2 deletions
|
@ -88,7 +88,7 @@ Rect GTableView::header_rect(int column_index) const
|
||||||
|
|
||||||
Point GTableView::adjusted_position(const Point& position)
|
Point GTableView::adjusted_position(const Point& position)
|
||||||
{
|
{
|
||||||
return position.translated(-frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect GTableView::column_resize_grabbable_rect(int column) const
|
Rect GTableView::column_resize_grabbable_rect(int column) const
|
||||||
|
@ -109,7 +109,6 @@ void GTableView::mousedown_event(GMouseEvent& event)
|
||||||
for (int i = 0; i < model()->column_count(); ++i) {
|
for (int i = 0; i < model()->column_count(); ++i) {
|
||||||
if (event.button() == GMouseButton::Left) {
|
if (event.button() == GMouseButton::Left) {
|
||||||
if (column_resize_grabbable_rect(i).contains(adjusted_position)) {
|
if (column_resize_grabbable_rect(i).contains(adjusted_position)) {
|
||||||
dbgprintf("now resizing column %d\n", i);
|
|
||||||
m_resizing_column = i;
|
m_resizing_column = i;
|
||||||
m_in_column_resize = true;
|
m_in_column_resize = true;
|
||||||
m_column_resize_original_width = column_width(i);
|
m_column_resize_original_width = column_width(i);
|
||||||
|
@ -157,6 +156,7 @@ void GTableView::mousemove_event(GMouseEvent& event)
|
||||||
auto& column_data = this->column_data(m_resizing_column);
|
auto& column_data = this->column_data(m_resizing_column);
|
||||||
if (column_data.width != new_width) {
|
if (column_data.width != new_width) {
|
||||||
column_data.width = new_width;
|
column_data.width = new_width;
|
||||||
|
update_content_size();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue