Merged PR 170: Add new eslint rules
- naming-convention - prefer-arrow-callback - func-style - import/no-default-export
This commit is contained in:
parent
3f58c5ba5e
commit
ad126c6c28
65 changed files with 781 additions and 784 deletions
|
@ -22,8 +22,8 @@ import { ISizePointer } from '../../../Interfaces/ISizePointer';
|
|||
export function ApplyRigidBody(
|
||||
container: IContainerModel
|
||||
): IContainerModel {
|
||||
container = constraintBodyInsideParent(container);
|
||||
container = constraintBodyInsideUnallocatedWidth(container);
|
||||
container = ConstraintBodyInsideParent(container);
|
||||
container = ConstraintBodyInsideUnallocatedWidth(container);
|
||||
return container;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ export function ApplyRigidBody(
|
|||
* @param container
|
||||
* @returns Updated container
|
||||
*/
|
||||
function constraintBodyInsideParent(
|
||||
function ConstraintBodyInsideParent(
|
||||
container: IContainerModel
|
||||
): IContainerModel {
|
||||
if (container.parent === null || container.parent === undefined) {
|
||||
|
@ -46,7 +46,7 @@ function constraintBodyInsideParent(
|
|||
const parentWidth = parentProperties.width;
|
||||
const parentHeight = parentProperties.height;
|
||||
|
||||
return constraintBodyInsideSpace(container, 0, 0, parentWidth, parentHeight);
|
||||
return ConstraintBodyInsideSpace(container, 0, 0, parentWidth, parentHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ function constraintBodyInsideParent(
|
|||
* @param height height of the rectangle
|
||||
* @returns Updated container
|
||||
*/
|
||||
function constraintBodyInsideSpace(
|
||||
function ConstraintBodyInsideSpace(
|
||||
container: IContainerModel,
|
||||
x: number,
|
||||
y: number,
|
||||
|
@ -113,7 +113,7 @@ function constraintBodyInsideSpace(
|
|||
* @param container
|
||||
* @returns Updated container
|
||||
*/
|
||||
export function constraintBodyInsideUnallocatedWidth(
|
||||
export function ConstraintBodyInsideUnallocatedWidth(
|
||||
container: IContainerModel
|
||||
): IContainerModel {
|
||||
if (container.parent === null || container.parent === undefined) {
|
||||
|
@ -121,7 +121,7 @@ export function constraintBodyInsideUnallocatedWidth(
|
|||
}
|
||||
|
||||
// Get the available spaces of the parent
|
||||
const availableWidths = getAvailableWidths(container.parent, container);
|
||||
const availableWidths = GetAvailableWidths(container.parent, container);
|
||||
const containerX = container.properties.x;
|
||||
const containerWidth = container.properties.width;
|
||||
|
||||
|
@ -158,7 +158,7 @@ export function constraintBodyInsideUnallocatedWidth(
|
|||
// Check if the container actually fit inside
|
||||
// It will usually fit if it was alrady fitting
|
||||
const availableWidthFound = availableWidths.find((width) =>
|
||||
isFitting(container.properties.width, width)
|
||||
IsFitting(container.properties.width, width)
|
||||
);
|
||||
|
||||
if (availableWidthFound === undefined) {
|
||||
|
@ -170,7 +170,7 @@ export function constraintBodyInsideUnallocatedWidth(
|
|||
// We want the container to fit automatically inside the available space
|
||||
// even if it means to resize the container
|
||||
const availableWidth: ISizePointer | undefined = availableWidths.find((width) => {
|
||||
return isFitting(container.properties.minWidth, width);
|
||||
return IsFitting(container.properties.minWidth, width);
|
||||
});
|
||||
|
||||
if (availableWidth === undefined) {
|
||||
|
@ -191,7 +191,7 @@ export function constraintBodyInsideUnallocatedWidth(
|
|||
return container;
|
||||
}
|
||||
|
||||
return constraintBodyInsideSpace(
|
||||
return ConstraintBodyInsideSpace(
|
||||
container,
|
||||
availableWidthFound.x,
|
||||
0,
|
||||
|
@ -206,10 +206,10 @@ export function constraintBodyInsideUnallocatedWidth(
|
|||
* @param sizePointer Size space to check
|
||||
* @returns
|
||||
*/
|
||||
const isFitting = (
|
||||
containerWidth: number,
|
||||
sizePointer: ISizePointer
|
||||
): boolean => containerWidth <= sizePointer.width;
|
||||
function IsFitting(containerWidth: number,
|
||||
sizePointer: ISizePointer): boolean {
|
||||
return containerWidth <= sizePointer.width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unallocated widths inside a container
|
||||
|
@ -220,7 +220,7 @@ const isFitting = (
|
|||
* @param exception Container to exclude of the widths (since a container will be moved, it might need to be excluded)
|
||||
* @returns {ISizePointer[]} Array of unallocated widths (x=position of the unallocated space, width=size of the allocated space)
|
||||
*/
|
||||
function getAvailableWidths(
|
||||
function GetAvailableWidths(
|
||||
container: IContainerModel,
|
||||
exception: IContainerModel
|
||||
): ISizePointer[] {
|
||||
|
@ -251,7 +251,7 @@ function getAvailableWidths(
|
|||
// In order to find unallocated space,
|
||||
// We need to calculate the overlap between the two containers
|
||||
// We only works with widths meaning in 1D (with lines)
|
||||
const newUnallocatedWidths = getAvailableWidthsTwoLines(
|
||||
const newUnallocatedWidths = GetAvailableWidthsTwoLines(
|
||||
unallocatedSpace,
|
||||
childX,
|
||||
childWidth
|
||||
|
@ -274,7 +274,7 @@ function getAvailableWidths(
|
|||
* @param rectWidth width of the second line
|
||||
* @returns Available widths
|
||||
*/
|
||||
function getAvailableWidthsTwoLines(
|
||||
function GetAvailableWidthsTwoLines(
|
||||
unallocatedSpace: ISizePointer,
|
||||
rectX: number,
|
||||
rectWidth: number
|
||||
|
@ -295,18 +295,18 @@ function getAvailableWidthsTwoLines(
|
|||
|
||||
const isOverlappingOnTheLeft = unallocatedSpace.x >= rectX;
|
||||
if (isOverlappingOnTheLeft) {
|
||||
return getAvailableWidthsLeft(unallocatedSpaceRight, rectRight);
|
||||
return GetAvailableWidthsLeft(unallocatedSpaceRight, rectRight);
|
||||
}
|
||||
|
||||
const isOverlappingOnTheRight = rectRight >= unallocatedSpaceRight;
|
||||
if (isOverlappingOnTheRight) {
|
||||
return getAvailableWidthsRight(unallocatedSpace.x, rectX);
|
||||
return GetAvailableWidthsRight(unallocatedSpace.x, rectX);
|
||||
}
|
||||
|
||||
return getAvailableWidthsMiddle(unallocatedSpace.x, unallocatedSpaceRight, rectX, rectRight);
|
||||
return GetAvailableWidthsMiddle(unallocatedSpace.x, unallocatedSpaceRight, rectX, rectRight);
|
||||
}
|
||||
|
||||
function getAvailableWidthsLeft(unallocatedSpaceRight: number, rectRight: number): ISizePointer[] {
|
||||
function GetAvailableWidthsLeft(unallocatedSpaceRight: number, rectRight: number): ISizePointer[] {
|
||||
if (unallocatedSpaceRight - rectRight <= 0) {
|
||||
return [];
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ function getAvailableWidthsLeft(unallocatedSpaceRight: number, rectRight: number
|
|||
];
|
||||
}
|
||||
|
||||
function getAvailableWidthsRight(unallocatedSpaceX: number, rectX: number): ISizePointer[] {
|
||||
function GetAvailableWidthsRight(unallocatedSpaceX: number, rectX: number): ISizePointer[] {
|
||||
if (rectX - unallocatedSpaceX <= 0) {
|
||||
return [];
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ function getAvailableWidthsRight(unallocatedSpaceX: number, rectX: number): ISiz
|
|||
];
|
||||
}
|
||||
|
||||
function getAvailableWidthsMiddle(
|
||||
function GetAvailableWidthsMiddle(
|
||||
unallocatedSpaceX: number,
|
||||
unallocatedSpaceRight: number,
|
||||
rectX: number,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue