Fix scoll issue

This commit is contained in:
Jaby 2025-04-05 22:22:33 +02:00
parent b0b8c43700
commit af633a4fdf
1 changed files with 10 additions and 0 deletions

View File

@ -121,10 +121,20 @@ export component MainTab inherits Rectangle {
} }
function update_viewport() { function update_viewport() {
// If this value is positive, then the image moved so much to the right, that we do not use the full display area anymore
if self.viewport-x > 0 {
self.viewport-x = 0;
}
if abs(self.viewport-x) + self.width > self.viewport-width { if abs(self.viewport-x) + self.width > self.viewport-width {
self.viewport-x += (self.width + abs(self.viewport-x)) - self.viewport-width; self.viewport-x += (self.width + abs(self.viewport-x)) - self.viewport-width;
} }
if self.viewport-y > 0 {
self.viewport-y = 0;
}
// If this value is positive, then the image moved so much down, that we do not use the full display area anymore
if abs(self.viewport-y) + self.height > self.viewport-height { if abs(self.viewport-y) + self.height > self.viewport-height {
self.viewport-y += (self.height + abs(self.viewport-y)) - self.viewport-height; self.viewport-y += (self.height + abs(self.viewport-y)) - self.viewport-height;
} }