尝试修复手机端文本框响应逻辑错误
This commit is contained in:
@@ -189,10 +189,8 @@ function love.touchreleased(id,x,y)
|
|||||||
WIDGET.press(x,y,1)
|
WIDGET.press(x,y,1)
|
||||||
WIDGET.release(x,y)
|
WIDGET.release(x,y)
|
||||||
touching=false
|
touching=false
|
||||||
if WIDGET.sel and not WIDGET.sel.keepFocus then
|
|
||||||
WIDGET.unFocus()
|
WIDGET.unFocus()
|
||||||
end
|
end
|
||||||
end
|
|
||||||
if SCN.touchUp then SCN.touchUp(x,y)end
|
if SCN.touchUp then SCN.touchUp(x,y)end
|
||||||
if(x-lastX)^2+(y-lastY)^2<62 then
|
if(x-lastX)^2+(y-lastY)^2<62 then
|
||||||
if SCN.touchClick then SCN.touchClick(x,y)end
|
if SCN.touchClick then SCN.touchClick(x,y)end
|
||||||
|
|||||||
@@ -94,29 +94,40 @@ function scene.touchMove()
|
|||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key)
|
||||||
if key=="escape"then
|
if key=="escape"then
|
||||||
|
if not inputBox.hide then
|
||||||
|
scene.keyDown("switchChat")
|
||||||
|
else
|
||||||
if TIME()-lastBackTime<1 then
|
if TIME()-lastBackTime<1 then
|
||||||
NET.signal_quit()
|
NET.signal_quit()
|
||||||
else
|
else
|
||||||
lastBackTime=TIME()
|
lastBackTime=TIME()
|
||||||
LOG.print(text.sureQuit,'warn')
|
LOG.print(text.sureQuit,'warn')
|
||||||
end
|
end
|
||||||
|
end
|
||||||
elseif key=="return"then
|
elseif key=="return"then
|
||||||
if inputBox.hide then
|
|
||||||
textBox.hide=false
|
|
||||||
inputBox.hide=false
|
|
||||||
TASK.new(function()YIELD()WIDGET.focus(inputBox)end)
|
|
||||||
else
|
|
||||||
local mes=STRING.trim(inputBox:getText())
|
local mes=STRING.trim(inputBox:getText())
|
||||||
if mes and #mes>0 then
|
if not inputBox.hide then
|
||||||
|
if #mes>0 then
|
||||||
NET.sendMessage(mes)
|
NET.sendMessage(mes)
|
||||||
inputBox:clear()
|
inputBox:clear()
|
||||||
elseif #EDITING==0 then
|
elseif #EDITING==0 then
|
||||||
|
scene.keyDown("switchChat")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
scene.keyDown("switchChat")
|
||||||
|
end
|
||||||
|
elseif key=="switchChat"then
|
||||||
|
if inputBox.hide then
|
||||||
|
textBox.hide=false
|
||||||
|
inputBox.hide=false
|
||||||
|
WIDGET.focus(inputBox)
|
||||||
|
else
|
||||||
textBox.hide=true
|
textBox.hide=true
|
||||||
inputBox.hide=true
|
inputBox.hide=true
|
||||||
WIDGET.unFocus()
|
WIDGET.unFocus()
|
||||||
end
|
end
|
||||||
end
|
|
||||||
elseif not inputBox.hide then
|
elseif not inputBox.hide then
|
||||||
|
print(1)
|
||||||
WIDGET.focus(inputBox)
|
WIDGET.focus(inputBox)
|
||||||
inputBox:keypress(key)
|
inputBox:keypress(key)
|
||||||
elseif playing then
|
elseif playing then
|
||||||
@@ -360,7 +371,7 @@ scene.widgetList={
|
|||||||
not netPLY.getSelfReady() or
|
not netPLY.getSelfReady() or
|
||||||
NET.getlock('ready')
|
NET.getlock('ready')
|
||||||
end},
|
end},
|
||||||
WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=pressKey"return"},
|
WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=pressKey"switchChat"},
|
||||||
WIDGET.newKey{name="quit",fText="X",x=900,y=35,w=60,font=40,code=pressKey"escape"},
|
WIDGET.newKey{name="quit",fText="X",x=900,y=35,w=60,font=40,code=pressKey"escape"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user