Compare commits
No commits in common. "4da161ff37326a6ad4ec424ee89b332af6fab79c" and "9f9ec8dc658533697c065ecc9f86580fdeadafde" have entirely different histories.
4da161ff37
...
9f9ec8dc65
4 changed files with 446 additions and 13157 deletions
|
@ -301,7 +301,7 @@ function getAvailableWidthsTwoLines(
|
||||||
|
|
||||||
const isOverlappingOnTheRight = rectRight >= unallocatedSpaceRight;
|
const isOverlappingOnTheRight = rectRight >= unallocatedSpaceRight;
|
||||||
if (isOverlappingOnTheRight) {
|
if (isOverlappingOnTheRight) {
|
||||||
return getAvailableWidthsRight(unallocatedSpace.x, rectX);
|
return getAvailableWidthsRight(unallocatedSpace.x, rectRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
return getAvailableWidthsMiddle(unallocatedSpace.x, unallocatedSpaceRight, rectX, rectRight);
|
return getAvailableWidthsMiddle(unallocatedSpace.x, unallocatedSpaceRight, rectX, rectRight);
|
||||||
|
@ -320,31 +320,31 @@ function getAvailableWidthsLeft(unallocatedSpaceRight: number, rectRight: number
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAvailableWidthsRight(unallocatedSpaceX: number, rectX: number): ISizePointer[] {
|
function getAvailableWidthsRight(unalloctedSpaceX: number, rectRight: number): ISizePointer[] {
|
||||||
if (rectX - unallocatedSpaceX <= 0) {
|
if (rectRight - unalloctedSpaceX <= 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
x: unallocatedSpaceX,
|
x: unalloctedSpaceX,
|
||||||
width: rectX - unallocatedSpaceX
|
width: rectRight - unalloctedSpaceX
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAvailableWidthsMiddle(
|
function getAvailableWidthsMiddle(
|
||||||
unallocatedSpaceX: number,
|
unalloctedSpaceX: number,
|
||||||
unallocatedSpaceRight: number,
|
unallocatedSpaceRight: number,
|
||||||
rectX: number,
|
rectX: number,
|
||||||
rectRight: number
|
rectRight: number
|
||||||
): ISizePointer[] {
|
): ISizePointer[] {
|
||||||
const sizePointers: ISizePointer[] = [];
|
const sizePointers: ISizePointer[] = [];
|
||||||
|
|
||||||
if (rectX - unallocatedSpaceX > 0) {
|
if (rectX - unalloctedSpaceX > 0) {
|
||||||
sizePointers.push({
|
sizePointers.push({
|
||||||
x: unallocatedSpaceX,
|
x: unalloctedSpaceX,
|
||||||
width: rectX - unallocatedSpaceX
|
width: rectX - unalloctedSpaceX
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
436
src/tests/resources/rigidbodytest.json
Normal file
436
src/tests/resources/rigidbodytest.json
Normal file
|
@ -0,0 +1,436 @@
|
||||||
|
{
|
||||||
|
"history": [
|
||||||
|
{
|
||||||
|
"MainContainer": {
|
||||||
|
"children": [],
|
||||||
|
"properties": {
|
||||||
|
"id": "main",
|
||||||
|
"parentId": "null",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
},
|
||||||
|
"userData": {}
|
||||||
|
},
|
||||||
|
"SelectedContainerId": "main",
|
||||||
|
"TypeCounters": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"LastAction": "Add container",
|
||||||
|
"MainContainer": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"properties": {
|
||||||
|
"id": "Container-0",
|
||||||
|
"parentId": "main",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 75,
|
||||||
|
"height": 100,
|
||||||
|
"isRigidBody": false,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "green"
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"type": "Container"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": "main",
|
||||||
|
"parentId": "null",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
},
|
||||||
|
"userData": {}
|
||||||
|
},
|
||||||
|
"SelectedContainerId": "main",
|
||||||
|
"TypeCounters": {
|
||||||
|
"Container": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"LastAction": "Select container Container-0",
|
||||||
|
"MainContainer": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"properties": {
|
||||||
|
"id": "Container-0",
|
||||||
|
"parentId": "main",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 75,
|
||||||
|
"height": 100,
|
||||||
|
"isRigidBody": false,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "green"
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"type": "Container"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": "main",
|
||||||
|
"parentId": "null",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
},
|
||||||
|
"userData": {}
|
||||||
|
},
|
||||||
|
"SelectedContainerId": "Container-0",
|
||||||
|
"TypeCounters": {
|
||||||
|
"Container": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"LastAction": "Change property of container Container-0",
|
||||||
|
"MainContainer": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"properties": {
|
||||||
|
"id": "Container-0",
|
||||||
|
"parentId": "main",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": "7",
|
||||||
|
"height": 100,
|
||||||
|
"isRigidBody": false,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "green"
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"type": "Container"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": "main",
|
||||||
|
"parentId": "null",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
},
|
||||||
|
"userData": {}
|
||||||
|
},
|
||||||
|
"SelectedContainerId": "Container-0",
|
||||||
|
"TypeCounters": {
|
||||||
|
"Container": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"LastAction": "Change property of container Container-0",
|
||||||
|
"MainContainer": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"properties": {
|
||||||
|
"id": "Container-0",
|
||||||
|
"parentId": "main",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": "",
|
||||||
|
"height": 100,
|
||||||
|
"isRigidBody": false,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "green"
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"type": "Container"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": "main",
|
||||||
|
"parentId": "null",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
},
|
||||||
|
"userData": {}
|
||||||
|
},
|
||||||
|
"SelectedContainerId": "Container-0",
|
||||||
|
"TypeCounters": {
|
||||||
|
"Container": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"LastAction": "Change property of container Container-0",
|
||||||
|
"MainContainer": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"properties": {
|
||||||
|
"id": "Container-0",
|
||||||
|
"parentId": "main",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": "2",
|
||||||
|
"height": 100,
|
||||||
|
"isRigidBody": false,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "green"
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"type": "Container"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": "main",
|
||||||
|
"parentId": "null",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
},
|
||||||
|
"userData": {}
|
||||||
|
},
|
||||||
|
"SelectedContainerId": "Container-0",
|
||||||
|
"TypeCounters": {
|
||||||
|
"Container": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"LastAction": "Change property of container Container-0",
|
||||||
|
"MainContainer": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"properties": {
|
||||||
|
"id": "Container-0",
|
||||||
|
"parentId": "main",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": "20",
|
||||||
|
"height": 100,
|
||||||
|
"isRigidBody": false,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "green"
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"type": "Container"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": "main",
|
||||||
|
"parentId": "null",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
},
|
||||||
|
"userData": {}
|
||||||
|
},
|
||||||
|
"SelectedContainerId": "Container-0",
|
||||||
|
"TypeCounters": {
|
||||||
|
"Container": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"LastAction": "Change property of container Container-0",
|
||||||
|
"MainContainer": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"properties": {
|
||||||
|
"id": "Container-0",
|
||||||
|
"parentId": "main",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": "200",
|
||||||
|
"height": 100,
|
||||||
|
"isRigidBody": false,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "green"
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"type": "Container"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": "main",
|
||||||
|
"parentId": "null",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
},
|
||||||
|
"userData": {}
|
||||||
|
},
|
||||||
|
"SelectedContainerId": "Container-0",
|
||||||
|
"TypeCounters": {
|
||||||
|
"Container": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"LastAction": "Change property of container Container-0",
|
||||||
|
"MainContainer": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"properties": {
|
||||||
|
"id": "Container-0",
|
||||||
|
"parentId": "main",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": "2000",
|
||||||
|
"height": 100,
|
||||||
|
"isRigidBody": false,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "green"
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"type": "Container"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": "main",
|
||||||
|
"parentId": "null",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
},
|
||||||
|
"userData": {}
|
||||||
|
},
|
||||||
|
"SelectedContainerId": "Container-0",
|
||||||
|
"TypeCounters": {
|
||||||
|
"Container": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"LastAction": "Change property of container Container-0",
|
||||||
|
"MainContainer": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"properties": {
|
||||||
|
"id": "Container-0",
|
||||||
|
"parentId": "main",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": "20000",
|
||||||
|
"height": 100,
|
||||||
|
"isRigidBody": false,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "green"
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"type": "Container"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": "main",
|
||||||
|
"parentId": "null",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
},
|
||||||
|
"userData": {}
|
||||||
|
},
|
||||||
|
"SelectedContainerId": "Container-0",
|
||||||
|
"TypeCounters": {
|
||||||
|
"Container": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"LastAction": "Change property of container Container-0",
|
||||||
|
"MainContainer": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"properties": {
|
||||||
|
"id": "Container-0",
|
||||||
|
"parentId": "main",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"isRigidBody": true,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "green"
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"type": "Container"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": "main",
|
||||||
|
"parentId": "null",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 2000,
|
||||||
|
"height": 100,
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
},
|
||||||
|
"userData": {}
|
||||||
|
},
|
||||||
|
"SelectedContainerId": "Container-0",
|
||||||
|
"TypeCounters": {
|
||||||
|
"Container": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"historyCurrentStep": 10,
|
||||||
|
"configuration": {
|
||||||
|
"AvailableContainers": [
|
||||||
|
{
|
||||||
|
"Type": "Container",
|
||||||
|
"Width": 75,
|
||||||
|
"Height": 100,
|
||||||
|
"Style": {
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "green"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"AvailableSymbols": [],
|
||||||
|
"MainContainer": {
|
||||||
|
"Type": "Container",
|
||||||
|
"Width": 2000,
|
||||||
|
"Height": 100,
|
||||||
|
"Style": {
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"stroke": "black"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -79,6 +79,7 @@ const GetSVGLayoutConfiguration = () => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Type: 'Remplissage',
|
Type: 'Remplissage',
|
||||||
|
DefaultChildType: 'Trou',
|
||||||
CustomSVG: `
|
CustomSVG: `
|
||||||
<rect width="{width}" height="{height}" style="{style}"></rect>
|
<rect width="{width}" height="{height}" style="{style}"></rect>
|
||||||
<rect width="{width}" height="{height}" stroke="black" fill-opacity="0"></rect>
|
<rect width="{width}" height="{height}" stroke="black" fill-opacity="0"></rect>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue