plantuml / plantuml-server

PlantUML Online Server
https://plantuml.com/
GNU General Public License v3.0
1.59k stars 463 forks source link

Diagram preview cuts off #332

Closed sh4r10 closed 3 months ago

sh4r10 commented 3 months ago

Describe the bug When working with medium sized PlantUML files, the diagram preview section cuts off and is unable to show the entire diagram. This in turn affects the export functionality as well which also export cut off diagrams. Not sure if this a bug with the server itself, but had the same issues on plantext.com as well.

To Reproduce Steps to reproduce the behavior:

  1. Run the server with the jetty docker image using docker run -d -p 8080:8080 plantuml/plantuml-server:jetty
  2. Go to localhost:8080
  3. Use the following file contents to generate a diagram
    
    @startuml

package com.example.zootypers {

class Activity {
}

class PreGameSelectionMulti {
    +onCreate(savedInstanceState: Bundle): void
    +onCreateOptionsMenu(menu: Menu): boolean
}

class TitlePage {
    +onCreate(savedInstanceState: Bundle): void
    +onCreateOptionsMenu(menu: Menu): boolean
    +goToPreGameSelection(view: View): void
    +goToPreGameSelectionMulti(view: View): void
    +goToLeaderboard(view: View): void
    +goToOptions(view: View): void
    +onBackPressed(): void
}

class WordDB {
    -dbHelper: WordDBHelper
    -allColumns: String[]
    -ALL_ROWS: String
    +WordDB(context: Context)
    +createWordData(word: String, diff: int): WordData
    +deleteWordData(worddata: WordData): void
    +resetDatabase(): void
    +getAllWords(): Map<WordData, Integer>
    -cursorToWordData(cursor: Cursor): WordData
}

class Leaderboard {
    +onCreate(savedInstanceState: Bundle): void
    +onCreateOptionsMenu(menu: Menu): boolean
}

class PreGameSelection {
    -HIGHTLIGHT_COLOR: int
    -diff: View
    -animal: View
    -background: View
    +onCreate(savedInstanceState: Bundle): void
    +onCreateOptionsMenu(menu: Menu): boolean
    +setDiff(view: View): void
    +setAnimal(view: View): void
    +setBackground(view: View): void
    +goToSinglePlayer(view: View): void
    +goToTitlePage(view: View): void
    +onBackPressed(): void
}

class TypingWordDB {
    -configProps: Properties
    -DBDriver: String
    -DBUrl: String
    -DBUser: String
    -DBPassword: String
    -DBcon: Connection
    -getStatement: PreparedStatement
    +openConnection(): void
    +closeConnection(): void
    +prepareStatements(): void
    +getSomething(): String
}

class WordDBHelper {
    +DATABASE_NAME: String
    +DATABASE_TABLE: String
    +DATABASE_VERSION: int
    +KEY_ID: String
    +KEY_WORDDATA: String
    +KEY_DIFFICULTY: String
    +WordDBHelper(context: Context)
    +onCreate(database: SQLiteDatabase): void
    +onUpgrade(db: SQLiteDatabase, oldVer: int, newVer: int): void
}

class SinglePlayer {
    -model: SinglePlayerModel
    -NUM_WORDS: int
    -bg: int
    -ppw: PopupWindow
    -popUpParams: LayoutParams
    -popUpLayout: LinearLayout
    -currentTime: long
    -pausedTime: long
    -gameTimer: GameTimer
    -INTERVAL: long
    -START_TIME: long
    -paused: boolean
    +onCreate(savedInstanceState: Bundle): void
    +onCreateOptionsMenu(menu: Menu): boolean
    +onKeyDown(key: int, event: KeyEvent): boolean
    +onPause(): void
    +initialDisplay(animalID: Drawable, backgroundID: Drawable): void
    +displayWord(wordIndex: int, word: String): void
    +displayTime(secondsLeft: long): void
    +displayScore(score: int): void
    +highlightWord(wordIndex: int, word: String, letterIndex: int): void
    +update(arg0: Observable, arg1: Object): void
    +keyboardButton(view: View): void
    +goToPostGame(): void
    +getByStringId(id: String): View
    +pauseGame(view: View): void
    +pausedContinue(view: View): void
    +pausedNewGame(view: View): void
    +pausedMainMenu(view: View): void
    -GameTimer: class
}

class States {
    difficulty: enum
    update: enum
}

class SinglePlayerModel {
    -numWordsDisplayed: int
    -wordsList: String[]
    -wordsDisplayed: int[]
    -currWordIndex: int
    -currLetterIndex: int
    -nextWordIndex: int
    -score: int
    -am: AssetManager
    -currFirstLetters: Set<Character>
    +SinglePlayerModel(diff: States.difficulty, am: AssetManager, wordsDis: int)
    +populateDisplayedList(): void
    +typedLetter(letter: char): void
    +getScore(): int
    +getCurrWord(): String
    +getCurrWordIndex(): int
    +getCurrLetterIndex(): int
    -getWordsList(diff: States.difficulty): void
    -updateWordsDisplayed(): void
}

class PostGameScreen {
    +onCreate(savedInstanceState: Bundle): void
    +onBackPressed(): void
    +onCreateOptionsMenu(menu: Menu): boolean
    +goToTitlePage(view: View): void
    +goToPreGameSelection(view: View): void
}

class ZeroFeature {
    -worddb: WordDB
    +onCreate(savedInstanceState: Bundle): void
    +onCreateOptionsMenu(menu: Menu): boolean
    +goToStart(view: View): void
    -addWords(): void
    -fetchData(): void
}

class Options {
    +onCreate(savedInstanceState: Bundle): void
    +onCreateOptionsMenu(menu: Menu): boolean
}

class WordData {
    -id: long
    -word: String
    +getId(): long
    +setId(id: long): void
    +getWord(): String
    +setWord(word: String): void
    +equals(obj: Object): boolean
    +hashCode(): int
    +toString(): String
}

}

PreGameSelectionMulti -|> Activity TitlePage -|> Activity Leaderboard -|> Activity PreGameSelection -|> Activity SinglePlayer -|> Activity Options -|> Activity PostGameScreen -|> Activity ZeroFeature -|> Activity

@enduml



**Expected behavior**
The entire diagram should be visible, hopefuly automatically aligned so that it makes effective use of the available space. At the very least the generated diagram should not be cut off. 

**Screenshots**
A screenshot showing the rightmost edge where the diagram cuts off. 
![image](https://github.com/plantuml/plantuml-server/assets/21986219/d3ad6926-7080-4352-aeb7-1723e1a73d6d)

**Desktop (please complete the following information):**

- OS: Arch Linux
- Browser: Mozilla Firefox 
- Version: 123.0.1

**Additional context**
The PlantUML is generated through GPT-4.
The-Lum commented 3 months ago

Hi @sh4r10,

Could you have a look on:

And on:

Regards, Th.

HeinrichAD commented 3 months ago

@The-Lum I agree with you and can even confirm that it worked for me with a higher limit without any problems.

docker run -d -p 8080:8080 -e PLANTUML_LIMIT_SIZE=16384 plantuml/plantuml-server:jetty
Rendered example image ![rendered image](https://github.com/plantuml/plantuml-server/assets/5962361/ac1e1ac7-f913-4543-8e99-85276ac2faf9)

I will close the issue for now but @sh4r10 feel free reach out for us if it is still not working for you.

sh4r10 commented 3 months ago

Thanks a lot for the help @HeinrichAD and @The-Lum, got it working now :smiley: