plantuml / plantuml

Generate diagrams from textual description
https://plantuml.com
Other
10.54k stars 964 forks source link

`rectangle` key word will reverse order in `left to right direction` layout #1892

Closed LY1806620741 closed 2 months ago

LY1806620741 commented 2 months ago

Describe the bug A clear and concise description of what the bug is. rectangle key word will reverse order in left to right direction layout, what should i do?

To Reproduce Steps to reproduce the behavior:

  1. vscode install Markdown Preview Enhanced v0.8.13 extension.
  2. download plantuml Release v1.2024.6 from github
  3. download and install windows_10_cmake_Release_graphviz-install-12.1.0-win64.exe. then config user environment GRAPHVIZ_DOT = c:\program files\graphviz\bin\dot.exe
  4. create a markdown file name **.md, write the plaintuml example
    ```plaintuml
    @startuml
    left to right direction
    actor "Food Critic" as fc
    rectangle Restaurant {
    usecase "Eat Food" as UC1
    usecase "Pay for Food" as UC2
    usecase "Drink" as UC3
    }
    fc --> UC1
    fc --> UC2
    fc --> UC3
    @enduml
  5. see the preview. and found the image not expect.

Expected behavior expect the same as https://plantuml.com/zh/guide page 47 say. image

Screenshots in fact, i get this image we can found that element in rectangle was reverse order print.

Desktop (please complete the following information):

Smartphone (please complete the following information):

not need

Additional context

The-Lum commented 2 months ago

Hello @LY1806620741

[!IMPORTANT]
FYI: PlantUML does not preserve place of element, it depends a lot of the layout used (Graphviz, Smetana, ELK).

I think it depends of the Graphviz version, see result on plantext server:

_[Link here]_

And FYI plantext used currently this GraphViz version:

But the issue will be then on normal layout, as:

@startuml
'left to right direction
actor "Food Critic" as fc
rectangle Restaurant {
usecase "Eat Food" as UC1
usecase "Pay for Food" as UC2
usecase "Drink" as UC3
}
fc --> UC1
fc --> UC2
fc --> UC3
@enduml

Regards, Th.

LY1806620741 commented 2 months ago

@The-Lum Okay, thanks for reply, my understanding of plantuml was stuck many years ago. Is there no way we can use keywords to adjust this order?

The-Lum commented 2 months ago

@LY1806620741

Is there no way we can use keywords to adjust this order?

Yes, You can add hidden arrow, as:

UC3 -r[hidden]-> UC2
UC2 -r[hidden]-> UC1

Enjoy, Regards, Th.