From 7b3fdb07bfe0e53e7c244b0110d7f21a8c414b7e Mon Sep 17 00:00:00 2001 From: koehr Date: Thu, 6 Jan 2022 14:58:04 +0100 Subject: [PATCH] add satellites to planets --- src/components/SatelliteSettings.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/SatelliteSettings.vue b/src/components/SatelliteSettings.vue index 6ce33d3..bfa7e14 100644 --- a/src/components/SatelliteSettings.vue +++ b/src/components/SatelliteSettings.vue @@ -50,7 +50,7 @@ - + @@ -75,7 +75,7 @@ function isResizable (satellite) { return satellite.type === 'moon' } -async function update (index, attr, target, isNumber) { +function update (index, attr, target, isNumber) { const satellites = [...props.satellites] let value = target.value if (isNumber) value = parseInt(value) @@ -84,6 +84,15 @@ async function update (index, attr, target, isNumber) { emit('update:satellites', satellites) } +// TODO: auto focus new satellite name input +function addSatellite () { + const satellites = [...props.satellites] + satellites.push({ + name: 'unnamed', type: 'moon', radius: 1 + }) + emit('update:satellites', satellites) +} + function deleteSatellite (index) { const confirmed = confirm(`Attention! This cannot be undone! Proceed anyway?`) if (!confirmed) return