lewish / asciiflow

ASCIIFlow
https://asciiflow.com
MIT License
4.76k stars 367 forks source link

Add plain lines, fix wonky text input, and add LocalStorage #146

Closed brewingcode closed 3 years ago

brewingcode commented 4 years ago

Hey, thanks for a great tool, I love it.

I had a need to draw lines between things without having the tool force symbols on the end, so I added a 3rd line type called "plain line":

https://gfycat.com/classicadvancedbellsnake

I also fixed an annoying issue where typing/importing SPECIAL_* characters wasn't preserving them during typing/importing. For example, typing in vvvv would show as <vvv>, and importing a diagram like the following would....hey wait, this issue has been mentioned a lot before! NOW I f'ing go looking.

I fixed it fairly simply by assigning a property on cells that are user input, such as text entered via the text tool, and text imported via the import button. These cells are never altered by the draw loop and it's surrounding-context checking.

I also saved the cell content in LocalStorage (it's ~1.2MB if you use all 2000x600 cells), because losing your work on an accidental page refresh is no fun. In practice, the stored size is far smaller, as it's simply the result of exporting the cells via the existing export button, which constrains the output to non-empty cells.

I also moved view.useLines into state.useLines, so that it could also be stored in LocalStorage.

I also changed the 3rd party client scripts to be conditionally included only on the main url, as it makes no sense to pull them in when developing locally. In the case of the Google Drive integration, the OAuth app is not even setup to allow any other url, so the oauth popup is permanently broken when hosted anywhere besides asciiflow.com.

brewingcode commented 4 years ago

The main reason I wanted plain lines with no endpoint markers is to reduce visual noise in diagrams, especially diagrams that don't have boxes around everything. Here's an example, with the current connector-lines on the left, and the new plain lines on the right:


         Hushed River                                                    Hushed River
            Valley                 Timberwolf                               Valley                 Timberwolf
              +                     Mountain                                  |                     Mountain
              |                        +                                      |                        |
              +                        +                                      |                        |
           Mountain         +------ Pleasant -------+                      Mountain         +------ Pleasant -------+
             Town           |        Valley         |                        Town           |        Valley         |
              +             |                       |                         |             |                       |
              |             |                       |                         |             |                       |
              +             +                       +                         |             |                       |
 Broken +-+ Forlorn +--+ Mystery +-------------+ Coastal         Broken --- Forlorn ---- Mystery --------------- Coastal
Railroad    Muskeg        Lake                   Highway        Railroad    Muskeg        Lake                   Highway
              +             +                        +                        |             |                        |
              |             |                        |                        |             |                        |
              |             +                        |                        |             |                        |
              +---------+ Bleak                      +                        +---------- Bleak                      |
                          Inlet                 Desolation                                Inlet                 Desolation
                                                  Point                                                           Point
brewingcode commented 4 years ago

I rebased all "Update compiled output" commits to a single commit, for prettiness.

crazybber commented 4 years ago

this is a cool feature

lewish commented 3 years ago

Hello!

I apologize deeply for not looking at your PR. Back at the start of the year I started a BIG refactor of the code base, it dragged on for much longer than I hoped.

I love the ideas here, and I've incorporated both into the new version. By default lines are now "plain":

image

Additionally I've implemented a proper local storage solution with multiple files so you should never lose your work again!

Bad news is that this PR is pretty much uunmergeable at this point...

lewish commented 3 years ago
         Hushed River
            Valley                 Timberwolf
              │                     Mountain
              │                        │
              │                        │
           Mountain         ┌────── Pleasant ───────┐
             Town           │        Valley         │
              │             │                       │
              │             │                       │
              │             │                       │
 Broken ─── Forlorn ──── Mystery ─────────────── Coastal
Railroad    Muskeg        Lake                   Highway
              │             │                        │
              │             │                        │
              │             │                        │
              └────────── Bleak                      │
                          Inlet                 Desolation
                                                  Point
Qix- commented 3 years ago

Hey there, going to go ahead and close this for now. Thanks again for the work and sorry for the delay!

brewingcode commented 3 years ago

No worries at all, glad to see the plain lines ended up in there one way or another. I'm even more glad to see the tool getting updated at all! :-)