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

View File

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