aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-01-29 15:19:38 -0800
committerAdam Soltys <[email protected]>2024-01-29 15:19:38 -0800
commitb54d3afc6465acd5e518a8b4970be1ab75b361b1 (patch)
treec2ab7a8d91140ec6a60bd2b76e25c68a0355ee38 /src/components
parenta7dd56863aada46964a4277f0a5940de68c332b5 (diff)
downloadcoinos-ui-b54d3afc6465acd5e518a8b4970be1ab75b361b1.tar.gz
coinos-ui-b54d3afc6465acd5e518a8b4970be1ab75b361b1.zip
autowithdrawals
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Numpad.svelte7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte
index 713f2e4d..9119999f 100644
--- a/src/components/Numpad.svelte
+++ b/src/components/Numpad.svelte
@@ -6,6 +6,7 @@
export let amount,
currency,
+ element,
fiat = !amount,
rate,
submit = undefined;
@@ -45,6 +46,9 @@
const numPad = ["1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "0", "<"];
const handleInput = (value) => {
+ if (selecting) amount = 0;
+ selecting = false;
+
if (fiat) {
if (amountFiat === 0 && value !== "." && value !== "<" && value !== "0") {
amountFiat = value;
@@ -161,12 +165,14 @@
}, 0);
};
+ let selecting;
let select = (e) => {
let range = document.createRange();
range.selectNodeContents(e.target);
let sel = getSelection();
sel.removeAllRanges();
sel.addRange(range);
+ selecting = true;
};
let blur = () => {
@@ -195,6 +201,7 @@
on:input={input}
on:keydown={keydown}
class="outline-none my-auto"
+ bind:this={element}
/>
</div>
<div class="mt-2">