Skip to content

Commit b2f89e5

Browse files
committed
Allow entering floating point numbers into game event details
1 parent 8a7149f commit b2f89e5

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

frontend/src/components/common/NumberInput.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const emit = defineEmits<{
1111
const updateValue = (value: string | number | null) => {
1212
if (value !== null) {
1313
if (typeof value === 'string') {
14-
emit('update:modelValue', parseInt(value))
14+
emit('update:modelValue', parseFloat(value))
1515
} else {
1616
emit('update:modelValue', value)
1717
}

frontend/src/components/game-events/common/LocationItem.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ const updateValue = (v: Vector2 | undefined) => {
1414
emit('update:modelValue', v)
1515
}
1616
const updateX = (x: string | number | null) => {
17-
if (x) {
17+
if (x !== null) {
1818
const y = props.modelValue?.y || 0
1919
if (typeof x === 'string') {
20-
updateValue({x: parseInt(x), y})
20+
updateValue({x: parseFloat(x), y})
2121
} else {
2222
updateValue({x, y})
2323
}
@@ -26,11 +26,10 @@ const updateX = (x: string | number | null) => {
2626
}
2727
}
2828
const updateY = (y: string | number | null) => {
29-
if (y) {
29+
if (y !== null) {
3030
const x = props.modelValue?.x || 0
3131
if (typeof y === 'string') {
32-
updateValue({x, y: parseInt(y)})
33-
32+
updateValue({x, y: parseFloat(y)})
3433
} else {
3534
updateValue({x, y})
3635
}

0 commit comments

Comments
 (0)