整理代码,修复控件模块一处bug

This commit is contained in:
MrZ626
2021-05-27 10:07:46 +08:00
parent fecb292e9b
commit 9f3550adbc

View File

@@ -531,8 +531,8 @@ function slider:drag(x)
end end
end end
function slider:release(x) function slider:release(x)
self.lastTime=0
self:drag(x) self:drag(x)
self.lastTime=0
end end
function slider:arrowKey(isLeft) function slider:arrowKey(isLeft)
local p=self.disp() local p=self.disp()
@@ -1116,9 +1116,10 @@ function WIDGET.cursorMove(x,y)
end end
function WIDGET.press(x,y,k) function WIDGET.press(x,y,k)
local W=WIDGET.sel local W=WIDGET.sel
if not W then return end if W then
W:press(x,y+WIDGET.scrollPos,k) W:press(x,y and y+WIDGET.scrollPos,k)
if W.hide then WIDGET.unFocus()end if W.hide then WIDGET.unFocus()end
end
end end
function WIDGET.drag(x,y,dx,dy) function WIDGET.drag(x,y,dx,dy)
if WIDGET.sel then if WIDGET.sel then
@@ -1134,8 +1135,7 @@ function WIDGET.drag(x,y,dx,dy)
end end
function WIDGET.release(x,y) function WIDGET.release(x,y)
local W=WIDGET.sel local W=WIDGET.sel
if not W then return end if W and W.type=='slider'then
if W.type=='slider'then
W:release(x,y+WIDGET.scrollPos) W:release(x,y+WIDGET.scrollPos)
end end
end end