no repeatable presses
This commit is contained in:
parent
b991ee03ce
commit
0b71eb99a9
|
@ -6,10 +6,10 @@ selectUp = (event, button) ->
|
||||||
return
|
return
|
||||||
$(".options li").removeClass("active")
|
$(".options li").removeClass("active")
|
||||||
count = $(".options li").length
|
count = $(".options li").length
|
||||||
window.selectedoption ?= count + 1
|
|
||||||
window.selectedoption--
|
window.selectedoption--
|
||||||
if window.selectedoption < 0
|
if window.selectedoption <= 0
|
||||||
window.selectedoption = count
|
window.selectedoption = count
|
||||||
|
console.log window.selectedoption
|
||||||
$(".options li:nth-child(#{window.selectedoption}").addClass("active")
|
$(".options li:nth-child(#{window.selectedoption}").addClass("active")
|
||||||
|
|
||||||
# Select the next choice
|
# Select the next choice
|
||||||
|
@ -19,11 +19,11 @@ selectDown = (event, button) ->
|
||||||
if $(".options li").length == 0
|
if $(".options li").length == 0
|
||||||
return
|
return
|
||||||
$(".options li").removeClass("active")
|
$(".options li").removeClass("active")
|
||||||
window.selectedoption ?= -1
|
|
||||||
window.selectedoption++
|
window.selectedoption++
|
||||||
count = $(".options li").length
|
count = $(".options li").length
|
||||||
if window.selectedoption > count
|
if window.selectedoption > count
|
||||||
window.selectedoption = 1
|
window.selectedoption = 1
|
||||||
|
console.log window.selectedoption
|
||||||
$(".options li:nth-child(#{window.selectedoption})").addClass("active")
|
$(".options li:nth-child(#{window.selectedoption})").addClass("active")
|
||||||
|
|
||||||
selectOption = (event, button) ->
|
selectOption = (event, button) ->
|
||||||
|
@ -38,7 +38,8 @@ joystick = () ->
|
||||||
if pad?
|
if pad?
|
||||||
temp = new Gamepad(pad)
|
temp = new Gamepad(pad)
|
||||||
if temp.pressed?
|
if temp.pressed?
|
||||||
$(document).trigger("press", temp.pressed)
|
if salet.view.gamepads[pad.id].pressed != temp.pressed
|
||||||
|
$(document).trigger("press", temp.pressed)
|
||||||
salet.view.gamepads[pad.id] = temp
|
salet.view.gamepads[pad.id] = temp
|
||||||
|
|
||||||
$(document).on("viewinit", () ->
|
$(document).on("viewinit", () ->
|
||||||
|
@ -59,6 +60,7 @@ $(document).on("viewinit", () ->
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
window.selectedoption ?= 1
|
||||||
$(document).on("press", selectUp)
|
$(document).on("press", selectUp)
|
||||||
$(document).on("press", selectDown)
|
$(document).on("press", selectDown)
|
||||||
$(document).on("press", selectOption)
|
$(document).on("press", selectOption)
|
||||||
|
|
Loading…
Reference in New Issue