YarnSpinnerTool/ExperimentalYarnSpinnerEditor

Manually creating a node makes coordinates freak out

TheMartianLife opened this issue · 6 comments

Clicking 'New Node' in the node view makes the following text appear in the text view:

title: 
xpos: 
ypos: 
---
 
===

However, if you type a node out manually, i.e.

title: Start
---

===

it spits out a whole file full of xpos: and ypos: lines until the app lags out at around 1500 lines.

Screen Shot 2021-09-15 at 11 01 20 am

Works as intended

shows how lazy we are, I havent manually typed a node in decades

/cib

if (allLines[i].match(/---/))
{
    if (metadata !== null && metadata.size !== 0)
    {
        let increment = 0;
        metadata.forEach((value, key) => 
        {
            const stringToInsert = key + ": " + value;
            allLines.splice(i + increment, 0, stringToInsert);
            increment++;
            changesOccured = true;
            metadata.delete(key.trim());
        });
        //Assign the lines
    }
}

Issue caused by having i + increment - 1, which caused the metadata to be placed above the title line, but the check was only looking for xpos and ypos between title and dialogue delimiter, ergo, infinite (1500) insertions above title.

Further work will need to be done to allow for x and y pos to be stored above title as legal metadata

I thought title: had to be the first field, so maybe check with Jon that that's supposed to be allowed before you bother changing stuff.