fix fit drag bitmap causing redraws on macos

This commit is contained in:
Grange Nagy
2023-12-03 01:47:32 -05:00
parent cdfa52e9ed
commit 193adc4ba5

View File

@@ -195,9 +195,8 @@ class FitItem(SFItem.SFBrowserItem):
self.dragged = False
if self.HasCapture():
self.ReleaseMouse()
# TODO: re-enable this once rendring of drag window is fixed
#self.dragWindow.Show(False)
#self.dragWindow = None
self.dragWindow.Show(False)
self.dragWindow = None
def OnContextMenu(self, event):
""" Handles context menu for fit. Dragging is handled by MouseLeftUp() """
@@ -417,12 +416,18 @@ class FitItem(SFItem.SFBrowserItem):
if self.dragging:
if not self.dragged:
if self.dragMotionTrigger < 0:
if not self.dragTLFBmp:
tdc = wx.MemoryDC()
self.dragTLFBmp = wx.Bitmap(200, self.GetRect().height)
tdc.SelectObject(self.dragTLFBmp)
tdc.SetBrush(wx.Brush(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)))
tdc.DrawRectangle(0, 0, 200, self.GetRect().height)
self.DrawItem(tdc)
if not self.HasCapture():
self.CaptureMouse()
# self.dragWindow = PFBitmapFrame(self, pos, self.dragTLFBmp)
# TODO: re-enable this once rendring of drag window is fixed
#self.dragWindow.Show()
#self.dragged = True
self.dragWindow = PFBitmapFrame(self, pos, self.dragTLFBmp)
self.dragWindow.Show()
self.dragged = True
self.dragMotionTrigger = self.dragMotionTrail
else:
self.dragMotionTrigger -= 1
@@ -521,12 +526,6 @@ class FitItem(SFItem.SFBrowserItem):
if self.tcFitName.IsShown():
self.AdjustControlSizePos(self.tcFitName, self.textStartx, self.toolbarx - self.editWidth - self.padding)
# TODO: migrate this away from a bitmap
#tdc = wx.MemoryDC()
#self.dragTLFBmp = wx.Bitmap((self.toolbarx if self.toolbarx < 200 else 200), rect.height, 24)
#tdc.SelectObject(self.dragTLFBmp)
#tdc.Blit(0, 0, (self.toolbarx if self.toolbarx < 200 else 200), rect.height, mdc, 0, 0, wx.COPY)
#tdc.SelectObject(wx.NullBitmap)
def AdjustControlSizePos(self, editCtl, start, end):
fnEditSize = editCtl.GetSize()