version 0.3.0 #1

Merged
ari merged 22 commits from dev into main 2024-07-02 19:39:03 +00:00
2 changed files with 19 additions and 6 deletions
Showing only changes of commit 4e9acb6502 - Show all commits

View file

@ -32,9 +32,15 @@
let mouse_pos = { top: 0, left: 0 }; let mouse_pos = { top: 0, left: 0 };
function gotoPost() { function gotoPost(event) {
if (focused) return; if (focused) return;
if (event && event.key && event.key !== "Enter") return; if (event) {
if (event.type == "mouseup" && (
event.button !== 0 ||
event.shiftKey ||
event.ctrlKey)) return;
if (event.key && event.key !== "Enter") return;
}
goto(`/post/${post.id}`); goto(`/post/${post.id}`);
} }
@ -62,7 +68,7 @@
aria-label={aria_label} aria-label={aria_label}
bind:this={el} bind:this={el}
on:mousedown={e => {mouse_pos.left = e.pageX; mouse_pos.top = e.pageY}} on:mousedown={e => {mouse_pos.left = e.pageX; mouse_pos.top = e.pageY}}
on:mouseup={e => {if (e.pageX == mouse_pos.left && e.pageY == mouse_pos.top) gotoPost()}} on:mouseup={e => {if (e.pageX == mouse_pos.left && e.pageY == mouse_pos.top) gotoPost(e)}}
on:keydown={gotoPost}> on:keydown={gotoPost}>
<PostHeader post={post} /> <PostHeader post={post} />
<Body post={post} /> <Body post={post} />

View file

@ -16,8 +16,15 @@
let mouse_pos = { top: 0, left: 0 }; let mouse_pos = { top: 0, left: 0 };
function gotoPost() { function gotoPost(event) {
if (event && event.key && event.key !== "Enter") return; if (event) {
if (event.type == "mouseup" && (
event.button !== 0 ||
event.shiftKey ||
event.ctrlKey)) return;
if (event.key && event.key !== "Enter") return;
}
goto(`/post/${post.id}`); goto(`/post/${post.id}`);
} }
</script> </script>
@ -32,7 +39,7 @@
class="post-reply" class="post-reply"
aria-label={aria_label} aria-label={aria_label}
on:mousedown={e => {mouse_pos.left = e.pageX; mouse_pos.top = e.pageY}} on:mousedown={e => {mouse_pos.left = e.pageX; mouse_pos.top = e.pageY}}
on:mouseup={e => {if (e.pageX == mouse_pos.left && e.pageY == mouse_pos.top) gotoPost()}} on:mouseup={e => {if (e.pageX == mouse_pos.left && e.pageY == mouse_pos.top) gotoPost(e)}}
on:keydown={gotoPost}> on:keydown={gotoPost}>
<div class="line"></div> <div class="line"></div>