updatesP
This commit is contained in:
parent
aec0db221f
commit
26f77a992d
6
android/.idea/AndroidProjectSystem.xml
generated
Normal file
6
android/.idea/AndroidProjectSystem.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AndroidProjectSystem">
|
||||||
|
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Haptics, ImpactStyle } from '@capacitor/haptics';
|
import { Haptics, ImpactStyle } from '@capacitor/haptics';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
focused = $bindable(false),
|
focused = $bindable(false),
|
||||||
@ -41,15 +41,17 @@
|
|||||||
charArray.push(event.key);
|
charArray.push(event.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the key to onscan
|
if (scanning) {
|
||||||
if ((event.key == 'Tab' || event.key == 'Enter')) {
|
// Send the key to onscan
|
||||||
// Prevent tab or enter from doing anything
|
if (event.key == 'Tab' || event.key == 'Enter') {
|
||||||
event.preventDefault();
|
// Prevent tab or enter from doing anything
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
// Send key as text
|
// Send key as text
|
||||||
onscan(charArray.join(''));
|
onscan(charArray.join(''));
|
||||||
charArray = [];
|
charArray = [];
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastPressed = Date.now();
|
lastPressed = Date.now();
|
||||||
@ -65,14 +67,14 @@
|
|||||||
if (e.target?.nodeName == 'INPUT') {
|
if (e.target?.nodeName == 'INPUT') {
|
||||||
focused = true;
|
focused = true;
|
||||||
inputElement = e.target;
|
inputElement = e.target;
|
||||||
Haptics.selectionStart();
|
Haptics.selectionStart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusOut() {
|
function focusOut() {
|
||||||
focused = false;
|
focused = false;
|
||||||
inputElement = null;
|
inputElement = null;
|
||||||
Haptics.selectionEnd();
|
Haptics.selectionEnd();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Button from '$lib/components/ui/button/button.svelte';
|
import Button from '$lib/components/ui/button/button.svelte';
|
||||||
import ScanCapture from '$lib/ScanCapture.svelte';
|
import ScanCapture from '$lib/ScanCapture.svelte';
|
||||||
import { Haptics, ImpactStyle } from '@capacitor/haptics';
|
|
||||||
import { SvelteSet } from 'svelte/reactivity';
|
import { SvelteSet } from 'svelte/reactivity';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
|
|
||||||
@ -11,7 +10,6 @@
|
|||||||
function onscan(value: string) {
|
function onscan(value: string) {
|
||||||
if (!list.has(value)) {
|
if (!list.has(value)) {
|
||||||
list.add(value);
|
list.add(value);
|
||||||
Haptics.impact({ style: ImpactStyle.Light });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -19,15 +17,24 @@
|
|||||||
<ScanCapture {onscan} />
|
<ScanCapture {onscan} />
|
||||||
|
|
||||||
<div class="flex h-screen">
|
<div class="flex h-screen">
|
||||||
<div class="m-auto flex flex-col gap-8 p-4">
|
<div class="m-auto flex flex-col justify-center items-center gap-8 p-4">
|
||||||
{#key count}
|
{#key count}
|
||||||
<h1
|
<h1 in:fade class="decoration-sky text-9xl font-bold text-center underline-offset-4">
|
||||||
in:fade
|
|
||||||
class="decoration-sky text-9xl font-bold text-center underline-offset-4"
|
|
||||||
>
|
|
||||||
{count}
|
{count}
|
||||||
</h1>
|
</h1>
|
||||||
{/key}
|
{/key}
|
||||||
<Button class="w-28 cursor-pointer">Submit</Button>
|
|
||||||
|
<div class="flex flex-wrap gap-2">
|
||||||
|
{#each list as value (value)}
|
||||||
|
<span>{value}</span>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
class="w-28 cursor-pointer"
|
||||||
|
onclick={() => {
|
||||||
|
list.clear();
|
||||||
|
}}>Reset</Button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user