fill3: Correctly limit scroll of portals
This commit is contained in:
parent
d192674236
commit
87515dd44f
2 changed files with 24 additions and 14 deletions
|
|
@ -245,20 +245,26 @@ class Portal:
|
|||
y = 0
|
||||
elif y > (widget_height - portal_height):
|
||||
y = widget_height - portal_height
|
||||
return x, y
|
||||
self.position = x, y
|
||||
|
||||
def appearance_for(self, dimensions):
|
||||
width, height = dimensions
|
||||
x, y = self.position
|
||||
def appearance_for(self, portal_dimensions):
|
||||
width, height = portal_dimensions
|
||||
try:
|
||||
appearance = self.widget.appearance_interval((max(y, 0), y+height))
|
||||
widget_dimensions = self.widget.appearance_dimensions()
|
||||
if self.is_scroll_limited:
|
||||
self.limit_scroll(portal_dimensions, widget_dimensions)
|
||||
x, y = self.position
|
||||
widget_appearance = self.widget.appearance_interval((max(y, 0), y + height))
|
||||
except AttributeError:
|
||||
appearance = self.widget.appearance()[max(y, 0):y+height]
|
||||
if self.is_scroll_limited:
|
||||
x, y = self.limit_scroll(dimensions, appearance_dimensions(appearance))
|
||||
self.last_dimensions = dimensions
|
||||
widget_appearance = self.widget.appearance()
|
||||
widget_dimensions = appearance_dimensions(self.widget.appearance())
|
||||
if self.is_scroll_limited:
|
||||
self.limit_scroll(portal_dimensions, widget_dimensions)
|
||||
x, y = self.position
|
||||
widget_appearance = widget_appearance[max(y, 0):y + height]
|
||||
self.last_dimensions = portal_dimensions
|
||||
top = [self.background_char * width] * -y if y < 0 else []
|
||||
bottom = appearance_resize([row[max(x, 0):x+width] for row in appearance],
|
||||
bottom = appearance_resize([row[max(x, 0):x + width] for row in widget_appearance],
|
||||
(width + min(x, 0), height + min(y, 0)),
|
||||
self.background_char)
|
||||
if x < 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue