Better description of add + fix regression form validation + fix http server not using strokeWidth + add doc about hardcoded
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Eric NGUYEN 2022-08-16 17:45:52 +02:00
parent da7f5060e8
commit d29d1f5054
6 changed files with 24 additions and 20 deletions

14
docs/Hardcoded.md Normal file
View file

@ -0,0 +1,14 @@
> Here you will find the documentation of desastrous stuff that I made
# XPositionReference
XPositionReference is used as a fake horizontal offset indicator.
The truth is that the svg will always take the left for its transformations and the best for us is to do the same.
That's why everything that is shown to the user about XPositionReference is an illusion. Like for example:
- The inputs, see `PropertiesOperations.ts`, `StaticForm`, `DynamicForm`.
- Child dimensions, see `Container.ts`.
Look for use of `transformX()` and `restoreX()`.

View file

@ -240,7 +240,7 @@ export function AddContainer(
// Update the state // Update the state
history.push({ history.push({
LastAction: 'Add container', LastAction: `Add ${type} in ${parentClone.properties.id}`,
MainContainer: clone, MainContainer: clone,
SelectedContainer: parentClone, SelectedContainer: parentClone,
SelectedContainerId: parentClone.properties.id, SelectedContainerId: parentClone.properties.id,

View file

@ -3,8 +3,7 @@ import { IContainerModel, ContainerModel } from '../../Interfaces/IContainerMode
import { IHistoryState } from '../../Interfaces/IHistoryState'; import { IHistoryState } from '../../Interfaces/IHistoryState';
import { findContainerById } from '../../utils/itertools'; import { findContainerById } from '../../utils/itertools';
import { getCurrentHistory } from './Editor'; import { getCurrentHistory } from './Editor';
import { constraintBodyInsideUnallocatedWidth, RecalculatePhysics } from './Behaviors/RigidBodyBehaviors'; import { RecalculatePhysics } from './Behaviors/RigidBodyBehaviors';
import { INPUT_TYPES } from '../Properties/PropertiesInputTypes';
import { ImposePosition } from './Behaviors/AnchorBehaviors'; import { ImposePosition } from './Behaviors/AnchorBehaviors';
import { restoreX } from '../SVG/Elements/Container'; import { restoreX } from '../SVG/Elements/Container';
@ -138,8 +137,9 @@ const submitHTMLInput = (
property: string, property: string,
form: HTMLFormElement form: HTMLFormElement
): void => { ): void => {
if (INPUT_TYPES[property] !== 'number') { if (input.type !== 'number') {
(container.properties as any)[property] = input.value; (container.properties as any)[property] = input.value;
return;
} }
if (property === 'x') { if (property === 'x') {
@ -188,7 +188,7 @@ const submitRadioButtons = (
return; return;
} }
if (INPUT_TYPES[property] === 'number') { if (radiobutton.type === 'radio') {
(container.properties as any)[property] = Number(radiobutton.value); (container.properties as any)[property] = Number(radiobutton.value);
return; return;
} }

View file

@ -116,7 +116,7 @@ export const ElementsSidebar: React.FC<IElementsSidebarProps> = (props: IElement
</div> </div>
<div ref={elementRef} className='h-96 text-gray-800'> <div ref={elementRef} className='h-96 text-gray-800'>
<List <List
className='List' className='List divide-y divide-black'
itemCount={containers.length} itemCount={containers.length}
itemSize={35} itemSize={35}
height={384} height={384}

View file

@ -1,9 +0,0 @@
export const INPUT_TYPES: Record<string, string> = {
x: 'number',
y: 'number',
width: 'number',
height: 'number',
isRigidBody: 'checkbox',
isAnchor: 'checkbox',
XPositionReference: 'number'
};

View file

@ -56,10 +56,9 @@ const GetSVGLayoutConfiguration = () => {
Width: 500, Width: 500,
Style: { Style: {
fillOpacity: 1, fillOpacity: 1,
borderWidth: 2, strokeWidth: 2,
stroke: 'red', stroke: 'red',
fill: '#78350F', fill: '#78350F',
stroke: 'red'
} }
}, },
{ {
@ -70,7 +69,7 @@ const GetSVGLayoutConfiguration = () => {
Height: 180, Height: 180,
Style: { Style: {
fillOpacity: 1, fillOpacity: 1,
borderWidth: 2, strokeWidth: 2,
stroke: 'green', stroke: 'green',
fill: 'white' fill: 'white'
} }
@ -79,7 +78,7 @@ const GetSVGLayoutConfiguration = () => {
Type: 'Remplissage', Type: 'Remplissage',
Style: { Style: {
fillOpacity: 1, fillOpacity: 1,
borderWidth: 2, strokeWidth: 2,
stroke: '#bfdbfe', stroke: '#bfdbfe',
fill: '#bfdbfe' fill: '#bfdbfe'
} }
@ -90,7 +89,7 @@ const GetSVGLayoutConfiguration = () => {
XPositionReference: 1, XPositionReference: 1,
Style: { Style: {
fillOpacity: 0, fillOpacity: 0,
borderWidth: 2, strokeWidth: 2,
stroke: '#713f12', stroke: '#713f12',
fill: '#713f12', fill: '#713f12',
} }