Merge pull request #287 from ejulio-ts/fix-sequence-diagram-zindex
Fix span render
This commit is contained in:
commit
20fd100431
2 changed files with 7 additions and 0 deletions
|
|
@ -218,6 +218,7 @@ func (sd *sequenceDiagram) placeSpans() {
|
||||||
width := SPAN_WIDTH + (float64(span.Level()-2) * SPAN_DEPTH_GROW_FACTOR)
|
width := SPAN_WIDTH + (float64(span.Level()-2) * SPAN_DEPTH_GROW_FACTOR)
|
||||||
x := rankToX[sd.objectRank[span]] - (width / 2.)
|
x := rankToX[sd.objectRank[span]] - (width / 2.)
|
||||||
span.Box = geo.NewBox(geo.NewPoint(x, minY), width, height)
|
span.Box = geo.NewBox(geo.NewPoint(x, minY), width, height)
|
||||||
|
span.ZIndex = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,12 @@ func TestSpansSequenceDiagram(t *testing.T) {
|
||||||
t.Fatalf("expected a.t1 and b.t1 to have the same height, got %.5f and %.5f", a_t1.Height, b_t1.Height)
|
t.Fatalf("expected a.t1 and b.t1 to have the same height, got %.5f and %.5f", a_t1.Height, b_t1.Height)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, span := range []*d2graph.Object{a_t1, a_t2, b_t1} {
|
||||||
|
if span.ZIndex != 1 {
|
||||||
|
t.Fatalf("expected span ZIndex=1, got %d", span.ZIndex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Y diff of the 2 first edges
|
// Y diff of the 2 first edges
|
||||||
expectedHeight := g.Edges[1].Route[0].Y - g.Edges[0].Route[0].Y + (2 * SPAN_EDGE_PAD)
|
expectedHeight := g.Edges[1].Route[0].Y - g.Edges[0].Route[0].Y + (2 * SPAN_EDGE_PAD)
|
||||||
if a_t1.Height != expectedHeight {
|
if a_t1.Height != expectedHeight {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue