move the "click to advance" text
the click to advance text is now moved into the right location using css transforms! this still runs every frame when we're forcing a specific text position. but it's getting better!
This commit is contained in:
parent
c56eea3b49
commit
c1a136f590
|
@ -322,16 +322,20 @@ Game.WORDS_HEIGHT_BOTTOM = -1;
|
||||||
if(updated) return
|
if(updated) return
|
||||||
updated = true
|
updated = true
|
||||||
|
|
||||||
|
let advanceTextPosition = 0
|
||||||
if(Game.FORCE_TEXT_Y != -1){
|
if(Game.FORCE_TEXT_Y != -1){
|
||||||
Game.wordsDOM.style.transform = `translateY(${Game.FORCE_TEXT_Y}px)`;
|
Game.wordsDOM.style.transform = `translateY(${Game.FORCE_TEXT_Y}px)`;
|
||||||
return
|
advanceTextPosition = Game.wordsDOM.clientHeight + Game.FORCE_TEXT_Y + 5
|
||||||
|
} else {
|
||||||
|
const wordsHeight = Game.wordsDOM.clientHeight;
|
||||||
|
let diff = wordsHeight - (Game.WORDS_HEIGHT_BOTTOM - offset)
|
||||||
|
if(diff < 0) diff = 0
|
||||||
|
Game.wordsDOM.style.transform = `translateY(${offset - diff}px)`;
|
||||||
|
advanceTextPosition = offset - diff + wordsHeight + 5
|
||||||
}
|
}
|
||||||
|
|
||||||
const wordsHeight = Game.wordsDOM.clientHeight;
|
// Also, move click_to_advance DOM
|
||||||
let diff = wordsHeight - (Game.WORDS_HEIGHT_BOTTOM - offset)
|
$('#click_to_advance').style.transform = `translateY(${Math.round(advanceTextPosition)}px)`;
|
||||||
if(diff < 0) diff = 0
|
|
||||||
|
|
||||||
Game.wordsDOM.style.transform = `translateY(${offset - diff}px)`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Game.wordsDOM.children.length != lastCount){
|
if(Game.wordsDOM.children.length != lastCount){
|
||||||
|
|
|
@ -111,11 +111,6 @@ Loader.addSounds([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also, move click_to_advance DOM
|
|
||||||
var wordsTop = parseInt($("#game_words").style.top);
|
|
||||||
var wordsHeight = $("#game_words").getBoundingClientRect().height;
|
|
||||||
click_to_advance.style.top = Math.round(wordsTop+wordsHeight+5) + "px";
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var _timeoutCallbacks = [];
|
var _timeoutCallbacks = [];
|
||||||
|
|
|
@ -564,7 +564,6 @@ OPTIONS
|
||||||
position: absolute;
|
position: absolute;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
top: 254px;
|
|
||||||
color:#fff;
|
color:#fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue