mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Merge c6faae1c79 into 0e83f4b09a
This commit is contained in:
commit
bf0aa04cef
1 changed files with 9 additions and 1 deletions
|
|
@ -206,7 +206,9 @@ class Code(VMobject, metaclass=ConvertToOpenGL):
|
|||
|
||||
from manim.mobject.text.text_mobject import Paragraph
|
||||
|
||||
height_line = "A" # The "height_line" is used to make sure the Paragraph bounding box has the same height as the line number bounding box
|
||||
self.code_lines = Paragraph(
|
||||
height_line,
|
||||
*code_lines,
|
||||
**base_paragraph_config,
|
||||
)
|
||||
|
|
@ -220,7 +222,8 @@ class Code(VMobject, metaclass=ConvertToOpenGL):
|
|||
*[
|
||||
str(i)
|
||||
for i in range(
|
||||
line_numbers_from, line_numbers_from + len(self.code_lines)
|
||||
line_numbers_from - 1,
|
||||
line_numbers_from + len(self.code_lines) - 1,
|
||||
)
|
||||
],
|
||||
**base_paragraph_config,
|
||||
|
|
@ -234,6 +237,11 @@ class Code(VMobject, metaclass=ConvertToOpenGL):
|
|||
line.submobjects = [c for c in line if not isinstance(c, Dot)]
|
||||
self.add(self.code_lines)
|
||||
|
||||
self.code_lines.submobjects.pop(
|
||||
0
|
||||
) # The "height_line" should not be displayed, neither does its line number
|
||||
self.line_numbers.submobjects.pop(0)
|
||||
|
||||
if background_config is None:
|
||||
background_config = {}
|
||||
background_config_base = self.default_background_config.copy()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue