Example #1
0
    def __init__(self, diagram: SequenceDiagram, title: str):
        super().__init__()
        self.diagram = diagram

        self.title = title

        tblock = VGroup()
        title = Text(title,
                     font=self.CONFIG["text_font"],
                     color=self.CONFIG["actor_text_color"])
        rect = (Rectangle(height=self._get_text_height(title) + 0.5,
                          width=title.get_width() +
                          0.5).round_corners(0.2).set_fill(
                              self.CONFIG["actor_fill_color"], 1))
        title.move_to(rect)
        tblock.add(rect, title)
        self.block = tblock

        self.line = DashedLine(
            start=rect.get_edge_center(DOWN),
            end=[rect.get_center()[0],
                 rect.get_bottom()[1], 0],
            stroke_style="dashed",
            dash_length=DEFAULT_DASH_LENGTH * 4,
            stroke_width=DEFAULT_STROKE_WIDTH / 2,
            positive_space_ratio=0.7,
        )
        self.bblock = tblock.copy()
        self.bblock.next_to(self.line, direction=DOWN, buff=0)
        self.add(tblock, self.line, self.bblock)
 def stretch(self, middle_height: float):
     self.remove(self.line, self.bblock)
     self.line = DashedLine(
         start=self.block.get_edge_center(DOWN),
         end=[self.block.get_center()[0], self.block.get_bottom()[1] - middle_height, 0],
         stroke_style="dashed",
         dash_length=DEFAULT_DASH_LENGTH * 2,
         stroke_width=DEFAULT_STROKE_WIDTH / 2,
         positive_space_ratio=0.5,
     )
     self.bblock = self.block.copy()
     self.bblock.next_to(self.line, direction=DOWN, buff=0)
     self.add(self.line, self.bblock)
    def __init__(self, diagram: SequenceDiagram, title: str, font=DEFAULT_FONT):
        super().__init__()
        self.diagram = diagram
        self.font = font

        self.title = title

        self.block = TextBox(title, font=self.font, shadow=True, rounded=True)

        self.line = DashedLine(
            start=self.block.get_edge_center(DOWN),
            end=[self.block.get_center()[0], self.block.get_bottom()[1], 0],
            stroke_style="dashed",
            dash_length=DEFAULT_DASH_LENGTH * 2,
            stroke_width=DEFAULT_STROKE_WIDTH / 2,
            positive_space_ratio=0.5,
        )
        self.bblock = self.block.copy()
        self.bblock.next_to(self.line, direction=DOWN, buff=0)
        self.add(self.block, self.line, self.bblock)