Skip to content

Commit

Permalink
timeout delay for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
noname0310 committed Jul 14, 2023
1 parent a8acff4 commit 5b98c9c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/test/SceneBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,17 @@ export class SceneBuilder implements ISceneBuilder {
const hidePlayerContainer = (): void => {
playerContainer.style.transform = "translateY(50%)";
};
playerContainer.onmouseenter = showPlayerContainer;
playerContainer.onmouseleave = hidePlayerContainer;
let mouseLeaveTimeout: number | null = null;
playerContainer.onmouseenter = (): void => {
if (mouseLeaveTimeout !== null) {
window.clearTimeout(mouseLeaveTimeout);
mouseLeaveTimeout = null;
}
showPlayerContainer();
};
playerContainer.onmouseleave = (): void => {
mouseLeaveTimeout = window.setTimeout(hidePlayerContainer, 3000);
};
hidePlayerContainer();

const playerInnerContainer = document.createElement("div");
Expand Down

0 comments on commit 5b98c9c

Please sign in to comment.