Skip to content

Commit b38aa50

Browse files
committed
Put the formula bar on the bottom on mobile
1 parent d6078c0 commit b38aa50

File tree

2 files changed

+42
-27
lines changed

2 files changed

+42
-27
lines changed

TODO.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
- Click cell while editing formula to insert it
2323
- Add conveniences for LLMs
2424
- Event hooks
25-
- Move formula bar to bottom
2625
- Zoom out extra on mobile, but only cells and code, not UI elements
2726
- Frozen rows and columns
2827
- Toggle off automatic cell updates

src/App.svelte

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,31 @@
3131
margin: 0 -0.5em;
3232
padding: 0.25em;
3333
border-top: 1px solid var(--fg-color);
34+
width: 100%;
35+
position: absolute;
36+
display: flex;
37+
flex-direction: column;
38+
justify-content: flex-start;
39+
align-items: stretch;
40+
gap: calc(0.25em + 3px);
41+
}
42+
43+
.buttonbar {
3444
min-height: max-content;
3545
display: flex;
3646
flex-direction: row;
3747
flex-wrap: nowrap;
3848
justify-content: flex-start;
3949
align-items: center;
4050
gap: 0.5ch;
41-
width: 100%;
42-
position: absolute;
43-
z-index: 19;
4451
overflow-x: auto;
4552
}
4653
4754
.bottombar {
4855
margin: -0.5em;
4956
padding: 0.25em;
5057
border-top: 1px solid var(--fg-color);
58+
border-bottom: 1px solid var(--fg-color);
5159
min-height: max-content;
5260
display: flex;
5361
flex-direction: row;
@@ -267,9 +275,12 @@
267275
bind:innerHeight
268276
/>
269277
270-
<div>
271-
<FormulaBar bind:globals bind:editor={globals.elements.formulaBar} />
272-
</div>
278+
{#if navigator.maxTouchPoints <= 1}
279+
<!-- Else float the bar above the virtual keyboard -->
280+
<div>
281+
<FormulaBar bind:globals bind:editor={globals.elements.formulaBar} />
282+
</div>
283+
{/if}
273284
274285
<div class="tabs">
275286
<Tabs bind:globals bind:value={globals.currentSheetIndex} />
@@ -402,28 +413,33 @@
402413
shadow="2px">{text}</Button
403414
>
404415
{/snippet}
405-
{#if Math.abs(innerHeight - visualBottom) > 5}
416+
{#if navigator.maxTouchPoints > 1}
406417
<div
407418
class="keyboardbar"
408-
style:top="calc({visualBottom}px - 2em - 2 * 0.25em - 2px)"
419+
style:bottom="max(calc(2.75em + 1px), {innerHeight - visualBottom}px)"
409420
>
410-
{@render insertTextButton("=")}
411-
{@render insertTextButton("(")}
412-
{@render insertTextButton(")")}
413-
{@render insertTextButton("[")}
414-
{@render insertTextButton("]")}
415-
{@render insertTextButton("+")}
416-
{@render insertTextButton("-")}
417-
{@render insertTextButton("*")}
418-
{@render insertTextButton("/")}
419-
{@render insertTextButton('"')}
420-
{@render insertTextButton("{")}
421-
{@render insertTextButton("}")}
422-
{@render insertTextButton(";")}
423-
{@render insertTextButton(">")}
424-
{@render insertTextButton("<")}
425-
{@render insertTextButton(":")}
426-
{@render insertTextButton("?")}
421+
<FormulaBar bind:globals bind:editor={globals.elements.formulaBar} />
422+
{#if Math.abs(innerHeight - visualBottom) > 5}
423+
<div class="buttonbar">
424+
{@render insertTextButton("=")}
425+
{@render insertTextButton("(")}
426+
{@render insertTextButton(")")}
427+
{@render insertTextButton("[")}
428+
{@render insertTextButton("]")}
429+
{@render insertTextButton("+")}
430+
{@render insertTextButton("-")}
431+
{@render insertTextButton("*")}
432+
{@render insertTextButton("/")}
433+
{@render insertTextButton('"')}
434+
{@render insertTextButton("{")}
435+
{@render insertTextButton("}")}
436+
{@render insertTextButton(";")}
437+
{@render insertTextButton(">")}
438+
{@render insertTextButton("<")}
439+
{@render insertTextButton(":")}
440+
{@render insertTextButton("?")}
441+
</div>
442+
{/if}
427443
</div>
428444
{/if}
429445
@@ -469,7 +485,7 @@
469485
</div>
470486
{/snippet}
471487
{#snippet clickable(handler)}
472-
<Button square onclick={handler} style="height: 1.5em;">=</Button>
488+
<Button square onclick={handler} style="height: 2em;">=</Button>
473489
{/snippet}
474490
</ShyMenu>
475491
<div style="flex-grow: 1;"><!-- Spacer --></div>

0 commit comments

Comments
 (0)