Fixed ScrollableTextLayout origin. Now aligned properly.
@@ -727,8 +727,8 @@ class TextLayout:
"""
_document = None
- _vertex_lists = ()
- _boxes = ()
+ _vertex_lists = []
+ _boxes = []
default_group_class = TextLayoutGroup
default_shader = _layout_program
@@ -1602,14 +1602,14 @@ class ScrollableTextLayout(TextLayout):
Use `view_x` and `view_y` to scroll the text within the viewport.
"""
- _origin_layout = True
-
default_group_class = ScrollableTextLayoutGroup
default_shader = _scrollable_layout_program
_translate_x = 0
_translate_y = 0
+ _origin_layout = False # Lay out relative to origin? Otherwise to box.
+
def __init__(self, document, width, height, multiline=False, dpi=None, batch=None, group=None, wrap_lines=True):
super().__init__(document, width, height, multiline, dpi, batch, group, wrap_lines)
self._calculate_scissor_box()
@@ -1622,9 +1622,7 @@ class ScrollableTextLayout(TextLayout):
width = max(min(x + self.width, self.width), 0)
x = max(0, x)
y = max(0, y)
- # TODO: fix this
- # group.scissor_box = x, y, width, height
- group.scissor_box = 0, 0, width, height
+ group.scissor_box = x, y, width, height
def _update_translation(self):
for group in self.groups.values():
