diff --git a/package.json b/package.json index ba131e2b..663d547a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homepage", - "version": "1.57.1", + "version": "1.57.2", "private": true, "type": "module", "scripts": { diff --git a/src/lib/components/recipes/IngredientsPage.svelte b/src/lib/components/recipes/IngredientsPage.svelte index 0cae126c..38ec7bdb 100644 --- a/src/lib/components/recipes/IngredientsPage.svelte +++ b/src/lib/components/recipes/IngredientsPage.svelte @@ -180,18 +180,16 @@ const formMultiplier = $derived( hasDefaultForm && defaultFormArea > 0 ? userFormArea / defaultFormArea : 1 ); -// Track whether multiplier is driven by form or manual buttons -let formDriven = $state(false); -let cakeFormExpanded = $state(false); +// Effective multiplier consumed by ingredient/portion calculations. +// Base multiplier (pill buttons / custom input) stays independent of the +// cake-form scaling so the two factors are visually distinct. +const effectiveMultiplier = $derived(multiplier * formMultiplier); -function applyFormMultiplier() { - formDriven = true; -} +let cakeFormExpanded = $state(false); /** @param {string} shape */ function pickShape(shape) { userFormShape = shape; - applyFormMultiplier(); } const isDefaultForm = $derived( @@ -217,19 +215,8 @@ function resetCakeForm() { userFormWidth = data.defaultForm.width || 20; userFormLength = data.defaultForm.length || 30; userFormInnerDiameter = data.defaultForm.innerDiameter || 8; - formDriven = false; - multiplier = 1; - updateUrl(1); } -// Reactively update multiplier when form dimensions change and form is driving -$effect(() => { - if (formDriven) { - multiplier = formMultiplier; - updateUrl(multiplier); - } -}); - /** @param {number} value */ function updateUrl(value) { if (browser) { @@ -298,7 +285,6 @@ function handleMultiplierClick(event, value) { if (browser) { event.preventDefault(); multiplier = value; - formDriven = false; updateUrl(value); } // If no JS, form will submit normally @@ -310,7 +296,6 @@ function handleCustomInput(event) { const value = parseFloat(/** @type {HTMLInputElement} */ (event.target).value); if (!isNaN(value) && value > 0) { multiplier = value; - formDriven = false; updateUrl(value); } } @@ -757,7 +742,7 @@ const nutritionFlatIngredients = $derived.by(() => {