fix: no more NaN
This commit is contained in:
parent
7e5137b317
commit
72f29467bd
1 changed files with 4 additions and 2 deletions
|
|
@ -163,7 +163,9 @@ public class RecipeDetailCtrl implements LocaleAware {
|
|||
this.recipeView = new ScalableRecipeView(recipe, scale);
|
||||
// TODO i18n
|
||||
inferredKcalLabel.textProperty().bind(Bindings.createStringBinding(() ->
|
||||
String.format("Inferred %.1f kcal/100g for this recipe", this.recipeView.scaledKcalProperty().get())
|
||||
String.format("Inferred %.1f kcal/100g for this recipe",
|
||||
Double.isNaN(this.recipeView.scaledKcalProperty().get()) ?
|
||||
0.0 : this.recipeView.scaledKcalProperty().get())
|
||||
, this.recipeView.scaledKcalProperty()));
|
||||
// expose the scaled view to list controllers
|
||||
this.ingredientListController.refetchFromRecipe(this.recipeView.getScaled());
|
||||
|
|
@ -391,7 +393,7 @@ public class RecipeDetailCtrl implements LocaleAware {
|
|||
public void initializeComponents() {
|
||||
initStepsIngredientsList();
|
||||
// creates a new scale spinner with an arbitrary max scale
|
||||
scaleSpinner.setValueFactory(new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 1));
|
||||
scaleSpinner.setValueFactory(new SpinnerValueFactory.DoubleSpinnerValueFactory(1, Double.MAX_VALUE, 1));
|
||||
scaleSpinner.setEditable(true);
|
||||
scaleSpinner.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue == null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue