@@ -263,6 +263,7 @@ void AbstractTableView::mousemove_event(MouseEvent& event)
263
263
return AbstractView::mousemove_event (event);
264
264
265
265
auto adjusted_position = this ->adjusted_position (event.position ());
266
+ Gfx::Point horizontally_adjusted_position (adjusted_position.x (), event.position ().y ());
266
267
267
268
if (m_in_column_resize) {
268
269
auto delta = adjusted_position - m_column_resize_origin;
@@ -281,7 +282,7 @@ void AbstractTableView::mousemove_event(MouseEvent& event)
281
282
282
283
if (m_pressed_column_header_index != -1 ) {
283
284
auto header_rect = this ->header_rect (m_pressed_column_header_index);
284
- if (header_rect.contains (adjusted_position )) {
285
+ if (header_rect.contains (horizontally_adjusted_position )) {
285
286
set_hovered_header_index (m_pressed_column_header_index);
286
287
if (!m_pressed_column_header_is_pressed)
287
288
update_headers ();
@@ -299,12 +300,12 @@ void AbstractTableView::mousemove_event(MouseEvent& event)
299
300
int column_count = model ()->column_count ();
300
301
bool found_hovered_header = false ;
301
302
for (int i = 0 ; i < column_count; ++i) {
302
- if (column_resize_grabbable_rect (i).contains (adjusted_position )) {
303
+ if (column_resize_grabbable_rect (i).contains (horizontally_adjusted_position )) {
303
304
window ()->set_override_cursor (StandardCursor::ResizeHorizontal);
304
305
set_hovered_header_index (-1 );
305
306
return ;
306
307
}
307
- if (header_rect (i).contains (adjusted_position )) {
308
+ if (header_rect (i).contains (horizontally_adjusted_position )) {
308
309
set_hovered_header_index (i);
309
310
found_hovered_header = true ;
310
311
}
@@ -320,16 +321,17 @@ void AbstractTableView::mousemove_event(MouseEvent& event)
320
321
void AbstractTableView::mouseup_event (MouseEvent& event)
321
322
{
322
323
auto adjusted_position = this ->adjusted_position (event.position ());
324
+ Gfx::Point horizontally_adjusted_position (adjusted_position.x (), event.position ().y ());
323
325
if (event.button () == MouseButton::Left) {
324
326
if (m_in_column_resize) {
325
- if (!column_resize_grabbable_rect (m_resizing_column).contains (adjusted_position ))
327
+ if (!column_resize_grabbable_rect (m_resizing_column).contains (horizontally_adjusted_position ))
326
328
window ()->set_override_cursor (StandardCursor::None);
327
329
m_in_column_resize = false ;
328
330
return ;
329
331
}
330
332
if (m_pressed_column_header_index != -1 ) {
331
333
auto header_rect = this ->header_rect (m_pressed_column_header_index);
332
- if (header_rect.contains (adjusted_position )) {
334
+ if (header_rect.contains (horizontally_adjusted_position )) {
333
335
auto new_sort_order = SortOrder::Ascending;
334
336
if (model ()->key_column () == m_pressed_column_header_index)
335
337
new_sort_order = model ()->sort_order () == SortOrder::Ascending
@@ -356,11 +358,12 @@ void AbstractTableView::mousedown_event(MouseEvent& event)
356
358
return AbstractView::mousedown_event (event);
357
359
358
360
auto adjusted_position = this ->adjusted_position (event.position ());
361
+ Gfx::Point horizontally_adjusted_position (adjusted_position.x (), event.position ().y ());
359
362
360
363
if (event.y () < header_height ()) {
361
364
int column_count = model ()->column_count ();
362
365
for (int i = 0 ; i < column_count; ++i) {
363
- if (column_resize_grabbable_rect (i).contains (adjusted_position )) {
366
+ if (column_resize_grabbable_rect (i).contains (horizontally_adjusted_position )) {
364
367
m_resizing_column = i;
365
368
m_in_column_resize = true ;
366
369
m_column_resize_original_width = column_width (i);
@@ -369,7 +372,7 @@ void AbstractTableView::mousedown_event(MouseEvent& event)
369
372
}
370
373
auto header_rect = this ->header_rect (i);
371
374
auto column_metadata = model ()->column_metadata (i);
372
- if (header_rect.contains (adjusted_position ) && column_metadata.sortable == Model::ColumnMetadata::Sortable::True) {
375
+ if (header_rect.contains (horizontally_adjusted_position ) && column_metadata.sortable == Model::ColumnMetadata::Sortable::True) {
373
376
m_pressed_column_header_index = i;
374
377
m_pressed_column_header_is_pressed = true ;
375
378
update_headers ();
0 commit comments