mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 07:21:50 +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
|
focused: true
|
||||||
}
|
}
|
||||||
this.songSelecting = {
|
this.songSelecting = {
|
||||||
speed: 800,
|
speed: 200,
|
||||||
resize: 0.3,
|
resize: 0.3,
|
||||||
scrollDelay: 0.1
|
scrollDelay: 0.1
|
||||||
}
|
}
|
||||||
|
this.wheelScrolls = 0
|
||||||
|
this.wheelTimer = 0
|
||||||
|
|
||||||
this.startPreview(true)
|
this.startPreview(true)
|
||||||
|
|
||||||
@ -339,7 +341,9 @@ class SongSelect{
|
|||||||
this.touchFullBtn.style.display = "block"
|
this.touchFullBtn.style.display = "block"
|
||||||
pageEvents.add(this.touchFullBtn, "touchend", toggleFullscreen)
|
pageEvents.add(this.touchFullBtn, "touchend", toggleFullscreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pageEvents.add(this.canvas, "wheel", this.mouseWheel.bind(this))
|
||||||
|
|
||||||
this.selectable = document.getElementById("song-sel-selectable")
|
this.selectable = document.getElementById("song-sel-selectable")
|
||||||
this.selectableText = ""
|
this.selectableText = ""
|
||||||
|
|
||||||
@ -503,6 +507,17 @@ class SongSelect{
|
|||||||
touchEnd(event){
|
touchEnd(event){
|
||||||
event.preventDefault()
|
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){
|
mouseMove(event){
|
||||||
var mouse = this.mouseOffset(event.offsetX, event.offsetY)
|
var mouse = this.mouseOffset(event.offsetX, event.offsetY)
|
||||||
var moveTo = null
|
var moveTo = null
|
||||||
@ -892,12 +907,17 @@ class SongSelect{
|
|||||||
|
|
||||||
for(var key in this.pressedKeys){
|
for(var key in this.pressedKeys){
|
||||||
if(this.pressedKeys[key]){
|
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.keyPress(true, key, null, true)
|
||||||
this.pressedKeys[key] = ms
|
this.pressedKeys[key] = ms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.wheelScrolls !== 0 && ms >= this.wheelTimer + 20) {
|
||||||
|
this.moveToSong(this.wheelScrolls)
|
||||||
|
this.wheelScrolls = 0
|
||||||
|
}
|
||||||
|
|
||||||
if(!this.redrawRunning){
|
if(!this.redrawRunning){
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user