mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 15:31:51 +08:00
make songsel fast + add mousewheel scrolling
This commit is contained in:
parent
714a0302ec
commit
d85f8909d7
@ -290,10 +290,12 @@ class SongSelect{
|
||||
focused: true
|
||||
}
|
||||
this.songSelecting = {
|
||||
speed: 800,
|
||||
speed: 200,
|
||||
resize: 0.3,
|
||||
scrollDelay: 0.1
|
||||
}
|
||||
this.wheelScrolls = 0
|
||||
this.wheelTimer = 0
|
||||
|
||||
this.startPreview(true)
|
||||
|
||||
@ -339,7 +341,9 @@ class SongSelect{
|
||||
this.touchFullBtn.style.display = "block"
|
||||
pageEvents.add(this.touchFullBtn, "touchend", toggleFullscreen)
|
||||
}
|
||||
|
||||
|
||||
pageEvents.add(this.canvas, "wheel", this.mouseWheel.bind(this))
|
||||
|
||||
this.selectable = document.getElementById("song-sel-selectable")
|
||||
this.selectableText = ""
|
||||
|
||||
@ -503,6 +507,17 @@ class SongSelect{
|
||||
touchEnd(event){
|
||||
event.preventDefault()
|
||||
}
|
||||
mouseWheel(event){
|
||||
if(this.state.screen === "song"){
|
||||
this.wheelTimer = this.getMS()
|
||||
|
||||
if(event.deltaY < 0) {
|
||||
this.wheelScrolls++
|
||||
}else if(event.deltaY > 0){
|
||||
this.wheelScrolls--
|
||||
}
|
||||
}
|
||||
}
|
||||
mouseMove(event){
|
||||
var mouse = this.mouseOffset(event.offsetX, event.offsetY)
|
||||
var moveTo = null
|
||||
@ -892,12 +907,17 @@ class SongSelect{
|
||||
|
||||
for(var key in this.pressedKeys){
|
||||
if(this.pressedKeys[key]){
|
||||
if(ms >= this.pressedKeys[key] + 50){
|
||||
if(ms >= this.pressedKeys[key] + (this.state.screen === "song" && (key === "right" || key === "left") ? 20 : 50)){
|
||||
this.keyPress(true, key, null, true)
|
||||
this.pressedKeys[key] = ms
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.wheelScrolls !== 0 && ms >= this.wheelTimer + 20) {
|
||||
this.moveToSong(this.wheelScrolls)
|
||||
this.wheelScrolls = 0
|
||||
}
|
||||
|
||||
if(!this.redrawRunning){
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user