Skip to content

Commit

Permalink
minor #27805 [Workflow] Fix autofit label in rendering (evertharmeling)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Workflow] Fix autofit label in rendering

Set default to autofit label in place/transition to render long labels properly.

| Q             | A
| ------------- | ---
| Branch?       | master (3.2 to 4.1)
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes, not sure how to add a proper test however
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

When using long names for `places` or `transitions`, currently this will not be properly rendered it via the `GraphvizDumper`, see below.

![Default truncated](https://cdn.pbrd.co/images/HsAMVK9.png)
![Default autofit](https://cdn.pbrd.co/images/HsANdKx.png)

By setting the default to `fixedsize=false` it will autofit the label in the rendering.

This will also solve the warning when running the `dump` command:
`Warning: node 'place_08b79deda74a924c3babb9b1d0f3e4eed9320989', graph 'workflow' size too small for label`

Commits
-------

76465fc [Workflow] Set default to autofit label in place/transition to render long labels properly
  • Loading branch information
nicolas-grekas committed Jul 7, 2018
2 parents fbb1f82 + 76465fc commit 1cf8146
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php
Expand Up @@ -28,7 +28,7 @@ class GraphvizDumper implements DumperInterface
{
protected static $defaultOptions = array(
'graph' => array('ratio' => 'compress', 'rankdir' => 'LR'),
'node' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => '#333333', 'fillcolor' => 'lightblue', 'fixedsize' => true, 'width' => 1),
'node' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => '#333333', 'fillcolor' => 'lightblue', 'fixedsize' => 'false', 'width' => 1),
'edge' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => '#333333', 'arrowhead' => 'normal', 'arrowsize' => 0.5),
);

Expand Down
Expand Up @@ -63,7 +63,7 @@ public function createComplexWorkflowDefinitionDumpWithMarking()
{
return 'digraph workflow {
ratio="compress" rankdir="LR"
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"];
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="false" width="1"];
edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"];
place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"];
Expand Down Expand Up @@ -101,7 +101,7 @@ public function createSimpleWorkflowDumpWithMarking()
{
return 'digraph workflow {
ratio="compress" rankdir="LR"
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"];
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="false" width="1"];
edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"];
place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"];
Expand All @@ -121,7 +121,7 @@ public function provideComplexWorkflowDumpWithoutMarking()
{
return 'digraph workflow {
ratio="compress" rankdir="LR"
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"];
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="false" width="1"];
edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"];
place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"];
Expand Down Expand Up @@ -159,7 +159,7 @@ public function provideSimpleWorkflowDumpWithoutMarking()
{
return 'digraph workflow {
ratio="compress" rankdir="LR"
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"];
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="false" width="1"];
edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"];
place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"];
Expand Down
Expand Up @@ -27,7 +27,7 @@ public function testDumpWithoutMarking()
$expected = <<<'EOGRAPH'
digraph workflow {
ratio="compress" rankdir="LR"
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"];
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="false" width="1"];
edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"];
place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"];
Expand All @@ -53,7 +53,7 @@ public function testDumpWithMarking()
$expected = <<<'EOGRAPH'
digraph workflow {
ratio="compress" rankdir="LR"
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"];
node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="false" width="1"];
edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"];
place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"];
Expand Down

0 comments on commit 1cf8146

Please sign in to comment.