brendand / mbtablegrid

An NSControl subclass which provides a spreadsheet-style table grid
9 stars 3 forks source link

Redraw and cursor flicker issue when resizing columns #42

Closed brendand closed 9 years ago

brendand commented 9 years ago

When you resize a column, the cursor is flickering, the sort indicator overlaps the header title, and the column divider jumps. The cursor is also misaligned with the divider line as it's being dragged. The flickering cursor doesn't really show in the video. But it flickers between the resizing cursor and the regular arrow cursor.

See video:

Column Resize Issue

Dejal commented 9 years ago

Yeah, I noticed that. The jumping seemed to be related to increasing the minimum column width; something odd going on there.

Dejal commented 9 years ago

Done. As a bonus, the cursor now changes to the right-only sizing one when the minimum is reached.

brendand commented 9 years ago

:+1:

brendand commented 9 years ago

There's still some resizing issues with the columns. If you drag a few columns to be really wide, then drag a column to the left to resize it to the minimum size, it will jump wide again. It makes it very difficult to resize the columns.

Column Resize Issue

brendand commented 9 years ago

Further to resizing columns, when you wiggle a column back and forth, the contentView frame keeps getting wider and wider. You can see it because the group rows are sized to the width of the contentView. So they appear to grow as the width of the contentView grows. It doesn't shrink back down when you drag left.

Somewhere here in MBTableGrid.m may be the culprit:

    if (currentWidth == minColumnWidth) {
        offset = columnRect.origin.x - location.x + minColumnWidth - self.rowHeaderView.frame.size.width;
        distance = 0.0;
    }

    // Update views with new sizes
    [contentView setFrameSize:NSMakeSize(NSWidth(contentView.frame) + distance, NSHeight(contentView.frame))];
Dejal commented 9 years ago

Both fixed. The latter issue was a bit tricky to trace, but I got there.

brendand commented 9 years ago

:+1: