Skip to content

Commit 1eba4fc

Browse files
committed
Improve mobile interactions: touch events, tooltip sizing, filter positioning
1 parent 0dffbfb commit 1eba4fc

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎src/components/layercake/ScrollVoronoi.svelte‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828
let pointsData = [];
2929
let selectedPoint;
3030
$: voronoiEnabled =
31-
!isMobile &&
32-
((typeof chartScrollIndex === "number" && chartScrollIndex >= 14) ||
33-
chartScrollIndex == "exit");
31+
(typeof chartScrollIndex === "number" && chartScrollIndex >= 14) ||
32+
chartScrollIndex == "exit";
3433
3534
const isSelectablePoint = (
3635
point,
@@ -233,18 +232,19 @@
233232
if (!$lockedSelection && !isMobile) mouseleaveCircle(point);
234233
}}
235234
on:focus={() => {
236-
if (!$lockedSelection && !isMobile) mouseoverCircle(point);
235+
if (!$lockedSelection) mouseoverCircle(point);
237236
}}
238237
on:click={() => {
239-
if (!isMobile) {
240-
lockedSelection.set(true);
241-
mouseClickCircle(point);
242-
}
238+
lockedSelection.set(true);
239+
mouseClickCircle(point);
240+
}}
241+
on:touchend|preventDefault={() => {
242+
lockedSelection.set(true);
243+
mouseClickCircle(point);
243244
}}
244245
on:keydown={(e) => {
245246
if (
246247
!$lockedSelection &&
247-
!isMobile &&
248248
(e.key === "Enter" || e.key === " ")
249249
) {
250250
lockedSelection.set(true);

‎src/components/ui/Filters.svelte‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@
336336
align-items: flex-start;
337337
margin: 0 auto;
338338
position: absolute;
339-
top: 0;
339+
top: var(--navbar-height, 3.5rem);
340340
z-index: 1000;
341341
padding: 1rem;
342342
}

‎src/components/ui/Tooltip.svelte‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,12 @@
238238
239239
<style>
240240
#universal-tooltip {
241+
--tooltip-height: clamp(200px, 35vh, 400px);
241242
position: fixed;
242243
left: 0;
243-
bottom: -300px;
244+
bottom: calc(-1 * var(--tooltip-height));
244245
width: 100%;
245-
height: 300px;
246+
height: var(--tooltip-height);
246247
padding: 1rem;
247248
background: var(--bg-tertiary);
248249
border-top: 1px solid var(--border-secondary);
@@ -452,8 +453,7 @@
452453
/* Mobile Responsive */
453454
@media (max-width: 700px) {
454455
#universal-tooltip {
455-
bottom: -400px;
456-
height: 400px;
456+
--tooltip-height: clamp(250px, 45vh, 400px);
457457
padding: 0.75rem;
458458
}
459459

0 commit comments

Comments
 (0)