bamaer commented on PR #9238: URL: https://github.com/apache/hop/pull/9238#issuecomment-6624502068
Thanks for the fix, @mattcasters. Checked the coordinate reasoning against the SWT 4.37 sources: on GTK3 the click point and `TableItem.getBounds` are both in bin-window space with the scroll carried by `getClientArea().x`, and on Windows `ScrollBar.getSelection()` returns raw device pixels. The bounds-based lookup is correct whenever the grid has a row. It also fixes macOS, where `toControl` and `frameOfCellAtColumn` are both in `NSTableView` document coordinates and the old code had the same double subtraction. **Empty grid on Windows.** `findDataColumnAtXFromWidths` walks the widths from 0 without the scroll. That is correct on GTK and Cocoa, where the click is in content coordinates, but on Windows the click is relative to the visible area, so a scrolled grid without items resolves to a column left of the pointer. Before this change Windows at 100% scaling handled this case. It is reachable from Show rows: two filters with no common match remove every item, and "Remove filter" from the header then addresses the wrong column (usually disabled because that column has no filter). One option: when `getClientArea().x == 0`, apply the scroll converted to points, e.g. `hBar.getSelection() * sum(widths) / hBar.getMaximum()`. **Tests.** The scrolled-header test was added and then removed in the second commit, so the change has no coverage. A package-private static hit test taking the painted lefts/rights in visual order plus `x` could be unit-tested without pixels: gaps between cells, zero-width (hidden) columns, the row-number column, and the empty-grid fallback. **Simplification.** The insertion sort over three parallel arrays is not needed. `getColumnOrderSafe()` already gives the visual order and the cell bounds increase along it, so iterating that order, skipping width 0 and applying the next-left-edge rule gives the same result in far fewer lines. **Hop Web.** `TableView` is shared with RAP. Was the header menu checked on a horizontally scrolled grid in Hop Web? Minor: the Javadoc could mention Cocoa next to GTK and Windows. The second commit undoes part of the first, so a squash on merge keeps the history clean. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
