缩放PlantUML图表中的一部分

3
缩放是由关键字scale控制的。我很好奇是否有可能以某种方式缩放PlantUML图表的部分,或者至少:缩放图表的部分字体大小。
似乎scale无法局限于图表的一部分(我没有找到任何示例表明这是可能的)。可以构想以下方式使用它,但此示例会缩放整个图像:
@startuml

package "Some Group" {
  scale 0.5
  HTTP - [First Component]
  [Another Component]
}

node "Other Groups" {
  FTP - [Second Component]
  [First Component] --> FTP
} 

@enduml
1个回答

3

我觉得目前没有实现这个的方法。从 PlantUML 的 scale 命令的源代码中可以看出:

protected CommandExecutionResult executeArg(AbstractPSystem diagram, LineLocation location, RegexResult arg) {
    double scale = Double.parseDouble(arg.get("SCALE", 0));
    if (scale == 0) {
        return CommandExecutionResult.error("Scale cannot be zero");
    }
    if (arg.get("DIV", 0) != null) {
        final double div = Double.parseDouble(arg.get("DIV", 0));
        if (div == 0) {
            return CommandExecutionResult.error("Scale cannot be zero");
        }
        scale /= div;
    }
    diagram.setScale(new ScaleSimple(scale));
    return CommandExecutionResult.ok();
}
scale的位置没有被使用,PlantUML只是通过diagram.setScale(new ScaleSimple(scale))来设置图表的scale。您可以通过以下方式验证这种操作:
@startuml
    
package "Some Group" {
  scale 0.5
  HTTP - [First Component]
  [Another Component]
}

node "Other Groups" {
  scale 5
  FTP - [Second Component]
  [First Component] --> FTP
}

@enduml

scale 0.5 命令被 scale 5 命令覆盖。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接