add threshold for button dragging in case of jittery mouse
parent
d2db9ca389
commit
010a3fcb15
|
@ -866,6 +866,15 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
elif e.Dragging() and e.ButtonIsDown(wx.MOUSE_BTN_LEFT):
|
elif e.Dragging() and e.ButtonIsDown(wx.MOUSE_BTN_LEFT):
|
||||||
obj = e.GetEventObject()
|
obj = e.GetEventObject()
|
||||||
scrpos = obj.ClientToScreen(e.GetPosition())
|
scrpos = obj.ClientToScreen(e.GetPosition())
|
||||||
|
if not hasattr(self,"dragpos"):
|
||||||
|
self.dragpos = scrpos
|
||||||
|
e.Skip()
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
dx,dy=self.dragpos[0]-scrpos[0],self.dragpos[1]-scrpos[1]
|
||||||
|
if dx*dx+dy*dy < 5*5: # threshold to detect dragging for jittery mice
|
||||||
|
e.Skip()
|
||||||
|
return
|
||||||
if not hasattr(self,"dragging"):
|
if not hasattr(self,"dragging"):
|
||||||
# init dragging of the custom button
|
# init dragging of the custom button
|
||||||
if hasattr(obj,"custombutton"):
|
if hasattr(obj,"custombutton"):
|
||||||
|
@ -945,6 +954,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
del self.dragging
|
del self.dragging
|
||||||
wx.CallAfter(self.cbuttons_reload)
|
wx.CallAfter(self.cbuttons_reload)
|
||||||
del self.last_drag_dest
|
del self.last_drag_dest
|
||||||
|
del self.dragpos
|
||||||
else:
|
else:
|
||||||
e.Skip()
|
e.Skip()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue