Merged PR 179: Fix bugs about flex and context menu (see desc) + disable hard rigid behavior + add missing properties to form + Clean up css
- Clean up some css class - Fix wrong order when applying flex - Fix Replace behavior not working because previous container was still existing - Disable hard rigid behavior which disallow two container to overlap - Add ENABLE_FLEX, ENABLE_HARD_RIGID ENABLE_SWAP - Add missing form properties with dimensions - Update readme
This commit is contained in:
parent
353f461f4b
commit
443a15e150
16 changed files with 158 additions and 45 deletions
|
@ -1,6 +1,6 @@
|
|||
import { IContainerModel } from '../../../Interfaces/IContainerModel';
|
||||
import { ISymbolModel } from '../../../Interfaces/ISymbolModel';
|
||||
import { APPLY_BEHAVIORS_ON_CHILDREN } from '../../../utils/default';
|
||||
import { APPLY_BEHAVIORS_ON_CHILDREN, ENABLE_RIGID, ENABLE_SWAP } from '../../../utils/default';
|
||||
import { ApplyAnchor } from './AnchorBehaviors';
|
||||
import { Flex } from './FlexBehaviors';
|
||||
import { ApplyRigidBody } from './RigidBodyBehaviors';
|
||||
|
@ -23,11 +23,15 @@ export function ApplyBehaviors(container: IContainerModel, symbols: Map<string,
|
|||
ApplyAnchor(container);
|
||||
}
|
||||
|
||||
ApplySwap(container);
|
||||
if (ENABLE_SWAP) {
|
||||
ApplySwap(container);
|
||||
}
|
||||
|
||||
Flex(container);
|
||||
|
||||
ApplyRigidBody(container);
|
||||
if (ENABLE_RIGID) {
|
||||
ApplyRigidBody(container);
|
||||
}
|
||||
|
||||
if (APPLY_BEHAVIORS_ON_CHILDREN) {
|
||||
// Apply DFS by recursion
|
||||
|
|
|
@ -38,6 +38,10 @@ function FlexGroup(flexibleGroup: IFlexibleGroup): void {
|
|||
nonFlexibleContainers
|
||||
} = SeparateFlexibleContainers(children);
|
||||
|
||||
if (flexibleContainers.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const minWidths = flexibleContainers
|
||||
.map(sibling => sibling.properties.minWidth);
|
||||
|
||||
|
@ -50,12 +54,8 @@ function FlexGroup(flexibleGroup: IFlexibleGroup): void {
|
|||
|
||||
const checkSumMinWidthsIsFitting = minimumPossibleWidth > requiredMaxWidth;
|
||||
if (checkSumMinWidthsIsFitting) {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Cannot fit!',
|
||||
text: 'Cannot fit at all even when squeezing all flex containers to the minimum.'
|
||||
});
|
||||
throw new Error('[FlexBehavior] Cannot fit at all even when squeezing all flex containers to the minimum.');
|
||||
console.warn('[FlexBehavior] Cannot fit at all even when squeezing all flex containers to the minimum.');
|
||||
return;
|
||||
}
|
||||
|
||||
const maxMinWidths = Math.max(...minWidths);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import Swal from 'sweetalert2';
|
||||
import { IContainerModel } from '../../../Interfaces/IContainerModel';
|
||||
import { ISizePointer } from '../../../Interfaces/ISizePointer';
|
||||
import { ENABLE_HARD_RIGID } from '../../../utils/default';
|
||||
|
||||
/**
|
||||
* "Transform the container into a rigid body"
|
||||
|
@ -23,7 +24,11 @@ export function ApplyRigidBody(
|
|||
container: IContainerModel
|
||||
): IContainerModel {
|
||||
container = ConstraintBodyInsideParent(container);
|
||||
container = ConstraintBodyInsideUnallocatedWidth(container);
|
||||
|
||||
if (ENABLE_HARD_RIGID) {
|
||||
container = ConstraintBodyInsideUnallocatedWidth(container);
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue