nkh / P5-App-Asciio

Plain ASCII diagram
https://nkh.github.io/P5-App-Asciio/
53 stars 4 forks source link

Object attributes #92

Closed nkh closed 8 months ago

nkh commented 1 year ago

Objects have an optional attribute describing its type

The type can be used to:

Generally, elements should have user editable attributes.

An example would be to store attributes needed by exporter that work with external program, like ditaa, a shape that can't be well displayed by Asciio can be displayed with another color but the shape would be exported properly.

The object extra attributes are all under a single entry in the object

create_box
    (
    NAME => 'box unicode',
    TEXT_ONLY => '',
    WITH_FRAME => 1,
    WITH_SIZE => [4, 2],
    BOX_TYPE =>
        [
            [1, 'top',             '╭',  '─',  '╮', 1, ],
            [0, 'title separator', '│',  '─',  '│', 1, ],
            [1, 'body separator',  '│ ', '│', ' │', 1, ], 
            [1, 'bottom',          '╰',  '─',  '╯', 1, ],
            [1, 'fill-character',  '',   ' ', '',   1, ],
        ]

        TYPE (what's NAME used for? )

        USER_ATTRIBUTES =>
               {
               ...
                }
    ),
nkh commented 8 months ago

Scripting.pm has it's own name to element hash which needs to be maintained in parallel when deleting the elements; adding a name to an element would remove the problem.

nkh commented 8 months ago

fixed in b48ff92