IDs of deleted shapes still written to PointsToNoteIDs list in Scapple XML

ho
houthakker
Posts: 17
Joined: Thu Jun 14, 2018 7:31 am
Platform: Mac

Tue Jun 19, 2018 4:34 pm Post

A small bug in the XML (.scap file) which Scapple writes out.

If we add a new shape to an existing diagram, perhaps after a few shape deletions, so that its ID is the highest in the document, and not contiguous to others, we might create something like this in the .scap file:

Screen Shot 2018-06-19 at 17.21.16.png
Screen Shot 2018-06-19 at 17.21.16.png (25.98 KiB) Viewed 4227 times

Code: Select all

<Note ID="34" FontSize="12.0" Position="628.167045,186.799347" Width="91.0">
    <Appearance>
        <Alignment>Left</Alignment>
    </Appearance>
    <String>Supernumerary</String>
    <ConnectedNoteIDs>6</ConnectedNoteIDs>
</Note>


and the in the PointsToNoteIDs list of the shape which points to it, its ID (34 in this example) will also appear:

Code: Select all

<Note ID="6" FontSize="12.0" Position="505.0,78.0" Width="73.0">
    <Appearance>
        <Alignment>Left</Alignment>
    </Appearance>
    <String>composition</String>
    <ConnectedNoteIDs>5, 7-8, 10, 34</ConnectedNoteIDs>
    <PointsToNoteIDs>7-8, 10, 34</PointsToNoteIDs>
</Note>


So far so good, however if we then delete the new shape, and save the Scapple file,
it turns out that its ID continues to appear in the PointsToNoteIDs list of the other shape, even though that ID:

- no longer corresponds to any actual shape in the diagram and
- has been successfully purged from the ConnectedNodeIDs value.

Code: Select all

<Note ID="6" FontSize="12.0" Position="505.0,78.0" Width="73.0">
    <Appearance>
        <Alignment>Left</Alignment>
    </Appearance>
    <String>composition</String>
    <ConnectedNoteIDs>5, 7-8, 10</ConnectedNoteIDs>
    <PointsToNoteIDs>7-8, 10, 34</PointsToNoteIDs>
</Note>


A minor bug in the sense that it doesn't seem to trip up Scapple itself,
but it did initially trip up a script which parsed the XML, and found:

- a reference to a shape which didn't exist, and
- an ID in the PointsToNoteIDs list which didn't show up in the corresponding ConnectedNoteIDs list.

User avatar
AmberV
Posts: 24632
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Fri Jun 22, 2018 6:26 pm Post

That I can reproduce. It looks to be as simple as this:

  1. Create a new blank board.
  2. Press ⌘↩ to create a new note.
  3. Use Notes ▸ New Background Shape.
  4. ⌥⌘-drag the new shape onto the note.
  5. Delete the shape.
  6. Save and examine XML.

Result:

Code: Select all

    <Notes>
        <Note ID="0" FontSize="14.0" Position="324.0,168.333333" Width="200.0">
            <Appearance>
                <Alignment>Left</Alignment>
                <Border Style="Square"></Border>
            </Appearance>
            <String>Test Note</String>
            <PointsToNoteIDs>1</PointsToNoteIDs>
        </Note>
    </Notes>
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles