Changed map and token select number inputs to not prepend a 0 when typing numbers

This commit is contained in:
Mitchell McCaffrey
2020-08-07 13:56:03 +10:00
parent 5dc338471d
commit 239f377aef
4 changed files with 19 additions and 5 deletions

View File

@@ -112,7 +112,13 @@ function SelectTokensModal({ isOpen, onRequestClose }) {
async function applyTokenChanges() {
if (selectedTokenId && !isEmpty(tokenSettingChanges)) {
await updateToken(selectedTokenId, tokenSettingChanges);
// Ensure size value is positive
let verifiedChanges = { ...tokenSettingChanges };
if ("defaultSize" in verifiedChanges) {
verifiedChanges.defaultSize = verifiedChanges.defaultSize || 1;
}
await updateToken(selectedTokenId, verifiedChanges);
setTokenSettingChanges({});
}
}