Parsing of block arrows with directions, creating a dedicated new node for this.

This commit is contained in:
Knut Sveidqvist 2023-10-26 22:02:16 +02:00
parent 7198fe55a9
commit 03c59adaed
2 changed files with 5 additions and 3 deletions

View File

@ -22,8 +22,7 @@ const populateBlockDatabase = (blockList: Block[], parent: Block): void => {
const children = [];
for (const block of blockList) {
if (block.type === 'column-setting') {
const columns = block.columns || -1;
parent.columns = columns;
parent.columns = block.columns || -1;
} else {
if (!block.label) {
if (block.type === 'composite') {
@ -39,7 +38,8 @@ const populateBlockDatabase = (blockList: Block[], parent: Block): void => {
}
if (block.type === 'space') {
for (let j = 0; j < block.width; j++) {
const w = block.width || 1;
for (let j = 0; j < w; j++) {
const newBlock = clone(block);
newBlock.id = newBlock.id + '-' + j;
blockDatabase[newBlock.id] = newBlock;

View File

@ -17,6 +17,7 @@ export type BlockType =
| 'lean_left'
| 'trapezoid'
| 'inv_trapezoid'
| 'rect_left_inv_arrow'
| 'odd_right'
| 'circle'
| 'ellipse'
@ -28,6 +29,7 @@ export type BlockType =
| 'composite';
export interface Block {
width?: number;
id: string;
label?: string;
parent?: Block;