From db36423f48d5b09a68d38c710bd63e9ec6e43c11 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 22 Sep 2020 22:58:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=89=E4=B8=ADselector?= =?UTF-8?q?=E6=8C=89=E7=A9=BA=E6=A0=BC=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/widget.lua | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/Zframework/widget.lua b/Zframework/widget.lua index f87f91ec..ba358e57 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -591,24 +591,26 @@ function WIDGET.press(x,y) elseif W.type=="slider"then WIDGET.drag(x,y) elseif W.type=="selector"then - local s=W.select - if x1 then - s=s-1 - sysFX.newShade(.3,1,1,1,W.x,W.y,W.w*.5,60) + if x then + local s=W.select + if x1 then + s=s-1 + sysFX.newShade(.3,1,1,1,W.x,W.y,W.w*.5,60) + end + else + if s<#W.list then + s=s+1 + sysFX.newShade(.3,1,1,1,W.x+W.w*.5,W.y,W.w*.5,60) + end end - else - if s<#W.list then - s=s+1 - sysFX.newShade(.3,1,1,1,W.x+W.w*.5,W.y,W.w*.5,60) + if W.select~=s then + W.code(W.list[s]) + W.select=s + W.selText=W.list[s] + SFX.play("prerotate") end end - if W.select~=s then - W.code(W.list[s]) - W.select=s - W.selText=W.list[s] - SFX.play("prerotate") - end end if W.hide and W.hide()then WIDGET.sel=nil end end