永久解决按输入框焦点和回车键的交互问题
This commit is contained in:
@@ -272,7 +272,7 @@ function love.keypressed(key)
|
|||||||
end
|
end
|
||||||
elseif not SCN.swapping then
|
elseif not SCN.swapping then
|
||||||
if SCN.keyDown then
|
if SCN.keyDown then
|
||||||
SCN.keyDown(key)
|
if #EDITING==0 then SCN.keyDown(key)end
|
||||||
elseif key=="escape"then
|
elseif key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1093,7 +1093,10 @@ function WIDGET.isFocus(W)
|
|||||||
end
|
end
|
||||||
function WIDGET.focus(W)
|
function WIDGET.focus(W)
|
||||||
if WIDGET.sel==W then return end
|
if WIDGET.sel==W then return end
|
||||||
if WIDGET.sel and WIDGET.sel.type=='inputBox'then kb.setTextInput(false)end
|
if WIDGET.sel and WIDGET.sel.type=='inputBox'then
|
||||||
|
kb.setTextInput(false)
|
||||||
|
EDITING=""
|
||||||
|
end
|
||||||
WIDGET.sel=W
|
WIDGET.sel=W
|
||||||
if W and W.type=='inputBox'then
|
if W and W.type=='inputBox'then
|
||||||
local _,y1=xOy:transformPoint(0,W.y+W.h)
|
local _,y1=xOy:transformPoint(0,W.y+W.h)
|
||||||
@@ -1103,7 +1106,10 @@ end
|
|||||||
function WIDGET.unFocus(force)
|
function WIDGET.unFocus(force)
|
||||||
local W=WIDGET.sel
|
local W=WIDGET.sel
|
||||||
if W and(force or not W.keepFocus)then
|
if W and(force or not W.keepFocus)then
|
||||||
if W.type=='inputBox'then kb.setTextInput(false)end
|
if W.type=='inputBox'then
|
||||||
|
kb.setTextInput(false)
|
||||||
|
EDITING=""
|
||||||
|
end
|
||||||
WIDGET.sel=false
|
WIDGET.sel=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ function scene.keyDown(key)
|
|||||||
if #mes>0 then
|
if #mes>0 then
|
||||||
NET.sendMessage(mes)
|
NET.sendMessage(mes)
|
||||||
inputBox:clear()
|
inputBox:clear()
|
||||||
elseif #EDITING==0 then
|
else
|
||||||
_switchChat()
|
_switchChat()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ function scene.sceneBack()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(k)
|
function scene.keyDown(k)
|
||||||
if k=="return"and #EDITING==0 then
|
if k=="return"then
|
||||||
createRoom()
|
createRoom()
|
||||||
elseif k=="escape"then
|
elseif k=="escape"then
|
||||||
SCN.go('net_rooms')
|
SCN.go('net_rooms')
|
||||||
|
|||||||
Reference in New Issue
Block a user