refine visuals and interactions: remove footer, enhance CSS styles, improve player and emote handling logic, and adjust asset scaling and animations
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m51s
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m51s
This commit is contained in:
@@ -1060,14 +1060,13 @@ window.onPresentationUpdate = function(players) {
|
||||
if (!el) {
|
||||
el = document.createElement('div');
|
||||
el.className = 'presi-player';
|
||||
el.innerHTML = `<img src="assets/playernew.png" style="height: 80px;">`;
|
||||
el.innerHTML = `<img src="assets/playernew.png" style="height: 120px; width: auto; object-fit: contain;">`;
|
||||
layer.appendChild(el);
|
||||
presiPlayers.set(p.id, el);
|
||||
}
|
||||
|
||||
// Map world coords to screen
|
||||
// World width is roughly 1280, height 720
|
||||
const screenX = (p.x % 1280) / 1280 * window.innerWidth;
|
||||
const screenX = ((p.x + 1280000) % 1280) / 1280 * window.innerWidth;
|
||||
const screenY = (p.y / 720) * window.innerHeight;
|
||||
|
||||
el.style.left = `${screenX}px`;
|
||||
@@ -1075,23 +1074,22 @@ window.onPresentationUpdate = function(players) {
|
||||
|
||||
// Handle Emotes
|
||||
if (p.state && p.state.startsWith('EMOTE_')) {
|
||||
const emoteNum = p.state.split('_')[1];
|
||||
const emotes = ["❤️", "😂", "😡", "👍"];
|
||||
const emoji = emotes[parseInt(emoteNum)-1] || "❓";
|
||||
|
||||
let emoteEl = el.querySelector('.presi-player-emote');
|
||||
if (!emoteEl) {
|
||||
emoteEl = document.createElement('div');
|
||||
if (el.lastEmoteState !== p.state) {
|
||||
el.lastEmoteState = p.state;
|
||||
const emoteNum = p.state.split('_')[1];
|
||||
const emotes = ["❤️", "😂", "😡", "👍"];
|
||||
const emoji = emotes[parseInt(emoteNum)-1] || "❓";
|
||||
const oldEmote = el.querySelector('.presi-player-emote');
|
||||
if (oldEmote) oldEmote.remove();
|
||||
const emoteEl = document.createElement('div');
|
||||
emoteEl.className = 'presi-player-emote';
|
||||
emoteEl.textContent = emoji;
|
||||
el.appendChild(emoteEl);
|
||||
setTimeout(() => {
|
||||
if (emoteEl.parentNode === el) emoteEl.remove();
|
||||
el.lastEmoteState = "";
|
||||
}, 2000);
|
||||
}
|
||||
emoteEl.textContent = emoji;
|
||||
|
||||
// Auto-remove emote text after 2s
|
||||
clearTimeout(el.emoteTimeout);
|
||||
el.emoteTimeout = setTimeout(() => {
|
||||
if (emoteEl) emoteEl.remove();
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user