Made health bar input accept negative sign from copy-paste and mobile (hopefully)

This commit is contained in:
Stefan Zermatten
2020-05-30 12:45:11 +02:00
parent eb97a98644
commit 5195e3fad5

View File

@@ -17,7 +17,13 @@
> >
{{ name }} {{ name }}
</div> </div>
<v-flex style="height: 20px; flex-basis: 300px; flex-grow: 100;"> <v-flex
style="
height: 20px;
flex-basis: 300px;
flex-grow: 100;
"
>
<v-layout <v-layout
column column
align-center align-center
@@ -33,7 +39,13 @@
/> />
<span <span
class="value" class="value"
style="margin-top: -20px; z-index: 1; font-size: 15px; font-weight: 600; height: 20px;" style="
margin-top: -20px;
z-index: 1;
font-size: 15px;
font-weight: 600;
height: 20px;
"
> >
{{ value }} / {{ maxValue }} {{ value }} / {{ maxValue }}
</span> </span>
@@ -80,6 +92,7 @@
:disabled="context.editPermission === false" :disabled="context.editPermission === false"
@focus="$event.target.select()" @focus="$event.target.select()"
@keypress="keypress" @keypress="keypress"
@input="input"
/> />
<v-btn <v-btn
small small
@@ -127,7 +140,7 @@
return { return {
editing: false, editing: false,
editValue: 0, editValue: 0,
operation: 3, operation: 'set',
hover: false, hover: false,
}; };
}, },
@@ -182,7 +195,13 @@
} else if (!digitsOnly.test(key)){ } else if (!digitsOnly.test(key)){
event.preventDefault(); event.preventDefault();
} }
} },
input(value){
if (+value < 0){
this.editValue = -value;
this.operation = 'subtract';
}
}
}, },
}; };
</script> </script>