Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

Wrong offset makes expanded twist button being unsmoothly drew

Open jmotad opened this issue 4 years ago • 1 comments

wxPython version & source: 4.1.1 & /wx/lib/agw/customtreectrl.py

Description of the problem: In /wx/lib/agw/customtreectrl.py, while drawing expanded twist button, offset 6 is used to calculate button[2].y, that makes the button is not smooth. Adding 5 will make it better.

Original source code of /wx/lib/agw/customtreectrl.py
                    if self.HasAGWFlag(TR_TWIST_BUTTONS):
                        # We draw something like the Mac twist buttons

                        dc.SetPen(wx.BLACK_PEN)
                        dc.SetBrush(self._hilightBrush)
                        button = [wx.Point(), wx.Point(), wx.Point()]

                        if item.IsExpanded():
                            button[0].x = x - 5
                            button[0].y = y_mid - 3
                            button[1].x = x + 5
                            button[1].y = button[0].y
                            button[2].x = x

                            # if +5 is used here, the expanded twist button will be more smooth
                            button[2].y = button[0].y + 6 

jmotad avatar Jan 31 '21 03:01 jmotad

Do you mean having the triangle with a height of 5 vs 6 makes it more symmetric? I suppose it's subjective. Looks better in Windows/GTK2 but too narrow in MacOS/GTK3.

twist

cbeytas avatar Jan 23 '22 19:01 cbeytas