remove d2graph edge.MinWidth MinHeight
This commit is contained in:
parent
4b931f7aec
commit
cd1f802d3a
2 changed files with 0 additions and 26 deletions
|
|
@ -30,7 +30,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const INNER_LABEL_PADDING int = 5
|
const INNER_LABEL_PADDING int = 5
|
||||||
const EDGE_LABEL_PADDING int = 5
|
|
||||||
const DEFAULT_SHAPE_SIZE = 100.
|
const DEFAULT_SHAPE_SIZE = 100.
|
||||||
const MIN_SHAPE_SIZE = 5
|
const MIN_SHAPE_SIZE = 5
|
||||||
|
|
||||||
|
|
@ -1043,9 +1042,6 @@ func (obj *Object) OuterNearContainer() *Object {
|
||||||
type Edge struct {
|
type Edge struct {
|
||||||
Index int `json:"index"`
|
Index int `json:"index"`
|
||||||
|
|
||||||
MinWidth int `json:"minWidth"`
|
|
||||||
MinHeight int `json:"minHeight"`
|
|
||||||
|
|
||||||
SrcTableColumnIndex *int `json:"srcTableColumnIndex,omitempty"`
|
SrcTableColumnIndex *int `json:"srcTableColumnIndex,omitempty"`
|
||||||
DstTableColumnIndex *int `json:"dstTableColumnIndex,omitempty"`
|
DstTableColumnIndex *int `json:"dstTableColumnIndex,omitempty"`
|
||||||
|
|
||||||
|
|
@ -1482,16 +1478,12 @@ func (g *Graph) SetDimensions(mtexts []*d2target.MText, ruler *textmeasure.Ruler
|
||||||
t := edge.Text()
|
t := edge.Text()
|
||||||
t.Text = edge.SrcArrowhead.Label.Value
|
t.Text = edge.SrcArrowhead.Label.Value
|
||||||
dims := GetTextDimensions(mtexts, ruler, t, usedFont)
|
dims := GetTextDimensions(mtexts, ruler, t, usedFont)
|
||||||
edge.MinWidth += dims.Width + EDGE_LABEL_PADDING
|
|
||||||
edge.MinHeight += dims.Height + EDGE_LABEL_PADDING
|
|
||||||
edge.SrcArrowhead.LabelDimensions = *dims
|
edge.SrcArrowhead.LabelDimensions = *dims
|
||||||
}
|
}
|
||||||
if edge.DstArrowhead != nil && edge.DstArrowhead.Label.Value != "" {
|
if edge.DstArrowhead != nil && edge.DstArrowhead.Label.Value != "" {
|
||||||
t := edge.Text()
|
t := edge.Text()
|
||||||
t.Text = edge.DstArrowhead.Label.Value
|
t.Text = edge.DstArrowhead.Label.Value
|
||||||
dims := GetTextDimensions(mtexts, ruler, t, usedFont)
|
dims := GetTextDimensions(mtexts, ruler, t, usedFont)
|
||||||
edge.MinWidth += dims.Width + EDGE_LABEL_PADDING
|
|
||||||
edge.MinHeight += dims.Height + EDGE_LABEL_PADDING
|
|
||||||
edge.DstArrowhead.LabelDimensions = *dims
|
edge.DstArrowhead.LabelDimensions = *dims
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1510,8 +1502,6 @@ func (g *Graph) SetDimensions(mtexts []*d2target.MText, ruler *textmeasure.Ruler
|
||||||
}
|
}
|
||||||
|
|
||||||
edge.LabelDimensions = *dims
|
edge.LabelDimensions = *dims
|
||||||
edge.MinWidth += dims.Width
|
|
||||||
edge.MinHeight += dims.Height
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -388,22 +388,6 @@ func CompareSerializedEdge(edge, other *Edge) error {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if edge.MinWidth != other.MinWidth {
|
|
||||||
return fmt.Errorf(
|
|
||||||
"min width differs: edge=%d, other=%d",
|
|
||||||
edge.MinWidth,
|
|
||||||
other.MinWidth,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if edge.MinHeight != other.MinHeight {
|
|
||||||
return fmt.Errorf(
|
|
||||||
"min height differs: edge=%d, other=%d",
|
|
||||||
edge.MinHeight,
|
|
||||||
other.MinHeight,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if edge.Label.Value != other.Label.Value {
|
if edge.Label.Value != other.Label.Value {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"labels differ: edge=%s, other=%s",
|
"labels differ: edge=%s, other=%s",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue