Skip to content

Commit

Permalink
feat(player): expand/collapse on swipe
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaraa committed Jun 6, 2024
1 parent b4c01c2 commit f0f7f83
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app/static/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,31 @@ audioPlayerEl.addEventListener("progress", () => {
console.log("downloading...");
});

let _collapsedStartY = 0;

playerEl?.addEventListener(
"touchstart",
(e) => {
_collapsedStartY = e.touches[0].pageY;
console.log("meow", _collapsedStartY);
},
{ passive: true },
);

playerEl?.addEventListener(
"touchmove",
async (e) => {
const y = e.touches[0].pageY;
if (y > _collapsedStartY + 75) {
collapse();
}
if (y < _collapsedStartY + 25) {
expand();
}
},
{ passive: true },
);

document
.getElementById("collapse-player-button")
?.addEventListener("click", (event) => {
Expand Down

0 comments on commit f0f7f83

Please sign in to comment.