Mask only labels in sequence diagram groups
This commit is contained in:
parent
73f08a24a0
commit
358a53d815
5 changed files with 9 additions and 1 deletions
|
|
@ -127,6 +127,9 @@ func toShape(obj *d2graph.Object, theme *d2themes.Theme) d2target.Shape {
|
|||
if obj.LabelPosition != nil {
|
||||
shape.LabelPosition = *obj.LabelPosition
|
||||
}
|
||||
if obj.MaskLabel != nil {
|
||||
shape.MaskLabel = *obj.MaskLabel
|
||||
}
|
||||
|
||||
shape.Tooltip = obj.Attributes.Tooltip
|
||||
shape.Link = obj.Attributes.Link
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ type Object struct {
|
|||
References []Reference `json:"references,omitempty"`
|
||||
|
||||
*geo.Box `json:"box,omitempty"`
|
||||
MaskLabel *bool `json:"maskLabel,omitempty"`
|
||||
LabelPosition *string `json:"labelPosition,omitempty"`
|
||||
LabelWidth *int `json:"labelWidth,omitempty"`
|
||||
LabelHeight *int `json:"labelHeight,omitempty"`
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ func (sd *sequenceDiagram) placeGroups() {
|
|||
})
|
||||
for _, group := range sd.groups {
|
||||
group.ZIndex = GROUP_Z_INDEX
|
||||
group.MaskLabel = go2.Pointer(true)
|
||||
sd.placeGroup(group)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -782,7 +782,9 @@ func drawShape(writer io.Writer, targetShape d2target.Shape) (labelMask string,
|
|||
textStyle,
|
||||
renderText(targetShape.Label, x, float64(targetShape.LabelHeight)),
|
||||
)
|
||||
labelMask = makeLabelMask(labelTL, targetShape.LabelWidth, targetShape.LabelHeight-d2graph.INNER_LABEL_PADDING)
|
||||
if targetShape.MaskLabel {
|
||||
labelMask = makeLabelMask(labelTL, targetShape.LabelWidth, targetShape.LabelHeight-d2graph.INNER_LABEL_PADDING)
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(writer, `</g>`)
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ type Shape struct {
|
|||
Text
|
||||
|
||||
LabelPosition string `json:"labelPosition,omitempty"`
|
||||
MaskLabel bool `json:"maskLabel"`
|
||||
|
||||
ZIndex int `json:"zIndex"`
|
||||
Level int `json:"level"`
|
||||
|
|
|
|||
Loading…
Reference in a new issue