From 1a954852e61cf8a3018883191389c1e64e3a6b97 Mon Sep 17 00:00:00 2001 From: Raphael Kabo Date: Fri, 3 Feb 2023 17:34:50 +0000 Subject: [PATCH] Adjust damage to dice output after upgrade --- src/components/DamageToDice.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/DamageToDice.tsx b/src/components/DamageToDice.tsx index e6fb748..266c99d 100644 --- a/src/components/DamageToDice.tsx +++ b/src/components/DamageToDice.tsx @@ -42,9 +42,11 @@ export default function DamageToDice() {
{`${roll.numberOfDice}${roll.die.die}${numberToAsciiWithSign( modifier - )} = ${roll.damage} (${roll.percentage}% of target damage); min: ${ - roll.numberOfDice * 1 + modifier - }, max: ${roll.numberOfDice * roll.die.sides + modifier}`} + )} = ${roll.damage} (${Math.round( + roll.percentage + )}% of target damage); min: ${roll.numberOfDice * 1 + modifier}, max: ${ + roll.numberOfDice * roll.die.sides + modifier + }`}
)); }; @@ -90,6 +92,11 @@ export default function DamageToDice() { const target = e.target as HTMLInputElement; target.select(); }} + onKeyPress={(e) => { + if (e.key === "Enter") { + handleCalculate(); + } + }} /> { + if (e.key === "Enter") { + handleCalculate(); + } + }} /> -- 2.45.2