From cfbedd3e594867334b01c3896abc99bb74aa133a Mon Sep 17 00:00:00 2001 From: Eric NGUYEN Date: Thu, 23 Feb 2023 12:21:05 +0100 Subject: [PATCH] Fix bug with colors and dimensions misapplied --- .../ContainerProperties/ContainerForm.tsx | 32 ++++++++----------- src/Components/SVG/Elements/Dimension.tsx | 2 +- src/utils/default.ts | 2 +- test-server/http.js | 18 +++++------ 4 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/Components/ContainerProperties/ContainerForm.tsx b/src/Components/ContainerProperties/ContainerForm.tsx index f70e42d..9a19743 100644 --- a/src/Components/ContainerProperties/ContainerForm.tsx +++ b/src/Components/ContainerProperties/ContainerForm.tsx @@ -385,7 +385,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element { labelClassName='' inputClassName='' type='color' - value={props.properties.dimensionOptions.selfDimensions.color} + value={props.properties.dimensionOptions.selfDimensions.color ?? '#000000'} onChange={(e) => { props.onChange('color', e.target.value, PropertyType.SelfDimension); }}/> { props.onChange('color', e.target.value, PropertyType.SelfMarginDimension); }}/> { props.onChange('color', e.target.value, PropertyType.ChildrenDimensions); }}/> { props.onChange('color', e.target.value, PropertyType.DimensionWithMarks); }}/>
- { props.onChange('stroke', value, PropertyType.Style); }} - /> + type='color' + value={props.properties.style.stroke ?? '#000000'} + onChange={(e) => { props.onChange('stroke', e.target.value, PropertyType.Style); }}/> { props.onChange('strokeWidth', Number(value), PropertyType.Style); }} /> - { props.onChange('fill', value, PropertyType.Style); }} - /> + type='color' + value={props.properties.style.fill ?? '#000000'} + onChange={(e) => { props.onChange('fill', e.target.value, PropertyType.Style); }}/> { Style: { fillOpacity: 1, strokeWidth: 2, - stroke: 'red', + stroke: '#ff0000', fill: '#d3c9b7', }, IsFlex: true, @@ -96,7 +96,7 @@ const GetSVGLayoutConfiguration = () => { Style: { fillOpacity: 1, strokeWidth: 2, - stroke: 'red', + stroke: '#ff0000', fill: '#d3c9b7', }, IsFlex: true, @@ -115,8 +115,8 @@ const GetSVGLayoutConfiguration = () => { Style: { fillOpacity: 1, strokeWidth: 2, - stroke: 'green', - fill: 'white' + stroke: '#00ff00', + fill: '#ffffff' }, Category: "Stuff", IsFlex: true, @@ -258,8 +258,8 @@ const GetSVGLayoutConfiguration = () => { Style: { fillOpacity: 1, strokeWidth: 2, - stroke: 'blue', - fill: 'blue', + stroke: '#0000ff', + fill: '#0000ff', } }, { @@ -270,8 +270,8 @@ const GetSVGLayoutConfiguration = () => { Style: { fillOpacity: 1, strokeWidth: 2, - stroke: 'red', - fill: 'red', + stroke: '#ff0000', + fill: '#ff0000', } } ], @@ -370,7 +370,7 @@ const GetSVGLayoutConfiguration = () => { Height: 200, Orientation: 0, Style: { - stroke: 'black', + stroke: '#000000', strokeWidth: 2, fillOpacity: 0 }