From ed42672fd3dcba800907d7b4032494395a186ed6 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 26 Jan 2020 04:12:47 -0800 Subject: [PATCH] Fix value when multiple elements are selected (#571) If you have two elements selected that have a different value (eg: a green line and a red line), the value of the color picker should be undefined, not the default value. --- src/actions/actionProperties.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/actions/actionProperties.tsx b/src/actions/actionProperties.tsx index 07a4c00d..2a482703 100644 --- a/src/actions/actionProperties.tsx +++ b/src/actions/actionProperties.tsx @@ -27,8 +27,9 @@ const getFormValue = function( ): T | null { return ( (editingElement && getAttribute(editingElement)) ?? - getCommonAttributeOfSelectedElements(elements, getAttribute) ?? - defaultValue ?? + (elements.some(element => element.isSelected) + ? getCommonAttributeOfSelectedElements(elements, getAttribute) + : defaultValue) ?? null ); };