Skip to content

Commit e96a819

Browse files
committed
fix: center click
1 parent 799558a commit e96a819

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/packlets/playground/playground.svelte

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
1616
const addBalloon = (
1717
x = Math.floor(Math.random() * window.innerWidth),
18-
y = 0
18+
y = 0,
19+
half = false
1920
) => {
2021
const size = Math.floor(Math.random() * 300) + 60
2122
2223
const item: Item = {
2324
id: (Math.random() + 1).toString(36).substring(7),
2425
size,
2526
horizontal: x - size / 2,
26-
vertical: y + size,
27+
vertical: y + (half ? size / 2 : size),
2728
}
2829
2930
balloons = [...balloons, item]
@@ -34,7 +35,7 @@
3435
}
3536
3637
const handleClick: MouseEventHandler<HTMLElement> = e => {
37-
addBalloon(e.pageX, -window.innerHeight + e.pageY)
38+
addBalloon(e.pageX, -window.innerHeight + e.pageY, true)
3839
}
3940
4041
onMount(() => {

0 commit comments

Comments
 (0)