mirror of
https://github.com/yuukiwww/taiko-web.git
synced 2024-10-22 17:05:49 +02:00
Fix weird sound on error and long lines not wrapping
This commit is contained in:
parent
4b37150ee0
commit
8f736b5b23
@ -927,8 +927,22 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
var search = () => {
|
||||
var end = line.length
|
||||
var dist = end
|
||||
while(dist){
|
||||
dist >>= 1
|
||||
line = words[i].slice(0, end)
|
||||
lastWidth = ctx.measureText(line).width
|
||||
end += lastWidth < config.width ? dist : -dist
|
||||
}
|
||||
if(line !== words[i]){
|
||||
words.splice(i + 1, 0, words[i].slice(line.length))
|
||||
words[i] = line
|
||||
}
|
||||
}
|
||||
|
||||
for(var i in words){
|
||||
for(var i = 0; i < words.length; i++){
|
||||
var skip = words[i].substitute || words[i] === "\n"
|
||||
if(!skip){
|
||||
var currentWidth = ctx.measureText(line + words[i]).width
|
||||
@ -960,8 +974,22 @@
|
||||
recenter()
|
||||
x = 0
|
||||
y += lineHeight
|
||||
line = words[i] === "\n" ? "" : words[i]
|
||||
lastWidth = ctx.measureText(line).width
|
||||
if(words[i] === "\n"){
|
||||
line = ""
|
||||
lastWidth = 0
|
||||
}else{
|
||||
line = words[i]
|
||||
lastWidth = ctx.measureText(line).width
|
||||
if(line.length !== 1 && lastWidth > config.width){
|
||||
search()
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(!line){
|
||||
line = words[i]
|
||||
lastWidth = ctx.measureText(line).width
|
||||
if(line.length !== 1 && lastWidth > config.width){
|
||||
search()
|
||||
}
|
||||
}else{
|
||||
line += words[i]
|
||||
|
@ -1022,7 +1022,7 @@ class SongSelect{
|
||||
}
|
||||
}
|
||||
|
||||
if(screen === "song" && (this.showWarning || scoreStorage.scoreSaveFailed) && !p2.session){
|
||||
if(screen === "song" && (this.showWarning && !this.showWarning.shown || scoreStorage.scoreSaveFailed)){
|
||||
if(!this.showWarning){
|
||||
this.showWarning = {name: "scoreSaveFailed"}
|
||||
}
|
||||
@ -1032,6 +1032,7 @@ class SongSelect{
|
||||
if(this.showWarning.name === "scoreSaveFailed"){
|
||||
scoreStorage.scoreSaveFailed = false
|
||||
}
|
||||
this.showWarning.shown = true
|
||||
this.state.showWarning = true
|
||||
this.state.locked = true
|
||||
this.playSound("se_pause")
|
||||
|
Loading…
Reference in New Issue
Block a user