controller test
This commit is contained in:
parent
197a14c236
commit
e308160bec
6 changed files with 72 additions and 1 deletions
|
@ -302,6 +302,70 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
simulateController() {
|
||||||
|
let intTabIndex = 0
|
||||||
|
|
||||||
|
var sounds = {
|
||||||
|
Confirm: new Audio("./sounds/confirm.ogg"),
|
||||||
|
Menu: new Audio("./sounds/btn1.ogg"),
|
||||||
|
Hover: new Audio("./sounds/hover.ogg")
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("keydown", (e) => {
|
||||||
|
sounds.Confirm.currentTime = 0
|
||||||
|
sounds.Menu.currentTime = 0
|
||||||
|
sounds.Hover.currentTime = 0
|
||||||
|
let tabbable = $("[tabindex]")
|
||||||
|
console.log(e.key)
|
||||||
|
switch (e.key) {
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
case "ArrowLeft":
|
||||||
|
|
||||||
|
e.preventDefault()
|
||||||
|
break;
|
||||||
|
case "ArrowRight":
|
||||||
|
e.preventDefault()
|
||||||
|
break;
|
||||||
|
case "ArrowUp":
|
||||||
|
sounds.Hover.play()
|
||||||
|
if(intTabIndex <= 0) {
|
||||||
|
intTabIndex = 0
|
||||||
|
}else{
|
||||||
|
intTabIndex--
|
||||||
|
}
|
||||||
|
$(tabbable[intTabIndex]).focus()
|
||||||
|
// $("#app-content").scrollTop($(document.activeElement).offset().top)
|
||||||
|
e.preventDefault()
|
||||||
|
break;
|
||||||
|
case "ArrowDown":
|
||||||
|
sounds.Hover.play()
|
||||||
|
if(intTabIndex < tabbable.length) {
|
||||||
|
intTabIndex++
|
||||||
|
}else{
|
||||||
|
intTabIndex = tabbable.length
|
||||||
|
}
|
||||||
|
$(tabbable[intTabIndex]).focus()
|
||||||
|
// $("#app-content").scrollTop($(document.activeElement).offset().top)
|
||||||
|
e.preventDefault()
|
||||||
|
break;
|
||||||
|
case "c":
|
||||||
|
app.resetState()
|
||||||
|
break;
|
||||||
|
case "x":
|
||||||
|
sounds.Menu.play()
|
||||||
|
document.activeElement.dispatchEvent(new Event("contextmenu"))
|
||||||
|
e.preventDefault()
|
||||||
|
break;
|
||||||
|
case "z":
|
||||||
|
sounds.Confirm.play()
|
||||||
|
document.activeElement.dispatchEvent(new Event("click"))
|
||||||
|
document.activeElement.dispatchEvent(new Event("controller-click"))
|
||||||
|
e.preventDefault()
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
songLinkShare(amUrl) {
|
songLinkShare(amUrl) {
|
||||||
notyf.open({ type: "info", className: "notyf-info", message: app.getLz('term.song.link.generate') })
|
notyf.open({ type: "info", className: "notyf-info", message: app.getLz('term.song.link.generate') })
|
||||||
let self = this
|
let self = this
|
||||||
|
|
BIN
src/renderer/sounds/btn1.ogg
Normal file
BIN
src/renderer/sounds/btn1.ogg
Normal file
Binary file not shown.
BIN
src/renderer/sounds/confirm.ogg
Normal file
BIN
src/renderer/sounds/confirm.ogg
Normal file
Binary file not shown.
BIN
src/renderer/sounds/hover.ogg
Normal file
BIN
src/renderer/sounds/hover.ogg
Normal file
Binary file not shown.
|
@ -12,6 +12,9 @@
|
||||||
@mouseenter="checkLibrary"
|
@mouseenter="checkLibrary"
|
||||||
@mouseover="showInLibrary = true"
|
@mouseover="showInLibrary = true"
|
||||||
@mouseleave="showInLibrary = false"
|
@mouseleave="showInLibrary = false"
|
||||||
|
@dblclick="route()"
|
||||||
|
@controller-click.self="route()"
|
||||||
|
tabindex="0"
|
||||||
:class="[{'mediaitem-selected': app.select_hasMediaItem(guid)}, addClasses]">
|
:class="[{'mediaitem-selected': app.select_hasMediaItem(guid)}, addClasses]">
|
||||||
<template v-if="isVisible">
|
<template v-if="isVisible">
|
||||||
<div class="isLibrary" v-if="showLibraryStatus == true">
|
<div class="isLibrary" v-if="showLibraryStatus == true">
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<script type="text/x-template" id="mediaitem-square">
|
<script type="text/x-template" id="mediaitem-square">
|
||||||
<div tabindex="0"
|
<div
|
||||||
|
tabindex="0"
|
||||||
|
@click.self="app.routeView(item)"
|
||||||
|
@controller-click.self="app.routeView(item)"
|
||||||
|
@contextmenu.self="contextMenu"
|
||||||
class="cd-mediaitem-square" :class="getClasses()" @contextmenu="contextMenu"
|
class="cd-mediaitem-square" :class="getClasses()" @contextmenu="contextMenu"
|
||||||
v-observe-visibility="{callback: visibilityChanged}"
|
v-observe-visibility="{callback: visibilityChanged}"
|
||||||
:style="{'--spcolor': getBgColor()}">
|
:style="{'--spcolor': getBgColor()}">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue